Request Help Renaming Set of Files Accompanying Media File

All about user-defined episode / movie format expressions
Post Reply
avip2u
Posts: 3
Joined: 08 Oct 2013, 20:42

Request Help Renaming Set of Files Accompanying Media File

Post by avip2u » 08 Oct 2013, 21:11

Hi, I need some help. My media player uses some accompanying files to display a thumbnail of the movie/TV poster, and background images. So I have "sets" of files that need to be renamed:

TV Show example, before rename:

Lost S1E1.jpg (thumbnail)
Lost S1E1.nfo (info)
Lost S1E1.mkv (the media file)
Lost S1E1.mkv.tgmd (metadata)
Lost S1E1.mkv_sheet.jpg (background sheet JPG)
Lost S1E1.mkv_sheet.png (background sheet PNG)

The last 3 files are my problem. I need the final renamed files to still have the string after the first "." dot/period. The bottom 3 filenames have to start with an exact match of the media filename including its extension, and then end as shown.

I would ideally also like to insert the IMDB ID#, within parentheses, into the final name.

Desired result:

Lost - S01E01 - Pilot (1) - (tt0411008).__________
with the underscore being one of the 6 above "endings" including ".mkv", ".jpg", ".nfo" as well as ".mkv.tgmd" , ".mkv_sheet.jpg", ".mkv_sheet.png"

I believe that the first part needs to be:
{n} - {s00e00} - {t} - {imdbid} .... not sure how to surround the IMDB# with parenthesis .... and when I type this into the edit format box it gives an "Binding Error"... net.sourceforge.filebot.web.Episode cannot be cast to net.sourceforge.web.Movie

But how do I extract that last part from the file name, which I've read is {fn} + {ext} ?

Thanks so much!

User avatar
rednoah
The Source
Posts: 16812
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Request Help Renaming Set of Files Accompanying Media Fi

Post by rednoah » 09 Oct 2013, 05:22

I've confirmed the episode matching works just fine for this. So it's all in the format.

Look at this one carefully and be inspired:
http://www.filebot.net/forums/viewtopic ... &t=2#p3625

PS: No IMDB for episodes.
:idea: Please read the FAQ and How to Request Help.

avip2u
Posts: 3
Joined: 08 Oct 2013, 20:42

Re: Request Help Renaming Set of Files Accompanying Media Fi

Post by avip2u » 09 Oct 2013, 12:58

SOLVED

Hi, I didn't get anywhere with the above brief post, and I had already read the suggested linked thread before I posted my request.

However, I got some n00b help elsewhere and here is the solution for others' future reference:

(1) File Name with "._____" removed (not needed below)

{fn.replaceAll(/[.].*/,"")}

(2) Just the "._____" part

{fn.match(/[.].*/)}

(3) Unfortunately you have to add the IMDB ID# manually. TV shows do have an IMDB #, one for the whole series and then one for each individual episode. So this is a limitation within FileBot. Fortunately it's the series one I'm interested in, so all the files within all the Season subfolders all get the same IMDB # inserted. Below I show the manually typed IMDB # in colored font.


So reassembling everything back together goes something like this:

{n} - {s00e00} - {t} - (tt_______){fn.match(/[.].*/)}

If you want to "clean" either {n} or {t} of colons, question marks, etc. you can add the appropriate replaceAll functions you can find on the forum. Ditto for handling special episodes. As well for moving files into other folders in addition to renaming them.

NOTE: There is a caveat to the expression above. If the file name already contains an extra "." period/dot, such as "vs." or "Dr." or similar, then the above fails. Better would be an expression to find the LAST "." within the string {fn} and then catch the text after that last "period". Perhaps there is a way to tell REGEX start at the end of the string and work backwards until it finds the first ".", then resume looking forward to capture the ".____" that is needed for the end of the file name.

Thanks.

User avatar
rednoah
The Source
Posts: 16812
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Request Help Renaming Set of Files Accompanying Media Fi

Post by rednoah » 09 Oct 2013, 14:37

* You could try {imdb.imdbId} binding. May or may not work.

* The regex thing is possible. Use $ token. Maybe like /[.][^.]+$/
:idea: Please read the FAQ and How to Request Help.

avip2u
Posts: 3
Joined: 08 Oct 2013, 20:42

Re: Request Help Renaming Set of Files Accompanying Media Fi

Post by avip2u » 09 Oct 2013, 16:05

Hi,

(1) I confirm that... REGEX = [.][^.]+$ ...does work well - - it finds the text including & after the LAST "." , ignoring earlier "." such as "Dr." etc.

Tested with http://regexpal.com/

----------------------------------------------------------

(2) In FileBot, trying this:

{n} - {s00e00} - {t} ({imdb.imdbid})

on this file:

Avatar S01E01 (tt0417299).mkv

gives this result:

Avatar: The Last AirBender - E01 - The Boy in the Iceberg.mkv

So, the match on TheTVDB.com works, but it's only "E01" not "S01E01" and the IMDB-ID# fails. I have no idea why the S01 is missing. Attempting to get the IMDB# no longer gives a binding error within FileBot though, so it may be that TheTVDB does not have this field? Doesn't work on "TVRage" either, and a search of "Serienjunkies" does not find the right episode. A search instead, of IMDB, forces the "mode" to switch to Movie and also does not find the TV series, nor the movie they made.

If instead you feed it this file:

Avatar, The Last Airbender S01E01 (tt0417299).mkv

You get the same results from TheTVDB and TVRage. Serienjunkies returns no results. IMDB and TheMovieDB both incorrectly find the movie (forcing a switch to Movie mode).

Lastly, if you supply this file:

tt0417299.mkv

- - trying to force a match at IMDB.com, it does not find the TV series, yet here it is: http://www.imdb.com/title/tt0417299/

Oh well.

User avatar
rednoah
The Source
Posts: 16812
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Request Help Renaming Set of Files Accompanying Media Fi

Post by rednoah » 09 Oct 2013, 20:40

This is the format:

Code: Select all

{n} - {s00e00} - {t} {"(tt${imdb.imdbId})"}
{imdb.imdbId} will work for some, it won't work for others, whatever data is available.

e.g.
Works => http://www.omdbapi.com/?i=&t=firefly
Doesn't work => http://www.omdbapi.com/?i=&t=avatar%20t ... r%20bender


There is no IMDb episode mode. And you can't just pick IMDb movie mode for episodes, the logic is completely different. I highly recommend not using IMDb and using TheTVDB/TheMovieDB instead.
:idea: Please read the FAQ and How to Request Help.

Post Reply