Fix for discovering the cat_ids structure when the 'ids' are of str type.

This commit is contained in:
Dean Gardiner committed 2013-09-30 14:49:42 +13:00
1 parent bef6a74dfe
commit a95c030885
3 files changed
+18 -4

No files matched your search

+1 -1
View File
@@ -75,7 +75,7 @@ class ShowSearcher(Plugin):
return return
show, season, episode = self._lookupMedia(media) show, season, episode = self._lookupMedia(media)
if not show or not season: if show is None or season is None:
log.error('Unable to find show or season library in database, missing required data for searching') log.error('Unable to find show or season library in database, missing required data for searching')
return return
+15 -1
View File
@@ -102,6 +102,7 @@ class YarrProvider(Provider):
type = 'movie' type = 'movie'
cat_ids = {} cat_ids = {}
cat_ids_structure = None
cat_backup_id = None cat_backup_id = None
sizeGb = ['gb', 'gib'] sizeGb = ['gb', 'gib']
@@ -246,11 +247,24 @@ class YarrProvider(Provider):
return 0 return 0
def _discoverCatIdStructure(self):
# Discover cat_ids structure (single or groups)
for group_name, group_cat_ids in self.cat_ids:
if len(group_cat_ids) > 0:
if type(group_cat_ids[0]) is tuple:
self.cat_ids_structure = 'groups'
if type(group_cat_ids[0]) is str:
self.cat_ids_structure = 'single'
def getCatId(self, identifier, media_type = 'movie'): def getCatId(self, identifier, media_type = 'movie'):
cat_ids = self.cat_ids cat_ids = self.cat_ids
if type(toIterable(cat_ids[0][0])[0]) is str: if not self.cat_ids_structure:
self._discoverCatIdStructure()
# If cat_ids is in a 'groups' structure, locate the media group
if self.cat_ids_structure == 'groups':
for group_type, group_cat_ids in cat_ids: for group_type, group_cat_ids in cat_ids:
if media_type in toIterable(group_type): if media_type in toIterable(group_type):
cat_ids = group_cat_ids cat_ids = group_cat_ids
@@ -27,10 +27,10 @@ class IPTorrents(TorrentProvider):
([7], ['dvdrip', 'brrip']), ([7], ['dvdrip', 'brrip']),
([6], ['dvdr']), ([6], ['dvdr']),
]), ]),
(['season'], [ ('season', [
([65], ['hdtv', '480p', '720p', '1080p']), ([65], ['hdtv', '480p', '720p', '1080p']),
]), ]),
(['episode'], [ ('episode', [
([5], ['720p', '1080p']), ([5], ['720p', '1080p']),
([78], ['480p']), ([78], ['480p']),
([4, 79], ['hdtv']) ([4, 79], ['hdtv'])