Browse Source

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

pull/2284/head
Dean Gardiner 12 years ago
parent
commit
a95c030885
  1. 2
      couchpotato/core/media/show/searcher/main.py
  2. 16
      couchpotato/core/providers/base.py
  3. 4
      couchpotato/core/providers/torrent/iptorrents/main.py

2
couchpotato/core/media/show/searcher/main.py

@ -75,7 +75,7 @@ class ShowSearcher(Plugin):
return
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')
return

16
couchpotato/core/providers/base.py

@ -102,6 +102,7 @@ class YarrProvider(Provider):
type = 'movie'
cat_ids = {}
cat_ids_structure = None
cat_backup_id = None
sizeGb = ['gb', 'gib']
@ -246,11 +247,24 @@ class YarrProvider(Provider):
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'):
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:
if media_type in toIterable(group_type):
cat_ids = group_cat_ids

4
couchpotato/core/providers/torrent/iptorrents/main.py

@ -27,10 +27,10 @@ class IPTorrents(TorrentProvider):
([7], ['dvdrip', 'brrip']),
([6], ['dvdr']),
]),
(['season'], [
('season', [
([65], ['hdtv', '480p', '720p', '1080p']),
]),
(['episode'], [
('episode', [
([5], ['720p', '1080p']),
([78], ['480p']),
([4, 79], ['hdtv'])

Loading…
Cancel
Save