Closed timmehtimtims closed 4 years ago
I've been playing around and have got this down to being an issue with creating symlinks:
python3 plexlibrary criterion_collection 2020-09-09 22:59:50,810 INFO:Running the recipe 'criterion_collection' 2020-09-09 22:59:50,810 INFO:Retrieving the trakt list: https://api.trakt.tv/users/yoursvivek/lists/the-criterion-collection/items/movies/ 2020-09-09 22:59:51,142 INFO:Trying to match with items from the 'Movies' library 2020-09-09 23:01:27,335 INFO:Creating symlinks for 0 matching items in the library... 2020-09-09 23:01:27,335 INFO:Created symlinks for 0 new items: 2020-09-09 23:01:27,336 INFO:Creating the 'Criterion' library in Plex... 2020-09-09 23:01:27,359 INFO:Waiting for metadata to finish downloading... 2020-09-09 23:01:27,363 INFO:Retrieving a list of items from the 'Criterion' library in Plex... 2020-09-09 23:01:27,366 INFO:Setting the sort titles for the 'Criterion' library... 2020-09-09 23:01:27,367 INFO:Removing symlinks for items which no longer qualify 2020-09-09 23:01:27,367 INFO:Removed symlinks for 0 items. 2020-09-09 23:01:27,367 INFO:Scanning the 'Criterion' library... 2020-09-09 23:01:37,393 INFO:Number of items in the new library: 0 2020-09-09 23:01:37,393 INFO:Number of missing items: 1167
Possibly similar to issue #42 - no symlinks are created within the list directories
EDIT: No longer an issue - all tokens are now consistent across the libraries
Could this error be caused by multiple plex tokens? Per library and within libraries? Somehow my restore and subsequent creation of new libraries has caused Plex to generate multiple tokens per library and items. I have counted 3 so far... Assume this is likely to be causing issues with Plex Auth? Can I use username and password to authenticate instead of baseURl & token in config?
Am still getting the same error after a brand new install of plex server, new libraries (no use of backups) and consistent tokens.
Should be fixed in the latest push
Cheers man,
I updated and it only updated recipe.py - was this the only change?
I have had a go and it is still unable to match with anything in my libraries.
Will have another go when I've got access to my laptop this evening.
Unfortunately the issue still persists, despite the update
I think I know what is going on.
Initially, the pip install failed:
/opt/appdata/python-plexlibrary$ pip install -r requirements.txt /usr/lib/python2.7/dist-packages/secretstorage/dhcrypto.py:15: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in a future release. from cryptography.utils import int_from_bytes DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality. WARNING: The directory '/home/timmeh/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. Defaulting to user installation because normal site-packages is not writeable Collecting plexapi Downloading PlexAPI-4.1.0.tar.gz (89 kB) |████████████████████████████████| 89 kB 1.5 MB/s ERROR: Package 'PlexAPI' requires a different Python: 2.7.17 not in '>=3.5' WARNING: You are using pip version 20.2.3; however, version 20.2.4 is available. You should consider upgrading via the '/usr/bin/python -m pip install --upgrade pip' command.
I got around this by using
pip3 install -r requirements.txt WARNING: The directory '/home/timmeh/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. Defaulting to user installation because normal site-packages is not writeable Collecting plexapi Downloading PlexAPI-4.1.2.tar.gz (91 kB) |████████████████████████████████| 91 kB 5.5 MB/s Requirement already satisfied: requests in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 3)) (2.18.4) Collecting trakt Downloading trakt-2.14.1.tar.gz (35 kB) Collecting ruamel.yaml Downloading ruamel.yaml-0.16.12-py2.py3-none-any.whl (111 kB) |████████████████████████████████| 111 kB 9.8 MB/s Requirement already satisfied: lxml in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 6)) (4.5.2) Requirement already satisfied: idna<2.7,>=2.5 in /usr/local/lib/python3.6/dist-packages (from requests->-r requirements.txt (line 3)) (2.6) Requirement already satisfied: urllib3<1.23,>=1.21.1 in /usr/local/lib/python3.6/dist-packages (from requests->-r requirements.txt (line 3)) (1.22) Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python3.6/dist-packages (from requests->-r requirements.txt (line 3)) (3.0.4) Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.6/dist-packages (from requests->-r requirements.txt (line 3)) (2020.6.20) Collecting requests-oauthlib>=0.6 Downloading requests_oauthlib-1.3.0-py2.py3-none-any.whl (23 kB) Requirement already satisfied: six>=1.10 in /usr/local/lib/python3.6/dist-packages (from trakt->-r requirements.txt (line 4)) (1.15.0) Collecting ruamel.yaml.clib>=0.1.2; platform_python_implementation == "CPython" and python_version < "3.9" Downloading ruamel.yaml.clib-0.2.2-cp36-cp36m-manylinux1_x86_64.whl (549 kB) |████████████████████████████████| 549 kB 9.4 MB/s Collecting oauthlib>=3.0.0 Downloading oauthlib-3.1.0-py2.py3-none-any.whl (147 kB) |████████████████████████████████| 147 kB 15.2 MB/s Building wheels for collected packages: plexapi, trakt Building wheel for plexapi (setup.py) ... done Created wheel for plexapi: filename=PlexAPI-4.1.2-py3-none-any.whl size=104596 sha256=c0e8b63d0626649280776815eaf7285c605fd81c236261982a5cb59bc0b29b6e Stored in directory: /tmp/pip-ephem-wheel-cache-7hrpcr7w/wheels/45/73/91/2860d7e2200f1b4739cf7a1b38cf12b8bedab90721721e6135 Building wheel for trakt (setup.py) ... done Created wheel for trakt: filename=trakt-2.14.1-py3-none-any.whl size=39662 sha256=016ff83afececd4c8695878d51d6c574848e66897b03baa0d1fe80aae1547b5a Stored in directory: /tmp/pip-ephem-wheel-cache-7hrpcr7w/wheels/6e/1a/68/d76c7ea3cc2ff02b54ddf8bedf04536162955c02eb141d4c03 Successfully built plexapi trakt Installing collected packages: plexapi, oauthlib, requests-oauthlib, trakt, ruamel.yaml.clib, ruamel.yaml Successfully installed oauthlib-3.1.0 plexapi-4.1.2 requests-oauthlib-1.3.0 ruamel.yaml-0.16.12 ruamel.yaml.clib-0.2.2 trakt-2.14.1 WARNING: You are using pip version 20.2.3; however, version 20.2.4 is available. You should consider upgrading via the '/usr/bin/python3 -m pip install --upgrade pip' command.
However, I have a feeling that this has caused the issue.
What is the best way to go back and delete the setup files and set this up properly using pip, but installing using python3 (python 2.7 is needed as the default for the time being)?
I have recently restored from backup of a previous server and have had to reconstruct my Movies library :(
I've deleted my old movies library and have created a new one. Both libraries were called 'Movies' and this is the library that I tell each recipe to check for...
When I run the script I get the following error:
user@dedi$ sudo python3 plexlibrary criterion 2020-09-09 16:57:45,651 INFO:Running the recipe 'criterion' 2020-09-09 16:57:45,652 INFO:Retrieving the trakt list: https://api.trakt.tv/users/yoursvivek/lists/the-criterion-collection/items/movies/ 2020-09-09 16:57:45,937 INFO:Trying to match with items from the 'Movies' library 2020-09-09 16:59:18,580 INFO:Creating symlinks for 0 matching items in the library... 2020-09-09 16:59:18,580 INFO:Created symlinks for 0 new items: 2020-09-09 16:59:18,580 INFO:Creating the 'Criterion Collection' library in Plex... 2020-09-09 16:59:18,583 WARNING:Library already exists in Plex. Scanning the library... 2020-09-09 16:59:18,585 INFO:Waiting for metadata to finish downloading... 2020-09-09 16:59:18,587 INFO:Retrieving a list of items from the 'Criterion Collection' library in Plex... 2020-09-09 16:59:18,589 INFO:Setting the sort titles for the 'Criterion Collection' library... Traceback (most recent call last): File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/usr/lib/python3.6/runpy.py", line 85, in _run_code exec(code, run_globals) File "plexlibrary/__main__.py", line 8, in <module> main() File "plexlibrary/plexlibrary.py", line 67, in main r.run(sort_only=args.sort_only, share_playlist_to_all=args.everyone) File "plexlibrary/recipe.py", line 654, in run missing_items, list_count = self._run(share_playlist_to_all=share_playlist_to_all) File "plexlibrary/recipe.py", line 629, in _run new_library=new_library, sort_only=False) File "plexlibrary/recipe.py", line 456, in _modify_sort_titles_and_cleanup return all_new_items UnboundLocalError: local variable 'all_new_items' referenced before assignment
It creates the library but is not able to scan the Movies library for matches...
Same issue with TV Shows library:
user@dedi$ sudo python3 plexlibrary latest_tv 2020-09-09 19:01:01,037 INFO:Running the recipe 'latest_tv' 2020-09-09 19:01:01,037 INFO:Retrieving the trakt list: https://api.trakt.tv/users/timmehtimtims/lists/latest-tv/items/show 2020-09-09 19:01:01,572 INFO:Trying to match with items from the 'TV Shows' library 2020-09-09 19:01:01,617 INFO:1 Star Trek: Picard (2020) 2020-09-09 19:01:01,656 INFO:2 The Outsider (2020) 2020-09-09 19:01:01,690 INFO:3 Locke & Key (2020) 2020-09-09 19:01:01,727 INFO:4 The Last Dance (2020) 2020-09-09 19:01:01,762 INFO:5 Upload (2020) 2020-09-09 19:01:01,793 INFO:6 Devs (2020) 2020-09-09 19:01:01,858 INFO:7 Defending Jacob (2020) 2020-09-09 19:01:01,893 INFO:8 Little Fires Everywhere (2020) 2020-09-09 19:01:01,918 INFO:9 Hollywood (2020) 2020-09-09 19:01:01,951 INFO:10 Normal People (2020) 2020-09-09 19:01:01,982 INFO:11 Gangs of London (2020) 2020-09-09 19:01:02,015 INFO:12 Outer Banks (2020) 2020-09-09 19:01:02,070 INFO:13 The Great (2020) 2020-09-09 19:01:02,101 INFO:14 ZeroZeroZero (2020) 2020-09-09 19:01:02,156 INFO:15 Perry Mason (2020) 2020-09-09 19:01:02,422 INFO:16 9-1-1: Lone Star (2020) 2020-09-09 19:01:02,548 INFO:17 Self Made: Inspired by the Life of Madam C.J. Walker (2020) 2020-09-09 19:01:02,646 INFO:18 Rise of Empires: Ottoman (2020) 2020-09-09 19:01:02,671 INFO:19 The Trials of Gabriel Fernandez (2020) 2020-09-09 19:01:02,729 INFO:20 I Know This Much Is True (2020) 2020-09-09 19:01:02,910 INFO:21 Cheer (2020) (2020) 2020-09-09 19:01:03,095 INFO:22 Lovecraft Country (2020) 2020-09-09 19:01:03,471 INFO:23 Disney Gallery: The Mandalorian (2020) 2020-09-09 19:01:04,114 INFO:24 We're Here (2020) 2020-09-09 19:01:05,575 INFO:Creating symlinks for 24 matching items in the library... 2020-09-09 19:01:05,885 INFO:Created symlinks for 0 new items: 2020-09-09 19:01:05,885 INFO:Creating the 'Latest TV Shows' library in Plex... 2020-09-09 19:01:05,900 INFO:Waiting for metadata to finish downloading... 2020-09-09 19:01:05,903 INFO:Retrieving a list of items from the 'Latest TV Shows' library in Plex... 2020-09-09 19:01:05,905 INFO:Setting the sort titles for the 'Latest TV Shows' library... Traceback (most recent call last): File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/usr/lib/python3.6/runpy.py", line 85, in _run_code exec(code, run_globals) File "plexlibrary/__main__.py", line 8, in <module> main() File "plexlibrary/plexlibrary.py", line 67, in main r.run(sort_only=args.sort_only, share_playlist_to_all=args.everyone) File "plexlibrary/recipe.py", line 654, in run missing_items, list_count = self._run(share_playlist_to_all=share_playlist_to_all) File "plexlibrary/recipe.py", line 629, in _run new_library=new_library, sort_only=False) File "plexlibrary/recipe.py", line 456, in _modify_sort_titles_and_cleanup return all_new_items UnboundLocalError: local variable 'all_new_items' referenced before assignment