Page 1 of 1
How to use Sort Name
Posted: 16 Mar 2016, 15:39
by JrGooNer
Hi, I'm currently using the code from the website for this preset - 'firefly 1x01 Pilot'
using this code -
Code: Select all
{n.replaceTrailingBrackets()} {s+'x'}{e.pad(2)} {t.replaceAll(/[!?.]+$/).replaceAll(/[`´‘’ʻ]/, "'") .lowerTrail().replacePart(', Part $1')}
could anyone please help me and tell me how I can also incorporate this {n.sortName()} into the code? I really don't want 'the' or 'A' in my episode titles
many thanks in advance. glad I found this forum for such an amazing piece of software.
Re: [SNIPPET] Sort Name
Posted: 16 Mar 2016, 15:55
by rednoah
Just replace t with t.sortName() (or n, or whatever String variable you wanna apply that method on). You're already chaining methods, so just add another. Use {sxe} instead of {s+'x'}{e.pad(2)} because the latter doesn't deal with special cases.
Re: [SNIPPET] Sort Name
Posted: 16 Mar 2016, 16:10
by JrGooNer
wow thanks for quick reply mate. so just to be clear.. would it look like this
{n.replaceTrailingBrackets()} {sxe}{e.pad(2)} {t.sortName().replaceAll(/[!?.]+$/).replaceAll(/[`´‘’ʻ]/, "'") .lowerTrail().replacePart(', Part $1')}
Re: [SNIPPET] Sort Name
Posted: 16 Mar 2016, 16:26
by rednoah
Probably more like:
Code: Select all
{n.sortName().replaceTrailingBrackets()} {sxe} {t.sortName().replaceAll(/[!?.]+$/).replaceAll(/[`´‘’ʻ]/, "'") .lowerTrail().replacePart(', Part $1')}
Re: [SNIPPET] Sort Name
Posted: 16 Mar 2016, 16:32
by JrGooNer
rednoah wrote:Probably more like:
Code: Select all
{n.sortName().replaceTrailingBrackets()} {sxe} {t.sortName().replaceAll(/[!?.]+$/).replaceAll(/[`´‘’ʻ]/, "'") .lowerTrail().replacePart(', Part $1')}
Mate, honestly thank you so much. This app is already saving me countless hours organizing 2tb of tv shows on my external and I'm finding it can do more and more as I go along. thanks again.
Re: How to use Sort Name
Posted: 16 Mar 2016, 16:51
by rednoah
Your format defines a filename, not an absolute path. You do realize that with your format you can rewrite the entire path and move files into a new structure entirely defined by your format, right?
Re: How to use Sort Name
Posted: 16 Mar 2016, 18:06
by JrGooNer
rednoah wrote:Your format defines a filename, not an absolute path. You do realize that with your format you can rewrite the entire path and move files into a new structure entirely defined by your format, right?
I'll be honest mate, I don't really understand what you mean..
but I'm using the code now and for some reason it's giving the episode number twice?.,.

Re: How to use Sort Name
Posted: 17 Mar 2016, 07:04
by rednoah
1.
If you're really just using
{sxe} then the other episode number is simply part of the episode title
{t}.
@see
http://thetvdb.com/?tab=seasonall&id=304214&lid=7
2.
If you reorganize files, you probably want to use formats like this:
Code: Select all
X:/TV Shows/{n}/{episode.special ? 'Special' : 'Season '+s.pad(2)}/{n} - {episode.special ? 'S00E'+special.pad(2) : s00e00} - {t.replaceAll(/[`´‘’ʻ]/, /'/).replaceAll(/[!?.]+$/).replacePart(', Part $1')}{'.'+lang}
More often than not, good filenames are not enough. If you organize your files, you might was well correctly organize them into folders by type/series/season while you're at it.
@see
viewtopic.php?f=5&t=2
Re: How to use Sort Name
Posted: 21 Mar 2016, 22:57
by JrGooNer
You're right about the folders but I actually already have all my folders. I have Tv or Movies then inside tv I have every folder called 'TV - Firefly' then I don't separate series inside them anymore because I like to just be able to play them on constant on my tv.
I was messing about with it a minute ago. I noticed that my code was adding '(Part 1)' to the end of appropriate episodes but I already have my files like '(1)' so I deleted the ', Part' and added brackets around the $1 and now it does it my way. felt quite pleased with that lol I guess that's a way of slowly learning bits of basic code..
One other thing I have been doing is putting WEB-DL at the end of some episodes because I'm gradually replacing all my HDTV files with them so want to know which ones I've done. is there any way to add that to the code to save me copy and pasting it for a whole season of episodes? so a file would look like this; 'Firefly 1x01 Serenity WEB-DL'
Re: How to use Sort Name
Posted: 22 Mar 2016, 07:18
by rednoah
Include source (e..g WEB-DL) in the filename:
Keep "WEB-DL" from the original filename:
Re: How to use Sort Name
Posted: 22 Mar 2016, 15:19
by JrGooNer
what about if it isn't there in the first place? If I just want to add it to 50 files that I've already renamed in the past?
Re: How to use Sort Name
Posted: 22 Mar 2016, 15:23
by rednoah
FileBot stores the original filename as xattr metadata, so {source} will pick it up from there (even if it's not part of the current filename).
Of course, there's plenty of other things, like video codec, audio codec, resolution, etc that is defined by file content, not the file name. That'll always work.
Re: How to use Sort Name
Posted: 22 Mar 2016, 15:42
by JrGooNer
Hmm. the only thing is I delete track names and properties using mkv merge because sometimes vlc player shows the track name rather than the title. (it's OCD)
but this is what I mean, say I have this folder here for Firefly
as you can see a few of the files are the nice web-dl versions that I want to have but some are still the standard HDTV copies that I used to get. so I add web-dl at the end so that I can open the folder and quickly see which ones I still need to download. Once I have filled the folder with web-dl I create a text file like the one in the picture so I don't need the suffixes but until then I still need to be able to check them.. does that make sense?
So.. there are folders like smallville where I know that seasons 1-6 are bluray but after that the rest are bad tv rips so I wanted to be able to just chuck a web-dl label at the end of every episode from seasons 1-6 so that I can easily see my progress as I go... lol I know this probably sounds insane but before filebot I would sit there for hours on end copying and pasting things into each episode one by one. I know I have a problem lol
Re: How to use Sort Name
Posted: 22 Mar 2016, 15:57
by rednoah
Have you actually tried using {source} yet?
1. Select your files
2. Drop them into FileBot -> Analyze/Tools/Filter panel
3. Click Attributes
What do you see?
PS: Your format could do things like IF there is a file called Web-DL in the same folder THEN add Web-DL to the filename kinda logic. But it's not necessary since FileBot does remember the original filename (using xattr, not mkv/mp4 tags).
Re: How to use Sort Name
Posted: 22 Mar 2016, 16:15
by JrGooNer
I see this
but the thing is I wanted the code to add it for some and not others and also the source might not be exactly WEB-DL it might be web rip or web-rp or web.dl or even Bd-rip which to me would all mean the same quality and format but I wanted a constant which is WEB-DL you know?.. mainly because I've already spent hours copy and pasting it on to the end of so many lol
Re: How to use Sort Name
Posted: 22 Mar 2016, 16:25
by rednoah
1.
No metadata. Extended Attributes are only supported on NTFS, or they got lost at some point. So
{source} won't work if the current filename doesn't contain that information and the original filename isn't known.
2.
If you really have those extra text files, you could use those in your format:
Code: Select all
{folder.list().find{ it =~ /.txt$/}.before(/.txt$/)}
Re: How to use Sort Name
Posted: 22 Mar 2016, 16:36
by JrGooNer
I'm surprised there is just no code that simply says 'add this to the end of the title "WEB-DL" but I guess that's just the way it goes. either way that text file route sounds like some good news. so I would just need to put a text file inside any folder I'm working with. and that will just simply put whatever text is there right at the end of each episode title right?
I'll tell you lol my code is getting bigger and bigger now but where will I insert this when I want to use it then?
current code - {n.sortName().replaceTrailingBrackets()} {sxe} {t.replaceAll(/[!?.]+$/).replaceAll(/[`´‘’ʻ]/, "'") .lowerTrail().replacePart(' ($1)')}
Re: How to use Sort Name
Posted: 22 Mar 2016, 16:42
by rednoah
1.
This is the code for adding
WEB-DL to the filename...
2.
You don't even need check the database for that...
- Drop files into Rename panel
- Hit F2
- Use this format:
- You've just added WEB-DL to all filenames
Re: How to use Sort Name
Posted: 22 Mar 2016, 16:56
by JrGooNer
omg hahaha I guess I completely asked the wrng questions lol I need to make myself clearer dear me. sorry mate. and Thankyou!
Re: How to use Sort Name
Posted: 22 Mar 2016, 17:07
by JrGooNer
but hold on, if I don't check the database then I'm not getting a chance to add that bit to my code am I? Don't I need to fetch data- edit format- add the code to mine - then choose one tv database?
Re: How to use Sort Name
Posted: 22 Mar 2016, 17:35
by rednoah
You could use TheTVDB to match files with episodes, and then rename files according to your episode format.
But since you just want to add something to the existing filename, it's infinitely faster to match each file to itself, and then modify the format for that.
1. Drop files
2. Hit F2
3. Double-Click any item in "New Names"
4. Change file format to your needs
The "file format" naturally only gives you access to file information. But that's all you need in this case.
Be playful. I don't think you actually need me to answer any of these questions... you could just try. It takes less time and is more fun.
Please read the manual:
viewtopic.php?f=3&t=2072
Re: How to use Sort Name
Posted: 23 Mar 2016, 08:03
by JrGooNer
You just literally write it at the end of the code! lol no brackets, no special characters, nothing just put WEB-DL at the end and it appears on every file I'm changing lol thanks mate. playing with it I guess is the best way to learn because then I wont forget these things..