How to move/copy files that aren't TV or Movies

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
ompster
Posts: 5
Joined: 25 Sep 2015, 07:49

How to move/copy files that aren't TV or Movies

Post by ompster »

First of all I'd like to say how great FileBot is and how helpful Rednoah's posts have been setting it up and getting it all working.

Now my question may seem odd. I want to copy the folder of the downloaded torrent that ISN't a TV or Movie torrent. ie. an ebook or something else.

The reasoning behind this is because I use flexget to automate downloads. It also automates the removal of torrents from the client once the seeding ratio has been met. Hence why I want to copy the files and not move them.

Thanks in advance!
User avatar
rednoah
The Source
Posts: 23002
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: How to move/copy files that aren't TV or Movies

Post by rednoah »

If you're using the amc script then you can use the --def unsorted=y option
:idea: Please read the FAQ and How to Request Help.
ompster
Posts: 5
Joined: 25 Sep 2015, 07:49

Re: How to move/copy files that aren't TV or Movies

Post by ompster »

Thanks for the reply, I think I did try that. Do i have to manually specify the dir for unsorted or will it just create an Unsorted dir like it does with movies, TV.
here is my current command I'm running
"C:\Program Files\FileBot\filebot.exe" -script fn:amc --output "D:/Completed" --log-file amc.log --action duplicate --conflict override -non-strict --def music=y clean=y --def unsorted=y --def plex=192.168.0.254:ojpq6p6e76C1X7Y53znZ artwork=y "ut_dir=D:/Completed/DOWNLOADED/%TR_TORRENT_NAME%" "ut_kind=multi" "ut_title=%TR_TORRENT_NAME%"

I am using transmission that's why I'm using %TR_TORRENT_NAME% ,etc.
User avatar
rednoah
The Source
Posts: 23002
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: How to move/copy files that aren't TV or Movies

Post by rednoah »

YES. It should work as expected by default.

Here's the default unsorted format:

Code: Select all

Unsorted/{file.structurePathTail}
IF you want to change the unsorted format, then you can just define --def unsortedFormat, but that's entirely optional.
:idea: Please read the FAQ and How to Request Help.
ompster
Posts: 5
Joined: 25 Sep 2015, 07:49

Re: How to move/copy files that aren't TV or Movies

Post by ompster »

Thanks for the reply. Again no dice though! I honestly can't figure out why it's not working. The parameters are correct in the log:

Code: Select all

Run script [fn:amc] at [Sat Sep 26 15:25:58 AEST 2015]
Parameter: music = y
Parameter: clean = y
Parameter: unsorted = y
Parameter: unsortedFormat = D:/Completed/Unsorted/{fn}
Parameter: plex = 192.168.0.254:ojpq6p6e76C1X7Y53znZ
Parameter: artwork = y
Parameter: ut_dir = D:/Completed/DOWNLOADS/
Parameter: ut_kind = multi
As you can see I tried manually setting the output of the unsortedFormat and also tried it without.
On further inspection of the log I can see that files other than movies, tv are EXCLUDED ie. unsorted

Code: Select all

Exclude: D:\Completed\DOWNLOADS\Windows Password Reset & Recovery Disk(Win 8 7 Vista XP)[.ISO]\PC_Login_Now_2.0.iso
the file is above the min filesize so not sure why it's excluded from input?
User avatar
rednoah
The Source
Posts: 23002
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: How to move/copy files that aren't TV or Movies

Post by rednoah »

non-video ISO files are always excluded, otherwise they would be processed in movie mode, which is not what you want either.

Try testing with anything but iso images.
:idea: Please read the FAQ and How to Request Help.
ompster
Posts: 5
Joined: 25 Sep 2015, 07:49

Re: How to move/copy files that aren't TV or Movies

Post by ompster »

an EXE? that didn't work either. anything else I download is either going to be an exe, bin or ISO. Any suggestion on another solution perhaps? A separate script to be called after the regular AMC has finished?
ompster
Posts: 5
Joined: 25 Sep 2015, 07:49

Re: How to move/copy files that aren't TV or Movies

Post by ompster »

What I'm essentially asking is... if filebot knows what files are EXCLUDED then is there a way to pipe said exclusions to another script or filebot instance? I'm guessing you'd be the best to ask about that :)
User avatar
rednoah
The Source
Posts: 23002
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: How to move/copy files that aren't TV or Movies

Post by rednoah »

1.
For *.exe files you're probably just below the minFileSize... I guess the current unsorted feature won't work well for you.

Just in case, here's the definitive guide for exclude rules, i.e. the code:
https://github.com/filebot/scripts/blob ... roovy#L244


2.
Sure you can, but that's more of a bash problem... go ask http://stackoverflow.com/questions/tagged/bash

Pseudo Code:

Code: Select all

filebot -script amc ... | grep "Exclude" ... | cut ... | xargs ... cp ...
:idea: Please read the FAQ and How to Request Help.
vthunder
Posts: 6
Joined: 10 Oct 2015, 03:27

Re: How to move/copy files that aren't TV or Movies

Post by vthunder »

The unsorted=y feature isn't working for me either, FWIW. I'm going to go the grep route, but just wanted to mention it.

I tried copying videos to new nonsense filenames (e.g. "foobar.baz" - a few variations). I also tried throwing in other documents (e.g. an 11MB PDF file). Nothing seemed to work.

Not a huge deal, just a head-scratcher.
vthunder
Posts: 6
Joined: 10 Oct 2015, 03:27

Re: How to move/copy files that aren't TV or Movies

Post by vthunder »

After I wrote the above I realized that the grep route is actually a pain, because there's no distinction between something that ought to be ignored/thrown away (e.g. .par files), and something that is unrecognized (e.g., the extra files I copied in there to test).

So here's my current solution:

Code: Select all

filebot -script fn:amc --action move ...
cd "/Volumes/Media/@tmp/complete"
for i in `ls`; do
    filebot -script fn:cleaner "$i" --def	root=y minsize=0
done
So, move known files out, then clean up all the known crap, deleting directories if they are empty. But leave anything that isn't recognized, I'll look at it later.

I want the folders for each download to get removed, but not the parent 'complete' folder. I didn't read through the cleaner script source, but just decided to loop over each download. If there's a less verbose way to do this, I'm all ears.

Note: if you use torrents, you should use a different strategy since you'll need to serve the downloaded files to maintain your ratio. Please don't use it and then blame me :)

Note 2: the astute will note there is a small race here. If a new download finishes during the execution of the amc script, it will get cleaned before it gets moved. But since cleaner doesn't act on a known file, it should not matter much. Assuming there are no cleaned files that are used to match.
User avatar
rednoah
The Source
Posts: 23002
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: How to move/copy files that aren't TV or Movies

Post by rednoah »

I guess --def unsorted=y really doesn't cut it for generic files. It really just applies to movies/episodes/music that can't be identified, and will then be moved to Unsorted.

The amc script won't process any non-media files. So random stuff like *.pdf files will always always pass through without being processed in any way.


As for the cleaner script, does setting --def root=n not work?

Code: Select all

filebot -script fn:cleaner "/Volumes/Media/@tmp/complete" --def root=n minsize=0
:idea: Please read the FAQ and How to Request Help.
vthunder
Posts: 6
Joined: 10 Oct 2015, 03:27

Re: How to move/copy files that aren't TV or Movies

Post by vthunder »

I guess --def unsorted=y really doesn't cut it for generic files.
Right. Maybe tweak the docs a little bit to make it more clear what it's useful for and what it's not? I'm happy with my current solution, though it was a bit more work than setting a command-line flag.
As for the cleaner script, does setting --def root=n not work?
I think I misunderstood what the root=n behavior is. I thought it would remove the files and leave empty directories behind. So I've just taken the loop out of my script, thanks!
vthunder
Posts: 6
Joined: 10 Oct 2015, 03:27

Re: How to move/copy files that aren't TV or Movies

Post by vthunder »

vthunder wrote:
I guess --def unsorted=y really doesn't cut it for generic files.
Right. Maybe tweak the docs a little bit to make it more clear what it's useful for and what it's not? I'm happy with my current solution, though it was a bit more work than setting a command-line flag.
Sorry - to expand on this a little bit: I *did* test with media files that were not recognized. I took videos and mangled the names so they would not be recognized.

So I actually still think there's a bug there somewhere, even for media files.
User avatar
rednoah
The Source
Posts: 23002
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: How to move/copy files that aren't TV or Movies

Post by rednoah »

Works for me:

Code: Select all

Input: /Users/reinhard/Development/test/AMC-TEST/asdfasdf.mp4
Group: [tvs:null] => [asdfasdf.mp4]
Processing 1 unsorted files
[DUPLICATE] Rename [/Users/reinhard/Development/test/AMC-TEST/asdfasdf.mp4] to [/Users/reinhard/Development/test/OUTPUT/Unsorted/AMC-TEST/asdfasdf.mp4]
Logs?
:idea: Please read the FAQ and How to Request Help.
vthunder
Posts: 6
Joined: 10 Oct 2015, 03:27

Re: How to move/copy files that aren't TV or Movies

Post by vthunder »

Ah I think I know why it didn't work for me. Looking through the logs... I used nonsense file extensions, not just names. e.g., "foobar.xyz". So the logs just have

Code: Select all

Input: /.../foobar.xyz
...
Exclude: /.../foobar.xyz
Contents were unchanged and `file` would've reported such, but I guess filebot only looks at the filename and couldn't figure out that it was a media file at all. So it got excluded. Correct?

Thanks!
Post Reply