Update release information on re-search. fixes #181
This commit is contained in:
1 parent
d5f8add25a
commit
a58088dc7c
1 file changed
+18
-13
@@ -65,6 +65,8 @@ class Searcher(Plugin):
|
|||||||
|
|
||||||
def single(self, movie):
|
def single(self, movie):
|
||||||
|
|
||||||
|
db = get_session()
|
||||||
|
|
||||||
pre_releases = fireEvent('quality.pre_releases', single = True)
|
pre_releases = fireEvent('quality.pre_releases', single = True)
|
||||||
release_dates = fireEvent('library.update_release_date', identifier = movie['library']['identifier'], merge = True)
|
release_dates = fireEvent('library.update_release_date', identifier = movie['library']['identifier'], merge = True)
|
||||||
available_status = fireEvent('status.get', 'available', single = True)
|
available_status = fireEvent('status.get', 'available', single = True)
|
||||||
@@ -94,7 +96,6 @@ class Searcher(Plugin):
|
|||||||
|
|
||||||
# Add them to this movie releases list
|
# Add them to this movie releases list
|
||||||
for nzb in sorted_results:
|
for nzb in sorted_results:
|
||||||
db = get_session()
|
|
||||||
|
|
||||||
rls = db.query(Release).filter_by(identifier = md5(nzb['url'])).first()
|
rls = db.query(Release).filter_by(identifier = md5(nzb['url'])).first()
|
||||||
if not rls:
|
if not rls:
|
||||||
@@ -106,20 +107,23 @@ class Searcher(Plugin):
|
|||||||
)
|
)
|
||||||
db.add(rls)
|
db.add(rls)
|
||||||
db.commit()
|
db.commit()
|
||||||
|
else:
|
||||||
|
[db.delete(info) for info in rls.info]
|
||||||
|
db.commit()
|
||||||
|
|
||||||
for info in nzb:
|
for info in nzb:
|
||||||
try:
|
try:
|
||||||
if not isinstance(nzb[info], (str, unicode, int, long)):
|
if not isinstance(nzb[info], (str, unicode, int, long)):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
rls_info = ReleaseInfo(
|
rls_info = ReleaseInfo(
|
||||||
identifier = info,
|
identifier = info,
|
||||||
value = toUnicode(nzb[info])
|
value = toUnicode(nzb[info])
|
||||||
)
|
)
|
||||||
rls.info.append(rls_info)
|
rls.info.append(rls_info)
|
||||||
db.commit()
|
db.commit()
|
||||||
except InterfaceError:
|
except InterfaceError:
|
||||||
log.debug('Couldn\'t add %s to ReleaseInfo: %s' % (info, traceback.format_exc()))
|
log.debug('Couldn\'t add %s to ReleaseInfo: %s' % (info, traceback.format_exc()))
|
||||||
|
|
||||||
|
|
||||||
for nzb in sorted_results:
|
for nzb in sorted_results:
|
||||||
@@ -137,6 +141,7 @@ class Searcher(Plugin):
|
|||||||
if self.shuttingDown():
|
if self.shuttingDown():
|
||||||
break
|
break
|
||||||
|
|
||||||
|
db.remove()
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def download(self, data, movie, manual = False):
|
def download(self, data, movie, manual = False):
|
||||||
|
|||||||
Reference in new issue
Block a user