dbr / tvnamer

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

Added the ability for the user to specify a priori what TVDb id to use for specific series names #180

Closed maxgarber closed 4 years ago

maxgarber commented 4 years ago

This enables a deterministic, single-result search which improves the ability to automate the process.

I tried my best to add this functionality without altering or breaking how it works currently; e.g. the command-line option --series-id=${tvdb_id} still overrides anything in the user's dotfile or the default config.

dbr commented 4 years ago

Thanks!

I wonder, does this do the same thing as specifying the show ID as the replacement? For example like this: https://github.com/dbr/tvnamer/blob/43a796479c16fd7ca27e2ef65a3c0a519711729e/tests/test_series_replacement.py#L39-L42 which maps the given series name (or regex) to series ID 76156

Definitely not obvious this is supported - I had to find that test to be sure it was implemented like that! If this does what you need, we should definitely improve the description as it doesn't mention this at all https://github.com/dbr/tvnamer/blob/43a796479c16fd7ca27e2ef65a3c0a519711729e/tvnamer/config_defaults.py#L451-L453

maxgarber commented 4 years ago

If I'm understanding you correctly, no, I don't think it does.

I added this so that instead of having tvnamer search for the matching series based on the file name and then confirming with the user which series to use, this lets the user make that choice and skip the search, so that tvnamer doesn't have to ask the user which series it matches--it can just look it up directly.

So for example if a file were named Some.Show.Name.S01E01.blah.blah.mkv, tvnamer might present me with a set of matches when it searches for 'Some Show Name' which I then have to select the correct one from. This makes it so instead of it doing that search, I can just say that I know the tvdb id of 'Some Show Name' and to just use that as the series id to use in retrieving the other information.

dbr commented 4 years ago

I think the input_series_replacement does function like you describe. For example, in the default configuration you will be prompted for series, as the search term was ambiguous:

(tvntest) [dbr@slate:~/code/tvnamer]$ tvnamer Scrubs.S01E01.blah.blah.mkv
####################
# Starting tvnamer
# Found 1 episode
####################
# Processing file: Scrubs.S01E01.blah.blah.mkv
# Detected series: Scrubs (season: 1, episode: 1)
TVDB Search Results:
1 -> Scrubs [en] # http://thetvdb.com/?tab=series&id=76156&lid=7 (default)
2 -> Wormwood Scrubs [en] # http://thetvdb.com/?tab=series&id=167151&lid=7
3 -> Scrubbing In [en] # http://thetvdb.com/?tab=series&id=274735&lid=7
Enter choice (first number, return for default, 'all', ? for help):

whereas with the replacement specified, the search terms is replaced with the unambiguous series ID integer, so no series selection prompt will appear:

(tvntest) [dbr@slate:~/code/tvnamer]$ cat testconf.json
{
"input_series_replacements": {
         "Scrubs": 76156}
}
(tvntest) [dbr@slate:~/code/tvnamer]$ tvnamer --config testconf.json Scrubs.S01E01.blah.blah.mkv
Loading config: testconf.json
####################
# Starting tvnamer
# Found 1 episode
####################
# Processing file: Scrubs.S01E01.blah.blah.mkv
# Detected series: 76156 (season: 1, episode: 1)
####################
Old filename: Scrubs.S01E01.blah.blah.mkv
New filename: Scrubs - [01x01] - My First Day.mkv
Rename?
([y]/n/a/q)
maxgarber commented 4 years ago

Ah, okay. That is definitely the functionality I was looking for. I think calling attention to that in the documentation would be a good idea; we could change my PR to do just that?