robobeaver6 / plex_playlist_generator

Generate a playlist of an arbatory Length on a Plex server for the next unplayed episode from random TV shows in the Library
16 stars 5 forks source link

TVDB now requires an API key #5

Closed danielb2 closed 1 year ago

danielb2 commented 2 years ago
Traceback (most recent call last):
  File "/home/daniel/tmp/plex_playlist_generator/playlist_generator.py", line 178, in <module>
    main()
  File "/home/daniel/tmp/plex_playlist_generator/playlist_generator.py", line 162, in main
    episodes = get_random_episodes(all_shows, n=args.number)
  File "/home/daniel/tmp/plex_playlist_generator/playlist_generator.py", line 83, in get_random_episodes
    if skipped_missing(all_shows.get(title=show_name), show_episodes[show_name][0]):
  File "/home/daniel/tmp/plex_playlist_generator/playlist_generator.py", line 122, in skipped_missing
    previous_season_count = tvdb_season_count(show, season_num - 1)
  File "/home/daniel/tmp/plex_playlist_generator/playlist_generator.py", line 100, in tvdb_season_count
    raise RuntimeError(f'TVDB now requires an API key.  Instructions on how to set it up are here:\n\n'
RuntimeError: TVDB now requires an API key.  Instructions on how to set it up are here:

https://koditips.com/create-tvdb-api-key-tv-database/

I'm invoking the script via the --server method, and according to the help, the --tvdb-api-key is only needed for the "Plex Account Connection Method". A miss?

GhostGuy9 commented 2 years ago

TVDB Started slowly removing the api keys and this error happened to me last night a couple times. It happens to specific shows and removing the show fixes the problem.

danielb2 commented 2 years ago

Adding the key solved the direct issue for me, but then I got another error for another show for which I had deleted seasons 1 and 2.

:main:SKIP_CHECK: Previous Episode not Found for S2E1

no idea how to proceed here now, but I didn't say anything originally since it wasn't related to this issue

GhostGuy9 commented 2 years ago

Thats normal its only checking if it's a valid skip and should output "SKIP_CHECK: Passed" if it succeeded in the skip. I'm not too understanding of the code yet.

danielb2 commented 2 years ago

Ah, that itself wasn't the problem. I pasted wrong:

INFO:__main__:SKIP_CHECK: Previous Episode not Found for <SHOW> S2E1
Traceback (most recent call last):
  File "/home/daniel/tmp/plex_playlist_generator/playlist_generator.py", line 178, in <module>
    main()
  File "/home/daniel/tmp/plex_playlist_generator/playlist_generator.py", line 162, in main
    episodes = get_random_episodes(all_shows, n=args.number)
  File "/home/daniel/tmp/plex_playlist_generator/playlist_generator.py", line 83, in get_random_episodes
    if skipped_missing(all_shows.get(title=show_name), show_episodes[show_name][0]):
  File "/home/daniel/tmp/plex_playlist_generator/playlist_generator.py", line 122, in skipped_missing
    previous_season_count = tvdb_season_count(show, season_num - 1)
  File "/home/daniel/tmp/plex_playlist_generator/playlist_generator.py", line 98, in tvdb_season_count
    tvdb_id = int(re.search('thetvdb://([0-9]+)?', show.guid).group(1))
AttributeError: 'NoneType' object has no attribute 'group'
(
GhostGuy9 commented 2 years ago

Is there any other args you are using besides Debug and TVDB api key? It seems to have a problem with skipping the missing episode and I can re-create it to produce that.

rich9474 commented 2 years ago

It was a while ago since I wrote this. I will need to remind myself how it works. I will try and have a look at the weekend.

danielb2 commented 2 years ago

playlist_generator.py --server --token <token> --baseurl <url> --tvdb-api-key <api-key>

GhostGuy9 commented 2 years ago

Looks like it has something to to with the GUID, if your using Plex's new library agent it will not work and breaks that code for some shows. Using the TVDB agent fixes the problem