#!/bin/bash # PSXC IMDB INFO # ################## # Just edit the 2 lines below, then continue on the "real" config file. # your glftpd root path. GLROOT=/glftpd + GLROOT=/glftpd # path to the config file when chrooted by glftpd. CONFFILE=/etc/psxc-imdb.conf + CONFFILE=/etc/psxc-imdb.conf ## End of config ## ################### # version number. do not change. VERSION="v2.7e" + VERSION=v2.7e ###################################################################################################### RECVDARGS="$1" + RECVDARGS=ils-sf.nfo # check if configfile exists ############################ if [ -r $GLROOT$CONFFILE ]; then . $GLROOT$CONFFILE if [ $? -ne 0 ]; then echo "Unable to open config file ($GLROOT$CONFFILE). Forced to exit." exit 0 fi elif [ -r $CONFFILE ]; then . $CONFFILE if [ $? -ne 0 ]; then echo "Unable to open config file ($CONFFILE). Forced to exit." exit 0 fi else echo "Config file not found. Forced to exit." exit 0 fi + '[' -r /glftpd/etc/psxc-imdb.conf ']' + '[' -r /etc/psxc-imdb.conf ']' + . /etc/psxc-imdb.conf #!/bin/bash ################## # PSXC IMDB INFO # ####################################################### # http://www.grandis.nu/glftpd | http://www.glftpd.at # ####################################################### ####### #CONFIG ########################################################################## ### Global settings. Unless you use a somewhat modified version of ### ### glftpd, these variables will be okay with little or no ### ### modification. ### # this set the debug level. valid levels are 1 to 4. the higher the # number, the more output. To disable, set to "" (default). "ON" is # the same as "2". # Level 1: check a couple of flags for changes. # Level 2: show what is processed in psxc-imdb.sh. # Level 3: show what is processed in psxc-imdb.sh, and what commands # are given. # Level 4: show what is processed in psxc-imdb.sh and in the bash # addons, and what commands are given. DEBUG="" ++ DEBUG= #DEBUG="2" # your glftpd root path. GLROOT=/glftpd ++ GLROOT=/glftpd #GLROOT="" # this path is usually sufficient for chrooted env. - no need to change. PATHCHROOTED=/bin ++ PATHCHROOTED=/bin # PATH variable. Make sure you have all needed executables. PATH=$GLROOT/bin:/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin ++ PATH=/glftpd/bin:/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin # logfile used - chrooted version. This file logs dirname and imdb-url. This # is not the logfile for imdb output - that comes later in the config. IMDBLOGCHROOTED=/ftp-data/logs/psxc-imdb.log ++ IMDBLOGCHROOTED=/ftp-data/logs/psxc-imdb.log # path to logfile for imdb lookups. Same as above (IMDBLOGCHROOTED), just # with the path outside glftpd's chrooted environment. Should not be changed. IMDBLOG=$GLROOT$IMDBLOGCHROOTED ++ IMDBLOG=/glftpd/ftp-data/logs/psxc-imdb.log # path to a logfile which keeps a specified number of IMDb urls. # this is used to prevent the bot from showing IMDB info again and # again for the same file. IMDBURLLOG=$GLROOT$IMDBLOGCHROOTED.keep ++ IMDBURLLOG=/glftpd/ftp-data/logs/psxc-imdb.log.keep # pidfile. IMDBPID=$GLROOT$IMDBLOGCHROOTED.pid ++ IMDBPID=/glftpd/ftp-data/logs/psxc-imdb.log.pid # the number of IMDB urls to keep in the logfile (above). This will prevent # duplicate imdb outputs if the same movie is uploaded more than once. Use # 0 to disable. #KEEPURLS=10 KEEPURLS=0 ++ KEEPURLS=0 # location of the file data for the bot is parsed to, normally glftpd.log. # you might want to change this if normal output doesn't work, or changing # the TRIGGER won't help, or writing to glftpd.log isn't possible. # Remember to use psxc-imdb-full.tcl if you use something other than the # glftpd.log. Read README for more info. GLLOG=$GLROOT/ftp-data/logs/glftpd.log ++ GLLOG=/glftpd/ftp-data/logs/glftpd.log #GLLOG=$GLROOT/ftp-data/logs/psxc-moviedata.log # This logfile is used by the script on !imdb lookups. If you have # psxc-imdb-find.sh installed, you either have to add a bunch to dZSbot.tcl # or use the "full" mode in psxc-imdb-bot.tcl. # psxc-imdb-find.README has more info - it's suggested you read it. # Setting this to "" will log all !imdb requests to GLLOG (default) PSXCFINDLOG="" ++ PSXCFINDLOG= #PSXCFINDLOG=$GLROOT/ftp-data/logs/psxc-moviedata.log # a temp file used to fetch imdb info. TMPFILE=$GLROOT/ftp-data/logs/psxc-imdb.tmp ++ TMPFILE=/glftpd/ftp-data/logs/psxc-imdb.tmp # bold character used for bot. Use "" to disable. BOLD="" ++ BOLD=$'\002' # quote char used. Since tcl and bash freaks out on a few chars, the # script replaces these with the following. Currently, only " is replaced # Do not use " or ` or some other special char here! QUOTECHAR="'" ++ QUOTECHAR=''\''' #QUOTECHAR="_" # should the script look up business data for the opening weekend on the # movie? use "" to disable. USEBUSINESS="YES" ++ USEBUSINESS=YES #USEBUSINESS="" # Show premiere date? Will show date of first public showing/premiere of the # movie. Premiere date takes precedence over public showing like Cannes etc. USEPREMIERE="YES" ++ USEPREMIERE=YES #USEPREMIERE="" # Show limited date? Will show first date of limited showing. USELIMITED="YES" ++ USELIMITED=YES #USELIMITED="" # Lynx retries. This is helpful for those times lynx fails for some reason # to look up the imdb info. LYNXTRIES=3 ++ LYNXTRIES=3 # Lynx flags used. Should probably not be changed, but if the script seem to # fail to look up a lot of imdb infos, you might wish to up the # -connect_timeout= to 20 or 30, depending on your internet line to # USA. Earlier versions of lynx do not have this flag, though, so please # check first. # If you run everything chrooted, use the 2nd line, and make sure lynx.cfg # exists. LYNXFLAGS="-dump -nolist -width=1000 -hiddenlinks=ignore -connect_timeout=10" ++ LYNXFLAGS='-dump -nolist -width=1000 -hiddenlinks=ignore -connect_timeout=10' #LYNXFLAGS="-dump -nolist -width=1000 -hiddenlinks=ignore -connect_timeout=10 -cfg=$GLROOT/etc/lynx.cfg" # To improve reliability even more, the use of wget can help. It's usage is # reccommended. Use "" to disable. USEWGET="YES" ++ USEWGET=YES #USEWGET="" # Allow the script to search for more generic imdb urls. This *may* lead to # false positives, but should not really cause any grief/false lookups. # Default is level 1 relaxation. 0 is *very* strict, 4 is most relaxed. If # you choose any level beyond 1, I would like to recieve the nfo's which # created false positives... So help me improve the routine and send the nfo's # my way ;) The FAQ has more info regarding the different levels. #RELAXEDURLS="1" # "" is the same as "1" RELAXEDURLS="3" # "ON" is the same as "3" ++ RELAXEDURLS=3 # To prevent false positives, you should list dirs here which you expect will # get movie-info. Please note that if you do not list any dirs, *all* nfo's # will be scanned. This is the default. # This list is case sensitive, so spell things correctly. #SCANDIRS="" SCANDIRS="/site/XViD /site/TV /site/ARCHIVE/ /site/REQUESTS /site/LOUNGE" ++ SCANDIRS='/site/XViD /site/TV /site/ARCHIVE/ /site/REQUESTS /site/LOUNGE' # To support international sites, you can change the "us.imdb.com" into a valid # url with info written in your language. For instance, to put "german.imdb.com" # in channel and the .imdb, set this variable to "german". The default is "" which # is equivalent to "us". #LOCALURL="" LOCALURL="swedish" ++ LOCALURL=swedish # When using post_check in glftpd.conf to start this script, it sometimes # do not recieve any arguments passed from glftpd. There is a way around this # but it should only be used if imdb lookups done on releases fail on uploads, # but works when doing a rescan. # I'm not sure how many is affected by this bug, so feedback is appreciated. GLFIX="" ++ GLFIX= #GLFIX="YES" ########################################################################### ### The following will affect output of the script. First the variables ### ### for the bot output. ### # should the script write to glftpd.log (ie, bot support)? Use "" to # disable. USEBOT="YES" ++ USEBOT=YES #USEBOT="" # Trigger for bot. Most bots should be able to show the info with the UPDATE # trigger. If you like to modify your bot for special purposes, edit to # whatever catches your fancy/setup. # Please BE SURE YOU KNOW WHAT YOU ARE DOING before changing this. Just putting # it to something that catches the mood will prevent any output in the channel. # pzs-ng uses IMDB as trigger - changed the default for this. TRIGGER="IMDB:" ++ TRIGGER=IMDB: #TRIGGER="IMDBVAR:" # Same as above, only valid for !imdb output. Please take note that !imdb output # is not as easy as general output - the UPDATE: trigger won't work unless you # edit dZSbot.tcl a bit and add type() and path(). You either have to use the # "full" mode, or edit dZSbot.tcl. You can read more about it in # README.psxc-imdb-find. # pzs-ng uses IMDBFIND - no need to change." FINDTRIGGER="IMDBFIND:" ++ FINDTRIGGER=IMDBFIND: #FINDTRIGGER="IMDFINDVAR:" # Date format used by bot. Edit according to your OS (FBSD/Linux is default) DATE=`date +"%a %b %d %H:%M:%S %Y"` date +"%a %b %d %H:%M:%S %Y" +++ date '+%a %b %d %H:%M:%S %Y' ++ DATE='Wed Sep 27 17:38:55 2006' # To prevent output in channel when movies are uploaded in private/affill/group- # dirs, put the dirs here. Dirs are separated by a space." BOTEXEMPT="/site/GROUPS /site/AFFILS /site/PRIVATE /site/TMP" ++ BOTEXEMPT='/site/GROUPS /site/AFFILS /site/PRIVATE /site/TMP' # The following wil output only ONE LINE OF INFO to the bot. This overrides the # rest of the settings, except BOTHEAD. The line includes Title, Country, Genre, # Rating and IMDb URL. Use "" for normal output. # This setting is ignored if you are using the LOGFORMAT feature (below). #BOTONELINE="" BOTONELINE="YES" ++ BOTONELINE=YES # Same as above, only valid for !imdb output. #FINDBOTONELINE="" FINDBOTONELINE="YES" ++ FINDBOTONELINE=YES # This line will be written prior to whatever IMDB info found. Use "" to disable. # Put RELEASENAME somewhere if you'd like to announce the name of the release. # This setting is ignored if you are using the LOGFORMAT feature. BOTHEAD="Releasename..: RELEASENAME" ++ BOTHEAD='Releasename..: RELEASENAME' #BOTHEAD="IMDb has some interesting facts on RELEASENAME" #BOTHEAD="info on RELEASENAME from IMDb:" #BOTHEAD="" # Should the bot announce who is starring in the movie? Use "" to disable. SHOWSTAR="YES" ++ SHOWSTAR=YES #SHOWSTAR="" # Should the short version of user comments be shown in channel? "" disables SHOWCOMMENTSHORT="YES" ++ SHOWCOMMENTSHORT=YES #SHOWCOMMENTSHORT="" # Showing both Tagline and Plot Outline may be too much to your liking. This variable # will show either Tagline or Plot Outline if either or both are found. Use "TAG" if # you prefer Tagline over Plot Outline, "PLOT" if you prefer Plot Outline over Tagline, # "NONE" to disable both, or "" to show both. # This setting is ignored if you are using the LOGFORMAT feature (above). #TAGPLOT="" # Show both #TAGPLOT="TAG" # Show one, tag prefered TAGPLOT="PLOT" # Show one, plot prefered ++ TAGPLOT=PLOT #TAGPLOT="NONE" # Show none # Logformat used. If you want to format the output yourself, this should help # you do it. To disable, use "" (default). # An example config to be used in dZSbot.tcl can be found in the README. # Valid options are "" (empty), "SPECIAL" for a list of variables passed to the # log, or "MYOWN" for your own formatted output (see below for more). # For pzs-ng, I've changed the default to MYOWN. LOGFORMAT="MYOWN" ++ LOGFORMAT=MYOWN #LOGFORMAT="SPECIAL" # The same as above, only used for !imdb lookups. # For pzs-ng, I've changed the default to MYOWN. FINDLOGFORMAT="MYOWN" ++ FINDLOGFORMAT=MYOWN # The following variables is what the variable %islimited (and $ISLIMITED) in the # extras scripts will be set to, depending on how many screens the movie has had on # opening weekend. If screens is below 500, LIMITEDYES will be used. Else, LIMITEDNO # will be used. If availible, the number of screens in US cinemas is the source. # Please note that this variable is used by INFOFILENAME too (below). LIMITEDYES="limited" ++ LIMITEDYES=limited LIMITEDNO="not limited" ++ LIMITEDNO='not limited' # Maximum number of cast members listed. Global setting. CASTNUM=2 ++ CASTNUM=2 #CASTNUM=99 # Maximum number of countries listed. Global setting. #COUNTRYNUM=2 COUNTRYNUM=99 ++ COUNTRYNUM=99 # Maximum number of languages listed. Global setting. #LANGUAGENUM=2 LANGUAGENUM=99 ++ LANGUAGENUM=99 # Maximum number of certifications listed. Global setting. #CERTIFICATIONNUM=2 CERTIFICATIONNUM=99 ++ CERTIFICATIONNUM=99 # Maximum number of genres listed. Global setting. #GENRENUM=2 GENRENUM=99 ++ GENRENUM=99 # Maximum number of runtimes listed. Global setting. #RUNTIMENUM=2 RUNTIMENUM=99 ++ RUNTIMENUM=99 ############################################################################### ### The next variables will affect output to a file in the release-dir. The ### ### idea here is to show this file when users enters the dir, thus removing ### ### the need to view the .nfo and looking up info on IMDb themselves. Check ### ### the README for more info. ### # The file to write imdb info to in the movie dir. Use "" to disable. DOTIMDB=".imdb" ++ DOTIMDB=.imdb #DOTIMDB="" # Someone requested a separate file for just the link, a .imdb.url # You can also get a .imdb.html, which is imho better. # Use "" to disable (default). DOTURL="" ++ DOTURL= #DOTURL="HTML" #DOTURL="URL" # Should user comment be shown in DOTIMDB? "" disables. This is in some cases a # lot of info - feel your way on this one. Default is disabled. #SHOWCOMMENT="YES" SHOWCOMMENT="" ++ SHOWCOMMENT= # Maximum width for text written to DOTIMDB. This controls how many chars wide the # text should be before word-wrapping it. IMDBWIDTH=77 ++ IMDBWIDTH=77 # head and tail written to DOTIMDB. Take notice of IMDBWITH - this should not be # wider than that. This output will be written as "echo -e" which means you can use # control characters like \n, thus the head and tail can stretch over 1 or more lines. IMDBHEAD="============================ PSXC IMDB INFO $VERSION ============================\n" ++ IMDBHEAD='============================ PSXC IMDB INFO v2.7e ============================\n' IMDBTAIL="\n============================ PSXC IMDB INFO $VERSION ============================" ++ IMDBTAIL='\n============================ PSXC IMDB INFO v2.7e ============================' #################################################################################### ### The following is a BETA feature, and has really nothing to do with IMDb info ### ### at all. It's a quick and dirty way to extract release dates from the .nfo ### ### files, and putting that info in a separate file. It works like the .imdb ### ### file (above) and is supposed to be listed on entering the dir. ### # Use the beta date-extraction? Enter a name here, or "" to disable. DOTDATE=".date" ++ DOTDATE=.date #DOTDATE="" #################################################################################### ### External programs which will be passed the extracted variables. You may for ### ### instance have a better idea on how your .imdb should look like. This will ### ### give you the opportunity. ### ### See the included example-file for a quick-n-dirty example, or take a peek in ### ### the addons/ -dir - I'll try to add more addons when time permits. If you ### ### have an idea for an addon, don't hesitate to contact me, or make your own. ### # Call up an external script? Enter full path, or "" to disable (default) # Only uncomment one of the lines - if you wish to run more than one addon, # you need to place the path/names of all the addons on the same line. An # example is shown below using two addons. EXTERNALSCRIPTNAME="" ++ EXTERNALSCRIPTNAME= #EXTERNALSCRIPTNAME="$GLROOT/bin/psxc-symlink-maker.sh" #EXTERNALSCRIPTNAME="$GLROOT/bin/psxc-imdb-nuker.sh" #EXTERNALSCRIPTNAME="$GLROOT/bin/psxc-imdb-nuker.sh $GLROOT/bin/psxc-symlink-maker.sh" #EXTERNALSCRIPTNAME="$GLROOT/bin/psxc-imdb-dotimdb.pl" #################################################################################### ### You might wish to add a file/dir with IMDB info in the name. This is now ### ### possible. The next few variables describe this. ### # If you wish, you can make a dir/file with info from the release in the dir/filename. # Currently, the only things availible are user rating, votes, genres and runtime. # To prevent the need for sticky bits on some bins, we will create a temporary # file/dir. The name of this file is not important - we will rename it to INFOFILENAME # (below) later. To disable this feature, set this variable to "". #INFOTEMPNAME="" INFOTEMPNAME=".imdbinfoname" ++ INFOTEMPNAME=.imdbinfoname # Format the file as you wish. Use the following names to be substituted for the # real info (case sensitive): VOTES SCORE GENRE RUNTIME YEAR ISLIMITED SCREENS INFOFILENAME="[IMDB]=- Score SCORE - GENRE - SCREENS Screens (YEAR) -=[IMDB]" ++ INFOFILENAME='[IMDB]=- Score SCORE - GENRE - SCREENS Screens (YEAR) -=[IMDB]' # Would you like to create a dir or a file? Use "" for dir, "FILE" for file. INFOFILEIS="" ++ INFOFILEIS= #INFOFILEIS="FILE" # For security and filesystem reasons we will change some chars to harmless ones. # This variable describe the valid chars to use. I suggest you leave this as is, # unless you know what you're doing. 'man tr' should give some indication. # If you wish to allow spaces in your file/dirname, use the second line. INFOVALID="[:alnum:])(.\-=][\n" ++ INFOVALID='[:alnum:])(.\-=][\n' #INFOVALID="[:alnum:][:space:])(.\-=][\n" # Put here the char you wish invalid chars to be changed into. INFOCHARTO="_" ++ INFOCHARTO=_ # Maximum number of genres that should show. This would prevent the dir/file that # is created from getting to be too long... INFOGENREMAX=2 ++ INFOGENREMAX=2 #INFOGENREMAX=5 # Separator between genres. Usually this is "/", but that can't be used in a dir/ # filename for obvious reasons. INFOGENRESEP="-" ++ INFOGENRESEP=- ############## # PRE CONFIG #################################################################### # ### # The following is the config for the pre-support. You only need to edit if ### # you plan on using it. ### # This is a tricky one to understand. If you run psxc-imdb-pre.sh from the # prescript you are using, or if whatever calls psxc-imdb-pre.sh is chrooted # under GLROOT, you must set this variable to "". If not (and this is the # majority of cases in my experience) you set this to "$GLROOT". # Normally, you don't change this. GLPREROOT=$GLROOT ++ GLPREROOT=/glftpd #GLPREROOT="" # Path variable. All commands should be within glftpd's bin directory. No need # to change. GLPATHPRE=$GLPREROOT/bin ++ GLPATHPRE=/glftpd/bin # Name of what psxc-imdb.sh is named when run in pre-mode. This variable may # be removed later, though for now you gotta make the symlink needed. See # README for info. PRENAME=psxc-imdb-pre.sh ++ PRENAME=psxc-imdb-pre.sh # Path to the logfile to read. This normally is glftpd.log, but can be a # separate file if your prescript logs elsewhere. Please see PRETRIGGER and # WORD as well. GLPRELOG=$GLPREROOT/ftp-data/logs/glftpd.log ++ GLPRELOG=/glftpd/ftp-data/logs/glftpd.log #GLPRELOG=$GLPREROOT/ftp-data/logs/prelog # Trigger your prescript uses. If you use a separate logfile which do not have # a trigger (like a prelog or something) set this to "". PRETRIGGER="PRE:" ++ PRETRIGGER=PRE: #PRETRIGGER="DONE:" #PRETRIGGER="" # This is a wordcount read after PRETRIGGER where the path is located. Imagine # the following as something found in glftpd.log: # # Sat Apr 19 06:46:26 2003 PRE: "/site/divx/somedir" "pregroup" "some text" # # If PRETRIGGER is "PRE:" then you'd want to set WORDS to "1", as this is the # location of the path. If PRETRIGGER is "" then you'd set WORDS to "7", as it # is the 7th word in the line. Please note that text within '"' is counted as # one word, ie, there're 9 words in my example, not 10. # # To support f00-pre and others, you can now enter more than one number, # separated by a space. With SEPARATOR set to "/" (see below), setting WORDS to # "4 3" with the following in glftpd.log: # # Sat Apr 19 06:46:26 2003 PRE: "user" "group" "some.release" "/site/section" # # will give "/site/section/some.release" as the path. WORDS="1" ++ WORDS=1 #WORDS="8 3" #WORDS=7 # use this separator between the words grabbed in WORDS. Use "" to disable. SEPARATOR="/" ++ SEPARATOR=/ #SEPARATOR="" ###################### # FORMATTING OPTIONS ############################################################ # ### # The following is options that will let you be able to format the bot-output ### # yourself. They will only be used if LOGFORMAT or FINDLOGFORMAT is set to ### # "MYOWN". ### # The following strings will be replaced with the actual data gathered: # %imdbdirname %imdburl %imdbtitle %imdbgenre %imdbrating %imdbcountry # %imdblanguage %imdbcertification %imdbruntime %imdbdirector # %imdbbusinessdata %imdbpremiereinfo %imdblimitedinfo %imdbvotes %imdbscore # %imdbname %imdbyear %imdbnumscreens %imdbislimited %imdbcastleadname # %imdbcastleadchar %imdbtagline %imdbplot %imdbbar %imdbcasting # %imdbcommentshort %newline %bold # # What these strings represents is found in 'README.use.of.special.format'. MYOWNFORMAT="%boldIMDB:%bold %bold%imdbname%bold (%imdburl), a %imdbdirector movie which scored %bold%imdbscore of 10%bold (%imdbvotes people voted). It premiered in %imdbpremiereinfo, with %bold%imdbnumscreens screens%bold on the opening weekend.%newline%boldIMDB:%bold %bold%imdbname%bold plot summary: %imdbplot" ++ MYOWNFORMAT='%boldIMDB:%bold %bold%imdbname%bold (%imdburl), a %imdbdirector movie which scored %bold%imdbscore of 10%bold (%imdbvotes people voted). It premiered in %imdbpremiereinfo, with %bold%imdbnumscreens screens%bold on the opening weekend.%newline%boldIMDB:%bold %bold%imdbname%bold plot summary: %imdbplot' FINDMYOWNFORMAT="%boldIMDB:%bold %bold%imdbname%bold (%imdburl) starring %imdbcasting.%newline%boldIMDB:%bold Score: %bold%imdbscore%bold - Screens: %imdbnumscreens in %imdbpremiereinfo, and is thus %bold%imdbislimited%bold.%newline%boldIMDB:%bold Comment: %imdbcommentshort." ++ FINDMYOWNFORMAT='%boldIMDB:%bold %bold%imdbname%bold (%imdburl) starring %imdbcasting.%newline%boldIMDB:%bold Score: %bold%imdbscore%bold - Screens: %imdbnumscreens in %imdbpremiereinfo, and is thus %bold%imdbislimited%bold.%newline%boldIMDB:%bold Comment: %imdbcommentshort.' # You may replace empty strings with something. MYOWNEMPTY="N/A" ++ MYOWNEMPTY=N/A FINDMYOWNEMPTY="N/A" ++ FINDMYOWNEMPTY=N/A # To get multiple lines in the format, we use a specified char as delimeter. # This char should not appear elsewhere in your output. # Also remember to set this char in your bot, or, if you use the "FULL" mode # make sure it's the same char as the variable psxc(NEWLINE) in # psxc-imdb-conf.tcl # This char will be replaced with the string %newline (above) # NOTE: # If you use \n as splitter char in the bot, you need to set NEWLINE here # to "\\\\n". NEWLINE="\\\\n" ++ NEWLINE='\\n' #NEWLINE="|" ############### # OTHER STUFF ################################################################### # ### # If you really, *REALLY* need to run imdb scan at the same time the nfo is # uploaded, set this variable to "YES". People uploading nfo's will notice # this - their upload queue will freeze while imdb info is looked up. In some # cases, people will actually loose connection while this is done... so, please, # consider carefully before changing this. # This will only work if you run everything chrooted. # The default is to have this variable disabled "". RUNCONTINOUS="" ++ RUNCONTINOUS= #RUNCONTINOUS="YES" # END OF CONFIG #################################################################################### + '[' 0 -ne 0 ']' # Start debugging if [ "$DEBUG" = "ON" ] || [ "$DEBUG" = "2" ]; then set -x elif [ "$DEBUG" = "3" ]; then set -x -v elif [ "$DEBUG" = "4" ]; then set -x -v fi + '[' '' = ON ']' + '[' '' = 2 ']' + '[' '' = 3 ']' + '[' '' = 4 ']' # Let's hack glftpd if [ -z "$RECVDARGS" ] && [ ! -z "$GLFIX" ]; then RECVDARGS=`ls -1Ft | grep -a -v "/" | grep -a -v "@" | head -n 1 | grep -a -e "[.][nN][fF][oO]$"` fi + '[' -z ils-sf.nfo ']' # Remove locale settings which might cause problems export LC_ALL=en_US + export LC_ALL=en_US + LC_ALL=en_US if [ ! -z "$RECVDARGS" ]; then # This is what is run under zs-c, chrooted. ########################################### # PATH=$PATHCHROOTED # IMDBLOG=$IMDBLOGCHROOTED FILENAME="$RECVDARGS" case $FILENAME in *.[nN][fF][oO]) if [ ! -z "$GLROOT" ]; then MYTMPFILE=`echo "$TMPFILE" | sed "s%$GLROOT%%"` else MYTMPFILE=$TMPFILE fi PSXCFLAG=`head -n 1 $MYTMPFILE | tr -cd '0-9'` if [ ! -z "$PSXCFLAG" ]; then if [ $PSXCFLAG -ge 4 ]; then let PSXCFLAG=PSXCFLAG-4 fi if [ $PSXCFLAG -ge 2 ]; then DOTIMDB="" INFOTEMPNAME="" DOTDATE="" DOTURL="" fi fi if [ ! -z "$DOTDATE" ]; then DOTDATEINFO="`grep -a [Dd][Aa][Tt][Ee] $FILENAME | tr -c '/a-zA-Z0-9:. -/\n' ' ' | tr -s ' '`" if [ ! -z "$DOTDATEINFO" ]; then echo "$DOTDATEINFO" > $DOTDATE chmod 666 $DOTDATE fi fi # Should we even begin searching for an url? SEARCHFORURLS=0 if [ -z "$SCANDIRS" ]; then SEARCHFORURLS=1 fi for SCANDIR in $SCANDIRS; do if [ ! -z "`pwd | grep -a "$SCANDIR"`" ]; then SEARCHFORURLS=1 break fi done if [ $SEARCHFORURLS -eq 0 ]; then exit 0 fi # First, replace some old variable values if [ -z "$RELAXEDURLS" ]; then RELAXEDURLS=1 fi if [ "$RELAXEDURLS" = "ON" ]; then RELAXEDURLS=3 fi # Level 0 search IMDBURLS="`grep -a [Ii][Mm][Dd][Bb] $FILENAME | tr ' \|' '\n' | sed -n /[hH][tT][tT][pP]:[/][/].*[.][iI][mM][dD][bB][.].*.[0-9]/p | head -n 1 | tr -c -d '[:alnum:]\:./?'`" if [ ! -z "`echo $IMDBURLS | grep -a "imdb\."`" ]; then IMDBURL="http://us.imdb.com/title/tt""`echo $IMDBURLS | sed "s/=/-/g" | sed "s/imdb./=/" | cut -d "=" -f 2 | cut -d "/" -f 2,3 | tr -c -d '[:digit:]'`" if [ -z `echo $IMDBURL | tr -cd '0-9'` ]; then IMDBURL="" fi fi # Level 1 search if [ -z "$IMDBURL" ] && [ $RELAXEDURLS -ge 1 ]; then IMDBURLS="`grep -a [Ii][Mm][Dd][Bb] $FILENAME | tr ' \|' '\n' | sed -n /[hH][tT][tT][pP]:[/][/].*[iI][mM][dD][bB][.].*.[0-9]/p | head -n 1 | tr -c -d '[:alnum:]\:./?'`" if [ ! -z "`echo $IMDBURLS | grep -a "imdb\."`" ]; then IMDBURL="http://us.imdb.com/title/tt""`echo $IMDBURLS | sed "s/=/-/g" | sed "s/imdb./=/" | cut -d "=" -f 2 | cut -d "/" -f 2,3 | tr -c -d '[:digit:]'`" if [ -z `echo $IMDBURL | tr -cd '0-9'` ]; then IMDBURL="" fi fi fi # Level 2 search if [ -z "$IMDBURL" ] && [ $RELAXEDURLS -ge 2 ]; then IMDBURLS="`grep -a [Ii][Mm][Dd][Bb] $FILENAME | tr ' \|' '\n' | sed -n /.*[iI][mM][dD][bB][.].*.[0-9]/p | head -n 1 | tr -c -d '[:alnum:]\:./?'`" if [ ! -z "`echo $IMDBURLS | grep -a "imdb\."`" ]; then IMDBURL="http://us.imdb.com/title/tt""`echo $IMDBURLS | sed "s/=/-/g" | sed "s/imdb./=/" | cut -d "=" -f 2 | cut -d "/" -f 2,3 | tr -c -d '[:digit:]'`" if [ -z `echo $IMDBURL | tr -cd '0-9'` ]; then IMDBURL="" fi fi fi # Level 3 search if [ -z "$IMDBURL" ] && [ $RELAXEDURLS -ge 3 ]; then for IMDBURLS in `grep -a [Ii][Mm][Dd][Bb] $FILENAME | tr -c '[:digit:]' '\n' | grep -a -v "^$"`; do if [ ! -z `echo $IMDBURLS | tr -cd '0-9'` ]; then if [ `echo $IMDBURLS | tr -cd '0-9' | wc -c` -eq 8 ] || [ `echo $IMDBURLS | tr -cd '0-9' | wc -c` -eq 7 ]; then IMDBURL="$IMDBURLS" break fi fi done if [ ! -z "$IMDBURL" ]; then IMDBURL="http://us.imdb.com/title/tt""$IMDBURL" fi fi # Level 4 search if [ -z "$IMDBURL" ] && [ $RELAXEDURLS -ge 4 ]; then for IMDBURLS in `cat $FILENAME | tr -c '[:digit:]' '\n' | grep -a -v "^$"`; do if [ `echo $IMDBURLS | wc -c` -eq 8 ] || [ `echo $IMDBURLS | wc -c` -eq 7 ]; then IMDBURL="$IMDBURLS" break fi done if [ ! -z "$IMDBURL" ]; then IMDBURL="http://us.imdb.com/title/tt""$IMDBURL" fi fi # export what we've found if [ ! -z "$IMDBURL" ]; then echo "$IMDBURL""|""$PWD" >> $IMDBLOGCHROOTED if [ ! -z "$DOTIMDB" ]; then if [ ! -e "$DOTIMDB" ] || [ -w "$DOTIMDB" ]; then echo -n "" > $DOTIMDB chmod 666 $DOTIMDB fi fi if [ ! -z "$DOTURL" ]; then DOTURLF="`basename "$PWD" | sed "s/ /./g"`" if [ ! "$DOTURL" = "URL" ]; then DOTURLF="$DOTURLF"".imdb.html" if [ ! -e "$DOTURLF" ] || [ -w "$DOTURLF" ]; then echo "IMDB REDIRECT" > $DOTURLF echo "" >> $DOTURLF chmod 666 $DOTURLF fi else DOTURLF="$DOTURLF"".imdb.url" if [ ! -e "$DOTURLF" ] || [ -w "$DOTURLF" ]; then echo "[InternetShortcut]" > $DOTURLF echo "URL=""$IMDBURL" >> $DOTURLF chmod 666 $DOTURLF fi fi fi if [ ! -z "$INFOTEMPNAME" ]; then if [ ! -e "$INFOTEMPNAME" ] || [ -w "$INFOTEMPNAME" ]; then if [ ! -z "$INFOFILEIS" ]; then echo -n "" > $INFOTEMPNAME chmod 666 $INFOTEMPNAME else mkdir -p $INFOTEMPNAME chmod 777 $INFOTEMPNAME fi fi fi fi touch -acmr "$FILENAME" `pwd` >/dev/null 2>&1 ;; esac # exit 0 #else fi + '[' '!' -z ils-sf.nfo ']' + FILENAME=ils-sf.nfo + case $FILENAME in + '[' '!' -z /glftpd ']' echo "$TMPFILE" | sed "s%$GLROOT%%" ++ echo /glftpd/ftp-data/logs/psxc-imdb.tmp ++ sed s%/glftpd%% + MYTMPFILE=/ftp-data/logs/psxc-imdb.tmp head -n 1 $MYTMPFILE | tr -cd '0-9' ++ head -n 1 /ftp-data/logs/psxc-imdb.tmp ++ tr -cd 0-9 + PSXCFLAG= + '[' '!' -z '' ']' + '[' '!' -z .date ']' grep -a [Dd][Aa][Tt][Ee] $FILENAME | tr -c '/a-zA-Z0-9:. -/\n' ' ' | tr -s ' ' ++ grep -a '[Dd][Aa][Tt][Ee]' ils-sf.nfo ++ tr -c '/a-zA-Z0-9:. -/\n' ' ' ++ tr -s ' ' + DOTDATEINFO=' Release Date..........: 2004/06/09 Theater Date..........: 2001/06/08 (USA) ' + '[' '!' -z ' Release Date..........: 2004/06/09 Theater Date..........: 2001/06/08 (USA) ' ']' + echo ' Release Date..........: 2004/06/09 Theater Date..........: 2001/06/08 (USA) ' + chmod 666 .date + SEARCHFORURLS=0 + '[' -z '/site/XViD /site/TV /site/ARCHIVE/ /site/REQUESTS /site/LOUNGE' ']' + for SCANDIR in '$SCANDIRS' pwd | grep -a "$SCANDIR" ++ pwd ++ grep -a /site/XViD + '[' '!' -z '' ']' + for SCANDIR in '$SCANDIRS' pwd | grep -a "$SCANDIR" ++ pwd ++ grep -a /site/TV + '[' '!' -z '' ']' + for SCANDIR in '$SCANDIRS' pwd | grep -a "$SCANDIR" ++ pwd ++ grep -a /site/ARCHIVE/ + '[' '!' -z '' ']' + for SCANDIR in '$SCANDIRS' pwd | grep -a "$SCANDIR" ++ pwd ++ grep -a /site/REQUESTS + '[' '!' -z '' ']' + for SCANDIR in '$SCANDIRS' pwd | grep -a "$SCANDIR" ++ pwd ++ grep -a /site/LOUNGE + '[' '!' -z '' ']' + '[' 0 -eq 0 ']' + exit 0