-
Notifications
You must be signed in to change notification settings - Fork 0
/
xbmc_list_episodes.py
executable file
·31 lines (26 loc) · 1.17 KB
/
xbmc_list_episodes.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#! /usr/bin/env python
import MySQLdb
import argparse
import gomXBMCTools
parser = argparse.ArgumentParser(description='Prints out all episodes for a given show')
parser.add_argument('-f', '--filename', action="store_true", default=False, required=False, help='print out path of episode too')
parser.add_argument('-s', '--show', type=str, required=True, help='the shows name')
parser.add_argument('-p', '--padding', type=int, default=60, required=False, help='column padding value')
args = parser.parse_args()
# globals
sortedEpList = []
actual_showname = ""
mysql_con = MySQLdb.connect (host = "localhost",user = "xbmc",passwd = "xbmc",db = "MyVideos75")
mc = mysql_con.cursor()
mc.execute("select strTitle, c12, c13, c00, strPath, strFilename from episodeview where strTitle like '%" + args.show + "%'" )
for m in mc:
actual_showname = m[0]
s = "s%se%s:\t\t" % (gomXBMCTools.formatNoAsStr( m[1]), gomXBMCTools.formatNoAsStr(m[2]))
ept = str(m[3]).ljust(args.padding)
s+= ept
if args.filename:
s += "%s%s" % (m[4], m[5])
sortedEpList.append(s)
print "Episodes in XBMC Library for: %s" % actual_showname
sortedEpList.sort()
for s in sortedEpList: print s