dbr / tvnamer

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

rename episode given show name and episode title? #193

Open workflowsguy opened 4 years ago

workflowsguy commented 4 years ago

When recording show episodes off TV, I get files with show name and episode title, but no season/episode information. From what I understand, tvnamer currently is not able to to rename such episode to a SHOW.SnnEnn - EPSIODE NAME format. Would it be possible to add such a feature?

dbr commented 4 years ago

There's no way to do this currently, but it would be a useful feature.

Biggest issue is I'm not too sure exactly how this would work in terms of UI. Of course it couldn't automatically parse the filenames without season or episode numbers, as they are completely ambiguous - e.g with The Show Name Here it's impossible to know where the show name starts and ends (e.g is it The Show Name and episode name Here, or The Show and episode name Name Here)

A few ideas I have are:

  1. Pattern with seriesname and episodename - these could either be added to config file, or specified on the command line:

    tvnamer --name-by-name '(?<seriesname>The Show) (?<episodename>.*$)' ./files/to/rename

    Good as this could be setup for automated use. Downside is the command line way is a bit clunky. This also wouldn't really work if the series name isn't present (although I suppose it could be specified by the existing --force-name argument)

  2. Some form of command line arg to specify the series name, and this gets removed from the filenames if present, e.g

    tvnamer --name-by-name "The Show" ./files/to/rename

    This is a more convenient CLI arg, but has some potential edge cases (e.g the series Dark has an episode named "Dark Matter"), and not too useful for automation

Additionally:

  1. Would probably require some kind of fuzzy matching threshold - e.g to account for difference in punctuation and slightly different wording or capitalization.
  2. Similarly, would probably need to add a "select which episode" interface - to present all episode which are "close" to the name, and let user pick the best one.
  3. Need to decide how to handle ambigious episode names, as some series have duplicate episode names (most commonly ones with generic names like "Episode 1", "Episode 2" etc)

I don't think this is something that I can really add easily into the current code without it becoming a huge mess. Once the refactoring for v4 is done I shall reconsider - but if you (or anyone else) has some ideas on how best this could work in terms of the command-line/config interface, would be good to hear!

jsloane commented 4 years ago

What about being able to specify a delimiter character to separate the series name with the episode name?

I tried this by adding custom regex for <seriesname> and <episodename> but get an error: Regex does not contain episode number group, shouldcontain episodenumber, episodenumber1-9, orepisodenumberstart and episodenumberend.

Would it be possible to add episodename to this list, and search the tvdb with the seriesname and episodename?

parkerlreed commented 1 year ago

Running into this with Game Changer (Dropout.TV)

I can pass in the series ID manually but Im having to manually add in sXXeYY for every episode for it to match. Title's are already there so a fuzzy match on that would work great.

[parker@wolfcola Dropout]$ cd season3/
[parker@wolfcola season3]$ ls
'20⧸20 Vision [1193568].mp4'
'ChangerCon [1126272].mp4'
'Ham It Up [1126274].mp4'
'Is This Thing On? [1126273].mp4'
'Jeopardy! [1193567].mp4'
'Make It Fashion [1386379].mp4'
'Never Have I Ever [1127014].mp4'
'Next Slide Please [1357812].mp4'
...
[parker@wolfcola season3]$ /home/parker/.local/bin/tvnamer --dry-run --series-id=369988 .
####################
# Starting tvnamer
# Found 15 episodes
####################
# Processing file: 20⧸20 Vision [1193568].mp4
# Detected series: 20⧸20 Vision (episode: 1193568)
Episode 1193568 of show Game Changer, season 1 could not be found (also tried searching by absolute episode number)
####################
Old filename: 20⧸20 Vision [1193568].mp4
New filename: Game Changer - [1193568].mp4
20⧸20 Vision [1193568].mp4 will be renamed to Game Changer - [1193568].mp4