[WINDOWS] questions about the scripts for context menus

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
vinnytr9
Posts: 5
Joined: 26 Nov 2013, 05:23

[WINDOWS] questions about the scripts for context menus

Post by vinnytr9 »

Hi there I'm a total newb at this and I have been trying to figure out a way to make the windows script work my way but no solutions have come up so far. The script for the context menus can be found here: http://www.filebot.net/forums/posting.p ... 536487b388. However, when this script renames, the format is not how I want my file to be renamed to.

For example:
the Raw File: XXX.S01E03.720p.HDTV.X264-GROUP.mkv
After using 'Rename Episode': XXX - 1x03 - EPISODE NAME.mkv

However, that is not how I want my episode to be renamed to.
This is how I want it to be like

After using 'Rename Episode': XXX - S01E03 - EPISODE NAME [720p HDTV] - GROUP

I tried to add the format function into the command but it doesn't work
original: @="cmd /c filebot -rename -r \"%1\" --db TheTVDB -non-strict --log-file context.log"

mine: @="cmd /c filebot -rename -r \"%1\" --db TheTVDB -non-strict --format {n} - {s00e00} - {t}{" [$vf"}{" $source]"} - {"$group"} --log-file context.log"

I have been trying to "trial and error" with the script but to no avail. I have no idea to change it to the way I want it.

my FileBot format is : {n} - {s00e00} - {t}{" [$vf"}{" $source]"} - {"$group"}
if that helps anything.

If anyone knows any way to make this work, please let me know. Apologies if I posted this in the wrong section of the forum.
Thanks!
User avatar
rednoah
The Source
Posts: 23054
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [WINDOWS] questions about the scripts for context menus

Post by rednoah »

You're not escaping it. You're breaking the .reg file syntax with your """""

1. Play with cmdline and make it work. You'll learn about about escaping while doing that.

Plenty of info on escaping here:
http://www.filebot.net/forums/viewtopic.php?f=4&t=215
http://www.filebot.net/forums/viewtopic.php?f=4&t=1041

2. Once you got it working on cmdline you can easily make a .reg file for that.


You'll probably need to escape twice for cmdline AND .reg entry:

cmdline escape:

Code: Select all

"{n} - {s00e00} - {t}{\" [\$vf\"}{\" \$source]\"} - {\"\$group\"}"
reg escape:

Code: Select all

\"{n} - {s00e00} - {t}{\\\" [\\\$vf\\\"}{\\\" \\\$source]\\\"} - {\\\"\\\$group\\\"}\"
Not sure if this will work. I'd rewrite the format so it doesn't use any " and then just enclose the argument with "...". Maybe if you edit the registry key directly maybe you don't need to escape twice.
:idea: Please read the FAQ and How to Request Help.
vinnytr9
Posts: 5
Joined: 26 Nov 2013, 05:23

Re: [WINDOWS] questions about the scripts for context menus

Post by vinnytr9 »

thanks for the quick reply
but sorry I'm completely inept at coding and what not.

I looked through the AMC thread and it seems that I'm missing the : -def seriesFormat
So in this case, would it be
".... --format "{n} - {s00e00} - {t}{\" [\$vf\"}{\" \$source]\"} - {\"\$group\"}"" for the cmdline or

".... --def seriesFormat="{n} - {s00e00} - {t}{\" [\$vf\"}{\" \$source]\"} - {\"\$group\"}"

I used the escaping tool to fix my registry line but nothing happened :x

sorry for the format lol

Edit: noticed a few things, learned a few things but still nothing :(
User avatar
rednoah
The Source
Posts: 23054
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [WINDOWS] questions about the scripts for context menus

Post by rednoah »

AMC is different cause it allows multiple formats to be passed but the issue of cmdline escaping is the same (for any and all cmdline tools).

First you need to play with cmd and make it work. After that you should be able to use regedit to set the command (instead of .reg file so u don't need to escape twice).
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 23054
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [WINDOWS] questions about the scripts for context menus

Post by rednoah »

With regedit it's easy to edit:
2013-11-26 15_52_55-Registry Editor.png
Export:

Code: Select all

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\Rename Movie\command]
@="cmd /c filebot -rename -r \"%1\" --db TheMovieDB -non-strict --log-file context.log --action move --format \"{n} ({y}) {\\\"[$source]\\\"}\""
:idea: Please read the FAQ and How to Request Help.
vinnytr9
Posts: 5
Joined: 26 Nov 2013, 05:23

Re: [WINDOWS] questions about the scripts for context menus

Post by vinnytr9 »

this is what i have in my regedit currently:

the whole line in regedit currently is

cmd /c filebot -rename -r \\\"%1\\\" --db TheTVDB -non-strict --log-file context.log --format "{n} - {s00e00} - {t} {\"[$vf $source]\"} - {\"$group\"}"

It still doesnt work. I'm wondering is it because of the dashes between the naming format.
would that be causing the problem?
User avatar
rednoah
The Source
Posts: 23054
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [WINDOWS] questions about the scripts for context menus

Post by rednoah »

You pass in "%1" on cmdline. That's basic cmdline skills. If you had tried from cmdline first you would have known.
:idea: Please read the FAQ and How to Request Help.
vinnytr9
Posts: 5
Joined: 26 Nov 2013, 05:23

Re: [WINDOWS] questions about the scripts for context menus

Post by vinnytr9 »

sorry been busy the last couple of days and havent had the chance to check in.
at this point im just giving up lol. I think I'll just settle for the traditional drag-n-drop into filebot
thanks for everything!
User avatar
rednoah
The Source
Posts: 23054
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [WINDOWS] questions about the scripts for context menus

Post by rednoah »

The --format is escaped correctly but passing in the filepath parameter was wrong:

Code: Select all

cmd /c filebot -rename -r "%1" --db TheTVDB -non-strict --log-file context.log --format "{n} - {s00e00} - {t} {\"[$vf $source]\"} - {\"$group\"}"
Think:

Code: Select all

filebot -rename "/path/to files" ...
:idea: Please read the FAQ and How to Request Help.
vinnytr9
Posts: 5
Joined: 26 Nov 2013, 05:23

Re: [WINDOWS] questions about the scripts for context menus

Post by vinnytr9 »

thanks so much for the reply
completely forgot to fix the %1 in the regedit and i suppose that was the reason why

anyway thanks for the help and this awesome tool!
:D
User avatar
Ithiel
Power² User
Posts: 204
Joined: 11 Jul 2013, 14:58

Re: [WINDOWS] questions about the scripts for context menus

Post by Ithiel »

Hi vinnytr9,

If you're aiming to use a context menu that just lets you rename to a custom naming scheme, might I suggest the following as an easier solution?

Step 1: Download this - [Windows] Advanced Context Menu & Cool Scripts Pack [v1.4]

Step 2: During the install and follow the prompts, and select the option to not use the cloud based naming scheme - this will create a files in "c:\program files\filebot\cmdlets\" called anime.txt, movies.txt, and tv_shows.txt

Step 3: Edit these newly created txt files to include your preferred naming scheme.

Step 4: Your context menu should be ready using your own naming schemes for renaming either individual files or complete folders (incl. sub folders & files), as well as support for subtitle and artwork downloads :-)

Let me know how you go :-)
There can be only one Power² User
Post Reply