#!/bin/bash #Company: PowerCraft Technology #Author: Copyright Jelle de Jong #Note: Please send me an email if you enhanced this script #Version: 0.0.2 #Date: 23-07-2006 /26-10-07 #System: Ubuntu/Debian GNU/Linux #Category Thunar scripts #Name: Queue NZB #Description: Move .nzb file to Hellanzb queue directory #Command: xfce4-terminal --disable-server --hide-toolbars --execute /usr/share/pct-thunar-scripts/scripts/queue-nzb %F #Patterns: *.nzb; *.NZB #Text Files: True # Did the script work for you? # Yes # Yes, but with some errors # Yes, but I had to change some things # Not at all # 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 2 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, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301, USA. TEXTDOMAINDIR=/usr/share/locale TEXTDOMAIN=${0##*/} NAME=$"Queue NZB" DESCRIPTION=$"Move .nzb file to Hellanzb queue directory" configfile="$HOME/.hellanzb/hellanzb.conf" cecho() { case "$1" in "black") echo -ne "\E[30m" ;; "red") echo -ne "\E[31m" ;; "green") echo -ne "\E[32m" ;; "yellow") echo -ne "\E[33m" ;; "blue") echo -ne "\E[34m" ;; "magenta") echo -ne "\E[35m" ;; "cyan") echo -ne "\E[36m" ;; *) echo -ne "\E[30m" exit ;; esac echo "$2" "$3" tput sgr0 } cecho "green" $"program:" echo "$0" cecho "green" $"description:" echo "$DESCRIPTION" cecho "green" $"processing:" for I in "$@" do cecho "blue" "$I" done file_memory=$(<"$configfile") queuedir=$(grep "Hellanzb.PREFIX_DIR =" <<< "$file_memory" | head -n 1 | cut -f 2 -d "'" | sed "s/^[' \t]*//;s/[' \t]*$//") queuedir+=$(grep "Hellanzb.QUEUE_DIR =" <<< "$file_memory" | head -n 1 | cut -f 2 -d "'" | sed "s/^[' \t]*//;s/[' \t]*$//") backupdir=$(sed "s/daemon/backup/" <<< "$queuedir") #file_memory=$(<"$configfile") #queuedir=$(grep "Hellanzb.PREFIX_DIR =" <<< "$file_memory" | sed "1s/[^']*'\(.*\)'.*/\1/p;q") #queuedir+=$(grep "Hellanzb.QUEUE_DIR =" <<< "$file_memory" | sed "1s/[^']*'\(.*\)'.*/\1/p;q") #backupdir=$(sed "s/daemon/backup/" <<< "$queuedir") #sed -n "1s/[^']*'\(.*\)'.*/\1/p;q" #cecho "cyan" "backupdir: $backupdir" #cecho "cyan" "queuedir: $queuedir" echo "" cecho "cyan" $"backup directory is $backupdir" mkdir -v -p "$backupdir" cecho "cyan" $"queue directory is $queuedir" mkdir -v -p "$queuedir" echo "" for I in "$@" do cecho "blue" $"add $I to queue" cp "$I" "$backupdir" && mv "$I" "$queuedir" done echo "" cecho "green" $"done, closing after 3 seconds" sleep 3 exit