# Plexy
Your Plex, your way
[![Latest
Version](https://img.shields.io/pypi/v/plexy.svg)](https://pypi.python.org/pypi/plexy)
[![tests](https://github.com/ratoaq2/plexy/actions/workflows/test.yml/badge.svg)](https://github.com/ratoaq2/plexy/actions/workflows/test.yml)
[![License](https://img.shields.io/github/license/ratoaq2/plexy.svg)](https://github.com/ratoaq2/plexy/blob/master/LICENSE)
- Project page
<https://github.com/ratoaq2/plexy>
## Info
**Plexy** is a command line tool to save your watching preferences in Plex.
**Dubbed** or **Original audio**, it's up to you.
- For **Dubbed** preference, Plexy will auto-select the audio track with your desired language.
If no audio track is found, Plexy will auto-select the subtitle track with your desired language.
- For **Original** preference, Plexy will auto-select the default/original audio track
and the subtitle track in your desired language.
Priorities:
- Commentary audio tracks have lower priority when selecting audio tracks
- Closed caption and SDH subtitle tracks also have lower priority when selecting subtitles
To select Brazilian Portuguese language with original audio
```bash
>> plexy --url http://mylocalplex:32400 --token ABCDEF1234567890 preferences --language pt-BR original
```
To select English language with dubbed audio
```bash
>> plexy --url http://mylocalplex:32400 --token ABCDEF1234567890 preferences --language en dubbed
```
To select French language with original audio only for Game of Thrones
```bash
>> plexy --url http://mylocalplex:32400 --token ABCDEF1234567890 preferences --language fr --title "Game of Thrones" original
```
To select German language with dubbed audio only for Mandalorian Season 2
```bash
>> plexy --url http://mylocalplex:32400 --token ABCDEF1234567890 preferences --language fr --title "Mandalorian s02" dubbed
```
To select German language with dubbed audio only for Game of Thrones, season 3 and episode 9
```bash
>> plexy --url http://mylocalplex:32400 --token ABCDEF1234567890 preferences --language fr --title "Game of Thrones s03e09" dubbed
```
To select Spanish language with dubbed audio only for all Matrix movies and the first Avatar movie
```bash
>> plexy --url http://mylocalplex:32400 --token ABCDEF1234567890 preferences --language es --title "Matrix" --title "Avatar (2009)" dubbed
```
To select Portuguese language with original audio for everything added to your libraries in the last week
```bash
>> plexy --url http://mylocalplex:32400 --token ABCDEF1234567890 preferences --language pt --newer 1w original
```
To select Brazilian Portuguese language with original audio for everything added to your "Movie" library before the last week
```bash
>> plexy --url http://mylocalplex:32400 --token ABCDEF1234567890 preferences --library Movie --language pt-BR --older 1w original
```
You can also select or exclude tracks based on their codec/format.
For instance, you have a Chromecast with Google TV which doesn't support Dolby TrueHD audio codec.
You can exclude this codec when saving your preferences:
```bash
>> plexy --url http://mylocalplex:32400 --token ABCDEF1234567890 preferences --language pt-BR -A truehd original
```
And print the full summary of changes:
```bash
>> plexy --url http://mylocalplex:32400 --token ABCDEFGHIJ1234567890 preferences -f -l en --title "The Matrix (1999)" original
Configuring watching preferences [####################################] 100%
1 movie changed out of 1 selected movie
The Matrix (1999) changed from pt-BR: Português (SRT External) to no subtitles
```
You can also define your configuration options in a `json` or `yaml` file:
```yaml
url: http://myplexserver:32400
token: ABCDEFGHIJ1234567890
preferences:
library:
- Movies
- TV Shows
excluded_subtitle_codec:
- eia_608
full_summary: True
language: pt-BR
watching_preference: original
```
By default, plexy will load `config.json`, `config.yaml` or `config.yml` file from the folders:
- Mac OS: `~/Library/Preferences/plexy`
- Linux: `~/.config/plexy/`
- Windows: `C:\Users\<USER>\AppData\Local\plexy\plexy`
And then update the configuration with data from `plexy.json`, `plexy.yaml` or `plexy.yml` in the current working directory.
You can pass the configuration to use with the `--config` parameter:
```bash
>> plexy --config myconfig.yml preferences
Configuring watching preferences [####################################] 100%
1 movie changed out of 1 selected movie
The Matrix (1999) changed from pt-BR: Português (SRT External) to no subtitles
```
All available CLI options:
```bash
>> plexy --url <PLEX_URL> --token <USER_TOKEN> preferences --help
Usage: plexy preferences [OPTIONS] {original|dubbed}
Your watching preferences
Dubbed prefers an audio track with the desired language.
Original prefers the original audio and an additional subtitle track if the audio is not in the desired language.
Options:
-L, --library TEXT Library to be used. e.g: Movies, Shows.
-t, --title TITLE Filter for titles in your library. It could refer to a movie, a
show, a season or an episode. e.g: Avatar, The Matrix (1999),
The Boys s2, Chernobyl s01e03, Game of Thrones (2011) s03e09
-l, --language LANGUAGE Desired watching language as IETF code, e.g.: en, pt-BR.
-a, --audio-codec [dca|aac|ac3|eac3|truehd|flac|mp2|mp3|vorbis|pcm]
Accepted audio codec.
-A, --excluded-audio-codec [dca|aac|ac3|eac3|truehd|flac|mp2|mp3|vorbis|pcm]
Excluded audio codec.
-s, --subtitle-codec [srt|pgs|vobsub|ass|mov_text|eia_608|dvb_subtitle]
Accepted subtitle codec.
-S, --excluded-subtitle-codec [srt|pgs|vobsub|ass|mov_text|eia_608|dvb_subtitle]
Excluded subtitle codec.
-n, --newer-than AGE Filter movies/episodes newer than AGE, e.g. 12h, 1w2d
-o, --older-than AGE Filter movies/episodes older than AGE, e.g. 12h, 1w2d
-f, --full-summary Print the full summary of changed preferences.
--skip-watching Skip movies/episodes that watch is in progress.
--keep-selected-audio Do not change the selected audio. Useful when using original
watching preference.
--keep-selected-subtitle Do not change the selected subtitle.
--force-subtitles Select subtitles, even when the audio already matches the
desired language.
--debug Print useful information for debugging and for reporting bugs.
--help Show this message and exit.
```
## Using Docker
docker run -it --rm plexy --url http://mylocalplex:32400 --token ABCDEF1234567890 preferences --language pt-BR -A truehd original
## Installation
**Plexy** can be installed as a regular python module by running:
$ [sudo] pip install plexy
For a better isolation with your system you should use a dedicated
virtualenv or install for your user only using the `--user` flag.
## Dependencies
* [Diaoul/babelfish](https://github.com/Diaoul/babelfish)
* [pkkid/python-plexapi](https://github.com/pkkid/python-plexapi)
* [ratoaq2/trakit](https://github.com/ratoaq2/trakit)
Raw data
{
"_id": null,
"home_page": "https://github.com/ratoaq2/plexy",
"name": "plexy",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0.0,>=3.9.0",
"maintainer_email": null,
"keywords": "video, plex, audio, subtitles, preferences, dubbed, subbed, original, language, foreign, movie, episode, tv, track, shows, series",
"author": "Rato",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/54/f2/2e078c7c0a31435f88f604652add87c1f79963f9fe6911e9879a94bbe851/plexy-0.1.5.tar.gz",
"platform": null,
"description": "# Plexy\nYour Plex, your way\n\n[![Latest\nVersion](https://img.shields.io/pypi/v/plexy.svg)](https://pypi.python.org/pypi/plexy)\n\n[![tests](https://github.com/ratoaq2/plexy/actions/workflows/test.yml/badge.svg)](https://github.com/ratoaq2/plexy/actions/workflows/test.yml)\n\n[![License](https://img.shields.io/github/license/ratoaq2/plexy.svg)](https://github.com/ratoaq2/plexy/blob/master/LICENSE)\n\n - Project page \n <https://github.com/ratoaq2/plexy>\n\n## Info\n\n**Plexy** is a command line tool to save your watching preferences in Plex.\n\n**Dubbed** or **Original audio**, it's up to you.\n\n- For **Dubbed** preference, Plexy will auto-select the audio track with your desired language.\nIf no audio track is found, Plexy will auto-select the subtitle track with your desired language.\n- For **Original** preference, Plexy will auto-select the default/original audio track \nand the subtitle track in your desired language.\n\nPriorities:\n- Commentary audio tracks have lower priority when selecting audio tracks\n- Closed caption and SDH subtitle tracks also have lower priority when selecting subtitles\n\n\nTo select Brazilian Portuguese language with original audio\n```bash\n>> plexy --url http://mylocalplex:32400 --token ABCDEF1234567890 preferences --language pt-BR original\n```\n\nTo select English language with dubbed audio\n```bash\n>> plexy --url http://mylocalplex:32400 --token ABCDEF1234567890 preferences --language en dubbed\n```\n\nTo select French language with original audio only for Game of Thrones\n```bash\n>> plexy --url http://mylocalplex:32400 --token ABCDEF1234567890 preferences --language fr --title \"Game of Thrones\" original\n```\n\nTo select German language with dubbed audio only for Mandalorian Season 2\n```bash\n>> plexy --url http://mylocalplex:32400 --token ABCDEF1234567890 preferences --language fr --title \"Mandalorian s02\" dubbed\n```\n\nTo select German language with dubbed audio only for Game of Thrones, season 3 and episode 9\n```bash\n>> plexy --url http://mylocalplex:32400 --token ABCDEF1234567890 preferences --language fr --title \"Game of Thrones s03e09\" dubbed\n```\n\nTo select Spanish language with dubbed audio only for all Matrix movies and the first Avatar movie\n```bash\n>> plexy --url http://mylocalplex:32400 --token ABCDEF1234567890 preferences --language es --title \"Matrix\" --title \"Avatar (2009)\" dubbed\n```\n\nTo select Portuguese language with original audio for everything added to your libraries in the last week\n```bash\n>> plexy --url http://mylocalplex:32400 --token ABCDEF1234567890 preferences --language pt --newer 1w original\n```\n\nTo select Brazilian Portuguese language with original audio for everything added to your \"Movie\" library before the last week\n```bash\n>> plexy --url http://mylocalplex:32400 --token ABCDEF1234567890 preferences --library Movie --language pt-BR --older 1w original\n```\n\nYou can also select or exclude tracks based on their codec/format.\nFor instance, you have a Chromecast with Google TV which doesn't support Dolby TrueHD audio codec.\nYou can exclude this codec when saving your preferences: \n```bash\n>> plexy --url http://mylocalplex:32400 --token ABCDEF1234567890 preferences --language pt-BR -A truehd original\n```\n\nAnd print the full summary of changes:\n```bash\n>> plexy --url http://mylocalplex:32400 --token ABCDEFGHIJ1234567890 preferences -f -l en --title \"The Matrix (1999)\" original\nConfiguring watching preferences [####################################] 100%\n1 movie changed out of 1 selected movie\nThe Matrix (1999) changed from pt-BR: Portugu\u00eas (SRT External) to no subtitles\n```\n\n\nYou can also define your configuration options in a `json` or `yaml` file:\n```yaml\nurl: http://myplexserver:32400\ntoken: ABCDEFGHIJ1234567890\npreferences:\n library:\n - Movies\n - TV Shows\n excluded_subtitle_codec:\n - eia_608\n full_summary: True\n language: pt-BR\n watching_preference: original\n```\n\nBy default, plexy will load `config.json`, `config.yaml` or `config.yml` file from the folders:\n- Mac OS: `~/Library/Preferences/plexy`\n- Linux: `~/.config/plexy/`\n- Windows: `C:\\Users\\<USER>\\AppData\\Local\\plexy\\plexy`\n\nAnd then update the configuration with data from `plexy.json`, `plexy.yaml` or `plexy.yml` in the current working directory.\n\nYou can pass the configuration to use with the `--config` parameter:\n```bash\n>> plexy --config myconfig.yml preferences\nConfiguring watching preferences [####################################] 100%\n1 movie changed out of 1 selected movie\nThe Matrix (1999) changed from pt-BR: Portugu\u00eas (SRT External) to no subtitles\n```\n\n\nAll available CLI options:\n```bash\n>> plexy --url <PLEX_URL> --token <USER_TOKEN> preferences --help\nUsage: plexy preferences [OPTIONS] {original|dubbed}\n\n Your watching preferences\n\n Dubbed prefers an audio track with the desired language.\n Original prefers the original audio and an additional subtitle track if the audio is not in the desired language.\n\nOptions:\n -L, --library TEXT Library to be used. e.g: Movies, Shows.\n -t, --title TITLE Filter for titles in your library. It could refer to a movie, a\n show, a season or an episode. e.g: Avatar, The Matrix (1999),\n The Boys s2, Chernobyl s01e03, Game of Thrones (2011) s03e09\n -l, --language LANGUAGE Desired watching language as IETF code, e.g.: en, pt-BR.\n -a, --audio-codec [dca|aac|ac3|eac3|truehd|flac|mp2|mp3|vorbis|pcm]\n Accepted audio codec.\n -A, --excluded-audio-codec [dca|aac|ac3|eac3|truehd|flac|mp2|mp3|vorbis|pcm]\n Excluded audio codec.\n -s, --subtitle-codec [srt|pgs|vobsub|ass|mov_text|eia_608|dvb_subtitle]\n Accepted subtitle codec.\n -S, --excluded-subtitle-codec [srt|pgs|vobsub|ass|mov_text|eia_608|dvb_subtitle]\n Excluded subtitle codec.\n -n, --newer-than AGE Filter movies/episodes newer than AGE, e.g. 12h, 1w2d\n -o, --older-than AGE Filter movies/episodes older than AGE, e.g. 12h, 1w2d\n -f, --full-summary Print the full summary of changed preferences.\n --skip-watching Skip movies/episodes that watch is in progress.\n --keep-selected-audio Do not change the selected audio. Useful when using original\n watching preference.\n --keep-selected-subtitle Do not change the selected subtitle.\n --force-subtitles Select subtitles, even when the audio already matches the\n desired language.\n --debug Print useful information for debugging and for reporting bugs.\n --help Show this message and exit.\n```\n\n\n## Using Docker\n\n\n docker run -it --rm plexy --url http://mylocalplex:32400 --token ABCDEF1234567890 preferences --language pt-BR -A truehd original\n\n\n## Installation\n\n**Plexy** can be installed as a regular python module by running:\n\n $ [sudo] pip install plexy\n\nFor a better isolation with your system you should use a dedicated\nvirtualenv or install for your user only using the `--user` flag.\n\n## Dependencies\n* [Diaoul/babelfish](https://github.com/Diaoul/babelfish)\n* [pkkid/python-plexapi](https://github.com/pkkid/python-plexapi)\n* [ratoaq2/trakit](https://github.com/ratoaq2/trakit)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Your Plex, your way",
"version": "0.1.5",
"project_urls": {
"Homepage": "https://github.com/ratoaq2/plexy",
"Repository": "https://github.com/ratoaq2/plexy"
},
"split_keywords": [
"video",
" plex",
" audio",
" subtitles",
" preferences",
" dubbed",
" subbed",
" original",
" language",
" foreign",
" movie",
" episode",
" tv",
" track",
" shows",
" series"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0e107dc9e59b5ea614d23233449250d68f61a5ad8c26338370ea992acc77598e",
"md5": "f0eecd2b9779994a672326c10fac364f",
"sha256": "9a06337108fb14c760bb1ec3f1e5efe76603c38e3e3bfd842c1aa162ddf175f5"
},
"downloads": -1,
"filename": "plexy-0.1.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f0eecd2b9779994a672326c10fac364f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0.0,>=3.9.0",
"size": 13662,
"upload_time": "2024-06-23T09:48:09",
"upload_time_iso_8601": "2024-06-23T09:48:09.815159Z",
"url": "https://files.pythonhosted.org/packages/0e/10/7dc9e59b5ea614d23233449250d68f61a5ad8c26338370ea992acc77598e/plexy-0.1.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "54f22e078c7c0a31435f88f604652add87c1f79963f9fe6911e9879a94bbe851",
"md5": "5e17c9d3e0dbf68a3e2953207a42a659",
"sha256": "8787a8a6f41754dce1375ca3979da87ecfa92fbe10a52d9c8832fc09cbacfccf"
},
"downloads": -1,
"filename": "plexy-0.1.5.tar.gz",
"has_sig": false,
"md5_digest": "5e17c9d3e0dbf68a3e2953207a42a659",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0.0,>=3.9.0",
"size": 13927,
"upload_time": "2024-06-23T09:48:11",
"upload_time_iso_8601": "2024-06-23T09:48:11.440194Z",
"url": "https://files.pythonhosted.org/packages/54/f2/2e078c7c0a31435f88f604652add87c1f79963f9fe6911e9879a94bbe851/plexy-0.1.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-23 09:48:11",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ratoaq2",
"github_project": "plexy",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "plexy"
}