Add unique config option to shows
This disables the automatic detection of multiple shows with identical names, which will add a timestamp to the filename. With unique=true, the show is treated as having unique episode titles, and only the first one will be downloaded.
This commit is contained in:
parent
f91a6afc70
commit
b77ae6c9a8
2 changed files with 21 additions and 6 deletions
|
@ -4,6 +4,7 @@ shows:
|
||||||
- "Conan":
|
- "Conan":
|
||||||
- series: "Dirk Gently's Holistic Detective Agency"
|
- series: "Dirk Gently's Holistic Detective Agency"
|
||||||
short: "Dirk Gently"
|
short: "Dirk Gently"
|
||||||
|
unique: true
|
||||||
host: "wavehh.lassitu.de:30080"
|
host: "wavehh.lassitu.de:30080"
|
||||||
postprocess: 'NQDIR=/home/stb/.tivo/nq nq archivevideo "{item.target}"'
|
postprocess: 'NQDIR=/home/stb/.tivo/nq nq archivevideo "{item.target}"'
|
||||||
proxies:
|
proxies:
|
||||||
|
|
|
@ -70,8 +70,10 @@ class Config:
|
||||||
|
|
||||||
for show in self.shows:
|
for show in self.shows:
|
||||||
if isinstance(show, dict):
|
if isinstance(show, dict):
|
||||||
if 'short' in show and 'series' in show:
|
if 'series' in show:
|
||||||
IncludeShow(show['series'], show['short'])
|
IncludeShow(show['series'],
|
||||||
|
short=show.get('short', show['series']),
|
||||||
|
unique=show.get('unique'))
|
||||||
else:
|
else:
|
||||||
logger.error("Need either a string, or a dict with 'series' and 'short' entries for a show, got \"{}\".".format\
|
logger.error("Need either a string, or a dict with 'series' and 'short' entries for a show, got \"{}\".".format\
|
||||||
(show))
|
(show))
|
||||||
|
@ -87,10 +89,11 @@ config = None
|
||||||
class IncludeShow:
|
class IncludeShow:
|
||||||
includes = dict()
|
includes = dict()
|
||||||
|
|
||||||
def __init__(self, title, short=None):
|
def __init__(self, title, short=None, unique=None):
|
||||||
self.short = short
|
self.short = short
|
||||||
self.title = title
|
self.title = title
|
||||||
self.timestamp = False
|
self.timestamp = False
|
||||||
|
self.unique = unique
|
||||||
self.includes[title] = self
|
self.includes[title] = self
|
||||||
|
|
||||||
|
|
||||||
|
@ -316,12 +319,23 @@ class TivoToc:
|
||||||
names[item.name] = []
|
names[item.name] = []
|
||||||
names[item.name].append(item)
|
names[item.name].append(item)
|
||||||
for name in names:
|
for name in names:
|
||||||
if len(names[name]) > 1:
|
utf8title = title.encode("utf-8")
|
||||||
self.uniquedb[title.encode("utf-8")] = "1"
|
if len(names[name]) > 1 and not self.uniquedb.has_key(utf8title):
|
||||||
|
self.uniquedb[utf8title] = "1"
|
||||||
if getattr(self.uniquedb, "sync", None) and callable(self.uniquedb.sync):
|
if getattr(self.uniquedb, "sync", None) and callable(self.uniquedb.sync):
|
||||||
self.uniquedb.sync()
|
self.uniquedb.sync()
|
||||||
|
# update all items based on config and uniquedb
|
||||||
for item in self.items:
|
for item in self.items:
|
||||||
if self.uniquedb.has_key(item.title.encode("utf-8")):
|
multiple = None
|
||||||
|
options = IncludeShow.includes.get(title)
|
||||||
|
if options:
|
||||||
|
if options.unique:
|
||||||
|
multiple = False
|
||||||
|
if multiple == None:
|
||||||
|
utf8title = title.encode("utf-8")
|
||||||
|
if self.uniquedb.has_key(utf8title) and self.uniquedb[utf8title] == '1':
|
||||||
|
multiple = True
|
||||||
|
if multiple:
|
||||||
item.makeNotUnique()
|
item.makeNotUnique()
|
||||||
return self.items
|
return self.items
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue