View Single Post
  #8  
Old 11th July 2016, 18:56
CoFix CoFix is offline
Senior Member
 
Join Date: May 2010
P2P
Posts: 15
Default
Thanks firefly007 these my all files

upload.pl
PHP Code:
#!/bin/bash

##############################################################
##                                                          ##
##  ScarS' torrent upload script v0.9.8                     ##
##                                                          ##
##  created by: ScarS                                       ##
##  edited by: BladE, TinTin                                ##
##  created on: Sat Oct 31 2009                             ##
##                                                          ##
##  last modified by: TinTin                                ##
##  last modified on: Sat Mar 30 2013                       ##
##                                                          ##
##                                                          ##
##  script placement:                                       ##
##  /usr/local/bin/ or ~/bin/                               ##
##                                                          ##
##  command:                                                ##
##  upload [options] /path/to/dir/                          ##
##                                                          ##
##  options:                                                ##
##  -c <category>  : category to upload in to               ##
##  -d <path>      : path to downloads directory            ##
##  -h             : show short information                 ##
##  -i             : show extended information              ##
##  -l             : list of categories                     ##
##  -o <file>      : log output to file                     ##
##  -p <password>  : password                               ##
##  -r <file>      : load resource file                     ##
##  -s <site>      : load .site.rc                          ##
##  -t <tags>      : tags to add must be in quotes          ##
##  -u <username>  : username                               ##
##  -w <path>      : path to torrentclient watch directory  ##
##  -x <test>      : execute test [cat, p2p, dupe, mkt, rfr]##
##  -y <number>    : piece size to use [ in 2^n bytes ]     ##
##  -z <number>    : piece size NOT to use [ in kB ]        ##
##                                                          ##
##  requires:                                               ##
##  - bash v3.2+                                            ##
##  - curl                                                  ##
##  - mktorrent v0.6+                                       ##
##  - ~/upload/.upload.rc                                   ##
##                                                          ##
##  recommends:                                             ##
##  - rtorrent                                              ##
##  - rtorrent_fast_resume.pl                               ##
##                                                          ##
##############################################################

# version number
VERSION=0.9.8

###############################
##        SCRIPT START       ##
###############################

# create function to display dots
progress() {
    while [ 
]; do
        echo -
" ."
        
sleep 1
    done
}

# create function to delete the process directory
cleanup_process() {
    
# if an error occured echo a stopped message to the log
    
if [ -"$1" ]; then
        
echo "### auto upload stopped at: $(date)" >> "$LOGFILE"
    
fi

    
# append temporarily log to main log
    
cat "$LOGFILE>> "$MAINLOG"

    
# if this is the only upload process delete the complete upload-processes dir
    
if [ $(ls -"/tmp/upload-processes-$USERwc -l) -eq 3 ]; then
        rm 
-rf "/tmp/upload-processes-$USER"
    
# if there are more upload processes only delete this process dir
    
else
        
rm -rf "/tmp/upload-processes-$USER/$$"
    
fi

    
# remove the .uploading dir
    
rm -rf "$FPATH/.uploading"

    
# if needed create an .uploaderror file
    
if [ -"$1" ]; then
        
echo "$1" "$FPATH/.uploaderror"
    
fi
}

# create function to handle CTRL-C and kill
signal_trap() {
    
# check if dotting function is active and if so kill it
    
if [ -"$PROCESS]; then
        kill 
-9 $PROCESS
    fi
    
echo -en "\b\b  \n\nTerminating . . . "

    
# echo script abortion to the log
    
echo "###-----------------------------------------------------" >> "$LOGFILE"
    
echo "### auto upload aborted at: $(date)" >> "$LOGFILE"

    
# delete the process directory
    
cleanup_process

    
# exit the script
    
echo -"terminated"
    
exit 1
}

# echo start of script
echo "torrent upload script v$VERSION by ScarS, modified by BladE and Tintin"

# check if the bash version is 3.2+
if [ ${BASH_VERSINFO[0]} -lt 3 ] || [ ${BASH_VERSINFO[0]} -eq 3 ] && [ ${BASH_VERSINFO[1]} -lt 2 ]; then
    
echo -"\nerror: your bash version appears to be lower than 3.2, please update."
    
exit 1
fi

# enable case-insensitive matching
shopt -s nocaseglob

# set default resource file
RESOURCE=".upload.rc"

# check for resource file first because some settings are used to check options
while getopts ":c:d:hilo:p:r:s:t:u:w:x:y:z:" opt; do
    case 
"$optin
    
# option r: load resource file
    
RESOURCE="$OPTARG";;
    
# option s: load .site.rc
    
RESOURCE=".$OPTARG.rc";;
    
# skip all other options to be handled later
    
) continue;;
    
# option *: unknown option. return with an error
    
* )
        echo -
"\nerror: -$OPTARG: this option was not recognised. run \`upload -h' for command explanation."
        
exit 1;;
    
esac
done

# if resource was not found in the current dir look in the uploader dir or home dir
if [ ! -"$RESOURCE]; then
    
if [ -"$HOME/upload/$RESOURCE]; then
        RESOURCE
="$HOME/upload/$RESOURCE"
    
elif [ -"$HOME/$RESOURCE]; then
        RESOURCE
="$HOME/$RESOURCE"
    
else
        echo -
"\nerror: \`$RESOURCE' does not exist. make sure you have a resource file."
        
exit 1
    fi
fi

# check if resource file is readable
if [ ! -"$RESOURCE]; then
    
echo -"\nerror: \`$RESOURCE' is not readable. make sure your resource file is readable."
    
exit 1
fi

# include settings
source "$RESOURCE"
echo -"\nloaded settings from \`$RESOURCE'"

# reset options to walk them again
OPTIND=1

while getopts ":c:d:hilo:p:r:s:t:u:w:x:y:z:" opt; do
    case 
"$optin
    
# option c: set a category
    
)
        
# get the entered category
        
CAT="$OPTARG"
        
CMATCH=0

        
# walk array of categories and search for a match
        
for (( 0< ${#ALLCATS[@]}; i++ )); do
            # if a matching category was found set the category and path and stop looping
            
if [[ $CAT =~ ${ALLCATS[i]} ]]; then
                
if [ $KEYVAL -eq 1 ]; then
                    CAT
=${ALLCATS[i+1]}
                else
                    
CAT=${ALLCATS[i]}
                
fi
                CMATCH
=1
                
break
            
fi
        done

        
# if no matching category was found return an error
        
if [ $CMATCH -eq 0 ]; then
            
echo -"\nerror: entered category after option -c was not found in list of categories. run \`upload -l' for a list of categories."
            
exit 1
        fi
;;
    
# option d: set path to download dir
    
)
        
# check if input is a directory
        
if [ ! -"$OPTARG]; then
            
echo -"\nerror: entered path after option -d is not a directory. make sure the entered path points to a directory."
            
exit 1
        elif 
[ ! -"$OPTARG]; then
            
echo -"\nerror: directory at entered path after option -d is not readable. make sure the entered path points to a readable directory.";
            exit 
1
        
else
            
DOWNLOADS="$OPTARG"
        
fi;;
    
# option h: show command information
    
)
        
cat <<EOF

command
:
upload [options] /path/to/dir/

options:
-
<category>  : category to upload in to
-<path>      : path to downloads directory
-h             show short information
-i             show extended information
-l             : list of categories
-<file>      : log output to file
-<password>  : password
-<file>      : load resource file
-<site>      : load .site.rc
-<tags>      : tags to add must be in quotes
-<username>  : username
-<path>      : path to torrentclient watch directory
-<test>      : execute test catp2pdupemktrfr ]
-
<number>    : piece size to use [ in 2^n bytes ]
-
<number>    : piece size NOT to use [ in kB ]
EOF
        
exit 0;;
    
# option i: show extended information
    
)
        
cat <<EOF

command
:
upload [options] /path/to/dir/

options:
-
<category>  : category to upload in to
-<path>      : path to downloads directory
-h             show short information
-i             show extended information
-l             : list of categories
-<file>      : log output to file
-<password>  : password
-<file>      : load resource file
-<site>      : load .site.rc
-<tags>      : tags to add must be in quotes
-<username>  : username
-<path>      : path to torrentclient watch directory
-<test>      : execute test catmktrfr ]
-
<number>    : piece size to use [ in 2^n bytes ]
-
<number>    : piece size NOT to use [ in kB ]

requires:
bash v3.2+
curl
mktorrent v0.6+
- ~/
upload/.upload.rc

recommends
:
rtorrent
rtorrent_fast_resume.pl
EOF
        
exit 0;;

    
# option l: show list of possible categories
    
)
        
# create string of categories array
        
for (( 0< ${#ALLCATS[@]}; i++ )); do
            
if [[ ${ALLCATS[$i]} =~ ^[0-9]*$ ]]; then
                
continue
            
elif $i -eq 0 ]; then
                RET
="'${ALLCATS[$i]}'"
            
else
                
RET="$RET, '${ALLCATS[$i]}'"
            
fi
        done

        
echo -"\nlist of categories:\n$RET"
        
exit 0;;
    
# option o: set output to entered file
    
)
        
# check if input is a directory
        
if [ -"$OPTARG]; then
            
echo -"\nerror: entered path after option -o is a directory. makse sure the entered path points to a file.";
            exit 
1
        
# if entered path does not contain a / prepend the current dir
        
elif [[ ! "$OPTARG=~ \/ ]]; then
            LOGFILE
="$PWD/$OPTARG"
        
else
            
LOGFILE="$OPTARG"
        
fi;;
    
# option p: set password
    
PASSWORD="$OPTARG";;
    
# option r: previously handled, do nothing
    
) continue;;
    
# option s: previously handled, do nothing
    
) continue;;
    
# option t: set tags to be used
    
TAG="$OPTARG"    ;;
    
# option u: set username
    
USERNAME="$OPTARG";;
    
# option w: set path to torrent client watch dir
    
)
        
# check if input is a directory
        
if [ ! -"$OPTARG]; then
            
echo -"\nerror: entered path after option -w is not a directory. make sure the entered path points to a directory."
            
exit 1
        elif 
[ ! -"$OPTARG]; then
            
echo -"\nerror: directory at entered path after option -w is not writable. make sure the entered path points to a writable directory.";
            exit 
1
        
else
            
TORRENTS="$OPTARG"
        
fi;;
    
# option x: set test string
    
TEST=$OPTARG;;
    
# option y: use this piece size
    
)
        if [[ 
$OPTARG =~ ^[0-9]*$ ]] && [ $OPTARG -ge 15 ] && [ $OPTARG -le 28 ]; then
            PIECE_SIZE
=$OPTARG
        
else
            echo -
"\nerror: entered value after option -y was not a valid piece size value. run \`upload -h' for command explanation."
            
exit 1
        fi
;;
    
# option z: set what piece size NOT to use
    
)
        
# min piece size: 2^15
        
MIN=32768
        
# max piece size: 2^28
        
MAX=268435456

        
# check if input is a number
        
if [[ $OPTARG =~ ^[0-9]*$ ]] && [ $OPTARG -ge $MIN ] && [ $OPTARG -le $MAX ]; then
            
# start at min piece size
            
NUM=15

            
# check all piece sizes
            
while [ $MAX -ge $MIN ]; do
                
# if input is larger than piece size increase by 1
                
if [ $OPTARG -gt $MAX ]; then
                    let NUM
+=1
                fi
                
# divide by 2 to get previous 2^x value
                
let MAX/=2
            done

            NOTPIECES
=$NUM
        
else
            echo -
"\nerror: entered value after option -z was not a valid piece size value. run \`upload -h' for command explanation."
            
exit 1
        fi
;;
    
# option *: unknown option. return with an error
    
* )
        echo -
"\nerror: -$OPTARG: this option was not recognised. run \`upload -h' for command explanation."
        
exit 1;;
    
esac
done

# check if the command mktorrent was found
if ( ! which "$MKT&>/dev/null ); then
    
echo -"\nerror: \`$MKT' is not a command. make sure the path of MKTORRENT is right."
    
exit 1
# check if the command curl was found
elif ( ! which "$CURL&>/dev/null ); then
    
echo -"\nerror: \`curl' is not a command. make sure the path of CURL is right. if not installed: run as root [or sudo] \`apt-get install curl' and try again."
    
exit 1
# check if the command rtorrent_fast_resume was found
elif [ -"$RFR] && ( ! which "$RFR&>/dev/null ); then
    
echo -"\nerror: \`$RFR' is not a command. make sure the path of RFR [ rtorrent_fast_resume.pl ] is right."
    
exit 1
fi

# check if downloads dir is a dir
if [ ! -"$DOWNLOADS]; then
    
echo -"\nerror: \`$DOWNLOADS' is not a directory. make sure the path of DOWNLOADS is right."
    
exit 1
# check if downloads dir is readable
elif [ ! -"$DOWNLOADS]; then
    
echo -"\nerror: \`$DOWNLOADS' is not readable. make sure the path of DOWNLOADS points to a readable directory."
    
exit 1
# check if torrents dir is a dir
elif [ ! -"$TORRENTS]; then
    
echo -"\nerror: \`$TORRENTS' is not a directory. make sure the path of TORRENTS is right."
    
exit 1
# check if torrents dir is writable
elif [ ! -"$TORRENTS]; then
    
echo -"\nerror: \`$TORRENTS' is not writable. make sure the path of TORRENTS points to a writable directory."
    
exit 1
# check if logfile is a dir
elif [ -"$LOGFILE] || [[ "$LOGFILE= */ ]]; then
    
echo -"\nerror: \`$LOGFILE' is a directory. make sure the path of LOGFILE points to a file."
    
exit 1
# check if logfile dir exists
elif [ ! -$(dirname "$LOGFILE") ]; then
    
echo -"\nerror: \`$LOGFILE' has a path to a directory that does not exist."
    
exit 1
fi

# check for ending slash in torrents dir and if not exist append it
if [[ "$DOWNLOADS!= */ ]]; then
    DOWNLOADS
="$DOWNLOADS/"
fi

# check for ending slash in torrents dir and if not exists append it
if [[ "$TORRENTS!= */ ]]; then
    TORRENTS
="$TORRENTS/"
fi

# switch to entered variables after options
shift $((OPTIND-1))

# if no variables were passed to the script show an error
if [ ! -"$1" ]; then
    
echo -"\nerror: you did not enter a path. run \`upload -h' for command explanation."
    
exit 1
# if a third variable was passed to the script show an error
elif [ -"$2" ]; then
    
echo -"\nerror: you entered too many variables. run \`upload -h' for command explanation."
    
exit 1
fi

# set the entered path
RLSPATH="$1"

# if entered path does not contain a / prepend the download dir
if [[ ! "$RLSPATH=~ \/ ]]; then
    RLSPATH
="$DOWNLOADS$RLSPATH"
fi

# check if entered path is a directory
if [ ! -"$RLSPATH]; then
    
echo -"\nerror: \`$RLSPATH' is not a directory."
    
exit 1
fi

# move to the entered path
cd "$RLSPATH"

# get the full path
FPATH="$PWD"

# get the dir name from the path by removing the download dir prefix
NAME=${FPATH/$DOWNLOADS/}

# replace & with its hex value for searching
SEARCHNAME=${NAME//&/%26/}

# if the name is the same as the path it's not in the downloads dir so return an error
if [ "$NAME"$FPATH]; then
    
echo -"\nerror: \`$FPATH' is not in \`$DOWNLOADS'."
    
exit 1
fi

# check filters
if [ ! -"$CAT] && [ ! -"$TAG]; then
    FMATCH
=0
    
# walk array of filters and search for a match
    
for (( 0< ${#FILTERS[@]}; i++ )); do
        # if a match was found set the min, max and category and stop looping
        
if [[ "$RLSPATH=~ ${FILTERS[$i]} ]] && [[ ! -${EXCEPTS[i]} || ! "$RLSPATH=~ ${EXCEPTS[i]} ]] && [[ ! -"$CAT|| "$CAT"${CATS[i]}]]; then
            MINSIZE
=${MINS[i]}
            
MAXSIZE=${MAXS[i]}
            
CAT=${CATS[i]}
            
TAG=${TAGS[i]}
            
FMATCH=1
            
break
        
fi
    done

    
# if no match found return an error
    
if [ $FMATCH -eq 0 ]; then
        
echo -"\nerror: no match was found with your filters."
        
exit 1
    fi
fi

# check p2p flag
if [ ! -"$P2P]; then
    P2PMATCH
=0
    
# walk array of p2p groups and search for a match
    
if [[ "$RLSPATH=~ $P2PCATS ]] && [[ ! -n $P2PEXCEPTS || ! "$RLSPATH=~ $P2PEXCEPTS ]]; then
    P2PMATCH
=1
    fi
fi

# check if filters need to be tested
if [[ $TEST =~ cat ]]; then
    
echo -"\nfilter test complete\ncategory found: $CAT"
    
exit 1
fi

# check if p2p need to be tested
if [[ $TEST =~ p2p ]]; then
    
echo -"\np2p test complete\nIs match found: $P2PMATCH"
    
exit 1
fi

# get the dir size
SIZE=$(du -"$FPATHcut -f 1)

# get the dir size in MB
MBs=$((SIZE/1024))
if [[ 
$MBs -eq "0" ]] && [[ $SIZE -gt "0" ]]; then
    MBs
=1
fi

# look for match with size filter and if found return an error
if [ -"$FMATCH] && [[ $MBs -lt $MINSIZE || $MBs -gt $MAXSIZE ]]; then
    
echo -"\nerror: $MBs MB is lower than $MINSIZE MB or greater than $MAXSIZE MB."
    
exit 1
fi

# if release is already being uploaded return an error, else create uploading directory
if [ $UPCHECK -eq 1 ] && [ -"$FPATH] && [ -"$FPATH/.uploading" ]; then
    
echo -"\nerror: torrent is already being uploaded (.uploading directory found in release directory).";
    exit 
1
elif 
[ -"$FPATH] && [ ! -"$FPATH/.uploading" ]; then
    mkdir 
"$FPATH/.uploading"
fi

# create and move to process dir
mkdir -"/tmp/upload-processes-$USER/$$"
cd "/tmp/upload-processes-$USER/$$"

# set main log
MAINLOG="$LOGFILE"

# set temp log
LOGFILE="log.tmp"

# log start script and info
echo >> "$LOGFILE"
echo "########################################################" >> "$LOGFILE"
echo "### auto upload started at: $(date)" >> "$LOGFILE"
echo "### name: $NAME>> "$LOGFILE"
echo "### path: $FPATH>> "$LOGFILE"
echo "### size: $MBs MB" >> "$LOGFILE"
echo "### cat: $CAT>> "$LOGFILE"
echo "### tags: $TAG>> "$LOGFILE"

# enable CTRL+C and kill trap
trap signal_trap SIGINT SIGTERM

# check if uploading needs to be done so we need to log in and look for a dupe
if [[ ! $TEST =~ mkt ]] && [[ ! $TEST =~ rfr ]]; then
    
echo -en "\nlogging in . . ."

    
# start dot function
    
progress &

    
# get process pid
    
PROCESS=$!

    
# disown process to supress output
    
disown %%

    
# log in to the site
    
wget -"$USERAGENT---no-check-certificate -O login.tmp --save-cookies cookies.tmp --keep-session-cookies --post-data "$LOGINUSR=$USERNAME&$LOGINPWD=$PASSWORD" "$LOGINURL"

    
# when done kill dot function
    
kill -9 $PROCESS
    
unset PROCESS

    
# check if you are logged in
    
LOGINCHECK=$(grep "$LOGINTXTlogin.tmp)

    
# if you are not logged in stop the auto upload
    
if [ ! -"$LOGINCHECK]; then
        
echo -"\b failed\n\nerror: it appears you could not be logged in. check login settings."
        
echo "### error: it appears you could not be logged in" >> "$LOGFILE"
        
cleanup_process "login"
        
exit 1
    fi

    
echo -en " logged in\n\nchecking for dupe . . ."

    
# start dot function
    
progress &

    
# get process pid
    
PROCESS=$!

    
# disown process to supress output
    
disown %%

    
# search the site for the torrent
    
wget -"$USERAGENT---no-check-certificate -O dupecheck.tmp --load-cookies cookies.tmp "$SEARCHURL$SEARCHNAME"

    
# when done kill the dot function
    
kill -9 $PROCESS
    
unset PROCESS

    
# check if a result was found
    
DUPECHECK=$(grep "$SEARCHTXTdupecheck.tmp)

    
# If we are dupe checking, dump out debugging and exit
    
if [[ $TEST =~ dupe ]]; then
       
echo -"\ndupe was checked with: $SEARCHURL$SEARCHNAME"
       
echo "dupe filtered with: $SEARCHTXT"
       
echo "dupe result: $DUPECHECK"
       
cleanup_process "dupecheck"
       
exit 1
    fi

    
# if a result was found stop the auto upload
    
if [ ! -"$DUPECHECK]; then
        
echo -"\bdupe found\n\nerror: torrent has already been uploaded."
        
echo "### error: torrent has already been uploaded" >> "$LOGFILE"

        
# check if the duped release needs to be downloaded
        
if [ $DUPEDL -eq 1 ]; then
            
# grab download link
            
DLPAGE=$(grep "$DUPETXTdupecheck.tmp $DUPECMD)
            
DLPAGE=${DLPAGE//&amp;/&}

            # download torrent
            
echo -"\ndownloading: $DUPEURL$DLPAGE"
            
wget -"$USERAGENT---no-check-certificate -"$NAME.torrent" --load-cookies cookies.tmp "$DUPEURL$DLPAGE"
            
echo "### downloaded: $DUPEURL$DLPAGE>> "$LOGFILE"

            
# check if rtorrent_fast_resume.pl needs to be done
            
if [ -"$RFR]; then
                
"$RFR" "$DOWNLOADS"$NAME.torrent" "$TORRENTS$PREPEND$NAME.torrent"
            
else
                
mv "$NAME.torrent" "$TORRENTS$PREPEND$NAME.torrent"
            
fi
        fi

        cleanup_process 
"dupe"
        
exit 1
    fi

    
echo -"\bno dupe found\n"
fi

if ( which bc &>/dev/null ); then
  PIECES
=$(printf '%.0f' $(echo "l($MBs)/l(2)+10" bc -l))
  echo 
"Piece size calculated: 2^$PIECES"
  
if [ $PIECES -gt 28 ]; then
        PIECES
=28
  fi
  
if [ $PIECES -lt 15 ]; then
    PIECES
=15
  fi
fi
if [ $PIECES -lt 15 ] || [ $PIECES -gt 28 ] || [ "$PIECES"" ]; then
    
# calculate piece size depending on dir size

    # > 473 GB -> 32 MB piece size (15.136+ pieces)
    
if [ $MBs -gt 484352 ]; then
            PIECES
=28    #was 24
    # 190 - 473 GB -> 16 MB piece size (12160 - 30272 pieces)
    
elif $MBs -gt 194560 ]; then
            PIECES
=27    #was 24
    # 72 - 190 GB -> 8 MB piece size (9216 - 24320 pieces)
    
elif $MBs -gt 73728 ]; then
            PIECES
=26    #was 23
    # 16 - 72 GB -> 4 MB piece size (4096 - 18432 pieces)
    
elif $MBs -gt 16384 ]; then
            PIECES
=25    #was 22
    # 8 - 16 GB -> 2 MB piece size (4096 - 8192 pieces)
    
elif $MBs -gt 8192 ]; then
            PIECES
=23    #was 21
    # 4 - 8 GB -> 1 MB piece size (4096 - 8192 pieces)
    
elif $MBs -gt 4096 ]; then
            PIECES
=22    #was 20
    # 2 - 4 GB -> 512 KB piece size (4096 - 8192 pieces)
    
elif $MBs -gt 2048 ]; then
            PIECES
=21    #was 19
    # 1 - 2 GB -> 256 KB piece size (4096 - 8192 pieces)
    
elif $MBs -gt 1024 ]; then
            PIECES
=20    #was 18
    # 512 MB - 1 GB -> 128 KB piece size (4096 - 8192 pieces)
    
elif $MBs -gt 512 ]; then
            PIECES
=19    #was 17
    # 256 MB - 512 MB -> 64 KB piece size (4096 - 8192 pieces)
    
elif $MBs -gt 256 ]; then
                PIECES
=18    #was 16
    # < 256 MB -> 32 KB piece size (1 - 8192 pieces)
    
else
            
PIECES=16    #was  15
    
fi
    
echo "Piece picked from table: 2^$PIECES"
fi

# set specified piece size
if [ -"$PIECE_SIZE]; then
    PIECES
=$PIECE_SIZE
fi

# if piece size matched entered piece size not to chose size and is highest possible piece size decrement by 1
if [[ $NOTPIECES -eq $PIECES ]] && [ $PIECES -eq 28 ]; then
    let PIECES
-=1
    
echo "### original piece size: $NOTPIECES ("$((2**NOTPIECES))" bytes)" >> "$LOGFILE"
    
echo "### piece size: $PIECES ("$((2**PIECES))" bytes)" >> "$LOGFILE"
# if piece size matched entered piece size not to chose increment by 1
elif [[ $NOTPIECES -eq $PIECES ]]; then
    let PIECES
+=1
    
echo "### original piece size: $NOTPIECES ("$((2**NOTPIECES))" bytes)" >> "$LOGFILE"
    
echo "### piece size: $PIECES ("$((2**PIECES))" bytes)" >> "$LOGFILE"
# log piece size
else
    echo 
"### piece size: $PIECES ("$((2**PIECES))" bytes)" >> "$LOGFILE"
fi

# log start mktorrent
echo "### mktorrent started: $(date)" >> "$LOGFILE"

# create the torrent
"$MKT-l $PIECES -"RM" -"$NAME.torrent" -pa "$ANNOUNCEURL" "$FPATH"

# log complete mktorrent
echo "### mktorrent completed: $(date)" >> "$LOGFILE"

# check if uploading needs to be done
if [[ ! $TEST =~ mkt ]] && [[ ! $TEST =~ rfr ]]; then
    
echo -en "\nchecking for dupe . . ."

    
# start dot function
    
progress &

    
# get process pid
    
PROCESS=$!

    
# disown process to supress output
    
disown %%

    
# search the site for the torrent
    
wget -"$USERAGENT---no-check-certificate -O dupecheck.tmp --load-cookies cookies.tmp "$SEARCHURL$SEARCHNAME"

    
# when done kill the dot function
    
kill -9 $PROCESS
    
unset PROCESS

    
# check if you are logged in
    
LOGINCHECK=$(grep "$LOGINTXTdupecheck.tmp)

    
# if you are not logged in try to log in again
    
if [ ! -"$LOGINCHECK]; then
        
echo -en " failed to log in\n\nlogging in . . ."

        
# start dot function
        
progress &

        
# get process pid
        
PROCESS=$!

        
# disown process to supress output
        
disown %%

        
# log in again
        
wget -"$USERAGENT---no-check-certificate -O login.tmp --save-cookies cookies.tmp --keep-session-cookies --post-data "$LOGINUSR=$USERNAME&$LOGINPWD=$PASSWORD" "$LOGINURL"

        
# when done kill the function
        
kill -9 $PROCESS
        
unset PROCESS

        
# check if you are logged in
        
LOGINCHECK=$(grep "$LOGINTXTlogin.tmp)

        
# if you are not logged in stop the auto upload
        
if [ ! -"$LOGINCHECK]; then
            mv 
"$NAME.torrent" "/tmp/upload-processes-$USER/$PREPEND$NAME.torrent"
            
echo -"\bfailed\n\nerror: it appears you could not be logged in - torrent saved: \`/tmp/upload-processes-$USER/$PREPEND$NAME.torrent'."
            
echo "### error: it appears you could not be logged in - torrent saved: /tmp/upload-processes-$USER/$PREPEND$NAME.torrent" >> "$LOGFILE"
            
cleanup_process "login"
            
exit 1
        fi
        
echo -en " logged in\n\nchecking for dupe . . ."

        
# start dot function
        
progress &

        
# get process pid
        
PROCESS=$!

        
# disown process to supress output
        
disown %%

        
# search the site for the torrent
        
wget -"$USERAGENT---no-check-certificate -O dupecheck.tmp --load-cookies cookies.tmp "$SEARCHURL$SEARCHNAME"

        
# when done kill the dot function
        
kill -9 $PROCESS
        
unset PROCESS
    fi

    
# check if a result was found
    
DUPECHECK=$(grep "$SEARCHTXTdupecheck.tmp)

    
# if a result was found stop the auto upload
    
if [ ! -"$DUPECHECK]; then
        rm 
-"$NAME.torrent"
        
echo -"\bdupe found\n\nerror: torrent has already been uploaded - torrent removed."
        
echo "### error: torrent has already been uploaded - torrent removed" >> "$LOGFILE"

        
# check if the duped release needs to be downloaded
        
if [ $DUPEDL -eq 1 ]; then
            
# grab download link
            
DLPAGE=$(grep "$DUPETXTdupecheck.tmp $DUPECMD)
            
DLPAGE=${DLPAGE//&amp;/&}

            # download torrent
            
echo -"\ndownloading: $DUPEURL$DLPAGE"
            
wget -"$USERAGENT---no-check-certificate -"$NAME.torrent" --load-cookies cookies.tmp "$DUPEURL$DLPAGE"
            
echo "### downloaded: $DUPEURL$DLPAGE>> "$LOGFILE"

            
# check if rtorrent_fast_resume.pl needs to be done
            
if [ -"$RFR]; then
                
"$RFR" "$DOWNLOADS"$NAME.torrent" "$TORRENTS$PREPEND$NAME.torrent"
            
# check if the mktorrent created torrent needs to be moved
            
else
                
mv "$NAME.torrent" "$TORRENTS$PREPEND$NAME.torrent"
            
fi
        fi

        cleanup_process 
"dupe"
        
exit 1
    fi

    
echo -"\bno dupe found"

    
# look for an NFO in the top dir
    
NFO=$(find "$FPATH-maxdepth 1 -iname *.nfo -print -quit)

    
# if no NFO has been found look for an NFO in subdirs
    
if [ ! -"$NFO]; then
        NFO
=$(find "$FPATH-iname *.nfo -print -quit)
    
fi

    
# if no NFO has been found create one to enter description
    
if [ ! -"$NFO]; then
        
echo "### nfo: not found, creating custom description" >> "$LOGFILE"
        
echo "name: $NAME"nfo.tmp"
        
echo "category: $CAT>> "nfo.tmp"
        
echo "size: $MBs MB ($SIZE kB)" >> "nfo.tmp"
        
echo "No NFO was supplied for this release" >> "nfo.tmp"
        
NFO="nfo.tmp"
    
else
        echo 
"### nfo: $NFO>> "$LOGFILE"
    
fi

    
echo -en "\nuploading torrent . . ."

    
# start dot function
    
progress &

    
# get process pid
    
PROCESS=$!

    
# disown process to supress output
    
disown %%

 
#   if [ $P2PMATCH -eq 1 ]; then
#    P2PXTRA = "-F 'p2p=on'"
  #  else
    #P2PXTRA = "=F 'p2p=off'"
  #  fi
  
#Strip the NFO
    
strings $NFO strnfo.tmp
    grep 
-'^ *$' strnfo.tmp newnfo.tmp
    STRNFO
="newnfo.tmp"

#grap the auth key from the upload page 
    
wget -"$USERAGENT---no-check-certificate -O getauth.tmp --load-cookies cookies.tmp "$UPLOADURL"
    
AUTHTAG="auth"
    
AUTH=$(sed -'s/.*name="auth"\s\+value="\([^"]\+\).*/\1/p' getauth.tmp)

    
# prepare the upload command
    
eval "UPLOADXTRA=\"$UPLOADXTRA\""
    
UPLOADCMD="'$CURL' -s -k -o upload.tmp -b cookies.tmp -A '$USERAGENT' -H 'Expect:' -F '$UPLOADCAT=$CAT' -F '$UPLOADTAG=$TAG' -F '$UPLOADTITLE=$NAME' -F '$UPLOADTOR=@$NAME.torrent' -F '$AUTHTAG=$AUTH$UPLOADXTRA '$UPLOADURL'"
    
# $P2PXTRA 
    # execute the upload command (need to use eval for $UPLOADXTRA)
    
    
eval $UPLOADCMD

    
# when done kill the dot function
    
kill -9 $PROCESS
    
unset PROCESS

    
echo -"\bupload complete"

    
if [ -e upload.tmp ] && [ $(cat upload.tmp wc -c) -ne 1 ]; then
        mv 
"upload.tmp" "/tmp/upload-processes-$USER/upload$$.tmp"
        
echo -"NOTE: the site returned something. make sure the upload is working properly. you might need to re-download the torrent.\ncheck the content of \`/tmp/upload-processes-$USER/upload$$.tmp' for the exact output.\n"
    
fi
fi

# check if rtorrent_fast_resume.pl needs to be done
if [ -"$RFR] && [[ ! $TEST =~ mkt ]]; then
    
"$RFR" "$DOWNLOADS"$NAME.torrent" "$TORRENTS$PREPEND$NAME.torrent"
# check if the mktorrent created torrent needs to be moved
elif [[ ! $TEST =~ mkt ]]; then
    mv 
"$NAME.torrent" "$TORRENTS$PREPEND$NAME.torrent"
fi

if [[ $TEST =~ mkt ]]; then
    mv 
"$NAME.torrent" "/tmp/upload-processes-$USER/$PREPEND$NAME.torrent"
    
echo -"\nmktorrent test completed\ntorrent saved: /tmp/upload-processes-$USER/$PREPEND$NAME.torrent"
    
echo "### mktorrent test completed - torrent saved: /tmp/upload-processes-$USER/$PREPEND$NAME.torrent" >> "$LOGFILE"
    
echo "### auto upload completed at: $(date)" >> "$LOGFILE"
    
cleanup_process
    
exit 1
fi

# echo script completion
echo -"\ntorrent moved to torrent client watch dir."
echo "### auto upload completed at: $(date)" >> "$LOGFILE"

# delete the process directory
cleanup_process

# check if uploaded dir exists and if not create it
if [[ ! $TEST =~ rfr ]] && [ ! -"$FPATH/.uploaded" ]; then
    mkdir 
"$FPATH/.uploaded"
fi

###############################
##        SCRIPT END         ##
############################### 
wrapper
PHP Code:
#!/bin/bash
HOME=/home/cofix/upload

# if invoked by the webui
if [ $"webui" ]; then
    
if [ $"reset" ]; then
        
if [ -"$3" ]; then
            rm 
-rf "$3/.uploading"
            
rm -rf "$3/.uploaded"
            
rm -rf "$3/.uploaderror"
        
fi
    elif 
[ $"hide" ]; then
        
if [ -"$3" ] && [ ! -"$3/.hidden" ]; then
            mkdir 
"$3/.hidden"
        
fi
    
else
        
        if [ -
"$5" ] && [[ $=~ ^[0-9]*$ ]] && [ $-ge 15 ] && [ $-le 28 ]; then
            TAGS
="";
            if [ -
"$6" ]; then
                TAGS
="-t '$6'"
            
fi
            upload 
-$-"$2" -"$3" "$4" $TAGS >/dev/null 2>&&
        else
            
TAGS="";
            if [ -
"$5" ]; then
                TAGS
="-t '$5'"
            
fi
            upload 
-"$2" -"$3" "$4" >/dev/null 2>&&
        
fi
    fi
# if invoked by rtorrent
elif [ $"rtorrent" ]; then
    cd 
"$HOME/upload"
    
upload -$"$3" >/dev/null 2>&&
fi 

webui
PHP Code:
# password to access the webui: required
pass 123456789

# path to downloads dir: required
data = /home/cofix/downloads/

# default directory sorting type: latest / alphabetically
datasort latest

# default directory sorting order: asc[ending] / desc[ending]
dataorder desc

# theme to use: light, dark, custom
theme dark

# show directory size on hover over release: 1 = yes, 0 = no
sizes 1

# print the upload command rather than executing it: 1 = yes, 0 = no
debug 0

# show only these sites in the dropdown: case-insensitive comma seperated list
sites AOTV

# sort sites alphabetically: 1 = yes, 0 = no
sitesort 1

# sort categories alphabetically: 1 = yes, 0 = no
catsort 

.upload.rc
PHP Code:
#!/bin/bash
####################################
##    example resource file for   ##
##      torrent upload script     ##
##                                ##
##      save in ~/.upload.rc      ##
##  chmod 700 to restrict access  ##
####################################
##         LOGIN SETTINGS         ##
####################################

# your website username
USERNAME="CoFix"

# your website password
PASSWORD="*******"

# website login URL
LOGINURL="https://www.torrentleech.org/user/account/login/"

# logged in text: something _unique_ to check if you are logged in
# possibly your username if it's unique and on the page you get directed to after logging in
LOGINTXT="CoFix"

# login form username: look for input NAME="username"
LOGINUSR="username"

# login form password: look for input NAME="password"
LOGINPWD="password"


####################################
##         SEARCH SETTINGS        ##
####################################

# website search URL
SEARCHURL="https://www.torrentleech.org/torrents/browse/index/query/"

# search no result text: something _unique_ to check if no results are found
SEARCHTXT="Sorry: There are no results found, based on your search parameters. Please refine your search."

# download dupe: 1 = yes, 0 = no
# note: only possible if download link is on the torrents page
DUPEDL=0    /*i choose 0 but still getting this => error: torrent has already been uploaded. */

# URL that needs to be prepended to the download URL
DUPEURL="https://www.torrentleech.org/torrents/browse/index/query/"

# search download link text:  something _unique_ to find the exact line
DUPETXT="action=download"

# command to extract the download link from the complete line
# note: test for the best way to get it outside the script first
DUPECMD="cut -d \" -f 2"

####################################
##         UPLOAD SETTINGS        ##
####################################

# website upload URL
UPLOADURL="https://www.torrentleech.org/upload"

# your personal announce URL
ANNOUNCEURL="http://wwww.xxx.net/announce.php"

# upload form torrent: look for input NAME="torrent"
UPLOADTOR="torrent"

# upload form category: look for select NAME="category"
UPLOADCAT="category"

# upload title form input
UPLOADTITLE=""       /*Dont know what is this*/

# upload tags
UPLOADTAG="tags"

# upload form extras: look for other inputs with NAME and VALUE
# and add to the list with: -F 'name=value'
UPLOADXTRA=" -F 'submit=true' -F 'desc=<\$STRNFO' -F 'Anonymous=on'"
# The auth field is no longer needed, upload script now auto adds it since version 0.9.7
# -F 'auth='

####################################
##          PATH SETTINGS         ##
####################################

# path to your downloads directory
DOWNLOADS="/home/cofix/downloads"

# path to your torrent client watch directory
TORRENTS="/home/cofix/downloads/watch"

# path to your log file: set to /dev/null to disable logging
LOGFILE="/home/cofix/upload/upload.log"

# path to curl: if in $PATH just enter curl
CURL="curl"

# path to mktorrent: if in $PATH just enter mktorrent
MKT="mktorrent"

# path to rtorrent_fast_resume.pl: leave empty if you dont want to use this
RFR="/home/cofix/nh.pl"


####################################
##       ADVANCED SETTINGS        ##
####################################

# string used to identify as a specific user-agent
USERAGENT="Mozilla/5.0"

# text to prepend on the torrent file before moving it to your torrents dir
PREPEND="downloads."

# check for already uploading: use with UPCHECK - 1 = yes, 0 = no
# you only need to disable this if you expect to upload the same torrent multiple times at the same time
UPCHECK=0

# list of categories able to be uploaded into: look for options after select NAME=category
# if the option value is a number add it _after_ the category name
ALLCATS=( "TV/XviD" "TV/HD" "TV/Pack" "Movies/XviD" "Movies/DVDR" "Movies/BluRay" "Movie/Pack" "XXX/XviD" "Games/PC" "Games/Xbox" "Games/PSX" "Games/Wii" "Games/Misc" "Games/Pack" "Music/MP3" "Music/FLAC" "Music/Video" "Music/Misc" "Music/Pack" "0day" "Ebook" "Misc" )

# list of groups that should be flagged as p2p. Format: "(-GrpName1|-Grpname2)", dont forget the seperator :)
P2PCATS="(-NYDIC|-26K|-CM8|-THETA|-3DM|-NFT|-LAZi|-FUSiON|-P2P|-XWT|-LTW|-FLAWL3SS|-IMAGiNE|-SIC|-ViSiON|-Rx|-FreaK|-CaLLiOPEd|-P2PROCKS|-J4F|-aXXo|-CtrlHD|-DEViSE|-DON|-D-ZON3|-ESiR|-EuReKA|-FOM|-GRiM|-iAPULA|-iLL|-JamBo|-KingBen|-LTRG|-LTT|-Lynks|-Prodji|-STG|-Stuffies|-TD|-TDM|-TFE|-THS|-TLF|-VamPTV|-ViEW|-Vision|-VoX|-vRs|-AJP|-ALLCRiME|-AXIA|-B-G|-BLaZekVCD|-DEViSE|-DiSHON|-DNR|-ELEKTRI4KA|-EMiNENCE|-EOS|-EOSiNT|-ESiR|-Funner|-GHEYLARD|-G0LDz|-HDB|-HDC|-HDmonSK|-HDV|-HDxT|-iAPULA|-iLL|-iRO|-KingBen|-Lynks|-M14CH0|-M794|-McFly|-MMI|-PerfectionHD|-PoTuS|-PrisM|-STG|-Stuffies|-TDM|-THS|-TFE|-THORA|-tK|-TLF|-TRiBE|-TriggeR|-XSHD|-sDx|-HWE|-OOO)"
P2PEXCEPTS=""

# is the option value different than the category name? 1 = yes, 0 = no
KEYVAL=1

####################################
##        FILTERS SETTING         ##
##                                ##
## - FILTERS : case insensitive   ##
## - EXCEPTS : case insensitive   ##
## - MINS    : min size in MB     ##
## - MAXS    : max size in MB     ##
## - CATS    : case sensitive,    ##
##             look at allcats.   ##
##             if KEYVAL use NUM  ##
##                                ##
##  NOTE: make sure the filter    ##
##        ends with `let n+=1'    ##
##                                ##
####################################

#FILTERS[n]=REGEX
#EXCEPTS[n]=REGEX
#MINS[n]=NUMBER
#MAXS[n]=NUMBER
#CATS[n]=NUMBER|STRING
n=0

# match starts with House or Simpsons or South Park S00E00 in format XviD which are not DSR or REPACK and are between 70 and 400 MB
FILTERS[n]="^(house|simpsons|south.park).*S[0-9]{2}E[0-9]{2}.*XviD"
EXCEPTS[n]="DSR|REPACK"
MINS[n]=70
MAXS
[n]=400
CATS
[n]="TV/XviD"
let n+=1

# match starts with House or CSI or NCIS S00E00 in format 720p which are between 800 and 1500 MB (1.5 GB)
FILTERS[n]="^(house|CSI|NCIS).*S[0-9]{2}E[0-9]{2}.*720p"
EXCEPTS[n]=
MINS[n]=800
MAXS
[n]=1500
CATS
[n]="TV/HD"
let n+=1

# match XXX.DVDRip.XviD which are not REPACK or PROPER and are between 650 and 750 MB
FILTERS[n]="XXX.DVDRip.XviD"
EXCEPTS[n]="REPACK|PROPER"
MINS[n]=650
MAXS
[n]=750
CATS
[n]="XXX/XviD"
let n+=1

# match DVDRip.XviD which are between 650 and 1500 MB (1.5 GB)
# NOTE: this is placed after series and XXX filters so it doesn't match most DVDRip series or XXX
# NOTE: if a DVDRip series or documentary which is not S00E00 format it will be matched as well so this filter might not be trusted
FILTERS[n]="DVDRip.XviD"
EXCEPTS[n]=
MINS[n]=650
MAXS
[n]=1500
CATS
[n]="Movies/XviD"
let n+=1

##################################
##         SETTINGS END         ##
################################## 


.td.rc
PHP Code:
#!/bin/bash
####################################
##    example resource file for   ##
##      torrent upload script     ##
##                                ##
##      save in ~/.upload.rc      ##
##  chmod 700 to restrict access  ##
####################################
##         LOGIN SETTINGS         ##
####################################

# your website username
USERNAME="CoFix"

# your website password
PASSWORD="*******"

# website login URL
LOGINURL="https://www.torrentleech.org/user/account/login/"

# logged in text: something _unique_ to check if you are logged in
# possibly your username if it's unique and on the page you get directed to after logging in
LOGINTXT="CoFix"

# login form username: look for input NAME="username"
LOGINUSR="username"

# login form password: look for input NAME="password"
LOGINPWD="password"


####################################
##         SEARCH SETTINGS        ##
####################################

# website search URL
SEARCHURL="https://www.torrentleech.org/torrents/browse/index/query/"

# search no result text: something _unique_ to check if no results are found
SEARCHTXT="Sorry: There are no results found, based on your search parameters. Please refine your search."

# download dupe: 1 = yes, 0 = no
# note: only possible if download link is on the torrents page
DUPEDL=0    /*i choose 0 but still getting this => error: torrent has already been uploaded. */

# URL that needs to be prepended to the download URL
DUPEURL="https://www.torrentleech.org/torrents/browse/index/query/"

# search download link text:  something _unique_ to find the exact line
DUPETXT="action=download"

# command to extract the download link from the complete line
# note: test for the best way to get it outside the script first
DUPECMD="cut -d \" -f 2"

####################################
##         UPLOAD SETTINGS        ##
####################################

# website upload URL
UPLOADURL="https://www.torrentleech.org/upload"

# your personal announce URL
ANNOUNCEURL="http://wwww.xxx.net/announce.php"

# upload form torrent: look for input NAME="torrent"
UPLOADTOR="torrent"

# upload form category: look for select NAME="category"
UPLOADCAT="category"

# upload title form input
UPLOADTITLE=""       /*Dont know what is this*/

# upload tags
UPLOADTAG="tags"

# upload form extras: look for other inputs with NAME and VALUE
# and add to the list with: -F 'name=value'
UPLOADXTRA=" -F 'submit=true' -F 'desc=<\$STRNFO' -F 'Anonymous=on'"
# The auth field is no longer needed, upload script now auto adds it since version 0.9.7
# -F 'auth='

####################################
##          PATH SETTINGS         ##
####################################

# path to your downloads directory
DOWNLOADS="/home/cofix/downloads"

# path to your torrent client watch directory
TORRENTS="/home/cofix/downloads/watch"

# path to your log file: set to /dev/null to disable logging
LOGFILE="/home/cofix/upload/upload.log"

# path to curl: if in $PATH just enter curl
CURL="curl"

# path to mktorrent: if in $PATH just enter mktorrent
MKT="mktorrent"

# path to rtorrent_fast_resume.pl: leave empty if you dont want to use this
RFR="/home/cofix/nh.pl"


####################################
##       ADVANCED SETTINGS        ##
####################################

# string used to identify as a specific user-agent
USERAGENT="Mozilla/5.0"

# text to prepend on the torrent file before moving it to your torrents dir
PREPEND="downloads."

# check for already uploading: use with UPCHECK - 1 = yes, 0 = no
# you only need to disable this if you expect to upload the same torrent multiple times at the same time
UPCHECK=0

# list of categories able to be uploaded into: look for options after select NAME=category
# if the option value is a number add it _after_ the category name
ALLCATS=( "TV/XviD" "TV/HD" "TV/Pack" "Movies/XviD" "Movies/DVDR" "Movies/BluRay" "Movie/Pack" "XXX/XviD" "Games/PC" "Games/Xbox" "Games/PSX" "Games/Wii" "Games/Misc" "Games/Pack" "Music/MP3" "Music/FLAC" "Music/Video" "Music/Misc" "Music/Pack" "0day" "Ebook" "Misc" )

# list of groups that should be flagged as p2p. Format: "(-GrpName1|-Grpname2)", dont forget the seperator :)
P2PCATS="(-NYDIC|-26K|-CM8|-THETA|-3DM|-NFT|-LAZi|-FUSiON|-P2P|-XWT|-LTW|-FLAWL3SS|-IMAGiNE|-SIC|-ViSiON|-Rx|-FreaK|-CaLLiOPEd|-P2PROCKS|-J4F|-aXXo|-CtrlHD|-DEViSE|-DON|-D-ZON3|-ESiR|-EuReKA|-FOM|-GRiM|-iAPULA|-iLL|-JamBo|-KingBen|-LTRG|-LTT|-Lynks|-Prodji|-STG|-Stuffies|-TD|-TDM|-TFE|-THS|-TLF|-VamPTV|-ViEW|-Vision|-VoX|-vRs|-AJP|-ALLCRiME|-AXIA|-B-G|-BLaZekVCD|-DEViSE|-DiSHON|-DNR|-ELEKTRI4KA|-EMiNENCE|-EOS|-EOSiNT|-ESiR|-Funner|-GHEYLARD|-G0LDz|-HDB|-HDC|-HDmonSK|-HDV|-HDxT|-iAPULA|-iLL|-iRO|-KingBen|-Lynks|-M14CH0|-M794|-McFly|-MMI|-PerfectionHD|-PoTuS|-PrisM|-STG|-Stuffies|-TDM|-THS|-TFE|-THORA|-tK|-TLF|-TRiBE|-TriggeR|-XSHD|-sDx|-HWE|-OOO)"
P2PEXCEPTS=""

# is the option value different than the category name? 1 = yes, 0 = no
KEYVAL=1

####################################
##        FILTERS SETTING         ##
##                                ##
## - FILTERS : case insensitive   ##
## - EXCEPTS : case insensitive   ##
## - MINS    : min size in MB     ##
## - MAXS    : max size in MB     ##
## - CATS    : case sensitive,    ##
##             look at allcats.   ##
##             if KEYVAL use NUM  ##
##                                ##
##  NOTE: make sure the filter    ##
##        ends with `let n+=1'    ##
##                                ##
####################################

#FILTERS[n]=REGEX
#EXCEPTS[n]=REGEX
#MINS[n]=NUMBER
#MAXS[n]=NUMBER
#CATS[n]=NUMBER|STRING
n=0

# match starts with House or Simpsons or South Park S00E00 in format XviD which are not DSR or REPACK and are between 70 and 400 MB
FILTERS[n]="^(house|simpsons|south.park).*S[0-9]{2}E[0-9]{2}.*XviD"
EXCEPTS[n]="DSR|REPACK"
MINS[n]=70
MAXS
[n]=400
CATS
[n]="TV/XviD"
let n+=1

# match starts with House or CSI or NCIS S00E00 in format 720p which are between 800 and 1500 MB (1.5 GB)
FILTERS[n]="^(house|CSI|NCIS).*S[0-9]{2}E[0-9]{2}.*720p"
EXCEPTS[n]=
MINS[n]=800
MAXS
[n]=1500
CATS
[n]="TV/HD"
let n+=1

# match XXX.DVDRip.XviD which are not REPACK or PROPER and are between 650 and 750 MB
FILTERS[n]="XXX.DVDRip.XviD"
EXCEPTS[n]="REPACK|PROPER"
MINS[n]=650
MAXS
[n]=750
CATS
[n]="XXX/XviD"
let n+=1

# match DVDRip.XviD which are between 650 and 1500 MB (1.5 GB)
# NOTE: this is placed after series and XXX filters so it doesn't match most DVDRip series or XXX
# NOTE: if a DVDRip series or documentary which is not S00E00 format it will be matched as well so this filter might not be trusted
FILTERS[n]="DVDRip.XviD"
EXCEPTS[n]=
MINS[n]=650
MAXS
[n]=1500
CATS
[n]="Movies/XviD"
let n+=1

##################################
##         SETTINGS END         ##
################################## 






my .upload.rc and .td.rc is same
Reply With Quote