init script

  • Post author:
  • Post category:Mythtv

Jake Graft pointed out in a comment that I had forgotten to put the init script from the MythTV book online. My apologies. #! /bin/sh # # mythbackend # PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin BACKEND=/usr/local/bin/mythbackend BACKEND_NAME=mythbackend MYTHUSER="myth" test -x $BACKEND || exit 0 set -e case "$1" in start) echo -n "Starting MythTV: $BACKEND_NAME" su ${MYTHUSER} -c "$BACKEND -v all -d -l ${MBE_LOGFILE}" & echo "." ;; stop) echo -n "Stopping MythTV: $BACKEND_NAME" killall $BACKEND echo "." ;; *) echo "Usage: $0 {start|stop}" >&2 exit 1 ;; esac exit 0

Continue Readinginit script

Building a symlink tree for MythTV recordings

  • Post author:
  • Post category:Mythtv

I wanted to build a directory of symlinks that pointed to my MythTV recordings, so I wrote a little python script to do it for me. I figure someone else might find this useful too... #!/usr/bin/python # Copyright (C) Michael Still (mikal@stillhq.com) 2007 # Released under the terms of the GNU GPL import MySQLdb import os import re from socket import gethostname # Connect to the MythTV database based on the MythTV config config_values = {} home = os.environ.get('HOME') config = open(home + '/.mythtv/mysql.txt') for line in config.readlines(): if not line.startswith('#') and len(line) > 5: (key, value) = line.rstrip('\n').split('=') config_values[key] = value db_connection = MySQLdb.connect(host = config_values['DBHostName'], user = config_values['DBUserName'], passwd = config_values['DBPassword'], db = config_values['DBName']) cursor = db_connection.cursor(MySQLdb.cursors.DictCursor) # Regexp for what is allowed in the symlink name unsafe = re.compile('[^a-zA-Z0-9\-\:_]+') # Find the recordings directory -- this assumes you haven't used an # identifier string for this machine... cursor.execute('select * from settings where value="RecordFilePrefix" and ' 'hostname="%s";' % gethostname()) row = cursor.fetchone() basedir = row['data'] # Now find all the recordings we have at the moment cursor.execute('select title, subtitle, starttime, basename from recorded;') for i in range(cursor.rowcount): row = cursor.fetchone() title = row['title'] subtitle = row['subtitle'] if subtitle…

Continue ReadingBuilding a symlink tree for MythTV recordings

End of content

No more pages to load