Sorting Movies into three different locations

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
FadeAway12
Donor
Posts: 51
Joined: 04 Mar 2016, 10:08

Sorting Movies into three different locations

Post by FadeAway12 »

Hey together,

currently i am trying to figure out a way to separate my movies into 3 different folders:

1. Movies
2. Cinedubs
3. Movies (3D)

Here is a command i found in this forum:

Code: Select all

{n =~ /^(?i)[0-9a-f]/ ? 'X' : n =~ /^(?i)[g-t]/ ? 'Y' : 'Z'}:/TV/{n}/{episode}
"Drive X if first letter of {n} matches [0-9a-f], Drive Y for [g-t] and Drive Z for everything else."

What i want to accomplish is this:

If the title of the file (no other media info is needed or can be looked at) contains "3D" "HSBS" "H-SBS" "HOU" or "H-OU" it should go into the 3D Movie Folder, unless it contains: "AC3D" (which stands for AC3-Dubbed). Then it should be moved to the Cinedubs folder. If it does not contain anything like "3D" "HSBS" "H-SBS" "HOU" "AC3D" "Line.dubbed" "WebHD" it should go to the Movies Folder. If it contains no hint for a 3D Movie File but for a Cinedub (like "WebHD" "Line.dubbed" "AC3D" "it should go to the Cinedub Folder.

I am unable to solve this task and am willing to Paypal the first one who can help me 20 USD. Its not that much but i am a student with a part time job and already spent way too much time with finding out how to get things done with filebot and now regex. Tbh i am tired and only want it to work after so much time.. thx for reading.. :|
User avatar
rednoah
The Source
Posts: 23953
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Sorting Movies into three different locations

Post by rednoah »

Here you go:

Code: Select all

{fn =~ /(?i)AC3D|Line.dubbed|WebHD/ ? 'Cinedubs' : fn =~ /(?i)3D|HSBS|H.SBS|HOU|H.OU/ ? 'Movies (3D)' : 'Movies'}
:idea: Please read the FAQ and How to Request Help.
FadeAway12
Donor
Posts: 51
Joined: 04 Mar 2016, 10:08

Re: Sorting Movies into three different locations

Post by FadeAway12 »

Thank you! I will definitely donate to you for all the work and support :) But this script seems to put a "Movie.3D.HSBS" into the "Movies" Folder.

Edit: Nevermind, restarted Filebot and seems to be working now. Donation already sent :) Thx! :!: :)
FadeAway12
Donor
Posts: 51
Joined: 04 Mar 2016, 10:08

Re: Sorting Movies into three different locations

Post by FadeAway12 »

Could you please give me another hint on why i can't use expressions like {n} or {y} in the file destinations? I thought i could simply replace "Movies" with "/media/usbdrive/Movies/{n} {y}/{n} {y}" but it only gives me {n}{y} as the filename then instead of naming the file correctly..

Code: Select all

{fn =~ /(?i)AC3D|Line.dubbed|WebHD/ ? '/media/usbdrive/Cinedubs/{n} {y}/{n} {y}' : fn =~ /(?i)3D|HSBS|H.SBS|HOU|H.OU/ ? '/media/usbdrive/Movies (3D)/{n} {y} (3D)/{n} {y} (3D)' : '/media/usbdrive/Movies/{n} {y}/{n} {y}'}
Edit: This seems to do the job right:

Code: Select all

{fn =~ /(?i)AC3D|Line.dubbed|WebHD/ ? 'Cinedubs' : fn =~ /(?i)3D|HSBS|H.SBS|HOU|H.OU/ ? 'Movies (3D)' : 'Movies'}/{n} ({y}){fn =~ /3D/ ? ' [3D]' : ''}/{n} ({y}){fn =~ /3D/ ? ' (3D)' : ''}
User avatar
rednoah
The Source
Posts: 23953
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Sorting Movies into three different locations

Post by rednoah »

Isn't your scheme all the same except for the conditional folder? Why are you trying to duplicate everything?

e.g.

Code: Select all

/media/usbdrive/{fn =~ /(?i)AC3D|Line.dubbed|WebHD/ ? 'Cinedubs' : fn =~ /(?i)3D|HSBS|H.SBS|HOU|H.OU/ ? 'Movies (3D)' : 'Movies'}/{n} ({y}){fn =~ /3D/ ? ' [3D]' : ''}/{n} ({y}){fn =~ /3D/ ? ' (3D)' : ''}/{n} {y}/{n} {y}
:idea: Please read the FAQ and How to Request Help.
FadeAway12
Donor
Posts: 51
Joined: 04 Mar 2016, 10:08

Re: Sorting Movies into three different locations

Post by FadeAway12 »

Thats (for now) my final file and boy am i happy with it :D

Code: Select all

filebot -script fn:amc --action move --conflict skip -non-strict --log-file amc.log  --def "seriesFormat=/media/usbdrive/TV-Serien/{n.ascii()}/{episode.special ? 'Special' : 'Season '+s.pad(2)}/{n.ascii()} - {s00e00} - {t.ascii()}" "movieFormat={fn =~ /(?i)AC3D|Line.dubbed|LD|WebHD/ ? '/media/usbdrive/Kinofilme' : fn =~ /(?i)3D|HSBS|H-SBS|HOU|H-OU/ ? '/media/usbdrive/3D-Filme' : '/media/usbdrive/Filme'}/{n.ascii()} ({y}){fn =~ /3D/ ? ' [3D]' : ''}/{n.ascii()} ({y}){fn =~ /3D/ ? ' (3D)' : ''}" "unsortedFormat=/media/usbdrive/Unsorted/{file.structurePathTail}" pushbullet=o.ARacv01enm63ySTZtjype97mJeugKPVz skipExtract=y unsorted=y music=y artwork=y excludeList=".excludes" ut_dir="$ARG_PATH" ut_kind="multi" ut_title="$ARG_NAME" ut_label="$ARG_LABEL" clean=y --lang de -no-xattr
This way all Movies will be placed in the right folder and 3D Movies will get a "(3D)" Tag as well. Now i can finally get some sleep.. its 4:49 am right now but it finally works
User avatar
rednoah
The Source
Posts: 23953
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Sorting Movies into three different locations

Post by rednoah »

1.
Still duplicating information... and you're not setting --output:

Code: Select all

--output /media/usbdrive
2.
Your unsortedFormat is the same as the default. Why make the call more unreadable than it needs to be?


Use:

Code: Select all

filebot -script fn:amc … --output "/media/usbdrive" --def "seriesFormat=TV-Serien/{n.ascii()}/{episode.special ? 'Special' : 'Season '+s.pad(2)}/{n.ascii()} - {s00e00} - {t.ascii()}" "movieFormat={fn =~ /(?i)AC3D|Line.dubbed|LD|WebHD/ ? 'Kinofilme' : fn =~ /(?i)3D|HSBS|H-SBS|HOU|H-OU/ ? '3D-Filme' : 'Filme'}/{n.ascii()} ({y}){fn =~ /3D/ ? ' [3D]' : ''}/{n.ascii()} ({y}){fn =~ /3D/ ? ' (3D)' : ''}" …
:idea: Please read the FAQ and How to Request Help.
FadeAway12
Donor
Posts: 51
Joined: 04 Mar 2016, 10:08

Re: Sorting Movies into three different locations

Post by FadeAway12 »

Thx! Changed it accordingly :)

Btw: Is there any kind of command that can look for the keywords not only in the filenames but the folders the files are in?

Sometimes there are situations like /Catching.Fire.AC3D.1080p/cf.1080p.mkv

As the file has no AC3D included it will most likely be sent to 'Filme' instead of 'Kinofilme'

Is there any workaround possible or do those expressions only work regarding the filename (and the file media info) itself?
User avatar
rednoah
The Source
Posts: 23953
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Sorting Movies into three different locations

Post by rednoah »

fn ... filename
file ... full file path
:idea: Please read the FAQ and How to Request Help.
FadeAway12
Donor
Posts: 51
Joined: 04 Mar 2016, 10:08

Re: Sorting Movies into three different locations

Post by FadeAway12 »

Nice! Will try that out immediately :)
FadeAway12
Donor
Posts: 51
Joined: 04 Mar 2016, 10:08

Re: Sorting Movies into three different locations

Post by FadeAway12 »

Do you know why filebot amc excluded the Movie "In the Heart of the Sea" although it seemed to detect it correctly?

Log:

http://img5.fotos-hochladen.net/uploads ... o2h5bu.jpg
User avatar
rednoah
The Source
Posts: 23953
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Sorting Movies into three different locations

Post by rednoah »

This is the reason. I guess I'll spend a few hours debugging this today. :P

Please send me the filename that doesn't work as text. I can't generate test files from screenshots.
:idea: Please read the FAQ and How to Request Help.
FadeAway12
Donor
Posts: 51
Joined: 04 Mar 2016, 10:08

Re: Sorting Movies into three different locations

Post by FadeAway12 »

Oh okay, here is the complete log regarding that file:

Code: Select all

Run script [fn:amc] at [Sat Mar 12 00:27:24 CET 2016]
Parameter: seriesFormat = TV-Serien/{n.ascii()}/{episode.special ? 'Special' : 'Season '+s.pad(2)}/{n.ascii()} - {s00e00} - {t.ascii()}
Parameter: movieFormat = {file =~ /(?i)AC3D|AC3.Dubbed|Line.dubbed|.ld|Dubbed|Line.Dubbed|WebDl|Web-Dl|Web.Dl|Web-Hd|WebHd|Web.Hd/ ? 'Cinedubs' : file =~ /(?i)3D|HSBS|H-SBS|HOU|H-OU/ ? '3D-Filme' : 'Filme'}/{n.ascii()} ({y}){file =~ /HSBS|H-SBS|HOU|H-OU/ ? ' [3D]' : ''}/{n.ascii()} ({y}){file =~ /HSBS|H-SBS|HOU|H-OU/ ? ' (3D)' : ''}
Parameter: pushbullet = *****
Parameter: skipExtract = y
Parameter: unsorted = y
Parameter: music = y
Parameter: artwork = y
Parameter: excludeList = .excludes
Parameter: ut_dir = /media/usbdrive/Downloads/lmZEKFMXZccAEyDAqCuDhFAPp
Parameter: ut_kind = multi
Parameter: ut_title = lmZEKFMXZccAEyDAqCuDhFAPp
Parameter: ut_label = N/A
Parameter: clean = y
Using excludes: /media/usbdrive/.excludes (23)
Input: /media/usbdrive/Downloads/lmZEKFMXZccAEyDAqCuDhFAPp/Im.Herzen.der.See.3D.HSBS.German.DL.AC3.Dubbed.1080p.BluRay.x264-LameHD/lame-herzdersee3d.hsbs-1080.mkv
Exclude: /media/usbdrive/Downloads/lmZEKFMXZccAEyDAqCuDhFAPp/Im.Herzen.der.See.3D.HSBS.German.DL.AC3.Dubbed.1080p.BluRay.x264-LameHD/lame-herzdersee3d.hsbs-1080.mkv.nfo
lame-herzdersee3d.hsbs-1080.mkv [series: lame herzdersee3d, movie: In the Heart of the Sea (2015)]
Exclude Movie: In the Heart of the Sea (2015)
Group: [tvs:lame herzdersee3d, mov:null, anime:null] => [lame-herzdersee3d.hsbs-1080.mkv]
Rename episodes using [TheTVDB]
Auto-detected query: [lame herzdersee3d]
Failed to fetch episode data: [lame herzdersee3d]
CmdlineException: Unable to match files to episode data
Processing 1 unsorted files
[MOVE] Rename [/media/usbdrive/Downloads/lmZEKFMXZccAEyDAqCuDhFAPp/Im.Herzen.der.See.3D.HSBS.German.DL.AC3.Dubbed.1080p.BluRay.x264-LameHD/lame-herzdersee3d.hsbs-1080.mkv] to [/media/usbdrive/Unsorted/lmZEKFMXZccAEyDAqCuDhFAPp/Im.Herzen.der.See.3D.HSBS.German.DL.AC3.Dubbed.1080p.BluRay.x264-LameHD/lame-herzdersee3d.hsbs-1080.mkv]
Processed 1 files
Sending PushBullet report
Clean clutter files and empty folders
Delete /media/usbdrive/Downloads/lmZEKFMXZccAEyDAqCuDhFAPp/Im.Herzen.der.See.3D.HSBS.German.DL.AC3.Dubbed.1080p.BluRay.x264-LameHD/lame-herzdersee3d.hsbs-1080.mkv.nfo
Delete /media/usbdrive/Downloads/lmZEKFMXZccAEyDAqCuDhFAPp/Im.Herzen.der.See.3D.HSBS.German.DL.AC3.Dubbed.1080p.BluRay.x264-LameHD
Delete /media/usbdrive/Downloads/lmZEKFMXZccAEyDAqCuDhFAPp
Done ヾ(@⌒ー⌒@)ノ
User avatar
rednoah
The Source
Posts: 23953
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Sorting Movies into three different locations

Post by rednoah »

* The filename does not contain the movie year
* You process German files in English mode (--lang en)
* You did not force movie mode (--def ut_label=movie)

If these 3 conditions are met, then it won't work, and files will be moved to Unsorted so you can sort it out yourself.
:idea: Please read the FAQ and How to Request Help.
FadeAway12
Donor
Posts: 51
Joined: 04 Mar 2016, 10:08

Re: Sorting Movies into three different locations

Post by FadeAway12 »

Regarding

2. I don't know why it detects it as english. The Filename and the Foldername both are german only. There is no hint for it being english (and in fact it is not english at all) + i used --lang de

3. Its forwarded by the jDownloader. So i guess its impossible to set the ut_label in jdownloader for each file before downloading, right?
User avatar
rednoah
The Source
Posts: 23953
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Sorting Movies into three different locations

Post by rednoah »

3.
My JD scripts are passing along the JD comment property as FileBot label, so you can set that from JD:
https://github.com/filebot/plugins/blob ... shed.js#L5
:idea: Please read the FAQ and How to Request Help.
Post Reply