[Windows] Context Menu w/ Folder Watcher+Scripts Pack [1.8]

How-to guides, frequently asked questions, not-so-obvious features, etc
Post Reply
User avatar
Ithiel
Power² User
Posts: 204
Joined: 11 Jul 2013, 14:58

[Windows] Context Menu w/ Folder Watcher+Scripts Pack [1.8]

Post by Ithiel »

SCRIPT UPDATED 2014/02/24 (v1.7) | INSTRUCTIONS UPDATED 2014/02/24
-----------------------------------------------------------------------------------------------

Advanced Context Menu & Cool Scripts Pack for Windows

Image

Image

Image


Features Include:
- Single file download automated live installer/uninstaller
- Anime Rename (AniDB) via file or folder
- TV Show Rename (theTVDB) via file or folder
- TV Show Rename (TVRage) via file or folder
- Movie Rename (IMDb) via file or folder
- Movie Rename (theMovieDB) via file or folder
- Movie Rename (OpenSubtitles) via file or folder
- Fetch Artwork for TV Shows (theTVDB) via file or folder
- Fetch Artwork for Movies (theMovieDB) via file or folder
- Fetch one or multiple Subtitle languages (from OpenSubtitles) per file or per folder with or without language tag
- Schedule Folder Watch for Automated Subtitle Downloads in Multiple Languages (NEW!)
- Includes support for UNC paths (network shares)
- All rename schemes based on "Ithiel's super crazy renaming scheme for perfectionists!" (http://www.filebot.net/forums/viewtopic ... &t=2#p7320)
- Option to use a cloud based (centrally updated) naming scheme or your own internam scheme
- Cloud Based Naming scheme is pulled directly from GitHub source files, meaning that it is always the most up to date version (when I fix/improve things, etc)
- Easy setup process allowing you to configure things the way you want without needing to edit registry or settings files.
- Improved compatibility for machines with multiple different security configurations

Bundled Tools (the Cool Scripts):
- OpenSubtitles login script v1.0 (simply double click, then enter your login details)
- Subtitle Language Tag removal scripts v1.0 (drag and drop files on the script for magic)
- Subtitle Fetch Multi-Language Language Selector v1.2 (allows you to quickly change what language(s) 'Fetch Subtitles' and 'Watch' sources). Updated!
- Filebot Auto Jar Updater v1.4 (just double click and it will download and swap out your filebot.jar for the latest version)


Prerequisites:
- Requires Windows 7 or higher
- Requires Powershell (should already be installed as standard on Windows 7 and 8)
- Requires FileBot version of 3.8-r1968 or newer
- Must be logged in from an administrator account
- Assumes FileBot is installed in C:\Program Files\FileBot\


Required Files:
Live Installer:
- Download: https://github.com/CapriciousSage/cmdle ... taller.cmd
- Preview: https://github.com/CapriciousSage/cmdle ... taller.cmd


Install Instructions:
- Download the live installer from the link above
- Right click on the file, go to properties, click 'Unblock' on the general tab, then click 'OK'.
- If using an 'active' antivirus that prevents registry changes (some versions of Norton and the like), please temporarily deactivate it.
- Double click the file and wait a few seconds while it downloads the latest installer.
- Select 'Yes' to install.
- When prompted, follow the instructions and enter the output path where you want to save your Anime, TV Shows, and Movies.
- If you would like to use the cloud based naming scheme, select 'yes' when prompted.
- If you would prefer to manage your own naming scheme, select 'no' and default files will be downloaded to "c:\program files\filebot\cmdlets"
- When prompted, input the number of languages you want the subtitle downloader to fetch (default is 1, there is no limit)
- When prompted, input the two character language code for the primary subtitle language (default is en, for English)
- If you requested more than 1 language, the input box will prompt you for each subsequent language individually.
- Once the setup is complete, the log file will open. Once the log file is closed, the command window will close as well.
- If you deactivated your antivirus, please be sure to reactivate it
- You're good to go!


- If/when stuff breaks or doesn't act the way you want, let me know here so I can fix it :-)


Uninstall Instructions:
- Download the live installer from the link above.
- Right click on the file, go to properties, click 'Unblock' on the general tab, then click 'OK'.
- If using an 'active' antivirus that prevents registry changes (some versions of Norton and the like), please temporarily deactivate it.
- Double click the file and wait a few seconds while it downloads the latest installer.
- Select 'No' to uninstall
- Follow the prompts to either just remove the context menu or the local cmdlets and folder watch tasks as well.
- If you deactivated your antivirus, please be sure to reactivate it


Troubleshooting:
- Make sure you actually installed FileBot in "C:\Program Files\FileBot" and that it otherwise 'works'.
- You will need to be logged into an Administrator account for this to work.
- If the script doesn't open/run correctly, try right clicking on it and selecting 'Run as Administrator'.
- If using the live installer, it will try and download the latest setup file each time it is run, but if you have any problems, you can download the full context_menu_setup.cmd file from GitHub directly.


Optional Instructions:
- Subtitles can be downloaded either with or without a language tag (ie. "show name s01e01.eng.srt"), however a language tag removal script will also be created in your cmdlets folder during the install. To remove the language tag from existing subtitles, you can either use the rename context menu or drag/drop the srt files onto remove-language-tag.cmd to remove the '.eng' bit automatically.
- If you want to download a lot of subtitles, run opensubtitles_login.cmd before fetching the subtitles (it is created in cmdlets folder during setup). This will let you log into OpenSubtitles.org with your account (if you don't have one, signup there for free). Logged in users have a higher anti-leech limit (and VIP Logged in users more-so).
- Remember that you can set/change your subtitle download language by running 'change_subtitle_fetch_language.cmd', which will be created in 'C:\Program Files\FileBot\cmdlets'.
- Want to be able to use the context menu for selecting more than 15 files from an explorer window? Follow this guide (or just run the desired function on the parent folder, which will affect all sub folders and sub files anyway).


Installing Updates:
- If upgrading from an earlier release (or went tweaking and want to reset), please be sure to uninstall before reinstalling.
- Remember that if you select the option to remove cmdlets during the uninstall, it will also remove the locally created groovy/scheme files.
- If using the GitHub source for the rename schedule (default), you'll always be pulling the most up to date code every time you rename a file.


DISCLAIMER: These scripts (all ~2200 lines of 'em!) have been provided 'as is', with no warranty given or implied. Use at your own risk.
Always personally inspect a reg file before running, regardless of who wrote it, where it came from, or what it is meant to do.


PLEASE NOTE: For users running 1.6.0 or earlier, please ensure that you re-download the live installer before updating as the live installer has also been changed (performance improvement).

KNOWN BUGS:
- Folder watcher currently does not support paths with ampersands in them.

--------------------------------------------------------------
Like what you see? Donate to FileBot via PayPal
There can be only one Power² User
User avatar
rednoah
The Source
Posts: 22899
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [Windows] Advanced Explorer Context Menu (GitHub Integra

Post by rednoah »

HOW DID YOU DO THE SUB MENUS !?!?!? I could never figure that out, I thought for that I'll need implement some C# interfaces.


EDIT:
btw if you maintain these scripts on GitHub you can directly execute from there so people don't need to download anything:

Code: Select all

filebot -script https://raw.github.com/CapriciousSage/scripts/master/anime.groovy -trust-script ...
And you're doing that for the formats already. Very Good! :)

EDIT2:
Also it's better if you just define a relative path in the format. And pass in some --output folder for each call so the format remains generic while the --output can change.
:idea: Please read the FAQ and How to Request Help.
Ambroisie
Supporter
Posts: 19
Joined: 06 Dec 2013, 22:08

Re: [Windows] Advanced Explorer Context Menu (GitHub Integra

Post by Ambroisie »

Will there be a way to use our own format, I don't need something as complicated as you do...
User avatar
rednoah
The Source
Posts: 22899
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [Windows] Advanced Explorer Context Menu (GitHub Integra

Post by rednoah »

Just edit the groovy scripts and use your own format.
:idea: Please read the FAQ and How to Request Help.
User avatar
Ithiel
Power² User
Posts: 204
Joined: 11 Jul 2013, 14:58

Re: [Windows] Advanced Explorer Context Menu (GitHub Integra

Post by Ithiel »

HOW DID YOU DO THE SUB MENUS !?!?!?
Believe me when I say that getting this to work correctly took a very VERY long time, lol. The MSDN documentation on this is total $#*&, lol.

Have a bit of a dig through the reg file to see how the magic works :-)
if you maintain these scripts on GitHub you can directly execute from there so people don't need to download anything
I was originally experimenting with that, but people will need to change the first part of the storage location (which is mentioned in the groovy). I was thinking of tweaking it so that it calls two text files instead - the first text file being local (saying the //mynas/media/whatever part), and the second text file being remote (with the full naming scheme).
Also it's better if you just define a relative path in the format. And pass in some --output folder for each call so the format remains generic while the --output can change.
Maybe it's because it's 2:30am, but I'm not quite following what you mean by that. Can you give me an example?

Are you saying I'm able to go something like (not in code block as it's untested, I have nfi if it works, and don't want anyone to try it out by accident):

cmd /c filebot -script "https://raw.github.com/CapriciousSage/s ... ime.groovy -trust-script "%1" --db AniDB -non-strict --log-file context.log --output "\\mynas\media\anime\"

and then have the groovy go:
def format = '''//mynas/media/Anime/''' + new URL('https://raw.github.com/CapriciousSage/s ... /anime.txt').getText()

--------------------------------------------------------------------
Will there be a way to use our own format, I don't need something as complicated as you do...
yuup - you'll notice that the groovy files follow this pattern:

Code: Select all

def format = '''//mynas/media/Anime/''' + new URL('https://raw.github.com/CapriciousSage/schemes/master/anime.txt').getText()
// def format = '''//mynas/media/Anime/''' + new File('C:\\Program Files\\FileBot\\cmdlets\\anime.txt').getText()
the first line is calling the GitHub, the second line calls a local file but is commented out. Simply add a // to the start of the first line, remove it from the start of the second line, create a file called "anime.txt" in your "C:\Program Files\FileBot\cmdlets\", and put your own naming scheme in there.

NOTE: As the first part of the path is defined in the groovy file (remember to update this), you don't need to put that part in the txt file. To view an example, load https://raw.github.com/CapriciousSage/s ... /anime.txt if your web browser to see what's in there.
There can be only one Power² User
User avatar
rednoah
The Source
Posts: 22899
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [Windows] Advanced Explorer Context Menu (GitHub Integra

Post by rednoah »

Actually you have a point. If you use --output we have to edit the .reg commands, while if you have the scripts local it's easy to edit.

You can do this:

Code: Select all

rename(..., format:'{n}/...', output:'//mynas/media')
Not much different, but slightly easier to manage if the root path and format is different. If format is relative it'll be resolved against --output.
:idea: Please read the FAQ and How to Request Help.
User avatar
Ithiel
Power² User
Posts: 204
Joined: 11 Jul 2013, 14:58

Re: [Windows] Advanced Explorer Context Menu (GitHub Integra

Post by Ithiel »

hm... with it calling from a file, rather than reading the whole file, does groovy support reading a specific line?

I can have it load the groovy from GitHub, and set the "output:" call a local text file, but rather than having a bunch of them, create a single (local) text file like this:
Anime://mynas/media/anime
TV_Shows://mynas/media/anime
Movies://mynas/media/movies
Then I'd just need groovy to load either line 1 (anime), 2 (tv shows), or 3 (movies), grabbing everything after the : symbol...

i.e. something like
def input = args[0].isDirectory() ? args[0].listFiles() : args[0]
def format = '''//mynas/media/Anime/''' + new URL('https://raw.github.com/CapriciousSage/s ... /anime.txt').getText()
def output = ('some sort of magic line selection and scan for the semi-colon code' for C:\Program Files\FileBot\cmdlets\output.txt)

rename(file:input, format:format, output:format)


Would that work (and do you know the required magic groovy wizardry), lol

P.S. what is -trust-script for? is that just required when the groovy isn't local?

Edit: To allow people to have local or remote, once I get the above working, I'll create 2 variations of the groovy file (one that calls github naming scheme, one that calls local scheme, but both allowing the groovy to be run from github), and then offering 2 reg file options. This gives everyone the best of both worlds (but as it's now 3am, that's a task for tomorrow haha.) :-)
Last edited by bonelifer on 02 Jan 2014, 20:16, edited 1 time in total.
Reason: Fixed quote ending tag
There can be only one Power² User
User avatar
rednoah
The Source
Posts: 22899
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [Windows] Advanced Explorer Context Menu (GitHub Integra

Post by rednoah »

Actually having local groovy script files isn't a bad idea, makes it easy to edit. The the script itself is extremely simple anyway.

-trust-script works like you said. You may not need it with basic filebot tasks but if you were to fetch artwork were the groovy script needs to write files it's required.

Simple local scripts are the way to go I think.

I think one option where people just need to edit the script a little bit is perfectly acceptable. Two reg files seems troublesome. I would just set the --output variable to reasonable default. Either the user home folder or maybe some via some environment variable like for example FILEBOT_OUTPUT.
:idea: Please read the FAQ and How to Request Help.
User avatar
Ithiel
Power² User
Posts: 204
Joined: 11 Jul 2013, 14:58

Re: [Windows] Advanced Explorer Context Menu (GitHub Integra

Post by Ithiel »

I've got a few ideas for an installer that may make everything a lot easier, but some more research will be required. Ideally, it would be a cmd file you run that asks questions and builds the reg/required local files for you automatically depending on the options you gave. This way, there would only be one file to download, and it would always be setup just the way you want it :-)

Can you point me in the direction of anywhere that might shed some light on the advanced file reading I mentioned before?
There can be only one Power² User
User avatar
rednoah
The Source
Posts: 22899
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [Windows] Advanced Explorer Context Menu (GitHub Integra

Post by rednoah »

I'm sure Groovy has lots of nifty ways to read config or Java Property Files.

Though for quickly reading CSV data I have a helper:

props.txt (tab-separated)

Code: Select all

a	1
b	2
c	3
Groovy:

Code: Select all

def map = csv('D:/props.txt', '\\t')
println map
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 22899
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [Windows] Advanced Explorer Context Menu (GitHub Integra

Post by rednoah »

With the next revision you can do this:

Code: Select all

-get-subtitles --format MATCH_VIDEO
:idea: Please read the FAQ and How to Request Help.
User avatar
Ithiel
Power² User
Posts: 204
Joined: 11 Jul 2013, 14:58

Re: [Windows] Advanced Explorer Context Menu (GitHub Integra

Post by Ithiel »

Though for quickly reading CSV data I have a helper:
hm.. interesting. I shall have a play and will let you know where I get :-)
With the next revision you can do this:
Awesome! *does a little dance before running off to update reg files*
There can be only one Power² User
User avatar
Ithiel
Power² User
Posts: 204
Joined: 11 Jul 2013, 14:58

Re: [Windows] Advanced Explorer Context Menu (GitHub Integra

Post by Ithiel »

Righto... out with the old, in with the new...

I've updated the script and created a single setup file that prompts you for the required settings, allows you to choose between a cloud and locally managed format, and automatically downloads all required files accordingly.

The setup also serves as an uninstall as well. OP should be updated momentarily :-)

Edit: OP Updated :-)
There can be only one Power² User
User avatar
Ithiel
Power² User
Posts: 204
Joined: 11 Jul 2013, 14:58

Re: [Windows] Advanced Explorer Context Menu (GitHub Integra

Post by Ithiel »

Update: v1.1b - updated OpenSubtitle Login Script with new command (replacing legacy command that's about to be removed)
Update: v1.1c - updated Language Tag Removal Script to fix a typo.

I think it all works now :-)
There can be only one Power² User
User avatar
rednoah
The Source
Posts: 22899
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [Windows] Advanced Explorer Context Menu (GitHub Integra

Post by rednoah »

That installer cmd scripts is a really good idea! Must have been a bitch getting that working with only bat scripting! :D
:idea: Please read the FAQ and How to Request Help.
User avatar
Ithiel
Power² User
Posts: 204
Joined: 11 Jul 2013, 14:58

Re: [Windows] Advanced Explorer Context Menu (GitHub Integra

Post by Ithiel »

Must have been a bitch getting that working with only bat scripting!
um.. yes... but I wanted to keep it as open, transparent, and universally accessible as possible, as well as keep it all simple enough that I can pull all the parts from GitHub, lol

Speaking of bee's with itches....

Update: v1.1d - updated Language Tag Removal Script to catch an escaping % that tried to ran away, and fixed a typo in the reg that prevented the 'with lang tag' sub download on single files.
There can be only one Power² User
User avatar
Ithiel
Power² User
Posts: 204
Joined: 11 Jul 2013, 14:58

Re: [Windows] Advanced Explorer Context Menu (GitHub Integra

Post by Ithiel »

UPDATED 2014/01/06

- Fixed file encoding error on several of the groovy config files (were Unicode when ANSI was expected)
- Updated groovy 'def input' to now correctly get all files of sub folders when renaming directories
- Updated naming scheme's certification check to try and get a little more consistency

Files Updated:
- anime.groovy
- anime_local.groovy
- movies.groovy
- movies_local.groovy
- tv_shows.groovy
- tv_shows_local.groovy
- anime.txt
- movies.txt
- tv_shows.txt

Update Instructions:
- People using the locally managed option should run the uninstall (removing cmdlets) and then reinstall to download newest files (or can update files manually).
--- If you have changed the locally stored rename scheme files (the 3 txt files), be sure to take a backup of them first, as they will be removed/replaced during the upgrade
- People using the cloud managed option will automatically retrieve the most up to date files the next time they use the context menu functions.

Installer Update:
- Additionally, the master installer file (context_menu_setup.cmd) has been updated to also create a FileBot Jar Updater script in your cmdlets folder.
- The live installer will automatically pull the updated master installer during install/uninstall. To get the new script, simply reinstall :-)

NOTE: Always uninstall before reinstalling!
There can be only one Power² User
User avatar
rednoah
The Source
Posts: 22899
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [Windows] Advanced Explorer Context Menu (GitHub Integra

Post by rednoah »

- Fixed file encoding error on several of the groovy config files (were Unicode when ANSI was expected)
The only reason it may expect ANSI is because it's set as default encoding on Windows, it'll probably be UTF-8 on other systems. I recommend forcing UTF-8 whenever reading / writing anything.
:idea: Please read the FAQ and How to Request Help.
User avatar
Ithiel
Power² User
Posts: 204
Joined: 11 Jul 2013, 14:58

Re: [Windows] Advanced Explorer Context Menu (GitHub Integra

Post by Ithiel »

Fair 'nuff... but being that this context menu only works on Windows, using the Windows default probably isn't a bad thing, lol.
There can be only one Power² User
romano
Posts: 35
Joined: 11 Jan 2014, 12:26

Re: [Windows] Advanced Explorer Context Menu (GitHub Integra

Post by romano »

Thank you Ithiel.



Great work Ithiel, works great.
romano
Posts: 35
Joined: 11 Jan 2014, 12:26

Re: [Windows] Advanced Explorer Context Menu (GitHub Integra

Post by romano »

Where do i change the subtitles Language?
now says: 401 unauthorized
chest069
Posts: 24
Joined: 01 Jan 2014, 11:09

Re: [Windows] Advanced Explorer Context Menu (GitHub Integra

Post by chest069 »

Hello,

I am using the live installer that you posted and when I right click on it and say run as admin in Win 7 64bit I get a quick terminal windiow that closes and nothing else happens.

What am I doing wrong?

thanks for any help.
romano
Posts: 35
Joined: 11 Jan 2014, 12:26

Re: [Windows] Advanced Explorer Context Menu (GitHub Integra

Post by romano »

chest069 wrote:Hello,

I am using the live installer that you posted and when I right click on it and say run as admin in Win 7 64bit I get a quick terminal windiow that closes and nothing else happens.

What am I doing wrong?

thanks for any help.
Try and first remove the old install, and then reinstall, it worked for me.
User avatar
Ithiel
Power² User
Posts: 204
Joined: 11 Jul 2013, 14:58

Re: [Windows] Advanced Explorer Context Menu (GitHub Integra

Post by Ithiel »

@romano

Currently subtitle language is fixed at english, however you can change this via a quick registry tweak after you've installed it.

1. Open regedit and go to:
HKEY_CLASSES_ROOT\FileBot\File_Menu\shell\002Fetch\003Subtitles\command\

2. On the right, double click (Default) to change this:
cmd /c filebot -get-subtitles "%1" -non-strict --lang en --log-file context.log

3. All you need to do is change the --lang en to be --lang xx (where xx is the code for your language of choice).

4. Repeat steps 2 & 3 for the following locations as well:
HKEY_CLASSES_ROOT\FileBot\File_Menu\shell\002Fetch\004Subtitles\command\
HKEY_CLASSES_ROOT\FileBot\Folder_Menu\shell\002Fetch\003Subtitles\command\
HKEY_CLASSES_ROOT\FileBot\Folder_Menu\shell\002Fetch\004Subtitles\command\

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

The language during the setup is fixed at English, but I can create another little script that will allow you to change the language from a message box, and then add that to the list of scripts that the installer loads into your cmdlets folder. This means that once you've installed the tool, you would quickly and easily be able to toggle the language to whatever you want by just running the script and entering a new language code when prompted. Note that this would just be changing the language for new subtitle downloads.

@Everyone: would this help, would you use it, and is there anything else you can think of that you need it to do?

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

@chest069

Are you still having this problem? If so, please let me know. Also, if just double clicking fails, does right clicking and running as administrator work?
Akki highlighted a compatibility tweak for the method I use to make the script seek admin privileges that I was planning on working into my next update.
There can be only one Power² User
chest069
Posts: 24
Joined: 01 Jan 2014, 11:09

Re: [Windows] Advanced Explorer Context Menu (GitHub Integra

Post by chest069 »

romano wrote:
chest069 wrote:Hello,

I am using the live installer that you posted and when I right click on it and say run as admin in Win 7 64bit I get a quick terminal windiow that closes and nothing else happens.

What am I doing wrong?

thanks for any help.
Try and first remove the old install, and then reinstall, it worked for me.
I haven't been able to install the script yet so I don't have a previous one to uninstall, or do you mean uninstall filebot?
Post Reply