AMC Delete Archives

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
SpencerC77
Posts: 10
Joined: 11 Oct 2013, 14:02

AMC Delete Archives

Post by SpencerC77 »

I've been using the sorty.groovy script because it has the ability to delete .rar files after extraction. Would it be possible for me to add this functionality to the amc script? I would much prefer using the amc script if possible. Thanks for the help!
User avatar
rednoah
The Source
Posts: 22998
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC Delete Archives

Post by rednoah »

You have the code for both scripts. If you more or less understand what it does it should be quite easy to paste things together. ;)
:idea: Please read the FAQ and How to Request Help.
SpencerC77
Posts: 10
Joined: 11 Oct 2013, 14:02

Re: AMC Delete Archives

Post by SpencerC77 »

I've actually tried pasting the code that appears to delete the archives after extraction into the AMC code. I get an error that says there was an unknown character on line 353 column 1... I actually have no idea what I'm doing...
SpencerC77
Posts: 10
Joined: 11 Oct 2013, 14:02

Re: AMC Delete Archives

Post by SpencerC77 »

Well, I have figured out how to get the script working with what I think is the code to delete archives after extraction but now I am getting this error when it runs:


MissingPropertyException: No such property: paths for class: Script3
groovy.lang.MissingPropertyException: No such property: paths for class: Script3
at Script3.run(Script3.groovy:106)
at net.sourceforge.filebot.cli.ScriptShell.evaluate(Unknown Source)
at net.sourceforge.filebot.cli.ScriptShell.runScript(Unknown Source)
at net.sourceforge.filebot.cli.ArgumentProcessor.process(Unknown Source)
at net.sourceforge.filebot.Main.main(Unknown Source)
Failure (?_?)
User avatar
rednoah
The Source
Posts: 22998
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC Delete Archives

Post by rednoah »

You're trying to use a variable called "paths" but it doesn't exist.
:idea: Please read the FAQ and How to Request Help.
SpencerC77
Posts: 10
Joined: 11 Oct 2013, 14:02

Re: AMC Delete Archives

Post by SpencerC77 »

Yeah, I really don't understand how any of it works. I would gladly donate if you could help me out with it. Just me know what you think it would cost.
User avatar
rednoah
The Source
Posts: 22998
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC Delete Archives

Post by rednoah »

Since you're planning to donate I've made a simple solution for this:
http://pastebin.com/0RDGp146

Barely tested, so not sure how well it'll work for multi-volume archives. Have a try and see how it works for you. ;)
:idea: Please read the FAQ and How to Request Help.
SpencerC77
Posts: 10
Joined: 11 Oct 2013, 14:02

Re: AMC Delete Archives

Post by SpencerC77 »

This doesn't seem to work. All of the normal AMC functions work but it is not deleting the leftover .rar files. Also, I did make a donation today. Thank you for all of your help and hard work with Filebot!
User avatar
rednoah
The Source
Posts: 22998
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC Delete Archives

Post by rednoah »

Do you get these lines in your log?

Code: Select all

Mark for deletion: <file>
It definitely works:

Code: Select all

Argument: D:\workspace\testdata\AMC-TEST
Read archive [Silver Spoon - 02.7z] to [D:\workspace\testdata\AMC-TEST\Silver Spoon - 02\AMC-TEST]
Extracting files [D:\workspace\testdata\AMC-TEST\Silver Spoon - 02\AMC-TEST\Silver Spoon - 02.avi]
Mark for deletion: D:\workspace\testdata\AMC-TEST\Silver Spoon - 02.7z
Input: D:\workspace\testdata\AMC-TEST\Silver Spoon - 02\AMC-TEST\Silver Spoon - 02.avi
Silver Spoon - 02.avi [series: Silver Spoon, movie: null]
Group: [tvs:Silver Spoon, mov:null, anime:null] => [Silver Spoon - 02.avi]
Rename episodes using [TheTVDB]
Auto-detected query: [Silver Spoon]
Fetching episode data for [Silver Spoon]
Fetching episode data for [Silver Spoons]
Fetching episode data for [Silver Spoon, Sterling Shackles]
[COPY] Rename [D:\workspace\testdata\AMC-TEST\Silver Spoon - 02\AMC-TEST\Silver Spoon - 02.avi] to [D:\workspace\output\TV Shows\Silver Spoon\Season 01\Silver Spoon - S01E02 - Hachiken Rides a Horse.avi]
Processed 1 files
Done ヾ(@⌒ー⌒@)ノ

If you get the "marked for deletion" but it's not gonna be deleted when the script ends then maybe there's an issue with 7zip-jbindings not releasing the file. It works for me with 7z archives though so shouldn't be an issue.
:idea: Please read the FAQ and How to Request Help.
SpencerC77
Posts: 10
Joined: 11 Oct 2013, 14:02

Re: AMC Delete Archives

Post by SpencerC77 »

Here is my log:


Read archive [sons.of.anarchy.s06e06.720p.hdtv.x264-2hd.rar] to [/Volumes/Spencer-HDD1/Downloads/Sons.of.Anarchy.S06E06.720p.HDTV.x264-2HD/sons.of.anarchy.s06e06.720p.hdtv.x264-2hd/Sons.of.Anarchy.S06E06.720p.HDTV.x264-2HD]
Extracting files [/Volumes/Spencer-HDD1/Downloads/Sons.of.Anarchy.S06E06.720p.HDTV.x264-2HD/sons.of.anarchy.s06e06.720p.hdtv.x264-2hd/Sons.of.Anarchy.S06E06.720p.HDTV.x264-2HD/sons.of.anarchy.s06e06.720p.hdtv.x264-2hd.mkv]
Mark archive for deletion: /Volumes/Spencer-HDD1/Downloads/Sons.of.Anarchy.S06E06.720p.HDTV.x264-2HD/sons.of.anarchy.s06e06.720p.hdtv.x264-2hd.rar
null
Input: /Volumes/Spencer-HDD1/Downloads/Sons.of.Anarchy.S06E06.720p.HDTV.x264-2HD/sons.of.anarchy.s06e06.720p.hdtv.x264-2hd/Sons.of.Anarchy.S06E06.720p.HDTV.x264-2HD/sons.of.anarchy.s06e06.720p.hdtv.x264-2hd.mkv
FileNotFoundException: /Users/spencercharest/Dropbox/Scripts/lib/htpc.groovy (No such file or directory)
Group: [tvs:Sons of Anarchy] => [sons.of.anarchy.s06e06.720p.hdtv.x264-2hd.mkv]
Rename episodes using [TheTVDB]
Auto-detected query: [Sons of Anarchy, of]
Fetching episode data for [Sons of Anarchy]
Fetching episode data for [Office]
Fetching episode data for [Office]
Fetching episode data for [Oficer]
Failed to write xattr: java.io.File.toPath()Ljava/nio/file/Path;
[MOVE] Rename [/Volumes/Spencer-HDD1/Downloads/Sons.of.Anarchy.S06E06.720p.HDTV.x264-2HD/sons.of.anarchy.s06e06.720p.hdtv.x264-2hd/Sons.of.Anarchy.S06E06.720p.HDTV.x264-2HD/sons.of.anarchy.s06e06.720p.hdtv.x264-2hd.mkv] to [/Volumes/Spencer-HDD1/TV Shows/Sons of Anarchy/Season 06/Sons of Anarchy - S06E06 - Salvage.mkv]
Processed 1 files
Done ?(?????)?

You're right. It is saying 'mark for deletion" but not deleting. I've found in messing around with it though that it will not extract the same set of archives twice... which is exactly what I was trying to achieve by deleting the archives after extraction. So it is still accomplishing what I need it to. How does this happen? Does it keep a log of what it has extracted?
User avatar
rednoah
The Source
Posts: 22998
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC Delete Archives

Post by rednoah »

I suppose the 7zip native code somehow keep the archive open, so it can't be deleted by the process. Maybe an issue for the .rar implementation since .7z works fine for me.

There is no logic that would keep it from extracting twice, are u sure it's not been deleted? :D Actually the script is set to override, always.

You can find the extract call and set this:

Code: Select all

conflict: 'override'
to this:

Code: Select all

conflict: 'skip'
Only missing files will be extracted if the extract() call is setup like this.
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 22998
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC Delete Archives

Post by rednoah »

If it really doesn't work I think by far the easiest way is to run separate clean-up script after the AMC. After the amc process has terminated there won't be any open file handles, then we could just have the clean-up script check through the amc logs and delete the archives.
:idea: Please read the FAQ and How to Request Help.
SpencerC77
Posts: 10
Joined: 11 Oct 2013, 14:02

Re: AMC Delete Archives

Post by SpencerC77 »

Ok, so I have figure out what is happening. The script IS deleting the .rar file but it is not deleting any of the other numbered archive files (.r00, .r01, .r02). This is why it won't touch any folders that have already processed...because the .rar file is missing. However, the folder is still taking up a lot of room on my disk that will add up very quickly. So, is there anyway to set it to delete all of the numbered archive files as well? Or would it be possible to set it to simple delete the entire folder after processing it? Whichever is easier to accomplish would work for me. I have included some before and after processing screenshots if that helps...

Before:
Image

After:
Image
User avatar
rednoah
The Source
Posts: 22998
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC Delete Archives

Post by rednoah »

oh... the old r00 numbering system. What's that like again? name.rar, name.r00, name.r01 right? I'll add that check for you...

Updated the script for that:
http://pastebin.com/0RDGp146
:idea: Please read the FAQ and How to Request Help.
Post Reply