dbr / tvnamer

Automatic TV episode file renamer, uses data from thetvdb.com via tvdb_api
https://pypi.python.org/pypi/tvnamer/
The Unlicense
912 stars 115 forks source link

Handle TVDB errors better #102

Closed adhawkins closed 4 years ago

adhawkins commented 9 years ago

Hi,

When tvnamer fails to download data from the TVDB, it still goes on to suggest renaming a file (typically offering to remove any 'name' part).

e.g.

####################
# Processing file: Casualty - s29e11 - Asylum.mkv
# Detected series: Casualty (season: 29, episode: 11)
DataRetrievalError('Error with www.thetvdb.com: Could not connect to server: HTTP Error 522: Origin Connection Time-out',)
####################
Old filename: Casualty - s29e11 - Asylum.mkv
Before custom output replacements: Casualty - s29e11.mkv
New filename: Casualty - s29e11.mkv
Rename?
([y]/n/a/q)

Here's it's offering to rename a correctly named file by removing the episode title.

It would be better if it either retried the attempt, or displayed an error and didn't offer to rename.

rustymyers commented 9 years ago

I agree that there could be better handling of tvdb connection errors, I experienced long delays while trying to retrieve information. However, I prefer some files to be renamed and have the title removed, as sometimes it's incorrect. This is why I suggest it be a preference (in fact it may already be, I'm not sure: https://github.com/dbr/tvnamer/blob/master/tvnamer/config_defaults.py). Thanks.

dbr commented 9 years ago

I think having the skip_file_on_error apply interactively makes sense, maybe preserving the current true/false behaviour, and introduce:

skip_file_on_error: "always" # skip file interactively and in batch
skip_file_on_error: "batch" # skip file in batch mode, prompt interactively
skip_file_on_error: "never" # always rename

(I can't think of any sane reason to have an option for "rename in batch, but skip in interactive")

rustymyers commented 9 years ago

I agree, those sound like appropriate options.

dbr commented 4 years ago

Closing old issue; solved by skip_file_on_error/skip_behaviour options from #111