Season- und Episoden-Nummer mit in den Titel
This commit is contained in:
parent
4ef5d42b91
commit
500219a4af
1 changed files with 18 additions and 15 deletions
|
@ -1,6 +1,6 @@
|
|||
#!/usr/local/bin/python
|
||||
|
||||
# $Schlepperbande: src/tivomirror/tivomirror,v 1.48 2012/08/23 19:12:32 stb Exp $
|
||||
# $Schlepperbande: src/tivomirror/tivomirror,v 1.49 2013/02/21 07:06:02 stb Exp $
|
||||
#
|
||||
# Stefans Script, um die Sendungen vom Tivo runterzuladen und in MPEG4
|
||||
# zu transkodieren.
|
||||
|
@ -99,6 +99,7 @@ class TivoItem:
|
|||
def __init__(self, i):
|
||||
self.title = getTagText(i, "Title")
|
||||
self.episode = getTagText(i, "EpisodeTitle")
|
||||
self.episodeNumber = getTagText(i, "EpisodeNumber")
|
||||
self.description = trimDescription(getTagText(i, "Description"))
|
||||
d = getTagText(i, "CaptureDate")
|
||||
self.date = datetime.datetime.utcfromtimestamp(int(d, 16))
|
||||
|
@ -121,6 +122,19 @@ class TivoItem:
|
|||
self.episode = self.description
|
||||
else:
|
||||
self.episode = self.datestr
|
||||
if self.episodeNumber and self.episodeNumber != u'0':
|
||||
en = int(self.episodeNumber)
|
||||
if en >= 100:
|
||||
self.name = "%s S%02dE%02d %s" % (self.title, en / 100, en % 100, self.episode)
|
||||
else:
|
||||
self.name = "%s E%s %s" % (self.title, self.episodeNumber, self.episode)
|
||||
else:
|
||||
self.name = "%s - %s" % (self.title, self.episode)
|
||||
self.dir = "%s/%s" % (targetdir, re.sub("[:/]", "-", self.title))
|
||||
self.file = "%s/%s" % (self.dir, re.sub("[:/]", "-", self.name))
|
||||
self.name = self.name.encode("utf-8");
|
||||
self.dir = self.dir.encode("utf-8");
|
||||
self.file = self.file.encode("utf-8");
|
||||
def __str__(self):
|
||||
return repr(self.title)
|
||||
|
||||
|
@ -283,6 +297,7 @@ def savetoc(toc):
|
|||
fd.write(toc)
|
||||
fd.close()
|
||||
|
||||
|
||||
def wantitem(item, downloaddb):
|
||||
if item.inprogress == "Yes":
|
||||
return "recording"
|
||||
|
@ -298,6 +313,7 @@ def wantitem(item, downloaddb):
|
|||
return "not included"
|
||||
return ""
|
||||
|
||||
|
||||
def mirror(dom, downloaddb):
|
||||
avail = getAvail(targetdir)
|
||||
if avail < minfree:
|
||||
|
@ -309,13 +325,6 @@ def mirror(dom, downloaddb):
|
|||
print "*** %d shows listed" % (items.length)
|
||||
for i in items:
|
||||
item = TivoItem(i)
|
||||
item.name = "%s - %s" % (item.title, item.episode)
|
||||
#dir = "%s/tivo/%s" % (curdir, re.sub("[:/]", "-", item.title))
|
||||
item.dir = "%s/%s" % (targetdir, re.sub("[:/]", "-", item.title))
|
||||
item.file = "%s/%s" % (item.dir, re.sub("[:/]", "-", item.name))
|
||||
item.name = item.name.encode("utf-8");
|
||||
item.dir = item.dir.encode("utf-8");
|
||||
item.file = item.file.encode("utf-8");
|
||||
|
||||
reason = wantitem(item, downloaddb)
|
||||
if (reason != ""):
|
||||
|
@ -336,18 +345,12 @@ def mirror(dom, downloaddb):
|
|||
|
||||
print "*** Completed %s" % datetime.datetime.now().strftime("%Y-%m-%d %H:%M")
|
||||
|
||||
|
||||
def printtoc(dom, downloaddb):
|
||||
items = dom.getElementsByTagName("Item")
|
||||
print "*** %d shows listed" % (items.length)
|
||||
for i in items:
|
||||
item = TivoItem(i)
|
||||
item.name = "%s - %s" % (item.title, item.episode)
|
||||
#dir = "%s/tivo/%s" % (curdir, re.sub("[:/]", "-", item.title))
|
||||
item.dir = "%s/%s" % (targetdir, re.sub("[:/]", "-", item.title))
|
||||
item.file = "%s/%s" % (item.dir, re.sub("[:/]", "-", item.name))
|
||||
item.name = item.name.encode("utf-8");
|
||||
item.dir = item.dir.encode("utf-8");
|
||||
item.file = item.file.encode("utf-8");
|
||||
reason = wantitem(item, downloaddb)
|
||||
if (reason != ""):
|
||||
print "--- %-11.11s: %s" % (reason, item.name)
|
||||
|
|
Loading…
Reference in a new issue