mdhiggins / sickbeard_mp4_automator

Automatically convert video files to a standardized format with metadata tagging to create a beautiful and uniform media library
MIT License
1.53k stars 202 forks source link

thetvdb lookups appear to be failing #1090

Closed thenezzah closed 4 years ago

thenezzah commented 4 years ago

since thetvdb revamped their page, it's no longer doing successful lookups or populating episode info.

thenezzah commented 4 years ago

Processing file b'C:\down\preconvert\Mobile Suit Victory Gundam (1993) Season 1 S01 + Extras (1080p BluRay x265 HEVC 10bit AC3 2.0 Japanese SAMPA)\Mobile Suit Victory Gundam (1993) - S01E01 - The White Mobile Suit (1080p BluRay x265 SAMPA).mkv' 'NoneType' object has no attribute 'split'

j-marcon commented 4 years ago

I'm getting the same issue. This TVDB change has broken a few of my automated tools. Any idea how to fix it here?

thenezzah commented 4 years ago

I'm imagining its just an API restructuring. If I knew anything about Python programing I would imagine it's probably trivial : https://www.thetvdb.com/api-information

mdhiggins commented 4 years ago

Just pushed an update that should be compatible with the latest API I've been dragging my feet on this one because the V2 API is broken with regards to poster ratings so I can't get the best poster, only the first poster so as of now that feature is broken

Feel free to voice your concerns here: https://forums.thetvdb.com/viewtopic.php?f=17&t=60236&p=163715#p163715

thenezzah commented 4 years ago

seems to still be having issues:

Processing file b'C:\down\preconvert\Black.Lightning.S03E06.WEB.h264-TRUMP[rarbg]\black.lightning.s03e06.web.h264-trump.mkv' Matched TV episode as b'Black Lightning' (TVDB ID:332525) S03E06 Failed to connect to TVDB, trying again in 20 seconds. Traceback (most recent call last): File "C:\apps\sickbeard_mp4_automator-master\tvdb_mp4.py", line 42, in init self.showdata = self.tvdb_show[self.show] File "C:\apps\sickbeard_mp4_automator-master\tvdb_api\tvdb_api.py", line 1186, in getitem self._getShowData(key, self.config['language']) File "C:\apps\sickbeard_mp4_automator-master\tvdb_api\tvdb_api.py", line 1113, in _getShowData self._parseBanners(sid) File "C:\apps\sickbeard_mp4_automator-master\tvdb_api\tvdb_api.py", line 1007, in _parseBanners banners_info = self._getetsrc(self.config['url_seriesBannerInfo'] % (sid, cur_banner)) File "C:\apps\sickbeard_mp4_automator-master\tvdb_api\tvdb_api.py", line 910, in _getetsrc src = self._loadUrl(url, language=language) File "C:\apps\sickbeard_mp4_automator-master\tvdb_api\tvdb_api.py", line 874, in _loadUrl raise tvdb_error("%s" % error) tvdb_api.tvdb_api.tvdb_error: No results for your query

mdhiggins commented 4 years ago

Honestly the new TVDB API is buggy and ruining the posters is frustrating enough that I think migrating to just TMDB for movies and TV shows is a better option I just pushed a new branch that attempts to do that that uses tmdbsimple if you wish to try it out

pip install tmdbsimple is a new requirement but then it should work

mdhiggins commented 4 years ago

https://github.com/mdhiggins/sickbeard_mp4_automator/tree/notvdb

thenezzah commented 4 years ago

will do! Also, as a small request, can you build in a function that only fetches and adds the poster? I've found that for some shows like Titans, it never gets Titans (2018) and therefore won't add artwork. If I could manually run a version where all it did was add posters that would be fabulous!

thenezzah commented 4 years ago

hrmm ...perhaps I'm not doing something right?

Installing tmdbsimple:

C:\Windows\system32>pip install tmdbsimple
Collecting tmdbsimple
  Downloading https://files.pythonhosted.org/packages/52/d7/e84d96acfff3154bd84cc139472fb3d1293fabf20cd150833b3229c1e40d/tmdbsimple-2.2.0-py2.py3-none-any.whl
Requirement already satisfied: requests in c:\apps\python37\lib\site-packages (from tmdbsimple) (2.22.0)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in c:\apps\python37\lib\site-packages (from requests->tmdbsimple) (1.25.3)
Requirement already satisfied: certifi>=2017.4.17 in c:\apps\python37\lib\site-packages (from requests->tmdbsimple) (2019.6.16)
Requirement already satisfied: idna<2.9,>=2.5 in c:\apps\python37\lib\site-packages (from requests->tmdbsimple) (2.8)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\apps\python37\lib\site-packages (from requests->tmdbsimple) (3.0.4)
Installing collected packages: tmdbsimple
Successfully installed tmdbsimple-2.2.0
WARNING: You are using pip version 19.1.1, however version 19.3.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

DOS run command I'm using: "C:\apps\sickbeard_mp4_automator-notvdb\manual.py" -i "C:\down\prec2" -a

Output from command:

C:\down\preconvert>"C:\apps\sickbeard_mp4_automator-notvdb\manual.py" -i "C:\down\prec2" -a
Manual processor started.
C:\apps\Python37\python.exe
Audio bitrate was invalid, defaulting to 256 per channel.
64bit Python.
File C:\down\prec2 is not in the correct format

index.log

2019-11-19 19:43:45 - MANUAL - INFO - Manual processor started.
2019-11-19 19:43:45 - MANUAL - INFO - C:\apps\Python37\python.exe
2019-11-19 19:43:45 - MANUAL - WARNING - Audio bitrate was invalid, defaulting to 256 per channel.
thenezzah commented 4 years ago

doesn't appear to be processing a "file" but rather the "directory" which itself isn't a media file? Just guessing.

mdhiggins commented 4 years ago

Did that command work previously? I didn't make any changes to the directory walking or file validation logic

thenezzah commented 4 years ago

yes it did. I created a new directory to convert from, and altered my batch file accordingly (mentioned above), and copied my autoprocess.ini in (the only real change made to it is in the MP4 section to 'output_directory'

thenezzah commented 4 years ago

i should mention i'm not married to the command. I welcome your suggestions

mdhiggins commented 4 years ago

Any chance its a permission issue? I was able to make a folder called prec2 and it processed fine Maybe move it somewhere you for sure have permissions (IE your home directory or desktop and not the root of the C drive)

thenezzah commented 4 years ago

BAH!! I had a typo in my batch! It's working like a champ so far, very much appreciated! here's a copy of the batch I use if it's of any use to you (bear in mind this was written quite a long time ago, I'd probably redo it if I were to write it again...

Also if you can think of a run command to just apply posters to a media file like I mentioned before, that would be amazing :-P

cd preconvert
::Find "sample" & "etrg"
powershell -Command "& {gci -Path "C:\down\preconvert" -Rec | ?{($_.Name -Match 'sample') -OR ($_.Extension -Match 'exe') -OR ($_.Extension -Match 'lnk')} | ?{$_.psIsContainer -eq $false} | Sort -Descending Name | Select-Object | Remove-Item}"

::Do Conversions
rem "C:\down\app\sickbeard_mp4_automator-master\manual.py" -i "c:\down\preconvert" -a
"C:\apps\sickbeard_mp4_automator-notvdb\manual.py" -i "C:\down\preconvert" -a

::Fix Filenames
"C:\program files\filebot\filebot.exe" -script fn:amc --output "C:\down\ConRenamed" --action copy -non-strict "c:\down\converted" --log-file amc.log --def excludeList=amc.txt
cd ..
mdhiggins commented 4 years ago

The general tagging command should always apply posters, not sure what you want specifically

thenezzah commented 4 years ago

Was wanting a command that didn't convert, only edits/cleans/corrects meta info and applies poster art to the media file (if mp4 of course).

mdhiggins commented 4 years ago

As long as the convert-mp4 option is disabled the script will do exactly that

thenezzah commented 4 years ago

nice! thank you so much for the help! keep up the great work, it's very much appreciated :)

thenezzah commented 4 years ago

new error appearing from the notvdb vrsion you made, here's the entry from index.log:

2019-11-23 11:28:30 - MANUAL - INFO - Starting conversion.
2019-11-23 11:28:31 - MANUAL - INFO - C:\down\converted\Chrisley.Knows.Best.S07E26.WEB.h264-TRUMP[eztv].m4v created.
2019-11-23 11:28:31 - MANUAL - INFO - Tagging file: C:\down\converted\Chrisley.Knows.Best.S07E26.WEB.h264-TRUMP[eztv].m4v.
2019-11-23 11:28:31 - MANUAL - ERROR - Exception while retrieving poster can only concatenate str (not "NoneType") to str.
2019-11-23 11:28:31 - MANUAL - INFO - Trying to write tags.
2019-11-23 11:28:31 - MANUAL - INFO - Tags written successfully.
2019-11-23 11:28:31 - MANUAL - INFO - Relocating MOOV atom to start of file.
2019-11-23 11:29:09 - MANUAL - ERROR - Failed to connect to TVDB, trying again in 20 seconds.
Traceback (most recent call last):
  File "C:\apps\sickbeard_mp4_automator-notvdb\tvdb_mp4.py", line 59, in __init__
    self.episodedata = episodequery.info()
  File "C:\apps\Python37\lib\site-packages\tmdbsimple\tv.py", line 477, in info
    response = self._GET(path, kwargs)
  File "C:\apps\Python37\lib\site-packages\tmdbsimple\base.py", line 85, in _GET
    return self._request('GET', path, params=params)
  File "C:\apps\Python37\lib\site-packages\tmdbsimple\base.py", line 80, in _request
    response.raise_for_status()
  File "C:\apps\Python37\lib\site-packages\requests\models.py", line 940, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://api.themoviedb.org/3/tv/4086/season/30/episode/19?api_key=45e408d2851e968e6e4d0353ce621c66
2019-11-23 11:29:36 - MANUAL - ERROR - Failed to connect to TVDB, trying again in 20 seconds.
Traceback (most recent call last):
  File "C:\apps\sickbeard_mp4_automator-notvdb\tvdb_mp4.py", line 59, in __init__
    self.episodedata = episodequery.info()
  File "C:\apps\Python37\lib\site-packages\tmdbsimple\tv.py", line 477, in info
    response = self._GET(path, kwargs)
  File "C:\apps\Python37\lib\site-packages\tmdbsimple\base.py", line 85, in _GET
    return self._request('GET', path, params=params)
  File "C:\apps\Python37\lib\site-packages\tmdbsimple\base.py", line 80, in _request
    response.raise_for_status()
  File "C:\apps\Python37\lib\site-packages\requests\models.py", line 940, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://api.themoviedb.org/3/tv/4086/season/30/episode/19?api_key=45e408d2851e968e6e4d0353ce621c66
mdhiggins commented 4 years ago

This is failing because there is no Season 30 Episode 19 of Diners, Drive-Ins, and Dives It looks like the first episode works fine (Chrisley Knows Best)

mdhiggins commented 4 years ago

https://www.themoviedb.org/tv/4086-diners-drive-ins-and-dives/season/30

mdhiggins commented 4 years ago

I went ahead and added the missing episode entries to the TMDB database and started season 31 Looks like the TMDB was just a little behind compared to TVDB

thenezzah commented 4 years ago

cool, thank you