#!/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.7f" + VERSION=v2.7f ###################################################################################################### RECVDARGS="$1" + RECVDARGS=ahs-war.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='Thu Sep 28 22:52:18 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.7f ============================\n' IMDBTAIL="\n============================ PSXC IMDB INFO $VERSION ============================" ++ IMDBTAIL='\n============================ PSXC IMDB INFO v2.7f ============================' #################################################################################### ### 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 ahs-war.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 ahs-war.nfo ']' + FILENAME=ahs-war.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]' ahs-war.nfo ++ tr -c '/a-zA-Z0-9:. -/\n' ' ' ++ tr -s ' ' + DOTDATEINFO=' Release Date 28th September 2006 Supplier/Ripper AEROHOLiCS DVD Street Date 2002 Language English NO. ORIGINAL VIDEO RELEASE DIRNAMES DVDR/XVID/VCD/TV * 2004-2006 REL. DATE' + '[' '!' -z ' Release Date 28th September 2006 Supplier/Ripper AEROHOLiCS DVD Street Date 2002 Language English NO. ORIGINAL VIDEO RELEASE DIRNAMES DVDR/XVID/VCD/TV * 2004-2006 REL. DATE' ']' + echo ' Release Date 28th September 2006 Supplier/Ripper AEROHOLiCS DVD Street Date 2002 Language English NO. ORIGINAL VIDEO RELEASE DIRNAMES DVDR/XVID/VCD/TV * 2004-2006 REL. DATE' + 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 /site/XVID/test ']' + SEARCHFORURLS=1 + break + '[' 1 -eq 0 ']' + '[' -z 3 ']' + '[' 3 = ON ']' 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:]\:./?' ++ grep -a '[Ii][Mm][Dd][Bb]' ahs-war.nfo ++ tr ' \|' '\n' ++ sed -n '/[hH][tT][tT][pP]:[/][/].*[.][iI][mM][dD][bB][.].*.[0-9]/p' ++ head -n 1 ++ tr -c -d '[:alnum:]\:./?' + IMDBURLS= echo $IMDBURLS | grep -a "imdb\." ++ echo ++ grep -a 'imdb\.' + '[' '!' -z '' ']' + '[' -z '' ']' + '[' 3 -ge 1 ']' 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:]\:./?' ++ grep -a '[Ii][Mm][Dd][Bb]' ahs-war.nfo ++ tr ' \|' '\n' ++ sed -n '/[hH][tT][tT][pP]:[/][/].*[iI][mM][dD][bB][.].*.[0-9]/p' ++ head -n 1 ++ tr -c -d '[:alnum:]\:./?' + IMDBURLS= echo $IMDBURLS | grep -a "imdb\." ++ echo ++ grep -a 'imdb\.' + '[' '!' -z '' ']' + '[' -z '' ']' + '[' 3 -ge 2 ']' 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:]\:./?' ++ grep -a '[Ii][Mm][Dd][Bb]' ahs-war.nfo ++ tr ' \|' '\n' ++ sed -n '/.*[iI][mM][dD][bB][.].*.[0-9]/p' ++ tr -c -d '[:alnum:]\:./?' ++ head -n 1 + IMDBURLS= echo $IMDBURLS | grep -a "imdb\." ++ echo ++ grep -a 'imdb\.' + '[' '!' -z '' ']' + '[' -z '' ']' + '[' 3 -ge 3 ']' grep -a [Ii][Mm][Dd][Bb] $FILENAME | tr -c '[:digit:]' '\n' | grep -a -v "^$" ++ grep -a '[Ii][Mm][Dd][Bb]' ahs-war.nfo ++ tr -c '[:digit:]' '\n' ++ grep -a -v '^$' + '[' '!' -z '' ']' + '[' -z '' ']' + '[' 3 -ge 4 ']' + '[' '!' -z '' ']' pwd ++ pwd + touch -acmr ahs-war.nfo /site/XVID/test if [ ! -z "$RUNCONTINOUS" ] || [ -z "$RECVDARGS" ]; then # run major part. if [ "`basename "$0"`" = "$PRENAME" ]; then # This is what is done with pre's ################################# PATH=$GLPATHPRE a="`tail -n 5 $GLPRELOG | grep -a "$PRETRIGGER" | tail -n 1`" DIRNAME="" for WORD in $WORDS; do count=0 combine=0 if [ -z "$a" ]; then exit 0 fi if [ ! -z "$PRETRIGGER" ]; then let WORD=WORD+1 fi for b in $a; do if [ -z `echo $b | grep -a "$PRETRIGGER"` ] && [ $count -gt 0 ] || [ -z "$PRETRIGGER" ]; then if [ $combine -eq 1 ]; then c=$c$b else c=$b fi if [ ! -z `echo "$c" | grep -a "^\""` ]; then combine=1 else c=$b let count=count+1 fi if [ ! -z `echo "$c" | grep -a "\"$"` ]; then combine=0 let count=count+1 fi if [ $count -eq $WORD ]; then break fi else if [ "$b" = "$PRETRIGGER" ]; then count=1 fi fi done DIRNAME="$DIRNAME""$c" done DIRNAME=`echo $DIRNAME | sed "s|\"\"|$SEPARATOR|g" | sed "s|\"||g"` if [ -d $GLROOT$DIRNAME ]; then FILENAME=`ls -1 $GLROOT$DIRNAME | grep -a "\.[Nn][Ff][Oo]$" | head -n 1` IMDBURL="`grep -a [Ii][Mm][Dd][Bb] $GLROOT$DIRNAME/$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 $IMDBURL | grep -a "\.imdb\."`" ]; then IMDBURL="http://us.imdb.com/title/tt""`echo $IMDBURL | sed "s/=/-/g" | sed "s/.imdb./=/" | cut -d "=" -f 2 | cut -d "/" -f 2,3 | tr -c -d '[:digit:]'`" fi if [ ! -z "$IMDBURL" ]; then a="`tail -n 5 $GLLOG | grep -a "$TRIGGER" | grep -a "$DIRNAME" | tail -n 1`" if [ -z "$a" ]; then SEARCHFORURLS=0 if [ -z "$SCANDIRS" ]; then SEARCHFORURLS=1 fi for SCANDIR in $SCANDIRS; do if [ ! -z "`echo "$DIRNAME" | grep -a "$SCANDIR"`" ]; then SEARCHFORURLS=1 break fi done if [ ! $SEARCHFORURLS -eq 0 ]; then echo "$IMDBURL""|""$DIRNAME" >> $IMDBLOG fi fi fi fi if [ -z "$RUNCONTINOUS" ]; then exit 0 fi fi if [ ! -e $IMDBLOG ]; then # Check to see if it's a first-run ################################## echo "Please read the docs before trying to run this script." exit 0 fi # The main part. ################ if [ -z "`cat $IMDBLOG`" ]; then # No new imdb-info. let's quit. ############################### exit 0 fi # Make sure this script isn't already running. ############################################## sleep 0.$RANDOM MYNAMEIS=`basename "$0"` IMDBPIDCONTENT=`cat $IMDBPID` if [ ! -z "$IMDBPIDCONTENT" ]; then if [ ! -z `ps ax | awk '{print $1}' | grep -a -e "^$IMDBPIDCONTENT$"` ]; then exit 0 fi fi echo $$ > $IMDBPID # Seems like something was put into the log. Let's check it. ############################################################ IMDBFLAGS=`head -n 1 $TMPFILE | tr -cd '0-9'` if [ ! -z "$IMDBFLAGS" ]; then if [ $IMDBFLAGS -ge 4 ]; then EXTERNALSCRIPTNAME="" let IMDBFLAGS=IMDBFLAGS-4 fi if [ $IMDBFLAGS -ge 2 ]; then DOTIMDB="" INFOTEMPNAME="" let IMDBFLAGS=IMDBFLAGS-2 fi if [ $IMDBFLAGS -ge 1 ]; then USEBOT="" fi fi if [ -z "$LANGUAGENUM" ] || [ $LANGUAGENUM -eq 0 ]; then LANGUAGENUM=99 fi if [ -z "$COUNTRYNUM" ] || [ $COUNTRYNUM -eq 0 ]; then COUNTRYNUM=99 fi if [ -z "$CERTIFICATIONNUM" ] || [ $CERTIFICATIONNUM -eq 0 ]; then CERTIFICATIONNUM=99 fi if [ -z "$CASTNUM" ] || [ $CASTNUM -eq 0 ]; then CASTNUM=99 fi if [ -z "$GENRENUM" ] || [ $GENRENUM -eq 0 ]; then GENRENUM=99 fi if [ -z "$RUNTIMENUM" ] || [ $RUNTIMENUM -eq 0 ]; then RUNTIMENUM=99 fi while [ ! -z "`cat $IMDBLOG`" ]; do IMDBLINE="`cat $IMDBLOG | grep -a -e "/" | head -n 1`" cat $IMDBLOG | grep -a -F -v "$IMDBLINE" > $TMPFILE cat $TMPFILE > $IMDBLOG ISLIMITED="" BUSINESS="" BUSINESSSHORT="" PREMIERE="" LIMITED="" EXEMPTED="" LYNXTRIESORIG=$LYNXTRIES IMDBURL="`echo $IMDBLINE | cut -d "|" -f 1`" IMDBLNK="`echo $IMDBLINE | cut -d "|" -f 2`" IMDBDST="`echo $IMDBLINE | cut -d "|" -f 3`" DEBUGCOUNT=1 if [ ! -z $DEBUG ]; then echo "$DEBUGCOUNT : DOTIMDB = '$DOTIMDB'" echo "$DEBUGCOUNT : USEBOT = '$USEBOT'" fi if [ -d "$GLROOT$IMDBLNK" ]; then IMDBDIR="`basename "$IMDBLNK"`" BASELNK="`dirname "$IMDBLNK"`" IMDBLKL="$IMDBLNK" IMDBLNK="$GLROOT$IMDBLKL/$DOTIMDB" elif [ "$IMDBLNK" = "/dev/null" ]; then IMDBLKL="$IMDBLNK" DOTIMDB="" EXTERNALSCRIPTNAME="" INFOTEMPNAME="" BOTONELINE=$FINDBOTONELINE TRIGGER="$FINDTRIGGER" LOGFORMAT="$FINDLOGFORMAT" MYOWNFORMAT="$FINDMYOWNFORMAT" MYOWNEMPTY="$FINDMYOWNEMPTY" if [ ! -z "$PSXCFINDLOG" ] && [ -w $PSXCFINDLOG ]; then GLLOG=$PSXCFINDLOG fi else DOTIMDB="" USEBOT="" EXTERNALSCRIPTNAME="" INFOTEMPNAME="" fi DEBUGCOUNT=2 if [ ! -z $DEBUG ]; then echo "$DEBUGCOUNT : DOTIMDB = '$DOTIMDB'" echo "$DEBUGCOUNT : USEBOT = '$USEBOT'" fi for EXEMPT in $BOTEXEMPT; do if [ ! -z `echo "$IMDBLKL" | grep -a "$EXEMPT"` ]; then USEBOT="" EXEMPTED="ON" fi done if [ ! -z "$LOGFORMAT" ]; then BOTONELINE="YES" TAGPLOT="" BOTHEAD="" fi DEBUGCOUNT=3 if [ ! -z $DEBUG ]; then echo "$DEBUGCOUNT : DOTIMDB = '$DOTIMDB'" echo "$DEBUGCOUNT : USEBOT = '$USEBOT'" fi if [ ! -z `cat $IMDBURLLOG | grep -a "$IMDBURL"` ] || [ ! -z $EXEMPTED ]; then if [ ! "$IMDBLKL" = "/dev/null" ]; then USEBOT="" fi else if [ ! "$IMDBLKL" = "/dev/null" ]; then echo "$IMDBURL" >> $IMDBURLLOG tail -n $KEEPURLS $IMDBURLLOG > $TMPFILE cat $TMPFILE > $IMDBURLLOG echo -n "" > $TMPFILE fi fi DEBUGCOUNT=4 if [ ! -z $DEBUG ]; then echo "$DEBUGCOUNT : DOTIMDB = '$DOTIMDB'" echo "$DEBUGCOUNT : USEBOT = '$USEBOT'" fi # grab info from web #################### OUTPUTTRIES=1 OUTPUTOK="" while [ -z "$OUTPUTOK" ]; do while [ $OUTPUTTRIES -le $LYNXTRIESORIG ]; do let OUTPUTTRIES=OUTPUTTRIES+1 OUTPUTOK="OK" while [ $LYNXTRIES -gt 0 ]; do if [ -z "$USEWGET" ]; then lynx $LYNXFLAGS $IMDBURL > $TMPFILE 2>&1 if [ $? = "0" ]; then LYNXTRIES=$LYNXTRIESORIG break else let LYNXTRIES=LYNXTRIES-1 sleep 1 fi else #http_proxy=192.168.0.1:8080 wget -U "Internet Explorer" -O $TMPFILE --timeout=30 $IMDBURL >/dev/null 2>&1 if [ $? = "0" ] || [ -z "`cat $TMPFILE`" ]; then LYNXTRIES=$LYNXTRIESORIG HTMLPAGE="`lynx $LYNXFLAGS -force_html $TMPFILE`" echo "$HTMLPAGE" > $TMPFILE break else let LYNXTRIES=LYNXTRIES-1 echo -n "" > $TMPFILE sleep 1 fi fi done if [ $LYNXTRIES -ne $LYNXTRIESORIG ]; then exit 0 fi # Check for a movie-title. This *must* be present, else the script will just exit. ################################################################################## TITLE=`cat "$TMPFILE" | grep -a -e "^[a-zA-Z0-9\"\.]" | sed "s/\"//g" | head -n 1` if [ -z "$TITLE" ]; then # a new version of lynx? let's try a diff. approach. TITLE=`cat "$TMPFILE" | grep -a -e "([12][089][0-9][0-9])" | head -n 1 | sed "s/PageFlicker//" | sed "s/\"//g"` fi if [ -z "$TITLE" ] || [ ! -z "`echo "$TITLE" | grep -a -e "with other users on IMDb"`" ] || [ ! -z "`echo "$TITLE" | grep -a -e "laserdisc details"`" ] || [ ! -z "`echo "$TITLE" | grep -a -e "(\ )"`" ] || [ ! -z "`echo "$TITLE" | grep -a -e "\.\.\.\."`" ]; then OUTPUTOK="" break fi # Grab hold of the info we'll use later. Also do some formatting. ################################################################# TITLEYEAR=`echo $TITLE | tr ' ' '\n' | grep -a -v "^[a-zA-Z]" | grep -a -e "^([12]" | head -n 1` TITLENAME=`echo $TITLE | sed "s| $TITLEYEAR||"` TITLEYEAR=`echo $TITLEYEAR | tr -cd '0-9'` if [ -z "$TITLEYEAR" ]; then OUTPUTOK="" break fi GENRE=`cat $TMPFILE | grep -a -e "Genre:" | sed "s/(more)//" | sed "s/^\ *//g" | sed "s/\ *$//g" | sed "s/Genre:/Genre........:/" | sed s/\"/$QUOTECHAR/g | tr '/' '\n' | head -n $GENRENUM | tr '\n' '/' | sed "s|/$||" | sed "s/ *$//"` GENRECLEAN=`echo $GENRE | sed "s/Genre........: *//"` RATING=`cat $TMPFILE | grep -a -e "User\ Rating:" | sed "s/^\ *//g" | sed "s/\ *$//g" | sed "s/ [Vv][Oo][Tt][Ee] [Hh][Ee][Rr][Ee]//" | sed "s/User Rating:/User Rating..:/" | sed "s/* //g" | sed "s/_ //g" | sed s/\"/$QUOTECHAR/g | head -n 1` RATINGCLEAN=`echo $RATING | sed "s/User Rating..: *//"` RATINGBAR="`cat $TMPFILE | grep -a -e "User\ Rating:" | tr -cd '\*_' | tr '\*_' '#-' | head -n 1`" if [ "`echo $RATINGCLEAN | grep -a -e "[Ww][Aa][Ii][Tt]"`" = "" ]; then RATINGVOTES=`echo $RATINGCLEAN | sed "s/ [Vv][Oo][Tt][Ee][Ss]//" | tr '() ' '\n' | grep -a -v "/" | grep -a -e "[0-9]" | head -n 1` RATINGSCORE=`echo $RATINGCLEAN | grep -a -e "/" | tr '/' '\n' | head -n 1` else RATINGVOTES="" RATINGSCORE="" fi COUNTRY=`cat $TMPFILE | grep -a -e "Country:" | sed "s/^\ *//g" | sed "s/\ *$//g" | sed "s/Country:/Country......:/" | sed s/\"/$QUOTECHAR/g | tr '/' '\n' | head -n $COUNTRYNUM | tr '\n' '/' | sed "s|/$||" | sed "s/ *$//"` COUNTRYCLEAN=`echo $COUNTRY | sed "s/Country......: *//"` TAGLINE=`cat $TMPFILE | grep -a -e "Tagline:" | sed "s/(more)//" | sed "s/^\ *//g" | sed "s/\ *$//g" | sed "s/([Mm][Oo][Rr][Ee])//" | sed "s/Tagline:/Tagline......:/" | sed s/\"/$QUOTECHAR/g | head -n 1` TAGLINECLEAN=`echo $TAGLINE | sed "s/Tagline......: *//"` LANGUAGE=`cat $TMPFILE | grep -a -e "Language:" | sed "s/^\ *//g" | sed "s/\ *$//g" | sed "s/Language:/Language.....:/" | sed s/\"/$QUOTECHAR/g | tr '/' '\n' | head -n $LANGUAGENUM | tr '\n' '/' | sed "s|/$||" | sed "s/ *$//"` LANGUAGECLEAN=`echo $LANGUAGE | sed "s/Language.....: *//"` PLOT=`cat $TMPFILE | grep -a -e "Plot\ [OS][u][tm][lm][ia][nr][ey]:" | sed "s/^\ *//g" | sed "s/\ *$//g" | sed "s/([Vv][Ii][Ee][Ww] [Tt][Rr][Aa][Ii][Ll][Ee][Rr])//" | sed "s/([Mm][Oo][Rr][Ee])//" | sed "s/Plot [OS][u][tm][lm][ia][nr][ey][:]/Plot Outline.:/" | sed s/\"/$QUOTECHAR/g | tr -s ' ' | head -n 1` PLOTCLEAN=`echo $PLOT | sed "s/Plot Outline.: *//"` if [ ! -z "`echo "$PLOTCLEAN" | grep -a -e "\(\ \)\ \(\ \)"`" ]; then OUTPUTOK="" break fi CERT=`cat $TMPFILE | grep -a -e "Certification:" | sed "s/^\ *//g" | sed "s/\ *$//g" | sed s/\"/$QUOTECHAR/g | tr '/' '\n' | head -n $CERTIFICATIONNUM | sed "s/(.*//g" | tr '\n' '/' | sed "s|/$||" | sed "s/ *$//"` CERTCLEAN=`echo $CERT | sed "s/Certification: *//" | tr '/' '\n' | grep -a -e "[uU][sS][aA]" | tr -d ' ' | head -n 1` CAST=`cat $TMPFILE | grep -a -e "\ \.\.\.\.\ " | sed s/\"/$QUOTECHAR/g | sed "s|\ \[.*\]||g" | head -n $CASTNUM` CASTCLEAN=`echo "$CAST" | sed "s/\.\.\.\..*/|/g" | tr '\n' ' ' | tr -s ' ' | sed "s/^\ *//g" | sed "s/\ *$//g" | sed "s/ |/\,/g" | sed "s/,$//"` CASTLEADNAME="`echo "$CAST" | head -n 1 | tr '.' '\n' | sed -e /^$/d | head -n 1 | tr -s ' ' | sed "s/^\ //g" | sed "s/\ $//g"`" CASTLEADCHAR="`echo "$CAST" | head -n 1 | tr '.' '\n' | sed -e /^$/d | tail -n 1 | tr -s ' ' | sed "s/^\ //g" | sed "s/\ $//g"`" COMMENTSHORT=`cat $TMPFILE | grep -a -e "User Comments:" | head -n 1 | sed "s/^\ *//g" | sed "s/\ *$//g" | sed "s/([Mm][Oo][Rr][Ee])//" | sed s/\"/$QUOTECHAR/g` COMMENTSHORTCLEAN=`echo $COMMENTSHORT | sed "s/User Comments: *//"` COMMENT=`cat $TMPFILE | awk '/User Comments:$/, /Check for other user comments.$/' | sed s/\"/$QUOTECHAR/g` COMMENTCLEAN=`echo "$COMMENT" | grep -a -e "^\ \ \ \ \ " | sed "s/^\ *//g" | sed "s/\ *$//g" | sed s/\{\}\"/$QUOTECHAR/g | tr '\n' '|'` RUNTIME=`cat $TMPFILE | grep -a -e "Runtime:" | sed "s/^\ *//g" | sed "s/\ *$//g" | sed "s/Runtime:/Runtime......:/" | sed s/\"/$QUOTECHAR/g | tr '/' '\n' | head -n $RUNTIMENUM | tr '\n' '/' | sed "s|/$||" | sed "s/ *$//"` RUNTIMECLEAN="`echo $RUNTIME | sed "s/Runtime......: *//" | tr '/ ' '\n' | sed -e /^$/d | head -n 1 | tr -c -d '[:digit:]'`" if [ ! -z "$RUNTIMECLEAN" ]; then RUNTIMECLEAN="$RUNTIMECLEAN min" fi DIRECTOR=`cat $TMPFILE | awk '/Directed by$/, /Writing credits$/' | grep -a -v "Directed by" | grep -a -v "Writing Credits" | sed "s/^\ *//g" | sed "s/\ *$//g" | head -n 1 | sed s/\"/$QUOTECHAR/g` DIRECTORCLEAN=`echo $DIRECTOR` if [ ! -z "`echo "$DIRECTOR" | grep -a -e "\(\ \)\ \(\ \)"`" ]; then OUTPUTOK="" break fi ONELINE="`echo "$BOLD$TITLE$BOLD""[$COUNTRY]: $GENRE - $BOLD$RATING$BOLD"" - $IMDBURL" | sed "s/Genre........: //" | sed "s/User Rating..: //" | sed "s/Country......: *//" | tr -s ' '`" if [ ! -z "`echo "$ONELINE" | grep -a -e "\(\ \)\ \(\ \)"`" ]; then OUTPUTOK="" break fi if [ ! -z "`echo "$GENRECLEAN" | grep -a -e "with other users on IMDb"`" ] || [ ! -z "`echo "$GENRECLEAN" | grep -a -e "laserdisc details"`" ] || [ ! -z "`echo "$GENRECLEAN" | grep -a -e "(\ )"`" ] || [ ! -z "`echo "$GENRECLEAN" | grep -a -e "\.\.\."`" ] || [ ! -z "`echo "$GENRECLEAN" | grep -a -e "Binary"`" ]; then OUTPUTOK="" break fi if [ ! -z "$OUTPUTOK" ]; then OUTPUTTRIES=$LYNXTRIESORIG break fi done if [ $OUTPUTTRIES -gt $LYNXTRIESORIG ]; then break fi done if [ -z "$OUTPUTOK" ]; then DOTIMDB="" USEBOT="" if [ ! -z "`echo $IMDBLKL | grep -a -e "/dev/null"`" ]; then if [ -z "$LOGFORMAT" ]; then echo "$DATE $TRIGGER \"$IMDBLKL\" \"Failed to fetch iMDB details. Please try again.\" \"$IMDBDST\"" >> $GLLOG elif [ "$LOGFORMAT" = "MYOWN" ]; then echo "$DATE $TRIGGER \"$IMDBLKL\" \"Failed to fetch iMDB details. Please try again.\" \"$IMDBDST\"" >> $GLLOG else echo "$DATE $TRIGGER \"$IMDBLKL\" \"\" \"Failed to fetch iMDB details. Please try again.\"" >> $GLLOG fi fi else # We won't check business and release as closely right away... may do so later ############################################################################## BUSINESSURL="$IMDBURL""/business" RELEASEURL="$IMDBURL""/releaseinfo" if [ -z "`cat $TMPFILE | grep -a -F "$BUSINESSURL"`" ] && [ -z "$USEWGET" ]; then USEBUSINESS="" fi if [ -z "`cat $TMPFILE | grep -a -F "$RELEASEURL"`" ] &[ -z "$USEWGET" ]; then USEPREMIERE="" USELIMITED="" fi if [ ! -z "$USEBUSINESS" ]; then while [ $LYNXTRIES -gt 0 ]; do if [ -z "$USEWGET" ]; then lynx $LYNXFLAGS $BUSINESSURL > $TMPFILE 2>&1 if [ $? = "0" ]; then LYNXTRIES=$LYNXTRIESORIG break else let LYNXTRIES=LYNXTRIES-1 sleep 1 fi else #http_proxy=192.168.0.1:8080 wget -U "Internet Explorer" -O $TMPFILE --timeout=30 $BUSINESSURL >/dev/null 2>&1 if [ $? = "0" ] || [ -z "`cat $TMPFILE`" ]; then LYNXTRIES=$LYNXTRIESORIG HTMLPAGE="`lynx $LYNXFLAGS -force_html $TMPFILE`" echo "$HTMLPAGE" > $TMPFILE break else let LYNXTRIES=LYNXTRIES-1 echo -n "" > $TMPFILE sleep 1 fi fi done if [ "$LYNXTRIES" = "$LYNXTRIESORIG" ]; then BUSINESS=`cat $TMPFILE | awk '/Opening Weekend$/,/Gross$/' | grep -a -e "(" | sed "s/^\ *//g" | sed "s/\ *$//g" | sed s/\"/$QUOTECHAR/g` BUSINESSSHORT=`cat $TMPFILE | awk '/Opening Weekend$/,/Gross$/' | grep -a -e "[Ss][Cc][Rr][Ee][Ee][Nn]" | grep -a -e "[Uu][Ss][Aa]" | sed "s/^\ *//g" | sed "s/\ *$//g" | sed s/\"/$QUOTECHAR/g | head -n 1` if [ -z "$BUSINESSSHORT" ]; then BUSINESSSHORT=`cat $TMPFILE | awk '/Opening Weekend$/,/Gross$/' | grep -a -e "[Uu][Ss][Aa]" | sed "s/^\ *//g" | sed "s/\ *$//g" | sed s/\"/$QUOTECHAR/g | head -n 1` fi if [ -z "$BUSINESSSHORT" ]; then BUSINESSSHORT=`echo "$BUSINESS" | head -n 1` fi BUSINESSSCREENS=`echo "$BUSINESSSHORT" | tr '()' '\n' | grep -a -e "[Ss][Cc][Rr][Ee][Ee][Nn]" | tr ' ' '\n' | head -n 1` BUSINESSSCREENSNUMBER=`echo "$BUSINESSSCREENS" | sed "s/,//"` #tr -d ','` echo "BIZNUM : $BUSINESSSCREENSNUMBER ( $BUSINESSSCREENS )" >/tmp/imdebug.log if [ ! -z "$BUSINESSSCREENSNUMBER" ]; then if [ $BUSINESSSCREENSNUMBER -lt 500 ]; then ISLIMITED=$LIMITEDYES else ISLIMITED=$LIMITEDNO fi else ISLIMITED="" fi fi fi if [ ! -z "$USEPREMIERE" ] || [ ! -z "$USELIMITED" ]; then while [ $LYNXTRIES -gt 0 ]; do if [ -z "$USEWGET" ]; then lynx $LYNXFLAGS $RELEASEURL > $TMPFILE 2>&1 if [ $? = "0" ]; then LYNXTRIES=$LYNXTRIESORIG break else let LYNXTRIES=LYNXTRIES-1 sleep 1 fi else #http_proxy=192.168.0.1:8080 wget -U "Internet Explorer" -O $TMPFILE --timeout=30 $RELEASEURL >/dev/null 2>&1 if [ $? = "0" ] || [ -z "`cat $TMPFILE`" ]; then LYNXTRIES=$LYNXTRIESORIG HTMLPAGE="`lynx $LYNXFLAGS -force_html $TMPFILE`" echo "$HTMLPAGE" > $TMPFILE break else let LYNXTRIES=LYNXTRIES-1 echo -n "" > $TMPFILE sleep 1 fi fi done if [ "$LYNXTRIES" = "$LYNXTRIESORIG" ]; then if [ ! -z "$USEPREMIERE" ]; then PREMIERE=`cat $TMPFILE | awk /Date$/,/endofThefile/ | grep -a -e "(" | grep -a -e "[Pp][Rr][Ee][Mm][Ii][Ee][Rr][Ee]" | head -n 1 | sed "s/^\ *//g" | sed "s/\ *$//g" | sed "s/ (/(/" | tr '(' '\n' | tr -s ' ' | head -n 1 | sed s/\"/$QUOTECHAR/g` if [ -z "$PREMIERE" ]; then PREMIERE=`cat $TMPFILE | awk /Date$/,/endofThefile/ | grep -a -v "Date$" | head -n 1 | sed "s/^\ *//g" | sed "s/\ *$//g" | sed "s/ (/(/" | tr '(' '\n' | tr -s ' ' | head -n 1 | sed s/\"/$QUOTECHAR/g` fi if [ -z "`echo "$PREMIERE" | tr -cd '0-9'`" ]; then PREMIERE="" fi fi if [ ! -z "$USELIMITED" ]; then LIMITED=`cat $TMPFILE | awk /Date$/,/endofThefile/ | grep -a -e "(" | grep -a -e "[Ll][Ii][Mm][Ii][Tt][Ee][Dd]" | head -n 1 | sed "s/^\ *//g" | sed "s/\ *$//g" | tr -s ' ' | sed s/\"/$QUOTECHAR/g` # if [ "$PREMIERE" = "$LIMITED" ]; then # PREMIERE="" # fi fi fi fi if [ ! -z "$IMDBHEAD" ]; then BOTHEAD=`echo $BOTHEADORIG | sed "s/RELEASENAME/$BOLD$IMDBDIR$BOLD/"` fi if [ ! -z $DEBUG ]; then DEBUGCOUNT=5 echo "$DEBUGCOUNT : DOTIMDB = '$DOTIMDB'" echo "$DEBUGCOUNT : USEBOT = '$USEBOT'" fi if [ ! -z "$DIRECTOR" ]; then DIRECTOR="Directed by..: $DIRECTOR" fi if [ ! -z $DEBUG ]; then DEBUGCOUNT=6 echo "$DEBUGCOUNT : DOTIMDB = '$DOTIMDB'" echo "$DEBUGCOUNT : USEBOT = '$USEBOT'" fi if [ ! -z "$USEBOT" ]; then # Time to put stuff out so the bot can read it. ############################################### if [ ! -z "$LOCALURL" ]; then IMDBURL="`echo $IMDBURL | sed "s|/us.|/$LOCALURL.|g" | tr 'A-Z' 'a-z'`" fi HEADTMP="Title........: $BOLD$TITLE$BOLD" if [ ! -z "$COUNTRY" ]; then HEADTMP="$HEADTMP / $COUNTRY" fi if [ ! -z "$LANGUAGE" ]; then HEADTMP="$HEADTMP / $BOLD$LANGUAGE$BOLD" fi HEAD=`echo "$HEADTMP" | sed "s/Country......: //" | sed "s/Language.....: //" | tr -s ' '` if [ ! -z "$BOTHEAD" ]; then echo "$DATE $TRIGGER \"$IMDBLKL\" \"$BOTHEAD\" \"$IMDBDST\"" >> $GLLOG fi if [ ! -z "$HEAD" ] && [ -z "$BOTONELINE" ]; then echo "$DATE $TRIGGER \"$IMDBLKL\" \"$HEAD\" \"$IMDBDST\"" >> $GLLOG fi if [ -z "$BOTONELINE" ]; then echo "$DATE $TRIGGER \"$IMDBLKL\" \"IMDb Link....: $IMDBURL\" \"$IMDBDST\"" >> $GLLOG fi if [ ! -z "$DIRECTOR" ] && [ -z "$BOTONELINE" ]; then echo "$DATE $TRIGGER \"$IMDBLKL\" \"$DIRECTOR\" \"$IMDBDST\"" >> $GLLOG fi if [ ! -z "$GENRE" ] && [ -z "$BOTONELINE" ]; then echo "$DATE $TRIGGER \"$IMDBLKL\" \"$GENRE\" \"$IMDBDST\"" >> $GLLOG fi if [ ! -z "$RATING" ] && [ -z "$BOTONELINE" ]; then echo "$DATE $TRIGGER \"$IMDBLKL\" \"$RATING\" \"$IMDBDST\"" >> $GLLOG fi if [ ! -z "$SHOWSTAR" ] && [ -z "$BOTONELINE" ] && [ ! -z "$CASTLEADNAME" ]; then echo "$DATE $TRIGGER \"$IMDBLKL\" \"Starring.....: $CASTLEADNAME as $CASTLEADCHAR\" \"$IMDBDST\"" >> $GLLOG fi if [ ! -z "$RUNTIME" ] && [ -z "$BOTONELINE" ]; then echo "$DATE $TRIGGER \"$IMDBLKL\" \"$RUNTIME\" \"$IMDBDST\"" >> $GLLOG fi if [ ! -z "$BUSINESSSHORT" ] && [ -z "$BOTONELINE" ]; then echo "$DATE $TRIGGER \"$IMDBLKL\" \"Opening Stats: $BUSINESSSHORT\" \"$IMDBDST\"" | tr '[=$=]' '¤' | sed "s|¤|USD|g" >> $GLLOG fi if [ ! -z "$PREMIERE" ] && [ -z "$BOTONELINE" ]; then echo "$DATE $TRIGGER \"$IMDBLKL\" \"Premiere Date: $PREMIERE\" \"$IMDBDST\"" >> $GLLOG fi if [ ! -z "$LIMITED" ] && [ -z "$BOTONELINE" ]; then echo "$DATE $TRIGGER \"$IMDBLKL\" \"Limited Date.: $LIMITED\" \"$IMDBDST\"" >> $GLLOG fi if [ ! -z "$TAGLINE" ] && [ ! -z "$PLOT" ] && [ -z "$BOTONELINE" ]; then if [ "$TAGPLOT" = "TAG" ] || [ -z "$TAGPLOT" ] ; then echo "$DATE $TRIGGER \"$IMDBLKL\" \"$TAGLINE\" \"$IMDBDST\"" >> $GLLOG fi if [ "$TAGPLOT" = "PLOT" ] || [ -z "$TAGPLOT" ]; then echo "$DATE $TRIGGER \"$IMDBLKL\" \"$PLOT\" \"$IMDBDST\"" >> $GLLOG fi elif [ ! -z "$TAGLINE" ] && [ ! "$TAGPLOT" = "NONE" ] && [ -z "$BOTONELINE" ]; then echo "$DATE $TRIGGER \"$IMDBLKL\" \"$TAGLINE\" \"$IMDBDST\"" >> $GLLOG elif [ ! -z "$PLOT" ] && [ ! "$TAGPLOT" = "NONE" ] && [ -z "$BOTONELINE" ]; then echo "$DATE $TRIGGER \"$IMDBLKL\" \"$PLOT\" \"$IMDBDST\"" >> $GLLOG fi if [ ! -z "$SHOWCOMMENTSHORT" ] && [ ! "$COMMENTSHORT" = "User Comments:" ] && [ -z "$BOTONELINE" ]; then echo "$DATE $TRIGGER \"$IMDBLKL\" \"$COMMENTSHORT\" \"$IMDBDST\"" >> $GLLOG fi if [ ! -z "$BOTONELINE" ]; then if [ -z "$LOGFORMAT" ]; then echo "$DATE $TRIGGER \"$IMDBLKL\" \"$ONELINE\" \"$IMDBDST\"" >> $GLLOG elif [ "$LOGFORMAT" = "MYOWN" ]; then # NEWLINE="|" MYOWNPAIRS="%imdbdirname|IMDBDIR %imdburl|IMDBURL %imdbtitle|TITLE %imdbgenre|GENRECLEAN %imdbrating|RATINGCLEAN %imdbcountry|COUNTRYCLEAN %imdblanguage|LANGUAGECLEAN %imdbcertification|CERTCLEAN %imdbruntime|RUNTIMECLEAN %imdbdirector|DIRECTORCLEAN %imdbbusinessdata|BUSINESSSHORT %imdbpremiereinfo|PREMIERE %imdblimitedinfo|LIMITED %imdbvotes|RATINGVOTES %imdbscore|RATINGSCORE %imdbname|TITLENAME %imdbyear|TITLEYEAR %imdbnumscreens|BUSINESSSCREENS %imdbislimited|ISLIMITED %imdbcastleadname|CASTLEADNAME %imdbcastleadchar|CASTLEADCHAR %imdbtagline|TAGLINECLEAN %imdbplot|PLOTCLEAN %imdbbar|RATINGBAR %imdbcasting|CASTCLEAN %imdbcommentshort|COMMENTSHORTCLEAN %newline|NEWLINE %bold|BOLD" for OWNPAIR in $MYOWNPAIRS; do MYOWNSTRING="`echo "$OWNPAIR" | cut -d '|' -f 1`" MYOWNVAR="`echo "$OWNPAIR" | cut -d '|' -f 2`" if [ ! -z "${!MYOWNVAR}" ]; then MYTEMPVAR="`echo "${!MYOWNVAR}" | tr '\&' '\`'`" MYOWNFORMAT="`echo "$MYOWNFORMAT" | sed "s^$MYOWNSTRING^$MYTEMPVAR^g" | tr '\`' '\&'`" else MYOWNFORMAT="`echo "$MYOWNFORMAT" | sed "s^$MYOWNSTRING^$MYOWNEMPTY^g"`" fi done echo "$DATE $TRIGGER \"$IMDBLKL\" \"$MYOWNFORMAT\" \"$IMDBDST\"" | tr '[=$=]' '¤' | sed "s|¤|USD|g" >> $GLLOG else echo "$DATE $TRIGGER \"$IMDBLKL\" \"$IMDBDIR\" \"$IMDBURL\" \"$TITLE\" \"$GENRECLEAN\" \"$RATINGCLEAN\" \"$COUNTRYCLEAN\" \"$LANGUAGECLEAN\" \"$CERTCLEAN\" \"$RUNTIMECLEAN\" \"$DIRECTORCLEAN\" \"$BUSINESSSHORT\" \"$PREMIERE\" \"$LIMITED\" \"$RATINGVOTES\" \"$RATINGSCORE\" \"$TITLENAME\" \"$TITLEYEAR\" \"$BUSINESSSCREENS\" \"$ISLIMITED\" \"$CASTLEADNAME\" \"$CASTLEADCHAR\" \"$TAGLINECLEAN\" \"$PLOTCLEAN\" \"$RATINGBAR\" \"$CASTCLEAN\" \"$COMMENTSHORTCLEAN\" \"$IMDBDST\"" | tr '[=$=]' '¤' | sed "s|¤|USD|g" >> $GLLOG fi fi fi if [ ! -z "$DOTIMDB" ]; then # Echo stuff to the .imdb file ############################## echo -e "$IMDBHEAD" > "$IMDBLNK" OWNER=`ls -1nl "$GLROOT$IMDBLKL" | tail -n 1 | { read junk junk owner group junk; echo $owner:$group; };` echo "Title........: $TITLE" | fold -s -w $IMDBWIDTH | head -n 1 >> "$IMDBLNK" echo "-" >> "$IMDBLNK" echo "IMDb Link....: $IMDBURL" | head -n 1 >> "$IMDBLNK" if [ ! -z "$DIRECTOR" ]; then echo "$DIRECTOR" | fold -s -w $IMDBWIDTH | head -n 1 >> "$IMDBLNK" fi if [ ! -z "$GENRE" ]; then echo "$GENRE" | fold -s -w $IMDBWIDTH | head -n 1 >> "$IMDBLNK" fi if [ ! -z "$RATING" ]; then echo "$RATING" | fold -s -w $IMDBWIDTH | head -n 1 >> "$IMDBLNK" fi if [ ! -z "$TAGLINE" ]; then echo "$TAGLINE" | fold -s -w $IMDBWIDTH >> "$IMDBLNK" fi echo "-" >> "$IMDBLNK" if [ ! -z "$COUNTRY" ]; then echo "$COUNTRY" | fold -s -w $IMDBWIDTH | head -n 1 >> "$IMDBLNK" fi if [ ! -z "$LANGUAGE" ]; then echo "$LANGUAGE" | fold -s -w $IMDBWIDTH | head -n 1 >> "$IMDBLNK" fi if [ ! -z "$CERT" ]; then echo "$CERT" | fold -s -w $IMDBWIDTH | head -n 1 >> "$IMDBLNK" fi if [ ! -z "$PREMIERE" ]; then echo "Premiere Date: $PREMIERE" | fold -s -w $IMDBWIDTH | head -n 1 >> "$IMDBLNK" fi if [ ! -z "$LIMITED" ]; then echo "Limited Date.: $LIMITED" | fold -s -w $IMDBWIDTH | head -n 1 >> "$IMDBLNK" fi if [ ! -z "$RUNTIME" ]; then echo "$RUNTIME" | fold -s -w $IMDBWIDTH | head -n 1 >> "$IMDBLNK" fi if [ ! -z "$CAST" ]; then echo "-" >> "$IMDBLNK" echo "Credited Cast:" >> "$IMDBLNK" echo "$CAST" | fold -s -w $IMDBWIDTH >> "$IMDBLNK" fi if [ ! -z "$BUSINESS" ]; then echo "-" >> "$IMDBLNK" echo "Business Data on Opening Weekend:" >> "$IMDBLNK" echo "$BUSINESS" | fold -s -w $IMDBWIDTH >> "$IMDBLNK" fi if [ ! -z "$PLOT" ]; then echo "-" >> "$IMDBLNK" echo "$PLOT" | fold -s -w $IMDBWIDTH >> "$IMDBLNK" fi if [ ! -z "$SHOWCOMMENT" ] && [ ! -z "`echo $COMMENT | grep -a -e "^User Comments:" | grep -a -e "Check for other user comments.$"`" ]; then echo "---" >> "$IMDBLNK" echo "User Comments:" >> "$IMDBLNK" echo "$COMMENT" | grep -a -e "^ " | sed "s/^\ *//g" | sed "s/\ *$//g" | tr -s ' ' | fold -s -w $IMDBWIDTH >> "$IMDBLNK" fi echo -e "$IMDBTAIL" >> "$IMDBLNK" fi if [ ! -z "$INFOTEMPNAME" ]; then # make a file/dir with imdb info in the name INFOGENRES=`echo $GENRECLEAN | tr '/ ' '\n' | sed -e /^$/d | wc -l` if [ ! $INFOGENRES -gt $INFOGENREMAX ]; then let INFOGENREMAXED=INFOGENRES else let INFOGENREMAXED=INFOGENREMAX fi if [ ! $INFOGENRES -lt 1 ]; then GENREFILE="`echo $GENRECLEAN | tr '/ ' '\n' | sed -e /^$/d | head -n $INFOGENREMAX | tr '\n' ' ' | sed "s/ /$INFOGENRESEP/g" | cut -d "$INFOGENRESEP" -f 1-$INFOGENREMAXED`" else GENREFILE="Unclassified" fi VOTESFILE="`echo $RATINGVOTES | tr ',' '.'`" if [ -z "$ISLIMITED" ]; then ISLIMITED="unknown" fi NUMSCREENS="`echo $BUSINESSSCREENS | tr ',' '.'`" if [ -z "$NUMSCREENS" ]; then NUMSCREENS="unknown" fi if [ -z "$RUNTIMECLEAN" ]; then RUNTIMECLEAN="unknown" fi INFOFILENAMEOLD="`echo "$INFOFILENAME" | tr -c $INFOVALID $INFOCHARTO | sed "s%VOTES%*%g" | sed "s%SCORE%*%g" | sed "s%GENRE%*%g" | sed "s%RUNTIME%*%g" | sed "s%YEAR%*%g" | sed "s%ISLIMITED%*%g" | sed "s%SCREENS%*%g" | tr -d ' '`" INFOFILENAMEOLDA="`echo "$INFOFILENAMEOLD" | sed "s%*%.*%g"`" INFOFILENAMEOLDB="`echo "$INFOFILENAMEOLDA" | tr '\]\[' '.'`" INFOFILENAMEPRINT="`echo "$INFOFILENAME" | sed "s%VOTES%$VOTESFILE%g" | sed "s%SCORE%$RATINGSCORE%g" | sed "s%GENRE%$GENREFILE%g" | sed "s%RUNTIME%$RUNTIMECLEAN%g" | sed "s%YEAR%$TITLEYEAR%g" | sed "s%ISLIMITED%$ISLIMITED%g" | sed "s%SCREENS%$NUMSCREENS%g"`" INFOFILENAMEPRINT="`echo "$INFOFILENAMEPRINT" | tr -c $INFOVALID $INFOCHARTO`" if [ ! -z "`ls -1 "$GLROOT$IMDBLKL" | grep -a -e "$INFOFILENAMEOLDB"`" ]; then for OLDINFOFILE in `ls -1 "$GLROOT$IMDBLKL" | grep -a -e "$INFOFILENAMEOLDB" | tr -d ' '`; do rm -f "$GLROOT$IMDBLKL/"$OLDINFOFILE >/dev/null 2>&1 rmdir "$GLROOT$IMDBLKL/"$OLDINFOFILE >/dev/null 2>&1 done fi if [ -e "$GLROOT$IMDBLKL/$INFOTEMPNAME" ]; then mv "$GLROOT$IMDBLKL/$INFOTEMPNAME" "$GLROOT$IMDBLKL/$INFOFILENAMEPRINT" fi fi # Should we run any external scripts? if [ ! -z "$EXTERNALSCRIPTNAME" ]; then FILENAMED=`ls -1Ftr "$GLROOT$IMDBLKL" | grep -a -v "/" | grep -a -v "@" | grep -a -e "[.][nN][fF][oO]" | head -n 1` if [ ! -z "$FILENAMED" ]; then touch -acmr "$GLROOT$IMDBLKL/$FILENAMED" "$GLROOT$IMDBLKL" >/dev/null 2>&1 fi for EXTERNALNAME in $EXTERNALSCRIPTNAME; do if [ "$DEBUG" = "4" ] && [ ! -z "`head -n 1 $EXTERNALNAME | grep -a -e "/bin/bash"`" ]; then bash -x -v $EXTERNALNAME "\"$DATE\" \"$IMDBLNK\" \"$IMDBLKL\" \"$IMDBDIR\" \"$IMDBURL\" \"$TITLE\" \"$GENRECLEAN\" \"$RATINGCLEAN\" \"$COUNTRYCLEAN\" \"$LANGUAGECLEAN\" \"$CERTCLEAN\" \"$RUNTIMECLEAN\" \"$DIRECTORCLEAN\" \"$BUSINESSSHORT\" \"$PREMIERE\" \"$LIMITED\" \"$RATINGVOTES\" \"$RATINGSCORE\" \"$TITLENAME\" \"$TITLEYEAR\" \"$BUSINESSSCREENS\" \"$ISLIMITED\" \"$CASTLEADNAME\" \"$CASTLEADCHAR\" \"$TAGLINECLEAN\" \"$PLOTCLEAN\" \"$RATINGBAR\" \"$CASTCLEAN\" \"$COMMENTSHORTCLEAN\" \"$COMMENTCLEAN\"" else $EXTERNALNAME "\"$DATE\" \"$IMDBLNK\" \"$IMDBLKL\" \"$IMDBDIR\" \"$IMDBURL\" \"$TITLE\" \"$GENRECLEAN\" \"$RATINGCLEAN\" \"$COUNTRYCLEAN\" \"$LANGUAGECLEAN\" \"$CERTCLEAN\" \"$RUNTIMECLEAN\" \"$DIRECTORCLEAN\" \"$BUSINESSSHORT\" \"$PREMIERE\" \"$LIMITED\" \"$RATINGVOTES\" \"$RATINGSCORE\" \"$TITLENAME\" \"$TITLEYEAR\" \"$BUSINESSSCREENS\" \"$ISLIMITED\" \"$CASTLEADNAME\" \"$CASTLEADCHAR\" \"$TAGLINECLEAN\" \"$PLOTCLEAN\" \"$RATINGBAR\" \"$CASTCLEAN\" \"$COMMENTSHORTCLEAN\" \"$COMMENTCLEAN\"" fi done # restore the releasedir's original date. ######################################### FILENAMED=`ls -1Ftr "$GLROOT$IMDBLKL" | grep -a -v "/" | grep -a -v "@" | grep -a -e "[.][nN][fF][oO]" | head -n 1` if [ ! -z "$FILENAMED" ]; then touch -acmr "$GLROOT$IMDBLKL/$FILENAMED" "$GLROOT$IMDBLKL" >/dev/null 2>&1 fi fi fi # clean up and make ready for next run. ####################################### cat $IMDBLOG | grep -a -F -v "$IMDBLINE" > $TMPFILE cat $TMPFILE > $IMDBLOG echo -n "" > $TMPFILE done echo -n "" > $IMDBPID fi + '[' '!' -z '' ']' + '[' -z ahs-war.nfo ']' exit 0 + exit 0