def sections(self, section_type=None): # Retrieve "section" for current task section_key = self.current.kwargs.get('section', None) # Fetch sections from server p_sections = Plex['library'].sections() if p_sections is None: return None # Filter sections, map to dictionary result = {} for section in p_sections.filter(section_type, section_key): # Apply section name filter if not Filters.is_valid_section_name(section.title): continue try: key = int(section.key) except Exception, ex: log.warn('Unable to cast section key %r to integer: %s', section.key, ex, exc_info=True) continue result[key] = section.uuid
def test_section_name_invalid_name(): # Basic Environment.prefs['filter_sections'] = 'one (movies)' assert Filters.is_valid_section_name('') is True
def test_section_name_invalid_name(): # Basic Environment.prefs["filter_sections"] = "one (movies)" assert Filters.is_valid_section_name("") is True