nosmokingbandit / Watcher3

Other
280 stars 60 forks source link

Crash on postprocessing files when Watcher can't properly parse title from filename #118

Open iskarian opened 7 years ago

iskarian commented 7 years ago

When Watcher cannot parse the filename correctly, the TMDB search fails:

INFO 2017-08-15 02:55:33,436 core.library.from_file: Gathering metadata for /storage/downloads/auto-watcher/[Raizel]_The_Garden_of_Words_[BD_1080p_Dual_Audio_FLAC]_[17B559AA].mkv.
INFO 2017-08-15 02:55:33,436 core.library.parse_filename: Parsing filename for movie information: /storage/downloads/auto-watcher/[Raizel]_The_Garden_of_Words_[BD_1080p_Dual_Audio_FLAC]_[17B559AA].mkv.
INFO 2017-08-15 02:55:33,436 core.library.parse_filename: Found {'audio': 'Dual Audio', 'title': 'The Garden of Words [BD 1080p Dual Audio FLAC] [17B559AA] mk', 'resolution': '1080p', 'container': 'mkv', 'release_name': '[Raizel]_The_Garden_of_Words_[BD_1080p_Dual_Audio_FLAC]_[17B559AA].mkv'} in filename.
INFO 2017-08-15 02:55:33,436 core.library.parse_media: Parsing codec data from file /storage/downloads/auto-watcher/[Raizel]_The_Garden_of_Words_[BD_1080p_Dual_Audio_FLAC]_[17B559AA].mkv.
INFO 2017-08-15 02:55:33,469 core.movieinfo.search: Searching TheMovieDB for The Garden of Words [BD 1080p Dual Audio FLAC] [17B559AA] mk
INFO 2017-08-15 02:55:33,469 core.movieinfo._search_title: Searching TheMovieDB for title: The Garden of Words [BD 1080p Dual Audio FLAC] [17B559AA] mk.
INFO 2017-08-15 02:55:33,469 core.movieinfo._search_title: Searching TMDB https://api.themoviedb.org/3/search/movie?page=1&include_adult=false&query=the garden of words bd 1080p dual audio flac 17b559aa mk
INFO 2017-08-15 02:55:33,819 core.movieinfo.search: Nothing found on TheMovieDatabase for The Garden of Words [BD 1080p Dual Audio FLAC] [17B559AA] mk
WARNING 2017-08-15 02:55:33,819 core.library.from_file: Unable to get data from TheMovieDB for None
INFO 2017-08-15 02:55:33,819 core.postprocessing.POST: Post-processing as Complete.

This triggers another crash due to the TMDB id not being set:

INFO 2017-08-15 02:55:34,281 core.library.convert_to_db: Converting movie metadata to database structure for The Garden of Words.
ERROR 2017-08-15 02:55:34,282 cherrypy.error.139785408369888.error: [15/Aug/2017:02:55:34] HTTP 
Traceback (most recent call last):
  File "/var/lib/watcher/lib/cherrypy/_cprequest.py", line 670, in respond
    response.body = self.handler()
  File "/var/lib/watcher/lib/cherrypy/lib/encoding.py", line 220, in __call__
    self.body = self.oldhandler(*args, **kwargs)
  File "/var/lib/watcher/lib/cherrypy/lib/jsontools.py", line 61, in json_handler
    value = cherrypy.serving.request._json_inner_handler(*args, **kwargs)
  File "/var/lib/watcher/lib/cherrypy/_cpdispatch.py", line 60, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "/var/lib/watcher/core/postprocessing.py", line 84, in POST
    response = self.complete(data)
  File "/var/lib/watcher/core/postprocessing.py", line 401, in complete
    data.update(self.metadata.convert_to_db(data))
  File "/var/lib/watcher/core/library.py", line 599, in convert_to_db
    movie['url'] = 'https://www.themoviedb.org/movie/{}'.format(movie['id'])
KeyError: 'id'
INFO 2017-08-15 02:55:34,282 cherrypy.error.139785408369888.error: [15/Aug/2017:02:55:34] HTTP 

Parsing ambiguously formatted names is really tricky, so perhaps at least for files being sent from downloads, this can be mitigated by using the movie info already associated with the download rather than trying to parse/look it up again for the file.

nosmokingbandit commented 7 years ago

It does pull info from the database if possible, but it was overwriting the title with the title parsed from the file name, which should not have been happening. It also doesn't need to query themoviedb if we have local data.

35ce9ada2245da9631d1f00bf6ad8e1104e914fe should help prevent weird things that pop up like that.

On Wed, Aug 16, 2017 at 12:08 AM, iskarian notifications@github.com wrote:

When Watcher cannot parse the filename correctly, the TMDB search fails:

INFO 2017-08-15 02:55:33,436 core.library.from_file: Gathering metadata for /storage/downloads/auto-watcher/[Raizel]_The_Garden_ofWords[BD_1080p_Dual_AudioFLAC][17B559AA].mkv. INFO 2017-08-15 02:55:33,436 core.library.parse_filename: Parsing filename for movie information: /storage/downloads/auto-watcher/[Raizel]_The_Garden_ofWords[BD_1080p_Dual_AudioFLAC][17B559AA].mkv. INFO 2017-08-15 02:55:33,436 core.library.parse_filename: Found {'audio': 'Dual Audio', 'title': 'The Garden of Words [BD 1080p Dual Audio FLAC] [17B559AA] mk', 'resolution': '1080p', 'container': 'mkv', 'release_name': '[Raizel]_The_Garden_ofWords[BD_1080p_Dual_AudioFLAC][17B559AA].mkv'} in filename. INFO 2017-08-15 02:55:33,436 core.library.parse_media: Parsing codec data from file /storage/downloads/auto-watcher/[Raizel]_The_Garden_ofWords[BD_1080p_Dual_AudioFLAC][17B559AA].mkv. INFO 2017-08-15 02:55:33,469 core.movieinfo.search: Searching TheMovieDB for The Garden of Words [BD 1080p Dual Audio FLAC] [17B559AA] mk INFO 2017-08-15 02:55:33,469 core.movieinfo._search_title: Searching TheMovieDB for title: The Garden of Words [BD 1080p Dual Audio FLAC] [17B559AA] mk. INFO 2017-08-15 02:55:33,469 core.movieinfo._search_title: Searching TMDB https://api.themoviedb.org/3/search/movie?page=1&include_adult=false&query=the garden of words bd 1080p dual audio flac 17b559aa mk INFO 2017-08-15 02:55:33,819 core.movieinfo.search: Nothing found on TheMovieDatabase for The Garden of Words [BD 1080p Dual Audio FLAC] [17B559AA] mk WARNING 2017-08-15 02:55:33,819 core.library.from_file: Unable to get data from TheMovieDB for None INFO 2017-08-15 02:55:33,819 core.postprocessing.POST: Post-processing as Complete.

This triggers another crash due to the TMDB id not being set:

INFO 2017-08-15 02:55:34,281 core.library.convert_to_db: Converting movie metadata to database structure for The Garden of Words. ERROR 2017-08-15 02:55:34,282 cherrypy.error.139785408369888.error: [15/Aug/2017:02:55:34] HTTP Traceback (most recent call last): File "/var/lib/watcher/lib/cherrypy/_cprequest.py", line 670, in respond response.body = self.handler() File "/var/lib/watcher/lib/cherrypy/lib/encoding.py", line 220, in call self.body = self.oldhandler(*args, kwargs) File "/var/lib/watcher/lib/cherrypy/lib/jsontools.py", line 61, in json_handler value = cherrypy.serving.request._json_inner_handler(*args, *kwargs) File "/var/lib/watcher/lib/cherrypy/_cpdispatch.py", line 60, in call return self.callable(self.args, self.kwargs) File "/var/lib/watcher/core/postprocessing.py", line 84, in POST response = self.complete(data) File "/var/lib/watcher/core/postprocessing.py", line 401, in complete data.update(self.metadata.convert_to_db(data)) File "/var/lib/watcher/core/library.py", line 599, in convert_to_db movie['url'] = 'https://www.themoviedb.org/movie/{}'.format(movie['id']) KeyError: 'id' INFO 2017-08-15 02:55:34,282 cherrypy.error.139785408369888.error: [15/Aug/2017:02:55:34] HTTP

Parsing ambiguously formatted names is really tricky, so perhaps at least for files being sent from downloads, this can be mitigated by using the imdb info already associated with the download rather than trying to parse/look it up again for the file.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/nosmokingbandit/Watcher3/issues/118, or mute the thread https://github.com/notifications/unsubscribe-auth/AKX1SUoYoCXfimJRByV4j_Y08AlbBAzzks5sYmtEgaJpZM4O4ZhU .