[Python] rescepy - automated ReScene reconstruction.

Come up with a useful post-processing script? Share it here!
sweetie
Full Member
Full Member
Posts: 117
Joined: May 10th, 2009, 10:47 am

Re: [bash] SceneSort [v3 - AIO post-processor script.]

Post by sweetie »

Oh right.

Just add:

Code: Select all

echo_process "Cleaning up.."
for cleanup in "srr.log" "srs.log" *.srr *.srs "unrar.log" "cfv_c.log" "xml.log" "mencoder.log" "mkvinfo.log" "mkvextract.log" "dcadec_aften.log" "tsMuxeR.log" "cfv.log" "abgx360.log" "wget.log" "index.html?q=$CWD" "orlydb.log"; do
[ -f "$cleanup" ] || continue; rm -f "$cleanup"; done

echo_success "Successfully processed: $CWD~!"
to the bottom.
Last edited by sweetie on May 8th, 2010, 3:29 am, edited 1 time in total.
stabu
Jr. Member
Jr. Member
Posts: 64
Joined: December 10th, 2008, 10:02 pm

Re: [bash] SceneSort [v3 - AIO post-processor script.]

Post by stabu »

Thanks, works perfect!
sweetie
Full Member
Full Member
Posts: 117
Joined: May 10th, 2009, 10:47 am

Re: [LiNUX/OSX - bash] SceneSort [v4 - ReScene Assistant.]

Post by sweetie »

stabu: latest version is behaving under Ubuntu* now. Have separated functions for remuxing/transcoding to MediaMux post.

http://forums.sabnzbd.org/index.php?topic=4500.0


Keep me posted on stats~!



*errors seem to have been caused by pastebin.
Last edited by sweetie on June 6th, 2010, 10:14 am, edited 1 time in total.
bwq
Newbie
Newbie
Posts: 6
Joined: August 10th, 2010, 4:06 pm

Re: [LiNUX/OSX/BSD - bash] SceneSort [v4 - ReScene Assistant.]

Post by bwq »

Amazing script! Just one thing though, how do you get this to work with multi-CD releases? I'm trying with a random multi-CD release and it keeps saying it can't find the cd1.avi and cd2.avi (with the proper filenames of course). That's because they are in CD1 and CD2 though, and it's trying to look for them in the root dir, just like srr.exe would do.
Last edited by bwq on August 11th, 2010, 1:18 am, edited 1 time in total.
sweetie
Full Member
Full Member
Posts: 117
Joined: May 10th, 2009, 10:47 am

Re: [LiNUX/OSX/BSD - bash] SceneSort [v4 - ReScene Assistant.]

Post by sweetie »

@bwq: You've just reminded me, intended to add a check for subdirs. Adding/updating in a moment.

edit: Added.

(also, to be safe: you'd better remove reference to the dir. name - against forum rules!)
Last edited by sweetie on August 10th, 2010, 10:04 pm, edited 1 time in total.
bwq
Newbie
Newbie
Posts: 6
Joined: August 10th, 2010, 4:06 pm

Re: [LiNUX/OSX/BSD - bash] SceneSort [v4 - ReScene Assistant.]

Post by bwq »

Cool, gonna check it out when I get back home and report my findings :). Thanks!

Btw, would you mind adding an option to remove the source (avi/mkv) files after cfv has succesfully verified the rar files' integrity? I know it's a very easy fix to implement myself, but I'm sure others would like this too. :)
Last edited by bwq on August 11th, 2010, 2:33 am, edited 1 time in total.
sweetie
Full Member
Full Member
Posts: 117
Joined: May 10th, 2009, 10:47 am

Re: [LiNUX/OSX/BSD - bash] SceneSort [v4 - ReScene Assistant.]

Post by sweetie »

The latest version will remove all input files with same extension. Previously, only input files with original filenames were removed.
bwq
Newbie
Newbie
Posts: 6
Joined: August 10th, 2010, 4:06 pm

Re: [LiNUX/OSX/BSD - bash] SceneSort [v4 - ReScene Assistant.]

Post by bwq »

That's nice :). I'd suggest adding this line of code btw:

search for:

toprar=$(mono "$SRREXE" "${PWD##*/}.srr" -l | grep "RAR Files:" -A1 | tail -n 1$
[ -f "$toprar" ] || mono "$SRREXE" "${PWD##*/}.srr" -r -u -y

add below:

toprar=`echo $toprar | sed -r 's/(.*)\///g'`

This is necessary for .srr files that contain CD1/ in the .srr itself. One example is the BELIAL release of 12 Monkeys. By adding that line of code you remove everything in front of the slash, so
for example:

CD1/rlsname.cd1-grp.rar will become rlsname.cd1-grp.rar

If you don't do this, it will not know that the files have extracted succesfully because it tries for the rar in CD1, while the script gets all the .avi files from the subdirs and places them in the root dir.

I'd also suggest only removing the source files after the release has been verified with cfv.

*edit: oops, don't do this right below that line, else it'll mess up the next if, because the $? now has the value of the echo | sed.
Last edited by bwq on August 11th, 2010, 11:15 am, edited 1 time in total.
bwq
Newbie
Newbie
Posts: 6
Joined: August 10th, 2010, 4:06 pm

Re: [LiNUX/OSX/BSD - bash] SceneSort [v4 - ReScene Assistant.]

Post by bwq »

Here you go, this should work:

toprar=$(mono "$SRREXE" "${PWD##*/}.srr" -l | grep "RAR Files:" -A1 | tail -n 1 | sed -e 's/^[ \t]*//;s/[ \t]*$//') [ -f "$toprar" ] || mono "$SRREXE" "${PWD##*/}.srr" -r -u -y
hurrdurr=$?
toprar=`echo $toprar | sed -r 's/(.*)\///g'`
if [ "$hurrdurr" = "0" -a -f "$toprar" ]; then
       srrfext=($(mono "$SRREXE" "${PWD##*/}.srr" -l | grep "Archived Files:" -A20 | egrep -i ".[a-z]|.[0-9]" | sed -e 's/^[ \t]*//;s/[ \t]*$//'))
       rm -f $(ls -A | grep "*.${srrfext[*]##*.}") &> "/dev/null"
       echo -e "\n>> RARs successfully reconstructed."
elif [ "$hurrdurr" != "0" -a -f "$toprar" ]; then
       echo -e "\n>> RARs exist - Not attempting to reconstruct." && return 0
else
       echo -e "\n@@ Error reconstructing RARs." && return 1
fi


*edit: It looks like there are some problems with the script. I figured it was the stuff I added but even without it does something wrong:

It goes ahead to recreate the original files, even though they are in the dir, which results in a corrupt filename.rar (only the filename.rar, then it stops since it can't find the source avi/mkv).
Last edited by bwq on August 11th, 2010, 12:17 pm, edited 1 time in total.
sweetie
Full Member
Full Member
Posts: 117
Joined: May 10th, 2009, 10:47 am

Re: [LiNUX/OSX/BSD - bash] SceneSort [v4 - ReScene Assistant.]

Post by sweetie »

Updated. Only required adding of additional sed expression.

Also, srr.exe has an inbuilt CRC verifier. It was disabled by default, as I've yet to encounter a release where RARs reconstructed, yet failed SFV verification. (have tested literally thousands.)
I've re-enabled at the cost of around (~5-10%) extra time per RAR set. Hardly a compromise.

Thanks for feedback!


edit: updated again. Re-organised method for checking existing RARs.
Last edited by sweetie on August 11th, 2010, 12:38 pm, edited 1 time in total.
bwq
Newbie
Newbie
Posts: 6
Joined: August 10th, 2010, 4:06 pm

Re: [LiNUX/OSX/BSD - bash] SceneSort [v4 - ReScene Assistant.]

Post by bwq »

I modified the script a little and replaced the rescene_srr_rebuild function. Tested it and now it doesn't create the .srr anymore if it finds one of the scene rars. I'll test more thoroughly when I have the time.

Replace the rescene_srr_rebuild function with this:
http://pastebin.com/1hjhR3hc
sweetie
Full Member
Full Member
Posts: 117
Joined: May 10th, 2009, 10:47 am

Re: [LiNUX/OSX/BSD - bash] SceneSort [v4 - ReScene Assistant.]

Post by sweetie »

Oh, you beat me to it.


Current version has same check in place. (I only modified that last night - though it shouldn't have been behaving as it was. It's now as it was originally.)
bwq
Newbie
Newbie
Posts: 6
Joined: August 10th, 2010, 4:06 pm

Re: [LiNUX/OSX/BSD - bash] SceneSort [v4 - ReScene Assistant.]

Post by bwq »

Ok cool :). Could you also make it so it doesn't delete the original folders (CD[0-9], Subs, Sample) after it got the files out of there? Else I'd have to create a CD1/CD2 for every single one of my multi-CD releases :P
sweetie
Full Member
Full Member
Posts: 117
Joined: May 10th, 2009, 10:47 am

Re: [LiNUX/OSX/BSD - bash] SceneSort [v4 - ReScene Assistant.]

Post by sweetie »

You should be able to use the 'c' option. Will call AweScript only to sort directories.


edit: Seems I managed to break the AweScript installer last night as well. Don't know what I was thinking - seemed far more stable at 4:30AM.

Everything in working order now.
Last edited by sweetie on August 11th, 2010, 7:55 pm, edited 1 time in total.
dbznbas
Newbie
Newbie
Posts: 16
Joined: January 21st, 2010, 2:14 pm

Re: [LiNUX/OSX/BSD - bash] SceneSort [v4 - ReScene Assistant.]

Post by dbznbas »

Possibility of a windows version?
Post Reply