d="/var/lib/mythtv/movies-group/rihanna/" def cmpTime(a,b): atime = int(time.mktime(a.recstartts.timetuple())) btime = int(time.mktime(b.recstartts.timetuple())) return btime - atime def filterMovies(a): return a.stars > 0 and a.recstatus == -1; myth = MythTV() db = MythDB() c = db.cursor() # c.execute("""UPDATE recorded SET %s = %%s # WHERE chanid=%%s and starttime=%%s""" % field, # (value,self.chanid,self.starttime)) # c.close() progs = filter(filterMovies, myth.getPendingRecordings()) for p in sorted(progs, cmpTime): print "%s %s %-8s %-8s %-20s" % (p.recstartts, p.chanid, p.recgroup, p.storagegroup, p.title) if p.recgroup <> "Movies" or p.storagegroup <> "Movies": c.execute("UPDATE record SET recgroup='Movies', storagegroup='Movies' WHERE recordid='%s'" % (p.recordid)) print "UPDATE: %s!" % p.recordid c.close()
LOG("mythadder.py v%s by Wagnerrp, Piotr Oniszczuk\n\n -Device : %s\n -Action : %s\n -DeviceLabel : %s\n -DeviceUUID : %s\n" % (version, device, action, label, uuid)) # # the drive is connected # if action == 'add': # connect to db try: LOG("-->Connecting to MythTV DB\n") db = MythDB() prepTable(db) except Exception, e: LOG(e.args[0]) sys.exit(1) cursor = db.cursor() regex = re.compile(device) time.sleep(mountWait) # wait a few seconds until the drive is mounted mount_output = commands.getoutput('mount -v') for line in mount_output.split('\n'): if regex.match(line): mount_point = line.split(' type ')[0].split(' on ')[1] LOG("Disk mounted at " + mount_point) cursor.execute("""SELECT extension FROM videotypes WHERE f_ignore=0""") extensions = zip(*cursor.fetchall())[0] cursor.execute("""SELECT dirname FROM storagegroup WHERE groupname='Videos'""") row = zip(*cursor.fetchall())[0] videoSGpath = str(row[0])
bookmark_file = '~/bookmarks.html' if len(sys.argv) == 2: bookmark_file = sys.argv[1] # check if file exists if not os.access(os.path.expanduser(bookmark_file), os.F_OK): print 'ERROR: bookmark file could not be found' sys.exit(-1) # connect to database try: db = MythDB() except: print 'ERROR: database could not be accessed' sys.exit(-1) # flush old entries and reset counter c = db.cursor() c.execute("""TRUNCATE TABLE websites""") c.close() # read in file fp = open(os.path.expanduser(bookmark_file)) data = ''.join(fp.readlines()) fp.close() # parse file for bookmarks parser = Parser() parser.feed(data)