[mythtv-users] Program Categorizing script: myth_categorize - Please test :)

Martin Moeller martin at martinm-76.dk
Fri Jan 9 15:29:53 EST 2004


Thank you. I have incorporated your changes and tested it. It still
works like it's supposed to :)

Looks somewhat cleaner now. Great! Hope others than I can get nice
results from the script...

/Martin.

fre, 2004-01-09 kl. 12:13 skrev Brad Allen:
> This patch is untested, but I decided to send it in because it will
> make using your script easier since it requires less configuration now
> (it adds support for mysql.txt so you don't have to put password into
> script any more).
> 
> ______________________________________________________________________
> --- myth_categorize.~1~	2004-01-07 14:20:07.000000000 -0800
> +++ myth_categorize	2004-01-09 00:34:47.000000000 -0800
> @@ -46,15 +46,21 @@
>  MAXMOVIE=10800              # Maximum movie length : 3:00. Adjust if needed.
>  
>  # Maybe search for mysql.txt and grab from there?
> -mysql_host="-hlocalhost"
> -mysql_user="mythtv"
> -mysql_pass="mythtv"
> +# Yes, I have a script that already does that:  -ulmo at q.net 20040909
> +for i in /etc /usr/share/mythtv; do
> + if [ -r "$i/mysql.txt" ];then . "$i/mysql.txt";break;fi;done
> +mysql_bare()  { mysql	"-h$DBHostName" "-u$DBUserName" "-p$DBPassword" \
> +			"$DBName" '--skip-column-names' "$@"; }
> +mysql_batch() { mysql_bare -B "$@"; }
> +mysql_exec()  { mysql_bare -e "$@"; }
>  
>  export TERM=xterm
>  
>  if [ "$1" != "manual" ] ; then
> -  mysql $mysql_host -u$mysql_user -p$mysql_pass mythconverg --skip-column-names -B -e "select chanid,starttime,endtime,description from program;" | tr '\t' '§' > /tmp/description.sql
> -  mysql $mysql_host -u$mysql_user -p$mysql_pass mythconverg --skip-column-names -B -e "select chanid,starttime,endtime,title,subtitle from program;" | tr '\t' '§' > /tmp/title.sql
> +  mysql_exec "SELECT chanid,starttime,endtime,description FROM program;"|
> +  tr '\t' '§' > /tmp/description.sql
> +  mysql_exec "SELECT chanid,starttime,endtime,title,subtitle FROM program;"|
> +  tr '\t' '§' > /tmp/title.sql
>  fi 
>  
>  if [ -e /tmp/categories ] ; then
> @@ -146,7 +152,9 @@
>      done
>    fi
>  
> -  mysql $mysql_host -u$mysql_user -p$mysql_pass mythconverg --skip-column-names -B -e "SELECT chanid,starttime,endtime from program WHERE subtitle<>\"\" and subtitle not like \"Episode%\" $EXCLUDE ;" | tr '\t' ':' >  /tmp/mov1 
> +  mysql_exec "SELECT chanid,starttime,endtime FROM program \
> +    WHERE subtitle<>\"\" AND subtitle NOT LIKE \"Episode%\" ${EXCLUDE};"|
> +  tr '\t' ':' >  /tmp/mov1 
>    for y in $(cat /tmp/mov1) ; do
>      CHANID=$(echo $y | cut -d: -f1) 
>      STARTTIME=$(echo $y | cut -d: -f2) 
> @@ -185,12 +193,12 @@
>  done
>  
>  if [ -e /tmp/mov2 ] ; then
> -  mysql $mysql_host -u$mysql_user -p$mysql_pass mythconverg < /tmp/mov2
> +  mysql_batch < /tmp/mov2
>    echo -n "."
>    rm /tmp/mov2
>  fi
>  
> -mysql $mysql_host -u$mysql_user -p$mysql_pass mythconverg < /tmp/categories/all.sql
> +mysql_batch < /tmp/categories/all.sql
>  echo -n "."
>  #rm /tmp/categories/all.sql
>  echo -n "."



More information about the mythtv-users mailing list