Rename One TV Series

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
manicjonah
Posts: 13
Joined: 13 Jan 2015, 19:34

Rename One TV Series

Post by manicjonah »

I am building a small (Windows) command line script that will trigger FileBot to run against my RecordedTV folder. For the most part I will use The TVDB for my renaming source but there is one show that I will need to use TVRage for.

What I'd like to do is call FileBot to rename all episodes of ShowA using TVRage and then call it again to rename all of the recordings from the other TV series that I watch.

ShowA_Episode1
ShowA_Episode2
ShowA_Episode3
ShowB_Episode9
ShowC_Episode3
ShowC_Episode4
ShowD_Episode11

(^contents of RecordedTV folder. I only want to process all episodes of ShowA)

From the command line it appears that I either have to enter a show name exactly as it appears in my RecordedTV folder or Filebot will assume that I'm referencing an entire folder. Is there a wildcard I can use or some other way to indicate that I want all shows with a specific name to be renamed?

Thanks for the help,

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

Re: Rename One TV Series

Post by rednoah »

filebot will process only the files/folders you pass in via cmdline arguments like any other cmdline tool.

I'm sure Windows CMD supports wildcards just fine.

@see http://linuxcommand.org/lc3_lts0080.php
:idea: Please read the FAQ and How to Request Help.
manicjonah
Posts: 13
Joined: 13 Jan 2015, 19:34

Re: Rename One TV Series

Post by manicjonah »

rednoah, thanks for your reply. I tested again and again and finally got it right in one circumstance. Spaces and quotations marks after the -rename switch were the cause of my failures. When I set my wildcard after just one word from the show title everything worked as it was designed to.

As I mentioned, I got this working under one circumstance - when the script is kept in the same folder as the video files. However, I intend to store the script in another location so I could use some direction on specifying the "rename" path AND a specific set of shows.

This errors:
"C:\program files\filebot\filebot.exe" -rename "C:\Users\Manicjonah\Desktop\Test\ShowA*" --db TVRage -non-strict --format "{n}/'Season '+s}/{s00e00} - {t.tr('/|', '-')}"
"C:\program files\filebot\filebot.exe" -rename C:\Users\Manicjonah\Desktop\Test\ShowA* --db TVRage -non-strict --format "{n}/'Season '+s}/{s00e00} - {t.tr('/|', '-')}"
"C:\program files\filebot\filebot.exe" -rename "C:\Users\Manicjonah\Desktop\Test\"ShowA* --db TVRage -non-strict --format "{n}/'Season '+s}/{s00e00} - {t.tr('/|', '-')}"
This is working:
"C:\program files\filebot\filebot.exe" -rename ShowA* --db TVRage -non-strict --format "{n}/'Season '+s}/{s00e00} - {t.tr('/|', '-')}"
How can I do what I need here?

Thank you!

MJ
manicjonah
Posts: 13
Joined: 13 Jan 2015, 19:34

Re: Rename One TV Series

Post by manicjonah »

I edited my last reply, maybe after it was read. Just checking in to see if it's possible to do what I want.

Thanks

MJ
manicjonah
Posts: 13
Joined: 13 Jan 2015, 19:34

Re: Rename One TV Series

Post by manicjonah »

Been away for awhile, checking back in. Is there a way to do what I need?
User avatar
rednoah
The Source
Posts: 22999
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Rename One TV Series

Post by rednoah »

If you're looking for advice on how to use Windows CMD I recommend Google and Stackoverflow ;)
:idea: Please read the FAQ and How to Request Help.
manicjonah
Posts: 13
Joined: 13 Jan 2015, 19:34

Re: Rename One TV Series

Post by manicjonah »

rednoah, thanks again for the reply. I apologize if my question wasn't clear. The problem doesn't lie with the commands I'm writing, it's with how Filebot handles arguments. You can see in my previous examples that the problem starts after the

Code: Select all

-rename
switch is passed. Filebot doesn't appear to know how to handle full paths. If I add open a command prompt IN the folder with my video files I can call filebot with this command:

Code: Select all

"C:\program files\filebot\filebot.exe" -rename ShowA* --db TVRage -non-strict --format "{n}/'Season '+s}/{s00e00} - {t.tr('/|', '-')}"
BUT, I will be running filebot from a scheduled task in Windows against my video folder so it is necessary to enter the full path to the specific folder. Because of this I need to call filebot like this:

Code: Select all

"C:\program files\filebot\filebot.exe" -rename "C:\Users\Manicjonah\Desktop\Test\ShowA*" --db TVRage -non-strict --format "{n}/'Season '+s}/{s00e00} - {t.tr('/|', '-')}"
But it doesn't work so I'm hoping you can tell me why. The above example is designed to have Filebot find all episodes of Show A in the Test folder and process them. It's been a while since I posted my request for help but I recall that the majority of the problem was with Filebot finding the specified path or files but now I'm wondering if I need to escape the special characters in the folder path to keep Filebot from choking.

Not sure if I explained it any better this time but I certainly appreciate you giving my problem another look.

Thanks

MJ
manicjonah
Posts: 13
Joined: 13 Jan 2015, 19:34

Re: Rename One TV Series

Post by manicjonah »

OK, I think I've narrowed down the problem to this: Filebot cannot process quotation marks or spaces in a path name.

I setup another test environment today and found that these commands worked:
"C:\program files\filebot\filebot.exe" -rename V:\RecordedTVTest\Chopped* --db TVRage -non-strict --format "{n}/{'Season '+s}/{s00e00} - {t.tr('/|', '-')}"
"C:\program files\filebot\filebot.exe" -rename V:\RecordedTVTest\Chopped\* --db TVRage -non-strict --format "{n}/{'Season '+s}/{s00e00} - {t.tr('/|', '-')}"
"C:\program files\filebot\filebot.exe" -rename V:\RecordedTV\Chopped\Chopped\* --db TVRage -non-strict --format "{n}/{'Season '+s}/{s00e00} - {t.tr('/|', '-')}"
BUT, all of the commands above failed when quotation marks were added around the path to the video files (as shown below):
"C:\program files\filebot\filebot.exe" -rename "V:\RecordedTVTest\Chopped*" --db TVRage -non-strict --format "{n}/{'Season '+s}/{s00e00} - {t.tr('/|', '-')}"
"C:\program files\filebot\filebot.exe" -rename "V:\RecordedTVTest\Chopped\*" --db TVRage -non-strict --format "{n}/{'Season '+s}/{s00e00} - {t.tr('/|', '-')}"
"C:\program files\filebot\filebot.exe" -rename "V:\RecordedTV\Chopped\Chopped\*" --db TVRage -non-strict --format "{n}/{'Season '+s}/{s00e00} - {t.tr('/|', '-')}"
Obviously the path I referenced in my example above doesn't require quotation marks but the location of Windows Media Center recordings is a folder named V:\Recorded TV. Because of the space in the path name it is necessary to enclose the entire path in quotation marks but . . . Filebot can't process this path without quotation marks, it errors when it hits the space between Recorded and TV. It also can't process the path with quotation marks around it - a Java IO Exception is thrown stating "Invalid Argument"

Soooo - what I need to know is what I need to do for FileBot to recoginze a path with spaces in it???

Thanks for hanging in there with me.

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

Re: Rename One TV Series

Post by rednoah »

Windows CMD can be tricky. It'll make sense once you figure out how * expansion works.

@see http://www.filebot.net/forums/viewtopic.php?f=4&t=1899

I highly recommend using filebot -script fn:sysenv ... so you can actually see the values you're passing in, so you see why it's not working the way you think. ;)
:idea: Please read the FAQ and How to Request Help.
manicjonah
Posts: 13
Joined: 13 Jan 2015, 19:34

Re: Rename One TV Series

Post by manicjonah »

rednoah, thanks again for sticking with me. I thought I resolved this problem yesterday with the --q switch but it seems I didn't understand the purpose of that switch. I'll take one more shot at explaining what I found here:

Goal: To rename all episodes of Chopped (and only Chopped) in my Recorded TV folder

Method 1: Open a command prompt FROM the folder that contains my video files.
Command:

Code: Select all

"C:\program files\filebot\filebot.exe" [u]-rename Chopped* [/u]-non-strict --format "{n}/{'Season '+s}/{s00e00} - {t.tr('/|', '-')}"
Result: All episodes of Chopped are renamed and moved as expected!

Method 2: Open a command prompt from the Windows Start menu.
Command:

Code: Select all

"C:\program files\filebot\filebot.exe"[u] -rename "V:\Recorded TV\Chopped*"[/u] -non-strict --format "{n}/{'Season '+s}/{s00e00} - {t.tr('/|', '-')}"
Result: Feb 27, 2015 1:58:22 PM net.filebot.cli.ArgumentBean getFiles
WARNING: Illegal Argument: java.io.IOException: Invalid argument (V:\Recorded TV\Chopped*)
Filename pattern: [NaN] SxE, [NaN] CWS
Rename movies using [TheMovieDB]
No media files: [V:\Recorded TV\Chopped*]
Failure (°_°)


The difference between the two commands above is the file path in the -rename argument. How the wildcard is used in both examples is exactly how it should be.You see Filebot recognizes the path (It's properly mentioned 2x in the error) but it doesn't process it properly. Maybe this is a bug in the program or maybe it's a known issue but either way it looks like I'm going to have to work around it unless you see something I don't.

I can work around the problem by changing directories in my script prior to calling Filebot but at this point I'm more interested in seeing if it can be done as written in Method 2.

Thanks,

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

Re: Rename One TV Series

Post by rednoah »

Please Google how * wildcard expansion works.

* is expanded BEFORE filebot is executed by CMD, so * is never passed to filebot. Instead * is expanded into MANY ARGUMENTS with which filebot is then called. If you do "*" it means you're LITERALLY passing * to filebot.

Please do read my Cmdline and Argument Passing primer => viewtopic.php?f=4&t=1899

EDIT:

As to close this thread, I thought I better give you the solution as well...

Code: Select all

-rename "V:\Recorded TV\Chopped"*
:idea: Please read the FAQ and How to Request Help.
Post Reply