Casvt / Plex-scripts

Plex, the arr's and tautulli scripts coming from user requests
GNU General Public License v3.0
338 stars 30 forks source link

Error on import #166

Closed RBeatse closed 4 months ago

RBeatse commented 1 year ago

In which file is the bug? Plex importer exporter

Describe the setup (arguments and their values, how it was run, etc.):

python3 plex_exporter_importer.py -t import -L plex_exporter_importer.db --All -p metadata -p poster -p art -p collection

Describe what the bug is: Message when run

Importing from plex_exporter_importer.db
You're going to import the following:
The standard plex metadata like title, summary, tags and more.
The (custom) poster of movies, shows, seasons, artists and albums.
The (custom) art of movies, shows, seasons, artists and albums.
The collections in every library
This is going to be done for your server and your complete plex library.

Collections
Shutting down...
Progress saved
AN ERROR OCCURED. ALL YOUR PROGRESS IS SAVED. PLEASE SHARE THE FOLLOWING WITH THE DEVELOPER:
Traceback (most recent call last):
File "c:\Plex_util\plex_exporter_importer\plex_exporter_importer.py", line 1423, in
response = plex_exporter_importer(
File "c:\Plex_util\plex_exporter_importer\plex_exporter_importer.py", line 1360, in plex_exporter_importer
_leave(**exit_args, e=e)
File "c:\Plex_util\plex_exporter_importer\plex_exporter_importer.py", line 443, in _leave
raise e
File "c:\Plex_util\plex_exporter_importer\plex_exporter_importer.py", line 1170, in plex_exporter_importer
response = method(type='collection', data={}, watched_map=watched_map, timestamp_map=timestamp_map, media_lib_id=0, **args)
File "c:\Plex_util\plex_exporter_importer\plex_exporter_importer.py", line 743, in _import
new_ratingkey = ssn.post(f'{base_url}/library/collections', params={'title': collection[2], 'smart': '0', 'sectionId': lib['key'], 'type': media_types[lib['type']][3], 'uri': f'server://{machine_id}/com.plexapp.plugins.library/library/metadata/{",".join(collection_keys)}'}).json()['MediaContainer']['Metadata'][0]['ratingKey']
TypeError: sequence item 1: expected str instance, NoneType found

Describe what should be happening: import process should be successful

Casvt commented 1 year ago

Yeah this, again, has to do with importing collections when you have an item in your library that doesn't have a guid. I'll fix it when I get home in 2h

Casvt commented 1 year ago

Please redownload the script

P.S. I swear I write clean and bug-free code normally haha but the Plex-scripts project is very sensitive to bugs due to the scripts needing to cover a vast amount of situations and environments.

RBeatse commented 1 year ago

Your code has been great!! I ran it again last afternoon and it ran for about 4 hours before it just hung up Plex and the PC. I restarted the PC and ran it before going to bed. It finished in about 3 hours and gave no errors. An interesting result, however. TV shows have the collections and such with no problems that I can see. Movies, however, have the collection created with the poster. However the individual movies are not "in" the collection. If you look at the UI, the lock is yellow as if something is there but nothing is in the field. If I update the tags Field to put the collection name, it is fine but whatever worked on TV Shows is off just a bit in Movies. I will just update them all over the next while. Thanks for your work on this!!!

Casvt commented 1 year ago

I'll check why movies don't have their collection applied when I'm home