Watcher3 icon indicating copy to clipboard operation
Watcher3 copied to clipboard

Improvements to post processing (renaming)

Open ellnic opened this issue 5 years ago • 8 comments
trafficstars

The post processing often cannot understand editions.

So for things like Diamond Edition (IIRC) or where no clear edition is defined (ie. none, standard etc), it names the file something like:

Film Name (2000) - 1080p - edition.mp4 or Film Name (2000) - 1080p - .mp4

Watcher would benefit from either a default option to use a user defined edition name (Standard?) or emit that part of the file name altogether where no clear edition can be determined.

Additionally, I have only just switched to using {resolution} instead of {quality} (thanks @scambra) but may I also suggest an alteration to this:

I have just tested and got an output of:

Film Name (2000) - WebDL-1080P - .mkv

Just for the sake of things remaining tidy, the WebDL should be separate from resolution, this I would say is {source}? And if we're really being picky, the 'P' should be lower case :grin: but this is just my OCD :laughing:

The resultant output of:

{title} ({year}) - {resolution} - {edition}

Should be:

Film Name (2000) - 1080p - Standard Edition.mp4

or

Film Name (2000) - 1080p.mp4

This would certainly be compatible with the major media servers.

ellnic avatar Jan 20 '20 12:01 ellnic

My suggestion was more generic, support default value for tags in renamer text, so format could be:

{title} ({year}) - {resolution} - {edition|Standard Edition}

So when there is no edition info it would rename file to:

Film Name (2000) - 1080p - Standard Edition.mp4

And it wouldn't change current behaviour, in case someone doesn't want to have this output. Also, it would work to other tags, to print something as unknown instead of blank, e.g. {videocodec|unknown codec}.

About resolution having source, I didn't expect it when I started to use watcher, I set my pattern to {source} {resolution} and I got double source in file names. Some thoughts about this:

  • Changing it wouldn't be backwards compatible, it would change pattern for current uses, so we may want to update pattern in config to use {source} {resolution} if we change it.
  • This info comes from Metadata.from_file method, which always set resolution to Source-(4K|1080P|720P|SD). Other methods in core/library.py also set resolution in this format, so changing it can be tricky to avoid breaking something else. Searchresults save resolution in that format too, or passed to plugins. We may want to change resolution when get_movie_info method in postprocessing get data from Metadata.from_file.
  • Changing P to p can be tricky too, we would have to change all strings in code, searchresults table, and it could break snatched plugins (possibly written by user) if they use resolution. Again, we may want to change it only in get_movie_info method in core/postprocessing.py.

scambra avatar Jan 20 '20 14:01 scambra

Ah got it, I think I understand about the editions part - sounds like a good solution. Would it also be possible to set the default to be something like {edition|none}, {edition|blank} (or whatever), so if it cannot be determined then it’s just left out? I’m not sure what the general consensus is, but I normally leave standard editions without an edition name entirely. Out of all the edition names I can think of, they are usually one of these:

Diamond, Directors, Extended, Ultimate, Uncut, Restored, Fan, Super Mega Awesome [whatever] Cut.

There’s a list of edition names here: https://en.m.wikipedia.org/wiki/Category:Alternate_versions_of_films

With regards to the resolution and capitalisation workings, the priority should be to cause minimal disruption to users. With that said, it does seem like a bit of an error that {resolution} is basically {source}+resolution and I’m sure most users who are particular enough to use some naming schema involving either of those would favour (or be understanding of) a possible minor disruption and reconfig over ‘incorrect’ naming. Since I have very little understanding of the work involved, I’m happy to go with whatever is deemed possible / doable without spending a disproportionate amount of time on what is basically a cosmetic issue.

The capitalisation of ‘P’ is just me being OCD and could be easily worked around with a ‘dumb’ post processing script that checks for “1080P”, “720P” etc and replaces with lowercase equivalents, so it’s really not that important if it’s not a 5 minute fix.

I’m always mindful of disrupting existing users, but I’m also under the opinion that sometimes there are necessary evils. What is your take on this @barbequesauce @ronilaukkarinen?

ellnic avatar Jan 20 '20 22:01 ellnic

Left tag blank it's current behaviour {edition} will be blank when nothing is found. So what's your current problem with edition? I thought you wanted to have always some value

scambra avatar Jan 21 '20 07:01 scambra

Yes, I think that option should be added. But also a 'real' blank because it's not entirely blank. Yes, there's no word, but it adds -, it should truncate at the previous tag if the next tag cannot be determined or is blank, or we end up with: Film Name (2000) - WebDL-1080P - .mp4 when it should be Film Name (2000) - WebDL-1080P.mp4

ellnic avatar Jan 21 '20 09:01 ellnic

Tag doesn't add " - ", the pattern has always that " - ". Let's say the pattern is "{title} ({year}) - {resolution} - {edition}", watcher will replace everything between {} with value for the tag, but everything out of {} will be there, always.

Not sure how to clean it. We could have another option to remove trailing characters, user will have to enter which trailing characters wants to remove, depending on separator characters used in the pattern. However, having 2 blank tags can create a file name like this:

Film Name (2000) - - 1080p.mp4

scambra avatar Jan 21 '20 15:01 scambra

Yes, I realise this. I think you've hit the nail on the head with trailing char removal, but taking it one step further I've been thinking about how to sort this without screwing with the tags too much and I keep coming back to an app I use on the Mac called Renamer. You can do tons of flow based actions with it, but one I find most useful is the find / replace. So lets say you have an image file called:

IMG_2000 8256X5504 NIKON CORP NIKON D850 .JPG

You may wonder why Nikon is mentioned twice, that's because Nikon include their name in the Model meta tag but Fuji, for example, do not. So if you initially rename a file using meta tags {manufacturer} {model} you get the above with Nikon. But you do want this for Fuji, as if you omitted the {manufacturer} you'd only get for example X-T20 in the file name. So my renamer flow for some images is something like:

a. IMG_ to Image- b. X to x c. NIKON CORP to Nikon d. NIKON D850 to D850 e. .JPG to .jpg

And the resultant filename would be: Image-2000 8256 x 5504 Nikon D850.jpg

Could this kind of flow be used?

So watcher would:

  1. Rename according to the tags e.g. {title} ({year}) - {resolution} - {edition}
  2. If the edition cannot be determined and a tag uses a default name, use it ie. {edition|Standard Edition}
  3. Lastly. perform a tidy up - a renamer style flow of actions.

For the above tags that I use, some examples of things I would enter would be:

a. If - - replace with - b. if - at end, remove it c. if (double space) replace with (single space) d. if 1080P replace with 1080p e. if 720P replace with 720p f. if Web-DL-, remove it or Web-DL-1080P replace with 1080p g. MP4 to mp4

So this would:

Film Name (2000) - - .mp4 > Film Name (2000).mp4 Film Name (2000) - 1080P - .MP4 > Film Name - 1080p.mp4 Film Name (2000) - WebDL-1080P - .mp4 > Film Name (2000) - 1080p.mp4

Or if using a default name like `{edition|Standard Edition}:

Film Name (2000) - - Standard Edition.mp4 > Film Name (2000) - Standard Edition.mp4 Film Name (2000) - 1080P - Standard Edition.mp4 > Film Name - 1080p - Standard Edition.mp4 Film Name (2000) - WebDL-1080P - Standard Edition.MP4 > Film Name (2000) - 1080p - Standard Edition.mp4

Minimal disruption to existing code, just an additional post processing step... Or is this the most ridiculous idea I've ever come up with?

ellnic avatar Jan 21 '20 21:01 ellnic

It could probably be the best idea, leave user to tell watcher how to clean name.

So features to fix/add are:

  • Remove source from resolution, only in postprocessing (e.g. split by - and keep last). Replace {resolution} with {source} {resolution} in existing patterns, so we don't change how files are renamed. If user doesn't want {source} they can edit and remove it.
  • Add default option to tags for renamer (e.g. allow to set {edition|Standard Edition})
  • Add cleaner filename option to watcher, dynamic lines with string to find and string to replace, if string to replace is blank, it will be removed.

scambra avatar Jan 22 '20 07:01 scambra

Perfect. This would drastically improve the post processing.

ellnic avatar Jan 22 '20 09:01 ellnic