Move shows to be included to its own YAML file

This commit is contained in:
Stefan Bethke 2017-07-17 21:41:53 +02:00
parent c85db3449f
commit e2a734f571

View file

@ -30,6 +30,7 @@ import threading
import time import time
import urllib2 import urllib2
import xml.dom.minidom import xml.dom.minidom
import yaml
host = "tivo.lassitu.de" host = "tivo.lassitu.de"
#host = "wavehh.lassitu.de:30080" #host = "wavehh.lassitu.de:30080"
@ -42,6 +43,7 @@ tivodecode = "tivodecode"
cookies = "cookies.txt" cookies = "cookies.txt"
proxies=None proxies=None
#proxies={"http":"http://us:8888","https":"http://us:8888"} #proxies={"http":"http://us:8888","https":"http://us:8888"}
config = '~/.tivo/config.yaml'
headers = requests.utils.default_headers() headers = requests.utils.default_headers()
headers.update( headers.update(
@ -59,42 +61,6 @@ class IncludeShow:
self.timestamp = False self.timestamp = False
self.includes[title] = self self.includes[title] = self
IncludeShow('Splash and Bubbles')
IncludeShow('Angie Tribeca')
IncludeShow('Anthony Bourdain Parts Unknown')
IncludeShow('Better Call Saul')
IncludeShow('Brooklyn Nine-Nine')
IncludeShow('Bull')
IncludeShow('College Football')
IncludeShow('Conan')
IncludeShow("Dirk Gently's Holistic Detective Agency", short='Dirk Gently')
IncludeShow('The Expanse')
IncludeShow('Family Guy')
IncludeShow('Full Frontal With Samantha Bee', short='Full Frontal')
IncludeShow("How It's Made")
IncludeShow("How Do They Do It?")
IncludeShow("How We Got to Now With Steven Johnson")
IncludeShow('Inside Amy Schumer')
IncludeShow('Join or Die With Craig Ferguson')
IncludeShow('Last Week Tonight With John Oliver', short='John Oliver')
IncludeShow('Louie')
IncludeShow('Modern Family')
IncludeShow('MythBusters')
IncludeShow('NCIS')
IncludeShow('NCIS: New Orleans')
#IncludeShow('NFL Football')
IncludeShow('Person of Interest')
IncludeShow('Saturday Night Live', short='SNL')
IncludeShow('Sesame Street')
IncludeShow("Somebody's Gotta Do It With Mike Rowe")
IncludeShow('StarTalk')
IncludeShow('The Big Bang Theory')
IncludeShow('The Daily Show With Trevor Noah', short='Daily Show')
IncludeShow('The Late Show With Stephen Colbert', short='Colbert')
#IncludeShow('The Late Late Show With James Corden')
IncludeShow('The Muppets')
IncludeShow('The X-Files')
#IncludeShow('The Tonight Show Starring Jimmy Fallon')
@ -544,7 +510,7 @@ def printtoc(toc, downloaddb):
def main(): def main():
global ignoreepisodetitle, logger global config, ignoreepisodetitle, logger
curdir = os.getcwd() curdir = os.getcwd()
os.chdir(os.path.expanduser("~") + "/.tivo") os.chdir(os.path.expanduser("~") + "/.tivo")
handler = logging.handlers.RotatingFileHandler("tivomirror.log", maxBytes=2*1024*1024, backupCount=5) handler = logging.handlers.RotatingFileHandler("tivomirror.log", maxBytes=2*1024*1024, backupCount=5)
@ -557,10 +523,12 @@ def main():
updateToc = False updateToc = False
try: try:
options, remainder = getopt.getopt(sys.argv[1:], 'dvuT', options, remainder = getopt.getopt(sys.argv[1:], 'c:dvuT',
['ignoreepisodetitle', 'debug', 'verbose', 'update']) ['config', 'ignoreepisodetitle', 'debug', 'verbose', 'update'])
for opt, arg in options: for opt, arg in options:
if opt in ('-c', '--config'):
config = arg
if opt in ('-d', '--debug'): if opt in ('-d', '--debug'):
logger.setLevel(logging.DEBUG) logger.setLevel(logging.DEBUG)
if opt in ('-v', '--verbose'): if opt in ('-v', '--verbose'):
@ -571,6 +539,18 @@ def main():
if opt in ('-T', '--ignoreepisodetitle'): if opt in ('-T', '--ignoreepisodetitle'):
ignoreepisodetitle = True ignoreepisodetitle = True
config = os.path.expanduser(config)
with open(config, 'r') as ymlfile:
y = yaml.load(ymlfile)
for show in y['shows']:
for key in show:
value = show[key]
if value and 'short' in value:
IncludeShow(key, value['short'])
else:
IncludeShow(key)
if len(remainder) >= 1: if len(remainder) >= 1:
cmd = remainder[0] cmd = remainder[0]