Merge pull request #2549 from fuzeman/tv_searcher
[TV] Searcher cleanup and matcher updates
This commit is contained in:
commit
180b2bbffe
14 files changed
+243
-154
No files matched your search
@@ -105,7 +105,6 @@ class YarrProvider(Provider):
|
||||
type = 'movie'
|
||||
|
||||
cat_ids = {}
|
||||
cat_ids_structure = None
|
||||
cat_backup_id = None
|
||||
|
||||
sizeGb = ['gb', 'gib']
|
||||
@@ -250,33 +249,9 @@ 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 = 'group'
|
||||
if type(group_cat_ids[0]) is str:
|
||||
self.cat_ids_structure = 'single'
|
||||
def getCatId(self, identifier):
|
||||
|
||||
def getCatId(self, identifier, group = None):
|
||||
|
||||
cat_ids = self.cat_ids
|
||||
|
||||
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 == 'group':
|
||||
if not group:
|
||||
raise ValueError("group is required on group cat_ids structure")
|
||||
|
||||
for group_type, group_cat_ids in cat_ids:
|
||||
if group in toIterable(group_type):
|
||||
cat_ids = group_cat_ids
|
||||
|
||||
for cats in cat_ids:
|
||||
ids, qualities = cats
|
||||
for ids, qualities in self.cat_ids:
|
||||
if identifier in qualities:
|
||||
return ids
|
||||
|
||||
|
||||
Reference in new issue
Block a user