dbr / tvnamer

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

Retain custom strings from the old filename #123

Closed hi2u closed 8 years ago

hi2u commented 8 years ago

If the string [W] is in the old filename, how can I make sure that it is kept/retained in the new filename? (this is how I mark videos as already watched)

Example...

Old: Stephen.Colbert.2015.09.08.George.Clooney.HDTV.AC3.XviD [W].avi
New: The Late Show with Stephen Colbert - [2015-09-08] - George Clooney, Jeb Bush, Jon Batiste & Stay Human [W].avi

I tried the "input_filename_replacements" and "output_filename_replacements" config options, but I guess it doesn't know where to keep [W] in the new filename? Although in my simple case, it's just at the end of the filename (before the extension).

Also are the config options documented anywhere? They're semi-self-explanatory, but some are a bit ambiguous.

dbr commented 8 years ago

Hm, I'm not sure this is currently possible, except maybe something strange like updating the extension pattern to consider [W].avi as a file extension

The config options are described here: https://github.com/dbr/tvnamer/blob/master/tvnamer/config_defaults.py

hi2u commented 8 years ago

Great, thanks for the "extension_pattern" config setting idea @dbr ! This does the trick for my need.

After reading the eng|cze example in config_defaults.py, I decided to change my watched filenames from (space)[W] to .w, which is probably more sensible overall anyway.

For anyone doing anything similar, my resulting config option was:

"extension_pattern": "(\\.w)?(\\.[a-zA-Z0-9]+)$",

...this will ensure that any files ending with .w.avi. or .w.mp4 etc will retain the .w in the filename.