def check_enabled_sections(self): enabled_for_primary_agents = {"movie": [], "show": []} enabled_sections = {} # find which agents we're enabled for for agent in Plex.agents(): if not agent.primary: continue for t in list(agent.media_types): if t.media_type in (MOVIE, SHOW): related_agents = Plex.primary_agent( agent.identifier, t.media_type) for a in related_agents: if a.identifier == PLUGIN_IDENTIFIER and a.enabled: enabled_for_primary_agents[MEDIA_TYPE_TO_STRING[ t.media_type]].append(agent.identifier) # find the libraries that use them for library in self.sections: if library.agent in enabled_for_primary_agents.get( library.type, []): enabled_sections[library.key] = library Log.Debug(u"I'm enabled for: %s" % [lib.title for key, lib in enabled_sections.iteritems()]) return enabled_sections
def check_enabled_sections(self): enabled_for_primary_agents = {"movie": [], "show": []} enabled_sections = {} # find which agents we're enabled for for agent in Plex.agents(): if not agent.primary: continue for t in list(agent.media_types): if t.media_type in (MOVIE, SHOW): related_agents = Plex.primary_agent(agent.identifier, t.media_type) for a in related_agents: if a.identifier == PLUGIN_IDENTIFIER and a.enabled: enabled_for_primary_agents[MEDIA_TYPE_TO_STRING[t.media_type]].append(agent.identifier) # find the libraries that use them for library in self.sections: if library.agent in enabled_for_primary_agents.get(library.type, []): enabled_sections[library.key] = library Log.Debug(u"I'm enabled for: %s" % [lib.title for key, lib in enabled_sections.iteritems()]) return enabled_sections