Commit 8e43de89 authored by echel0n's avatar echel0n
Browse files

Fixed issues with removing duplicate shows and episodes

parent 7b19a3c9
# Changelog
- * 41dc16d - 2017-12-11: Updated misc provider code
- * d335473 - 2017-12-11: Fixed issues with removing duplicate shows and episodes
- * 7b19a3c - 2017-12-11: Updated misc provider code
- * 3f23fd2 - 2017-12-11: refactored remaining database calls to use custom database calls
- * cf0821c - 2017-12-11: Fixed issue #151 - using unicode instead of str to result post-process results
- * 4323d84 - 2017-12-10: Refactored database calls, resolves memory usage issues
......
......@@ -121,35 +121,26 @@ class MainDB(srDatabase):
del checked
def fix_dupe_shows(self):
checked = []
found = []
for show in self.all('tv_shows'):
if show['indexer_id'] in checked:
continue
for dupe in list(self.get_many('tv_shows', show['indexer_id']))[1::]:
sickrage.app.log.info("Deleting duplicate show with id: {}".format(dupe["indexer_id"]))
self.delete(dupe)
if show['indexer_id'] in found:
sickrage.app.log.info("Deleting duplicate show with id: {}".format(show["indexer_id"]))
self.delete(show)
found += [show['indexer_id']]
checked += [show['indexer_id']]
del checked
del found
def fix_dupe_episodes(self):
checked = []
found = []
for ep in self.all('tv_episodes'):
if ep['showid'] in checked:
continue
for dupe in list(self.get_many('tv_episodes', ep['showid']))[1::]:
if dupe['indexerid'] == ep['indexerid']:
sickrage.app.log.info("Deleting duplicate episode with id: {}".format(dupe["indexerid"]))
self.delete(dupe)
checked += [ep['showid']]
if ep['indexerid'] in found:
sickrage.app.log.info("Deleting duplicate episode with id: {}".format(ep["indexerid"]))
self.delete(ep)
found += [ep['indexerid']]
del checked
del found
def fix_orphaned_episodes(self):
for ep in self.all('tv_episodes'):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment