Ignore Specific Folder(s) with uTorrent Script?

Any questions? Need some help?
Post Reply
Oshinigami
Posts: 6
Joined: 23 Feb 2016, 12:35

Ignore Specific Folder(s) with uTorrent Script?

Post by Oshinigami »

Hi guys,

I've just started to use FileBot and it's amazing for matching with my RSS Downloader and Plex. My problem is I know nothing about scripting and I've just grabbed my uTorrent script which automatically runs after a download from the forums and mashed together some bits and pieces with what little understanding I have of it (it's probably done really badly, but it works for the most part). Below is the script I've been using.


filebot -script fn:amc --action move --conflict skip -non-strict --log-file amc.log --def music=y clean=y "ignore=D:/Downloads" "seriesFormat=N:/TV Shows/{n}/{'Season '+s}/{n} - {sxe} - {t}" "movieFormat=S:/Movies/{n}" "musicFormat=P:/Music/{n}/{t}" "ut_label=%L" "ut_state=%S" "ut_title=%N" "ut_kind=%K" "ut_file=%F" "ut_dir=%D"

My main issue is that I want it to automatically rename and sort my TV Shows and Movies which it does perfectly, however I DO NOT want it to touch my anime. I've tried a lot of things such as --def "ignore=Anime" or "ignore=D:/Downloads" etc, but in the end it always renames and moves my anime files. I've seen a lot of people suggest something that looks like a proper script outside of uTorrent, but I can't find anything like that and have no idea how to use it. So basically what I want to know is, can I edit the below uTorrent script to ignore 2 specific folders since I have 2 anime folders at this time. P.S: Yes, I know I could rename the folder to contain the word "Anime" in it, but it makes manual downloads a bit more tedious as they all follow the "Downloads" structure on other drives for other media types.

Thanks guys, hope you can solve this issue for me :)
User avatar
rednoah
The Source
Posts: 22991
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Ignore Specific Folder(s) with uTorrent Script?

Post by rednoah »

1.
This only works if "Anime" occurs in the file path. So you might need an Anime folder to make sure that is the case:

Code: Select all

--def "ignore=Anime"
Assuming that all Anime file names contain the [1234ABCD] CRC32 checksum, you could make your ignore pattern check for that:

Code: Select all

--def "ignore=\[\p{XDigit}{8}\]"

2.
The amc script will ignore everything if the label is set to other:

Code: Select all

--def ut_label=other
:idea: Please read the FAQ and How to Request Help.
Oshinigami
Posts: 6
Joined: 23 Feb 2016, 12:35

Re: Ignore Specific Folder(s) with uTorrent Script?

Post by Oshinigami »

rednoah wrote:1.
This only works if "Anime" occurs in the file path. So you might need an Anime folder to make sure that is the case:

Code: Select all

--def "ignore=Anime"
Assuming that all Anime file names contain the [1234ABCD] CRC32 checksum, you could make your ignore pattern check for that:

Code: Select all

--def "ignore=\[\p{XDigit}{8}\]"

2.
The amc script will ignore everything if the label is set to other:

Code: Select all

--def ut_label=other
Hi Rednoah,

Thanks for your reply. I like that second option to ignore the files based on that checksum so I might give that a go and see if that works for me since that's probably the most viable option I've got right now.

The 3rd option however, I've been having to set my labels manually to Ignore on each of my anime downloads. I've tried using the automatic label system in uTorrent but I can't figure out how to automatically set it based on directory or maybe even that CRC32 checksum formula. Is there any way you know of that automatically sets the labels on just certain types of files (in this case only anime files) based on either directory or particles contained in the file?
Oshinigami
Posts: 6
Joined: 23 Feb 2016, 12:35

Re: Ignore Specific Folder(s) with uTorrent Script?

Post by Oshinigami »

I was hopeful that the checksum formula would work, but alas it didn't. Maybe I'm misunderstanding what it's doing but I thought that it was looking for the format of an anime episode such as "[Blaze077] Koyomimonogatari - 02 - Koyomi Flower [540p].mkv" and targetting whether it had a subgroup's name in the file name. I'll paste the results of my test below.

Code: Select all

Run script [fn:amc] at [Fri Feb 26 19:08:28 AWST 2016]
Parameter: music = y
Parameter: clean = y
Parameter: ignore = \[\p{XDigit}{8}\]
Parameter: seriesFormat = N:/TV Shows/{n}/{'Season '+s}/{n} - {sxe} - {t}
Parameter: movieFormat = S:/Movies/{n}
Parameter: musicFormat = P:/Music/{n}/{t}
Parameter: ut_label = 
Parameter: ut_state = 11
Parameter: ut_title = [Blaze077] Koyomimonogatari - 02 - Koyomi Flower [540p].mkv
Parameter: ut_kind = single
Parameter: ut_file = [Blaze077] Koyomimonogatari - 02 - Koyomi Flower [540p].mkv
Parameter: ut_dir = D:\Downloads
Input: D:\Downloads\[Blaze077] Koyomimonogatari - 02 - Koyomi Flower [540p].mkv
Group: [anime:koyomimonogatari] => [[Blaze077] Koyomimonogatari - 02 - Koyomi Flower [540p].mkv]
Feb 26, 2016 7:08:32 PM java.util.prefs.WindowsPreferences <init>
WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.
Rename episodes using [AniDB]
Auto-detected query: [Koyomimonogatari, Blaze077 Koyomimonogatari]
Fetching episode data for [Koyomimonogatari]
Fetching episode data for [Owarimonogatari]
Fetching episode data for [Kizumonogatari]
Fetching episode data for [Bakemonogatari]
Fetching episode data for [TSF Monogatari]
[MOVE] Rename [D:\Downloads\[Blaze077] Koyomimonogatari - 02 - Koyomi Flower [540p].mkv] to [Anime\Koyomimonogatari\Koyomimonogatari - 02 - Koyomi Flower.mkv]
Processed 1 files
Feb 26, 2016 7:08:38 PM net.filebot.media.MediaDetection storeMetaInfo
WARNING: Failed to set xattr: java.lang.RuntimeException: java.nio.file.AccessDeniedException: D:\Downloads\Anime\Koyomimonogatari\Koyomimonogatari - 02 - Koyomi Flower.mkv:net.filebot.metadata
Done ヾ(@⌒ー⌒@)ノ
User avatar
rednoah
The Source
Posts: 22991
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Ignore Specific Folder(s) with uTorrent Script?

Post by rednoah »

This filename does not contain a CRC32 checksum:

Code: Select all

[Blaze077] Koyomimonogatari - 02 - Koyomi Flower [540p].mkv

This is what CRC32 checksums look like:
Image


If you want to check for a leading [...] then you might want to try this:

Code: Select all

--def ignore="^\[.+\]"
:idea: Please read the FAQ and How to Request Help.
Oshinigami
Posts: 6
Joined: 23 Feb 2016, 12:35

Re: Ignore Specific Folder(s) with uTorrent Script?

Post by Oshinigami »

rednoah wrote:This filename does not contain a CRC32 checksum:

Code: Select all

[Blaze077] Koyomimonogatari - 02 - Koyomi Flower [540p].mkv

This is what CRC32 checksums look like:
Image


If you want to check for a leading [...] then you might want to try this:

Code: Select all

--def ignore="^\[.+\]"
Oh of course, I feel silly now. Thanks for clearing that up.

I tried the new suggestion with the same file but still no dice. Is there anything else that might work? Below are the results.

Code: Select all

Run script [fn:amc] at [Fri Feb 26 23:28:02 AWST 2016]
Parameter: music = y
Parameter: clean = y
Parameter: ignore = ^\[.+\]
Parameter: seriesFormat = N:/TV Shows/{n}/{'Season '+s}/{n} - {sxe} - {t}
Parameter: movieFormat = S:/Movies/{n}
Parameter: musicFormat = P:/Music/{n}/{t}
Parameter: ut_label = 
Parameter: ut_state = 5
Parameter: ut_title = [Blaze077] Koyomimonogatari - 02 - Koyomi Flower [540p].mkv
Parameter: ut_kind = single
Parameter: ut_file = [Blaze077] Koyomimonogatari - 02 - Koyomi Flower [540p].mkv
Parameter: ut_dir = D:\Downloads
Input: D:\Downloads\[Blaze077] Koyomimonogatari - 02 - Koyomi Flower [540p].mkv
Group: [anime:koyomimonogatari] => [[Blaze077] Koyomimonogatari - 02 - Koyomi Flower [540p].mkv]
Feb 26, 2016 11:28:05 PM java.util.prefs.WindowsPreferences <init>
WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.
Rename episodes using [AniDB]
Auto-detected query: [Koyomimonogatari, Blaze077 Koyomimonogatari]
Fetching episode data for [Koyomimonogatari]
Fetching episode data for [Owarimonogatari]
Fetching episode data for [Kizumonogatari]
Fetching episode data for [Bakemonogatari]
Fetching episode data for [TSF Monogatari]
[MOVE] Rename [D:\Downloads\[Blaze077] Koyomimonogatari - 02 - Koyomi Flower [540p].mkv] to [Anime\Koyomimonogatari\Koyomimonogatari - 02 - Koyomi Flower.mkv]
Processed 1 files
Feb 26, 2016 11:28:10 PM net.filebot.media.MediaDetection storeMetaInfo
WARNING: Failed to set xattr: java.lang.RuntimeException: java.nio.file.AccessDeniedException: D:\Downloads\Anime\Koyomimonogatari\Koyomimonogatari - 02 - Koyomi Flower.mkv:net.filebot.metadata
Done ヾ(@⌒ー⌒@)ノ
User avatar
rednoah
The Source
Posts: 22991
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Ignore Specific Folder(s) with uTorrent Script?

Post by rednoah »

Right, the --def ignore pattern is applied on the file path, not just the filename.

This pattern will work:

Code: Select all

[\\\/][[\w-.]+\]
@see http://regexr.com/3ct0p


I recommend using @file syntax to pass the command-line argument so you don't need to worry about correctly escaping shit:
viewtopic.php?f=3&t=3244
:idea: Please read the FAQ and How to Request Help.
Oshinigami
Posts: 6
Joined: 23 Feb 2016, 12:35

Re: Ignore Specific Folder(s) with uTorrent Script?

Post by Oshinigami »

rednoah wrote:Right, the --def ignore pattern is applied on the file path, not just the filename.

This pattern will work:

Code: Select all

[\\\/][[\w-.]+\]
@see http://regexr.com/3ct0p


I recommend using @file syntax to pass the command-line argument so you don't need to worry about correctly escaping shit:
viewtopic.php?f=3&t=3244
Thank you!! I think we've found a winner. It didn't attempt to rename the test file. I'm assuming this is working as intended, however I'll post the result in any case.
Oh and one last question, if I wanted to ignore "Anime" as well as this formula, would it just look like this? --def "ignore=Anime|[\\\/][[\w-.]+\]" or do I need to separate it another way for both ignores to run correctly?

Code: Select all

Run script [fn:amc] at [Sat Feb 27 09:59:24 AWST 2016]
Parameter: music = y
Parameter: clean = y
Parameter: ignore = [\\\/][[\w-.]+\]
Parameter: seriesFormat = N:/TV Shows/{n}/{'Season '+s}/{n} - {sxe} - {t}
Parameter: movieFormat = S:/Movies/{n}
Parameter: musicFormat = P:/Music/{n}/{t}
Parameter: ut_label = 
Parameter: ut_state = 5
Parameter: ut_title = [Blaze077] Koyomimonogatari - 02 - Koyomi Flower [540p].mkv
Parameter: ut_kind = single
Parameter: ut_file = [Blaze077] Koyomimonogatari - 02 - Koyomi Flower [540p].mkv
Parameter: ut_dir = D:\Downloads
Input: D:\Downloads\[Blaze077] Koyomimonogatari - 02 - Koyomi Flower [540p].mkv
PatternSyntaxException: Unclosed character class near index 15
[\\\/][[\w-.]+\]
               ^
java.util.regex.PatternSyntaxException: Unclosed character class near index 15
[\\\/][[\w-.]+\]
               ^
	at net.filebot.format.ExpressionFormatMethods.findMatch(ExpressionFormatMethods.java:213)
	at Script1$_run_closure41.doCall(Script1.groovy:74)
	at Script1$_run_closure67.doCall(Script1.groovy:274)
	at Script1.run(Script1.groovy:272)
	at net.filebot.cli.ScriptShell.evaluate(ScriptShell.java:61)
	at net.filebot.cli.ScriptShell.runScript(ScriptShell.java:82)
	at net.filebot.cli.ArgumentProcessor.process(ArgumentProcessor.java:116)
	at net.filebot.Main.main(Main.java:169)
Failure (°_°)
User avatar
rednoah
The Source
Posts: 22991
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Ignore Specific Folder(s) with uTorrent Script?

Post by rednoah »

What makes you think that this is how it should work???? :lol:

Code: Select all

PatternSyntaxException: Unclosed character class near index 15
The first [ literal wasn't correct:

Code: Select all

[\\\/]\[[\w-.]+\]
Regex OR:

Code: Select all

(Anime)|([\\\/]\[[\w-.]+\])
:idea: Please read the FAQ and How to Request Help.
Oshinigami
Posts: 6
Joined: 23 Feb 2016, 12:35

Re: Ignore Specific Folder(s) with uTorrent Script?

Post by Oshinigami »

I suspected it was an error message, but it wasn't attempting to rename the file so I thought I'd ask even though it did what I was aiming for. I only copied what you gave me so it's a good thing I made sure then.

Ok I think I understand now. As you said it's complicated while the rest of the script was pretty self explanatory. I know very little about coding so I'm only going on basic understandings which is why I'm relying on this forum after days of research didn't give me what I needed. Thanks for the help, it seems to be all good and working now. Hopefully this topic will help someone else in my shoes in the future.

Code: Select all

Run script [fn:amc] at [Sat Feb 27 12:15:08 AWST 2016]
Parameter: music = y
Parameter: clean = y
Parameter: ignore = (Anime)|([\\\/]\[[\w-.]+\])
Parameter: seriesFormat = N:/TV Shows/{n}/{'Season '+s}/{n} - {sxe} - {t}
Parameter: movieFormat = S:/Movies/{n}
Parameter: musicFormat = P:/Music/{n}/{t}
Parameter: ut_label = 
Parameter: ut_state = 5
Parameter: ut_title = [Blaze077] Koyomimonogatari - 02 - Koyomi Flower [540p].mkv
Parameter: ut_kind = single
Parameter: ut_file = [Blaze077] Koyomimonogatari - 02 - Koyomi Flower [540p].mkv
Parameter: ut_dir = D:\Downloads
Input: D:\Downloads\[Blaze077] Koyomimonogatari - 02 - Koyomi Flower [540p].mkv
Group: [:] => [[Blaze077] Koyomimonogatari - 02 - Koyomi Flower [540p].mkv]
Finished without processing any files
Failure (°_°)
Post Reply