Description fuer den Episodentitel verwenden, wenn keiner angegeben ist

This commit is contained in:
Stefan Bethke 2012-08-23 19:12:32 +00:00
parent 80535becb2
commit db4e634bbd

View file

@ -1,6 +1,6 @@
#!/usr/local/bin/python
# $Schlepperbande: src/tivomirror/tivomirror,v 1.46 2011/11/26 13:58:43 stb Exp $
# $Schlepperbande: src/tivomirror/tivomirror,v 1.47 2012/07/27 20:19:03 stb Exp $
#
# Stefans Script, um die Sendungen vom Tivo runterzuladen und in MPEG4
# zu transkodieren.
@ -33,12 +33,13 @@ arset = dict()
arset["Futurama"] = 169
includes = dict()
includes['Breaking Bad'] = 1
includes['Castle'] = 1
includes['Dirty Jobs'] = 1
includes['Family Guy'] = 1
includes['Flying Wild Alaska'] = 1
includes['Futurama'] = 1
includes['House'] = 1
includes["John Oliver's New York Stand-Up Show"] = 1
includes['Late Show With David Letterman'] = 1
includes['Louie'] = 1
includes['Mad Men'] = 1
@ -72,6 +73,15 @@ opener = urllib2.build_opener(authhandler, urllib2.HTTPCookieProcessor(cookiejar
urllib2.install_opener(opener)
tmp = "/tmp"
def trimDescription(desc):
desc = desc.strip()
i = desc.rfind(". Copyright Tribune Media Services, Inc.");
if i > 0:
desc = desc[0:i]
if len(desc) > 80:
desc = desc[0:80]
return desc
class TivoException(Exception):
def __init__(self, value):
self.value = value
@ -82,6 +92,7 @@ class TivoItem:
def __init__(self, i):
self.title = getTagText(i, "Title")
self.episode = getTagText(i, "EpisodeTitle")
self.description = trimDescription(getTagText(i, "Description"))
d = getTagText(i, "CaptureDate")
self.date = datetime.datetime.utcfromtimestamp(int(d, 16))
self.time = int(d, base=0)
@ -96,8 +107,13 @@ class TivoItem:
self.ar = arset[self.title]
elif self.highdef == "Yes":
self.ar = "hd"
if ignoreepisodetitle or (self.episode == ""):
if ignoreepisodetitle:
self.episode = self.datestr
if self.episode == "":
if self.description != "":
self.episode = self.description
else:
self.episode = self.datestr
def __str__(self):
return repr(self.title)