[LINUX] Unobfuscate a single rar file of a collection.
Posted: November 16th, 2016, 2:34 pm
- Description, how it work:
Select one rar file of a collection, create a NZB and download it. File(s) inside the rar will be diplayed in SABNZBD web interface.
Display also a direct link to NZBIndex and Binsearch NZB. (triple click on a link, then right click to open the page)
Create a Google search link to the file, can be usefull in some case.
It's composed of a pre queue script and a post processing script.
- INSTALL note:
Create two blank file withtout extension, copy code inside, make it executable.
The post processing script must be named "unobfuscate_show-name" withtout the quotes.
Specify the name of the PRE QUEUE script you just created in SAB Settings here: SABNZBD > CONFIG > SWITCH > QUEUE > PRE QUEUE script: <your file>
PRE QUEUE script
Settings:
- Max size of a downloaded NZB that we consider to be a single RAR file. Default 200MB
- Priority of the downloaded file, allow catch files below 200MB while downloading bigger files. Default HIGH.
POST PROCESSING script
WARNING: This script must be named "unobfuscate_show-name" withtout the quotes.
- Settings:
What do we do with downloaded file ? Default Do nothing and keep downloaded folder and file as usual.
DELETE (Warning)
Move to _TRASH folder
Do nothing and keep downloaded folder and file as usual.
- Limitation and side effect of this script
The script will consider every file below specified size as a file to look inside with unrar and will remain uncompressed. So depending the size of the file you are used to download you will need to modify the PRE QUEUE script specified in SABNZBD > CONFIG > SWITCH > QUEUE > PRE QUEUE script if you want to download thoses files normally.
I have no idea how it will work with Couchpotatoes etc.. i'm only using SAB i have a very simple configuration
My Bash version:
SCREENSHOT:
Let me know if you enjoy this script or have any suggestion
Select one rar file of a collection, create a NZB and download it. File(s) inside the rar will be diplayed in SABNZBD web interface.
Display also a direct link to NZBIndex and Binsearch NZB. (triple click on a link, then right click to open the page)
Create a Google search link to the file, can be usefull in some case.
It's composed of a pre queue script and a post processing script.
- INSTALL note:
Create two blank file withtout extension, copy code inside, make it executable.
The post processing script must be named "unobfuscate_show-name" withtout the quotes.
Specify the name of the PRE QUEUE script you just created in SAB Settings here: SABNZBD > CONFIG > SWITCH > QUEUE > PRE QUEUE script: <your file>
PRE QUEUE script
Settings:
- Max size of a downloaded NZB that we consider to be a single RAR file. Default 200MB
- Priority of the downloaded file, allow catch files below 200MB while downloading bigger files. Default HIGH.
Code: Select all
#!/bin/bash
#
# Unobfuscate_pre-queue v1.0 - GPL v3
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#
# Description:
#
# This pre queue script catch files below specified size (ex:250MB),
# set priority download to high and specify to use the post processing
# script "Unobfuscate_show-name".
# This pre queue script is useless without the post processing script associated.
#
# Debug
# set -x
# Limit size in bytes, above the downloaded file is downloaded as usual.
# http://easycalculation.com/bandwidth-calculator.php (9663676416 bytes = 9 GB)
# Size examples:
# 367001600 # 350MB
# 209715200 # 200MB
# 157286400 # 150MB
# 104857600 # 100MB
unob_size_limit="209715200" # 200MB
# Set download priority to continue unobfuscate while downloading bigger files.
# -100 = Default, -2 = Paused, -1 = Low, 0 = Normal, 1 = High, 2 = Force
unob_priority="1"
#
# Don't EDIT below
#
# Size of downloaded file in bytes
unob_size="$6"
# Main process: If Downloaded file is below specified size limit
if [[ "$unob_size" -lt "$unob_size_limit" ]]; then
# 1 tell SABnzbd to use this .nzb (1) or skip (0)
echo "1"
# 2 set nzbname
echo
# 3 set Processing mode to Download
echo "0"
# 4 set category
echo
# 5 set post processing script
echo "unobfuscate_show-name"
# 6 Set download priority
echo "$unob_priority"
# 7 Set Group to be used
echo
fi
WARNING: This script must be named "unobfuscate_show-name" withtout the quotes.
- Settings:
What do we do with downloaded file ? Default Do nothing and keep downloaded folder and file as usual.
DELETE (Warning)
Move to _TRASH folder
Do nothing and keep downloaded folder and file as usual.
Code: Select all
#!/bin/bash
#
# Unobfuscate_show-name v1.0 - GPL v3
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#
# Description:
#
# This post processing script watch inside a downloaded rar archive
# and echo in SABnzbd script pop-up the name of file(s) inside.
# It Also create direct links to nzb file at NZBIndex and BinSearch
# and a Google link to search the file name.
#
# This script is useless without pre-queue script unobfuscated_pre-queue
#
# Debug
# set -x
# Delete, Move to _TRASH folder or keep downloaded files ?
# 0 = DELETE WARNING, 1 = Move to _TRASH folder, 2 = Do nothing and keep downloaded folder and file.
unob_trash="2"
#
# Don't EDIT below
#
# Path to downloaded folder
unob_path="$1"
# Name of the nzb withtout extension
unob_nzb="$3"
# Check downloaded folder exist or exit (Case of failed download)
[[ -d "$unob_path" ]] || exit
# Echo result
unob_showresult ()
{
echo -e "\n\n Unobfuscate File\n"
echo -e "BinSearch, NZBIndex and Google links:
https://www.binsearch.info/?q=$unob_nzb
https://www.nzbindex.com/search/?results=250&sort=age_desc&q=$unob_nzb\n
https://www.google.fr/search?q=$unob_file\n"
}
# Main process: Search every file in download folder
find "$unob_path" -type f | sort | while read -r l
do
# List file(s) inside RAR archive and store file name to var
unob_file=$( unrar lb $l)
# Echo download link
unob_showresult
# Echo file(s) in archive
echo -e "PREVIEW: $unob_file"
done
# Trash downloaded files cases
case "$unob_trash" in
0)
rm -rf "$unob_path"
;;
1)
# Extract Sabnzbd Download Folder
unob_SAB_download_folder="${unob_path%/*}"
# Create _TRASH folder
[[ -d "$unob_SAB_download_folder/_TRASH" ]] || mkdir -p "$unob_SAB_download_folder/_TRASH"
# Move downloaded folder to _TRASH
mv "$unob_path" "$unob_SAB_download_folder/_TRASH"
;;
*)
;;
esac
The script will consider every file below specified size as a file to look inside with unrar and will remain uncompressed. So depending the size of the file you are used to download you will need to modify the PRE QUEUE script specified in SABNZBD > CONFIG > SWITCH > QUEUE > PRE QUEUE script if you want to download thoses files normally.
I have no idea how it will work with Couchpotatoes etc.. i'm only using SAB i have a very simple configuration
My Bash version:
Code: Select all
GNU bash, version 4.2.53(2)-release (x86_64-slackware-linux-gnu)
Let me know if you enjoy this script or have any suggestion