bpoxy / plex-tvdb-alt-orderer Goto Github PK
View Code? Open in Web Editor NEWA utility that applies alternate TVDB orders to Plex.
A utility that applies alternate TVDB orders to Plex.
Python: 3.8.10
OS: Linux mediaserver 5.4.0-150-generic #167-Ubuntu SMP Mon May 15 17:35:05 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
plex-tvdb-alt-orderer: plex-tvdb-alt-orderer-0.2.2
(Server name and Auth set as environment variables)
john@mediaserver ~ % plex-tvdb-alt-orderer
[?] Select the library to update: Documentaries
Anime
> Documentaries
TV Shows
YouTube
[?] Enter the name of the show: ?
Your TV show library doesn't contain a show with name '?'.
john@mediaserver ~ % plex-tvdb-alt-orderer
[?] Select the library to update: Documentaries
Anime
> Documentaries
TV Shows
YouTube
[?] Enter the name of the show: Grand
[?] Select the show to update: Grand Designs
Traceback (most recent call last):
File "/home/john/.local/bin/plex-tvdb-alt-orderer", line 8, in <module>
sys.exit(main())
File "/home/john/.local/lib/python3.8/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/home/john/.local/lib/python3.8/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/home/john/.local/lib/python3.8/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/john/.local/lib/python3.8/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/home/john/.local/lib/python3.8/site-packages/plex_tvdb_alt_orderer/main.py", line 38, in main
plex_show = get_plex_show(plex_section, plex_show_name)
File "/home/john/.local/lib/python3.8/site-packages/plex_tvdb_alt_orderer/main.py", line 91, in get_plex_show
return inquirer.prompt([inquirer.List("show", message="Select the show to update", choices=dict_to_tuple(shows_dict))])["show"]
File "/home/john/.local/lib/python3.8/site-packages/inquirer/prompt.py", line 11, in prompt
answers[question.name] = render.render(question, answers)
File "/home/john/.local/lib/python3.8/site-packages/inquirer/render/console/__init__.py", line 38, in render
return self._event_loop(render)
File "/home/john/.local/lib/python3.8/site-packages/inquirer/render/console/__init__.py", line 49, in _event_loop
self._print_options(render)
File "/home/john/.local/lib/python3.8/site-packages/inquirer/render/console/__init__.py", line 66, in _print_options
for message, symbol, color in render.get_options():
File "/home/john/.local/lib/python3.8/site-packages/inquirer/render/console/_list.py", line 51, in get_options
symbol = "+" if choice == GLOBAL_OTHER_CHOICE else self.theme.List.selection_cursor
File "/home/john/.local/lib/python3.8/site-packages/inquirer/questions.py", line 27, in __eq__
return self.value == other
File "/home/john/.local/lib/python3.8/site-packages/plexapi/base.py", line 458, in __eq__
return other not in [None, []] and self.key == other.key
AttributeError: 'OtherChoice' object has no attribute 'key'
From comment by /u/zn448sk39:
If you're looking for suggestions it would be nice to set the settings via env vars. Maybe login with plex token too
OS: Linux mediaserver 5.4.0-150-generic #167-Ubuntu SMP Mon May 15 17:35:05 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Python: 3.8.10
pip install plex-tvdb-alt-orderer
Collecting inquirer (from plex-tvdb-alt-orderer)
Downloading inquirer-3.1.3-py3-none-any.whl (18 kB)
Requirement already satisfied: plexapi in ./.local/lib/python3.8/site-packages (from plex-tvdb-alt-orderer) (4.11.1)
Downloading termcolor-2.3.0-py3-none-any.whl (6.9 kB)
Collecting tvdb-v4-official (from plex-tvdb-alt-orderer)
Downloading tvdb_v4_official-1.1.0-py3-none-any.whl (3.8 kB)
Collecting validators (from plex-tvdb-alt-orderer)
Downloading validators-0.20.0.tar.gz (30 kB)
Preparing metadata (setup.py) ... done
Collecting blessed>=1.19.0 (from inquirer->plex-tvdb-alt-orderer)
Downloading blessed-1.20.0-py2.py3-none-any.whl (58 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 58.4/58.4 kB 11.3 MB/s eta 0:00:00
Collecting python-editor>=1.0.4 (from inquirer->plex-tvdb-alt-orderer)
Downloading python_editor-1.0.4-py3-none-any.whl (4.9 kB)
Collecting readchar>=3.0.6 (from inquirer->plex-tvdb-alt-orderer)
Downloading readchar-4.0.5-py3-none-any.whl (8.5 kB)
Requirement already satisfied: requests in ./.local/lib/python3.8/site-packages (from plexapi->plex-tvdb-alt-orderer) (2.27.1)
Requirement already satisfied: decorator>=3.4.0 in ./.local/lib/python3.8/site-packages (from validators->plex-tvdb-alt-orderer) (5.1.1)
Collecting wcwidth>=0.1.4 (from blessed>=1.19.0->inquirer->plex-tvdb-alt-orderer)
Downloading wcwidth-0.2.6-py2.py3-none-any.whl (29 kB)
Requirement already satisfied: six>=1.9.0 in ./.local/lib/python3.8/site-packages (from blessed>=1.19.0->inquirer->plex-tvdb-alt-orderer) (1.16.0)
Requirement already satisfied: setuptools>=41.0 in ./.local/lib/python3.8/site-packages (from readchar>=3.0.6->inquirer->plex-tvdb-alt-orderer) (62.3.2)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in ./.local/lib/python3.8/site-packages (from requests->plexapi->plex-tvdb-alt-orderer) (1.26.9)
Requirement already satisfied: certifi>=2017.4.17 in ./.local/lib/python3.8/site-packages (from requests->plexapi->plex-tvdb-alt-orderer) (2022.5.18.1)
Requirement already satisfied: charset-normalizer~=2.0.0 in ./.local/lib/python3.8/site-packages (from requests->plexapi->plex-tvdb-alt-orderer) (2.0.12)
Requirement already satisfied: idna<4,>=2.5 in ./.local/lib/python3.8/site-packages (from requests->plexapi->plex-tvdb-alt-orderer) (3.3)
Building wheels for collected packages: progress, validators
Building wheel for progress (setup.py) ... done
Created wheel for progress: filename=progress-1.6-py3-none-any.whl size=9613 sha256=251d82dea8e7e7374097d1be80fe5dcd74cc8b121c746b114bab5531d1d76e55
Stored in directory: /home/john/.cache/pip/wheels/bb/01/5a/c916509df9b12c6465864251dbe826def8e31a16fa7da54f08
Building wheel for validators (setup.py) ... done
Created wheel for validators: filename=validators-0.20.0-py3-none-any.whl size=19579 sha256=f51739ca2d6cd5b64dc0219ecbcebb4c9cadbf99e36b2a438415823118afe4ca
Stored in directory: /home/john/.cache/pip/wheels/19/09/72/3eb74d236bb48bd0f3c6c3c83e4e0c5bbfcbcad7c6c3539db8
Successfully built progress validators
Installing collected packages: wcwidth, tvdb-v4-official, python-editor, progress, validators, termcolor, readchar, blessed, inquirer, plex-tvdb-alt-orderer
Successfully installed blessed-1.20.0 inquirer-3.1.3 plex-tvdb-alt-orderer-0.2.1 progress-1.6 python-editor-1.0.4 readchar-4.0.5 termcolor-2.3.0 tvdb-v4-official-1.1.0 validators-0.20.0 wcwidth-0.2.6
john@mediaserver ~ % plex-tvdb-alt-orderer
Traceback (most recent call last):
File "/home/john/.local/bin/plex-tvdb-alt-orderer", line 5, in <module>
from plex_tvdb_alt_orderer.main import main
File "/home/john/.local/lib/python3.8/site-packages/plex_tvdb_alt_orderer/main.py", line 104, in <module>
def update_plex(season: int, plex_episodes: list[Episode], tvdb_episodes: list[dict]):
TypeError: 'type' object is not subscriptable
App will recognize the series properly, as well as its number of seasons, but throws an error about a missing episode when attempting to use regional order. Confirmed that episode exists in both TVDB regional order and in my filesystem. Specific episode it gets angry about is s10e38. Seems like this might be thrown to mask a different error, but not positive.
It occurs when I try to apply alternate order to Entire Series, it also happens if I try season by season. It succesfully changes the name but still get the error
[?] Select the order to apply: Sagas
Aired Order
DVD Order
Absolute Order
> Sagas
[?] Select the season to update: Entire Series
> Entire Series
Season 1
Season 2
Season 3
Season 4
Season 5
Season 6
Season 7
Season 8
Season 9
Updating Plex |############################## | 154/162Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Users\PMS\AppData\Local\Programs\Python\Python311\Scripts\plex-tvdb-alt-orderer.exe\__main__.py", line 7, in <module>
File "C:\Users\PMS\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1157, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\PMS\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "C:\Users\PMS\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\PMS\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\PMS\AppData\Local\Programs\Python\Python311\Lib\site-packages\plex_tvdb_alt_orderer\main.py", line 48, in main
update_plex(season, plex_show, tvdb_episodes, tvdb_seasons)
File "C:\Users\PMS\AppData\Local\Programs\Python\Python311\Lib\site-packages\plex_tvdb_alt_orderer\main.py", line 186, in update_plex
if tvdb_season["image"]:
~~~~~~~~~~~^^^^^^^^^
KeyError: 'image'
For example, I have successfully updated the name till season 4. I'll run the script get the same error but still the name of season 5 will be updated
[?] Select the order to apply: Sagas
Aired Order
DVD Order
Absolute Order
> Sagas
[?] Select the season to update: Season 5
Entire Series
Season 1
Season 2
Season 3
Season 4
> Season 5
Season 6
Season 7
Season 8
Season 9
Updating Plex |############################# | 10/11Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Users\PMS\AppData\Local\Programs\Python\Python311\Scripts\plex-tvdb-alt-orderer.exe\__main__.py", line 7, in <module>
File "C:\Users\PMS\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1157, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\PMS\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "C:\Users\PMS\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\PMS\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\PMS\AppData\Local\Programs\Python\Python311\Lib\site-packages\plex_tvdb_alt_orderer\main.py", line 48, in main
update_plex(season, plex_show, tvdb_episodes, tvdb_seasons)
File "C:\Users\PMS\AppData\Local\Programs\Python\Python311\Lib\site-packages\plex_tvdb_alt_orderer\main.py", line 186, in update_plex
if tvdb_season["image"]:
~~~~~~~~~~~^^^^^^^^^
KeyError: 'image'
Quick question is it possible to rename the seasons using the alternate order titles ? for example for Dragon Ball season 09 would be ' Season 9 - Piccolo Jr. Saga '
I was wondering if you could change the order when it asks for the name of the show and the PIN. Also once it finishes to rename a show it should go back to the line where it asks for the Name of the show in case the user wants to rename more than one show. If 'Enter the name of the show' is after 'Enter your TVDB subscriber PIN' then the user would not have to enter the PIN over and over again.
From comment by /u/benzo8:
At a later stage, might it be possible to have the option to choose just a single season of a show? I've a number of tv shows where I've early seasons in DVD order and later seasons only in aired order and Plex obviously only lets me pick one order per show.
Suppose I have a series currently in DVD order (Because that what Plex is able to support) and I want to change a show to instead be in, say, Book order. Would it be possible to add that option to the script or would that require renaming files?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.