[Synology] Post processing rename.par/rename.with.this.par

Come up with a useful post-processing script? Share it here!
Post Reply
Delerium
Newbie
Newbie
Posts: 3
Joined: May 18th, 2016, 2:31 pm

[Synology] Post processing rename.par/rename.with.this.par

Post by Delerium »

I wanted a script for post processing a Rename.par or rename.with.this.par to the par processor.

The script checks if there is a PAR file (any name will go) in the extraction folder, if there is it will get the biggest file in the folder and assume this is the movie.
The parfile and the moviefile will be offered to the par2 parser used in SABnzbd and will rename the movie using the par file.

Save this script as ParRename.sh in the SABnzbd script folder, chmod the file to 755 so execution is possible.
Changes needed in SABnzbd settings:
- Settings > Switches > Enable the tickbox for: Ignore any folders inside archives
- Settings > Categories > Enable postprocessing script

Code: Select all

#! /bin/bash

cd "$1"
pwd
ls -al

parfile=$(find . -regex ".*\.\(par2\)" -printf "%f\n")
moviefile=$(ls -1S | head -n 1)

if [ ! -z "$parfile" ]; then
	echo ""
	echo "Found par file for rename: $parfile"
	echo "Found biggest file in folder for rename: $moviefile"
	echo ""

	echo "Running command: /volume1/@appstore/sabnzbd/bin/par2 r $parfile $moviefile"

	/volume1/@appstore/sabnzbd/bin/par2 r $parfile $moviefile
else
	echo "Completed, no par file for rename found"
fi

echo "Completed"
Example output:

Code: Select all

Output from user script "ParRename.sh" (Exit code = 0):
/volume1/Downloads/complete/NameOfSeries (2015) S04E05 XViD DD5.1 NLSubs -Q o Q-
total 478116
drwxrwxrwx 2 sabnzbd users      4096 Jul 15 18:30 .
drwxrwxrwx 6 sabnzbd users      4096 Jul 15 18:30 ..
-rw-rw-rw- 1 sabnzbd users       115 Nov  6  2013 Als eerste op Place2Home Torrents (Klik Hier).url
-rw-rw-rw- 1 sabnzbd users       223 May 30  2015 Fan-Q-CLub-ChatBox.url.URL
-rw-rw-rw- 1 sabnzbd users       205 Nov 15  2015 Fan-Q-CLub-Forum.URL
-rw-rw-rw- 1 sabnzbd users 486696190 Jul 12 20:28 fd6b46cc984632d77cde341a0a41c121.avi
-rw-rw-rw- 1 sabnzbd users    231692 Feb 29  2012 Flyer Place2Home.net.jpg
-rw-rw-rw- 1 sabnzbd users       115 Nov  6  2013 Place2Home Torrents (Klik Hier).url
-rw-rw-rw- 1 sabnzbd users       186 Nov 15  2015 Place2Home Usenet.url
-rw-rw-rw- 1 sabnzbd users    444297 Jun  4 12:15 P.png
-rw-rw-rw- 1 sabnzbd users    486785 Feb 28 20:40 QoQ-iNFO (DoubleClick Here).chm
-rw-rw-rw- 1 sabnzbd users      1894 Jul 15 18:29 QoQ.nfo
-rw-rw-rw- 1 sabnzbd users     44584 Jul 12 21:35 Rename.With.This.par2
-rw-rw-rw- 1 sabnzbd users   1173766 May 11  2013 T.gif
-rw-rw-rw- 1 sabnzbd users    465708 Jun  3  2012 Usenet Provider Newsconnection.nl.jpg
-rw-rw-rw- 1 sabnzbd users       178 May 12  2014 Usenet Provider Newsconnection.nl.url

Found par file for rename: Rename.With.This.par2
Found biggest file in folder for rename: fd6b46cc984632d77cde341a0a41c121.avi

Running command: /volume1/@appstore/sabnzbd/bin/par2 r Rename.With.This.par2 fd6b46cc984632d77cde341a0a41c121.avi
/volume1/@appstore/sabnzbd/bin/par2: /lib/libstdc++.so.6: no version information available (required by /volume1/@appstore/sabnzbd/bin/par2)
/volume1/@appstore/sabnzbd/bin/par2: /lib/libstdc++.so.6: no version information available (required by /volume1/@appstore/sabnzbd/bin/par2)
/volume1/@appstore/sabnzbd/bin/par2: /lib/libstdc++.so.6: no version information available (required by /volume1/@appstore/sabnzbd/bin/par2)
/volume1/@appstore/sabnzbd/bin/par2: /lib/libstdc++.so.6: no version information available (required by /volume1/@appstore/sabnzbd/bin/par2)
par2cmdline version 0.4, Copyright (C) 2003 Peter Brian Clements.

par2cmdline comes with ABSOLUTELY NO WARRANTY.

This is free software, and you are welcome to redistribute it and/or modify
it under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version. See COPYING for details.

Loading "Rename.With.This.par2".
Loading: 0.3%
Loading: 99.6%
Loading: 99.8%
Loaded 4 new packets

There are 1 recoverable files and 0 other files.
The block size used was 220424 bytes.
There are a total of 2208 data blocks.
The total size of the data files is 486696190 bytes.

Verifying source files:

Target: "NameOfSeries.S04E05.XViD.DD5.1.NLSubs-QoQ.avi" - missing.

Scanning extra files:

Scanning: "fd6b46cc984632d77cde341a0a41c121.avi": 0.1%
Scanning: "fd6b46cc984632d77cde341a0a41c121.avi": 0.2%
{...}
Scanning: "fd6b46cc984632d77cde341a0a41c121.avi": 99.9%
File: "fd6b46cc984632d77cde341a0a41c121.avi" - is a match for "NameOfSeries.S04E05.XViD.DD5.1.NLSubs-QoQ.avi".

Repair is required.
1 file(s) have the wrong name.
You have 2208 out of 2208 data blocks available.
Repair is possible.


Repair complete.
Completed

User avatar
smoldersonline
Newbie
Newbie
Posts: 13
Joined: April 30th, 2008, 1:13 pm

Re: [Synology] Post processing rename.par/rename.with.this.p

Post by smoldersonline »

Thank you for sharing! Do you perhaps know whether this will work on a linux box? If so, I guess I'll have to point the script to the proper volume?

Thanks again
Post Reply