MediaElch
MediaElch copied to clipboard
Improved File Renamer
This was originally requested on the old MediaElch forum
It would be great if you could consider improving the file renaming tool in MediaElch to include the following features:
- Rename at the moment of scraping info (not in two separate tools, actions)
- Rename files and folders at the same time (starting with files, ending with folders)
- Include episode name (according to scrapper selected) in a file and/or folder renaming
- Adding a custom suffix (IE: 1080p.WEB-DL.EAC3-5.1.x264)
- The option to replace "spaces" with "periods"
- Be able to remove diacritics in files name and folders name
Other feature requests:
- from #592: It would be nice if we can rename files all in lower- or uper case. For logical reasons with a new placeholder in the rename window.
- #582
Personally I really like tinyMediaManager's renamer:
Suggestions for a new renamer
Movies
Key-Types
- Title:
String
without newlines - Overview:
String
with newlines - Year:
Number
- 3D:
Bool
- Movieset:
Object
with sub-keys, e.g. movie set
Modifiers
Given title: "Big Buck Bunny (2008), 10min, Rating: 9.768"
Type | Key | Example |
---|---|---|
String | ${title} |
Big Buck Bunny |
Substring | ${title:3 } |
Big |
Character | ${title[0]} |
B |
String Literal | my string , ${"my string"} |
my string |
Bool | ${3D ? ${title} } |
Big Buck Bunny or empty |
Bool with alternative | ${3D ? ${title} : "no-3d" } |
Big Buck Bunny or no-3d |
Integer | ${year} |
2008 |
Integer: left pad with 0 |
${minutes:4} |
0010 |
Float | ${rating} |
9.65 (default: width=2) |
Float + width | ${rating.2} |
9.6 |
Rules
- Spaces are ignored inside
${...}
- "Variables" are inside
${}
- Format options are separated by
:
- Access options (e.g. character) are inside
[]
- conditions use
?
and:
Alternative: http://mustache.github.io would be good idea as well work in progress
Hello! A little something that bothers me with some non-english languages: trailing spaces. For example if the title of a movie is "Quoi de neuf ?", the filename will be "Year - Quoi de neuf .avi".
The problem doesn't appear in english where there is no spaces in front of double punctuations.
Did I miss how to set the renamer to exclude those trailing spaces or do you need to fix the code?
Thank you for all the work!
Must be fixed on our side. Thanks for reporting. :-)
Ok, nice. I can't wait the update! ;)
Hi,
This look like a nice improvement.
I try to organize movies by genres folders, can you also support the "genre" tag too please ?
It's a little different from the studio implementation since here we probably only need to use the first tag, so the template implementation is needed.
For now, the genre tags seem to be arranged in alphabetical order, so maybe in the long run a possibility to reorder them manually?
Hello. Back then I edited all my files by hand, even if I'm pretty sure I did some tests.
In 2.8.2 I see the old behaviour, trailing spaces remain. Since 2.8.4 it's ok, they're removed. BUT not totally.
If
With all my files edited by hand, I just re-encountered this problem now. ^^'
hmm.. That shouldn't happen. sanitizeFilename()
removes trailing/leading whitespace last, after replacing the ?
. Thanks for reporting!
I will try to improve the renamer this year. I will use this issue as a log for personal notes, etc. If you don't want notifications, you can disable them via GitHub (on the right side in this issue).
I write about a new concept here a bit: https://github.com/Komet/MediaElch/pull/1576 Feel free to add comments. It's work in progress.
Another one for the wishlist:
A "search and replace" type function to manually strings to replace. As an example I have several TV series with external subtitles, however they aren't recognised by Jellyfin because they are using a "wrong" format:
$ ls -1
rsg-fargo-s01e02-1080p-eng.idx
rsg-fargo-s01e02-1080p-eng.sub
rsg-fargo-s01e02-1080p-forced.idx
rsg-fargo-s01e02-1080p-forced.sub
rsg-fargo-s01e02-1080p.idx
rsg-fargo-s01e02-1080p.mkv
rsg-fargo-s01e02-1080p.sub
Notice the -
in the filename as a separator at the end, but Jellyfin requires a .
to separate these flags:
https://jellyfin.org/docs/general/server/media/external-files#naming-flags
Ideally the renamer could grab the language identifier from the idx
file and apply it to both idx
and sub
, but since that would presumably require a lot more work, it would be nice to at least be able to replace -eng
with .eng
, and -forced
with .forced
(or .ger.forced
in this case).
edit: On that note, it might be cool to have these external files listed in the Stream Details tab so the user can adjust those flags (whether that be a selection field or free-form-input).
I also forgot to mention this should also apply to External Audio Tracks, which currently aren't picked up at all:
$ ls -1 | grep S01E01
S01E01.ac3
S01E01.mkv
S01E01.nfo
edit: I just noticed there is already an issue for this: #1044
I don't know how the Renamer currently picks files to rename but it seems to me like a lot of special case handling. I might be wrong on this but I feel like a shotgun approach wouldn't actually be bad in this case, i.e. just getting the current filename (minus extension) and grabbing every single filename that starts with that same string. That way ME doesn't need special handling for specific filetypes or care about suffixes in the filename at all and users can throw any kind of file they like at it, as long as ME preserves the suffixes.
I currently do some of that with sed
where I just swap out specific parts of the filename that I need.
Notes to self: https://en.wikipedia.org/wiki/Filename#Comparison_of_filename_limitations