adamgot / python-plexlibrary

Create and maintain dynamic Plex libraries based on recipes.
BSD 3-Clause "New" or "Revised" License
204 stars 40 forks source link

Unable to create any library. #27

Closed irjon closed 6 years ago

irjon commented 6 years ago

I am getting the following errors and unable to create any dynamic libraries, I am running the latest plexguide (stable not developer), I am running the latest version of python plexlibrary, there are 0 pending OS updates. The system is a dedicated avotom 8 core atom with 8GB ram.

Heres the log whilst attempting to run plexlibrary:

root@onepro:/mnt/PlexDynamic/python-plexlibrary# python plexlibrary movies\_imdb\_top_250

Running the recipe 'movies\_imdb\_top_250'

Retrieving the trakt list: https://api.trakt.tv/users/justin/lists/imdb-top-rated-movies/items/movies

Trying to match with items from the 'Christmas Films' library

Trying to match with items from the 'Documentary Films' library

Trying to match with items from the 'Films' library

Trying to match with items from the 'Kids Films' library

1 The Shawshank Redemption (1994)

Traceback (most recent call last):

File "/usr/lib/python2.7/runpy.py", line 174, in \_run\_module\_as\_main

"\_\_main\_\_", fname, loader, pkg_name)

File "/usr/lib/python2.7/runpy.py", line 72, in \_run\_code

exec code in run_globals

File "/mnt/PlexDynamic/python-plexlibrary/plexlibrary/\_\_main\_\_.py", line 3, in <module>

main()

File "plexlibrary/plexlibrary.py", line 61, in main

r.run(args.sort_only)

File "plexlibrary/recipe.py", line 673, in run

missing\_items, list\_count = self._run()

File "plexlibrary/recipe.py", line 136, in _run

if r.guid is not None and 'imdb://' in r.guid:

File "/usr/local/lib/python2.7/dist-packages/plexapi/base.py", line 284, in \_\_getattribute\_\_

self.reload()

File "/usr/local/lib/python2.7/dist-packages/plexapi/base.py", line 189, in reload

data = self._server.query(key)

File "/usr/local/lib/python2.7/dist-packages/plexapi/server.py", line 341, in query

response = method(url, headers=headers, timeout=timeout, **kwargs)

File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 521, in get

return self.request('GET', url, **kwargs)

File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 508, in request

resp = self.send(prep, **send_kwargs)

File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 618, in send

r = adapter.send(request, **kwargs)

File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 521, in send

raise ReadTimeout(e, request=request)

requests.exceptions.ReadTimeout: HTTPConnectionPool(host='onepro.mukt.uk', port=32400): Read timed out. (read timeout=30)\

For reference here is the plexlibrary recipe being called:

\# Supported types: movie, tv

library_type: 'movie'

\# Source list(s)

source\_list\_urls:

\- 'https://api.trakt.tv/users/justin/lists/imdb-top-rated-movies/items/movies'

\# Source library details

source_libraries:

\- name: 'Christmas Films'

folders:

\- '/plexdrive/Media/Christmas'

\- '/plexdrive/Media2/Christmas'

\- '/plexdrive/Media3/Christmas'

\- name: 'Documentary Films'

folders:

\- '/plexdrive/Media/Documentary'

\- '/plexdrive/Media2/Documentary'

\- '/plexdrive/Media3/Documentary'

\- name: 'Films'

folders:

\- '/plexdrive/Media/Film'

\- '/plexdrive/Media2/Film'

\- '/plexdrive/Media3/Film'

\- name: 'Kids Films'

folders:

\- '/plexdrive/Media/Kids'

\- '/plexdrive/Media2/Kids'

\- '/plexdrive/Media3/Kids'

\# New library details

new_library:

name: 'Movies - IMDB Top 250'

folder: '/mnt/PlexDynamic/library/imdb/'

sort: yes

sort_title:

format: '{number}. {title}'

visible: yes

absolute: yes # Skips numbers for missing items

\# Limit the age (in years) of items to be considered

\# * 0 for no limit

max_age: 0

\# Maximum number of items to keep in the library

max_count: 250

\# Remove items that no longer exist in the source lists

remove\_from\_library: yes

\# Weighted sorting (requires TMDb API)

weighted_sorting:

enabled: no

better\_release\_date: no

weights:

\# Think of these as percentages,

\# but they don't have to add up to 1.0

\# * Additive

\# * Higher value -> more important

index: 0.0

vote: 0.0

age: 0.0

random: 0.0

\# Penalize (<0) or reward (>0) certain (TMDb) genres

\# * Final weight is multipled by these values

genre_bias:

'TV Movie': 0.7

'Animation': 0.95

I have plexlibrary installed at: /mnt/PlexDynamic/python-plexlibrary

I have my dynamic libraries at: /mnt/PlexDynamic/library

I have sym linked /mnt/unionfs to /unionfs and /mnt/plexdrive to /plexdrive so that file paths are identical to the plex docker container.

I have read that the symlinks need to be on a local drive so I avoided the unionfs, plexdrive, gdrive folders which were attempting to upload. I have also tried the servers external IP address, servers dns resolvable hostname and internal Docker IP in my config.yml all result in the same errors.

I have been able to get this working using the same config and recipies at home on my unRaid server, just having problems with my dedicated server which is using plexguide.

I have also posted this on the plexguide forums, I followed the github tutorial to set this up. I discovered your dynamic libraries at the following: https://plexguide.com/threads/organizing-content-with-dynamic-libraries.525/

Can anyone shed any light on this? Thanks in advance.

irjon commented 6 years ago

I have switched to plexdrive version 4 (previously using 5) and the problem is mostly resolved, theres quite a few python timeouts still as before so I just ran it using a for loop until it managed to complete.

I think my main problem was using plexdrive 5, and my server is with one provider who I think have a pretty heavily congested network.

Would it be possible to specify the HTTPConnectionPool read timeout as a runtime parameter to help mitigate against read timeouts as shown in the following error?

requests.exceptions.ReadTimeout: HTTPConnectionPool(host='onepro.mukt.uk', port=32400): Read timed out. (read timeout=30)

adamgot commented 6 years ago

It should be possible to set longer timeout, however if each request to the Plex server takes over 30 seconds it will take a long time to run the whole thing. Optimally the script should run on the same server/network as the Plex server. Is this possible?

And by the way, getting 30 second response times from your Plex server must render it pretty much unusable?