def __init__(self, system):
   SystemService.__init__(self, system)
   Log.Debug("Starting the help service")
   Plugin.AddViewGroup('Help_Groups', viewMode="List", mediaType="items")
   Plugin.AddViewGroup("Help_Videos", viewMode="InfoList", mediaType="items")
   Route.Connect('/system/help', self.help_root_menu)
   Route.Connect('/system/help/{group_name}', self.help_group_menu)
示例#2
0
    def __init__(self, system):
        SystemService.__init__(self, system)
        Log.Debug("Starting the proxy service")

        Route.Connect('/system/proxy',
                      self.do_proxy,
                      method=['GET', 'POST', 'PUT', 'DELETE'])
示例#3
0
    def __init__(self, system):
        SystemService.__init__(self, system)
        Log.Debug("Starting the player service")

        Route.Connect("/player/{player_controller}/{command}",
                      self.process_remote_command)
        Route.Connect("/system/players/{player}/{player_controller}/{command}",
                      self.process_legacy_remote_command)
示例#4
0
 def __init__(self, system):
   SystemService.__init__(self, system)
   Log.Debug("Starting the stream service")
   self.streams = dict()
   Core.messaging.expose_function(self.register_local_file, '_StreamService:RegisterLocalFile')
   Core.messaging.expose_function(self.is_stream_valid, '_StreamService:IsStreamValid')
   Core.runtime.add_private_request_handler(self.token_handler)
   Thread.CreateTimer(3600, self.invalidation_timer)
示例#5
0
 def __init__(self, system):
     SystemService.__init__(self, system)
     Log.Debug("Starting the help service")
     Plugin.AddViewGroup('Help_Groups', viewMode="List", mediaType="items")
     Plugin.AddViewGroup("Help_Videos",
                         viewMode="InfoList",
                         mediaType="items")
     Route.Connect('/system/help', self.help_root_menu)
     Route.Connect('/system/help/{group_name}', self.help_group_menu)
示例#6
0
 def __init__(self, system):
   SystemService.__init__(self, system)
   Log.Debug("Starting the media flag service")
   
   self.patterns = {}
   self.pattern_update_time = None
   self.identifier = "com.plexapp.resources.mediaflags"
   
   Thread.Create(self.start)
  def __init__(self, system):
    SystemService.__init__(self, system)

    Route.Connect('/system/scanners/{mediaType}', self.list)

    self.scanner_types = {
      1: 'Movies',
      2: 'Series',
      8: 'Music',
      9: 'Music',
     13: 'Photos',
    }
示例#8
0
  def __init__(self, system):
    SystemService.__init__(self, system)

    Route.Connect('/system/scanners/{mediaType}', self.list)

    self.scanner_types = {
      1: 'Movies',
      2: 'Series',
      8: 'Music',
      9: 'Music',
     13: 'Photos',
    }
 def __init__(self, system):
   SystemService.__init__(self, system)
   Log.Debug("Starting the bundle service")
   
   self.plugins_path = Core.storage.join_path(Core.app_support_path, 'Plug-ins')
   self.bundle_dict = dict()
   self.update_lock = Thread.Lock()
   self.service_started = Thread.Event()
   self.first_scan = True
   
   Core.messaging.expose_function(self.all_services, '_BundleService:AllServices')
   
   Thread.Create(self.start)
示例#10
0
 def __init__(self, system):
   SystemService.__init__(self, system)
   
   # Create or load the events dict
   if EVENTS_KEY in Dict:
     self.events = Dict[EVENTS_KEY]
   else:
     self.events = dict()
     
   # Connect the routes
   Route.Connect('/system/messaging/register_for_event/{target}/{encoded_key}', self.register_for_event)
   Route.Connect('/system/messaging/broadcast_event/{source}/{encoded_key}/{packed_args}/{packed_kwargs}', self.broadcast_event)
   Route.Connect('/system/messaging/clear_events/{target}', self.clear_events)
示例#11
0
 def __init__(self, system):
   SystemService.__init__(self, system)
   Log.Debug("Starting the bundle service")
   
   self.plugins_path = Core.storage.join_path(Core.app_support_path, 'Plug-ins')
   self.bundle_dict = dict()
   self.bundled_identifiers = []
   self.update_lock = Thread.Lock()
   self.service_started = Thread.Event()
   self.first_scan = True
   
   Core.messaging.expose_function(self.all_services, '_BundleService:AllServices')
   
   Thread.Create(self.start)
 def __init__(self, system):
   SystemService.__init__(self, system)
   Log.Debug("Starting the install service")
   
   self.installing = False
   self.stage = Core.storage.join_path(Core.storage.data_path, 'DataItems', 'Stage')
   self.inactive = Core.storage.join_path(Core.storage.data_path, 'DataItems', 'Deactivated')
   
   try:
     Core.storage.remove_tree(self.stage)
   except:
     Log.Error("Unable to remove staging root")
   Core.storage.make_dirs(self.stage)
   
   try:
     Core.storage.remove_tree(self.inactive)
   except:
     Log.Error("Unable to remove inactive root")
   Core.storage.make_dirs(self.inactive)
   
   if HISTORY_KEY in Dict:
     self.history = Dict[HISTORY_KEY]
   else:
     self.history = list()
   self.history_lock = Thread.Lock()
   
   Route.Connect('/system/appstore/apps/{identifier}/install', self.gui_install)
   Route.Connect('/system/appstore/apps/{identifier}/update', self.gui_update)
   Route.Connect('/system/appstore/apps/{identifier}/restart', self.gui_restart)
   Route.Connect('/system/appstore/apps/{identifier}/reset', self.gui_reset)
   Route.Connect('/system/appstore/apps/{identifier}/uninstall', self.gui_uninstall)
   Route.Connect('/system/appstore/updates/install', self.gui_install_all_updates)
   Route.Connect('/system/appstore/history', self.gui_update_history_menu)
   
   Route.Connect('/system/plexonline/apps/{identifier}/install', self.gui_install)
   Route.Connect('/system/plexonline/apps/{identifier}/update', self.gui_update)
   Route.Connect('/system/plexonline/apps/{identifier}/restart', self.gui_restart)
   Route.Connect('/system/plexonline/apps/{identifier}/reset', self.gui_reset)
   Route.Connect('/system/plexonline/apps/{identifier}/uninstall', self.gui_uninstall)
   Route.Connect('/system/plexonline/updates/install', self.gui_install_all_updates)
   Route.Connect('/system/plexonline/history', self.gui_update_history_menu)
   
   Route.Connect('/system/channeldirectory/history', self.gui_update_history_menu)
   Route.Connect('/system/channeldirectory/updates/install', self.gui_install_all_updates)
示例#13
0
  def __init__(self, system):
      SystemService.__init__(self, system)
      Log.Debug("Starting the peer service")
    
      self.servers = dict()
      self.refreshed = Thread.Event()

      Route.Connect('/system/search', self.get_search_providers)
      Route.Connect('/system/notify/serverUpdated', self.handle_notify)

      if not Core.config.daemonized:
        Route.Connect("/system/library/sections", self.get_sections)
        for name in ('channels', 'plugins'):
          Route.Connect("/system/%s/all" % name, self.get_channels)
          for prefix in ['music', 'video', 'photos', 'applications']:
            Route.Connect("/system/%s/%s" % (name, prefix), self.get_channels, prefix='/' + prefix)
          
        Thread.Create(self.refresh_servers)
        Thread.CreateTimer(120, self.refresh_servers)
示例#14
0
    def __init__(self, system):
        SystemService.__init__(self, system)
        Route.Connect(
            '/system/services/url/lookup',
            Core.runtime.find_handler(
                Framework.handlers.ServiceRequestHandler).url_lookup)
        Route.Connect('/system/services/search', self.cs_search)
        Route.Connect('/system/services/searches', self.cs_searches)
        Route.Connect('/system/services/relatedcontent/lookup',
                      self.cs_relatedcontent_lookup)

        if hasattr(Core.config, 'daemonized') and Core.config.daemonized:
            Route.Connect(
                '/services/url/lookup',
                Core.runtime.find_handler(
                    Framework.handlers.ServiceRequestHandler).url_lookup)
            Route.Connect('/services/search', self.cs_search)
            Route.Connect('/services/relatedcontent/lookup',
                          self.cs_relatedcontent_lookup)
 def __init__(self, system):
   SystemService.__init__(self, system)
   Log.Debug("Starting the store service")
   
   Plugin.AddViewGroup('Store:Info', 'InfoList', 'items')
   Plugin.AddViewGroup('Store:List', 'List', 'items')
   
   #TODO: Add this to the store server so we don't have to update the System bundle to change it
   appGroups = JSON.ObjectFromString(Resource.Load('AppGroups.json'))
   self.system_app_list = appGroups['System']
   self.required_app_list = appGroups['Required']
   self.hidden_app_list = appGroups['Hidden']
   self.ignored_dev_apps = appGroups['IgnoreDevMode']
   self.updater_scheduled = False
   self.update_lock = Thread.Lock()
   self.geo_region = None
   self.name_substitutions = JSON.ObjectFromString(Resource.Load('NameSubstitutions.json'))
   
   self.media_icons = {
     'Photos'    : 'Camera.png',
     'Video'     : 'TV.png',
     'Music'     : 'CD.png'
   }
   
   self.plugins = {}
   
   # TODO: Remove the old path when appropriate
   Route.Connect('/system/appstore', self.gui_main_menu)
   Route.Connect('/system/appstore/more', self.gui_more_menu)
   Route.Connect('/system/appstore/apps', self.gui_all_available_menu)
   Route.Connect('/system/appstore/installed', self.gui_installed_menu)
   Route.Connect('/system/appstore/featured', self.gui_featured_menu)
   Route.Connect('/system/appstore/new', self.gui_new_menu)
   Route.Connect('/system/appstore/popular', self.gui_popular_menu)
   Route.Connect('/system/appstore/updated', self.gui_updated_menu)
   Route.Connect('/system/appstore/international', self.gui_international_menu)
   Route.Connect('/system/appstore/apps/{identifier}', self.gui_app_popup)
   Route.Connect('/system/appstore/categories', self.gui_categories_menu)
   Route.Connect('/system/appstore/categories/{name}', self.gui_category_menu)
   Route.Connect('/system/appstore/types', self.gui_types_menu)
   Route.Connect('/system/appstore/types/{name}', self.gui_type_menu)
   Route.Connect('/system/appstore/updates', self.gui_show_updates_menu)
   
   Route.Connect('/system/plexonline', self.gui_main_menu)
   Route.Connect('/system/plexonline/more', self.gui_more_menu)
   Route.Connect('/system/plexonline/apps', self.gui_all_available_menu)
   Route.Connect('/system/plexonline/installed', self.gui_installed_menu)
   Route.Connect('/system/plexonline/featured', self.gui_featured_menu)
   Route.Connect('/system/plexonline/new', self.gui_new_menu)
   Route.Connect('/system/plexonline/popular', self.gui_popular_menu)
   Route.Connect('/system/plexonline/updated', self.gui_updated_menu)
   Route.Connect('/system/plexonline/international', self.gui_international_menu)
   Route.Connect('/system/plexonline/agents', self.gui_agents_menu)
   Route.Connect('/system/plexonline/apps/{identifier}', self.gui_app_popup)
   Route.Connect('/system/plexonline/categories', self.gui_categories_menu)
   Route.Connect('/system/plexonline/categories/{name}', self.gui_category_menu)
   Route.Connect('/system/plexonline/types', self.gui_types_menu)
   Route.Connect('/system/plexonline/types/{name}', self.gui_type_menu)
   Route.Connect('/system/plexonline/updates', self.gui_show_updates_menu)
   
   Route.Connect('/system/channeldirectory', self.gui_channel_directory)
   Route.Connect('/system/channeldirectory/updates', self.gui_list_updates)
   
   Core.messaging.expose_function(self.is_channel_broken, '_StoreService:IsChannelBroken')
   
   Core.runtime.create_thread(self.start)
示例#16
0
    def __init__(self, system):
        SystemService.__init__(self, system)
        Log.Debug("Starting the store service")

        Plugin.AddViewGroup('Store:Info', 'InfoList', 'items')
        Plugin.AddViewGroup('Store:List', 'List', 'items')

        #TODO: Add this to the store server so we don't have to update the System bundle to change it
        appGroups = JSON.ObjectFromString(Resource.Load('AppGroups.json'))
        self.system_app_list = appGroups['System']
        self.required_app_list = appGroups['Required']
        self.hidden_app_list = appGroups['Hidden']
        self.ignored_dev_apps = appGroups['IgnoreDevMode']
        self.updater_scheduled = False
        self.update_lock = Thread.Lock()
        self.geo_region = None
        self.name_substitutions = JSON.ObjectFromString(
            Resource.Load('NameSubstitutions.json'))

        self.media_icons = {
            'Photos': 'Camera.png',
            'Video': 'TV.png',
            'Music': 'CD.png'
        }

        self.plugins = {}

        # TODO: Remove the old path when appropriate
        Route.Connect('/system/appstore', self.gui_main_menu)
        Route.Connect('/system/appstore/more', self.gui_more_menu)
        Route.Connect('/system/appstore/apps', self.gui_all_available_menu)
        Route.Connect('/system/appstore/installed', self.gui_installed_menu)
        Route.Connect('/system/appstore/featured', self.gui_featured_menu)
        Route.Connect('/system/appstore/new', self.gui_new_menu)
        Route.Connect('/system/appstore/popular', self.gui_popular_menu)
        Route.Connect('/system/appstore/updated', self.gui_updated_menu)
        Route.Connect('/system/appstore/international',
                      self.gui_international_menu)
        Route.Connect('/system/appstore/apps/{identifier}', self.gui_app_popup)
        Route.Connect('/system/appstore/categories', self.gui_categories_menu)
        Route.Connect('/system/appstore/categories/{name}',
                      self.gui_category_menu)
        Route.Connect('/system/appstore/types', self.gui_types_menu)
        Route.Connect('/system/appstore/types/{name}', self.gui_type_menu)
        Route.Connect('/system/appstore/updates', self.gui_show_updates_menu)

        Route.Connect('/system/plexonline', self.gui_main_menu)
        Route.Connect('/system/plexonline/more', self.gui_more_menu)
        Route.Connect('/system/plexonline/apps', self.gui_all_available_menu)
        Route.Connect('/system/plexonline/installed', self.gui_installed_menu)
        Route.Connect('/system/plexonline/featured', self.gui_featured_menu)
        Route.Connect('/system/plexonline/new', self.gui_new_menu)
        Route.Connect('/system/plexonline/popular', self.gui_popular_menu)
        Route.Connect('/system/plexonline/updated', self.gui_updated_menu)
        Route.Connect('/system/plexonline/international',
                      self.gui_international_menu)
        Route.Connect('/system/plexonline/agents', self.gui_agents_menu)
        Route.Connect('/system/plexonline/apps/{identifier}',
                      self.gui_app_popup)
        Route.Connect('/system/plexonline/categories',
                      self.gui_categories_menu)
        Route.Connect('/system/plexonline/categories/{name}',
                      self.gui_category_menu)
        Route.Connect('/system/plexonline/types', self.gui_types_menu)
        Route.Connect('/system/plexonline/types/{name}', self.gui_type_menu)
        Route.Connect('/system/plexonline/updates', self.gui_show_updates_menu)

        Route.Connect('/system/channeldirectory', self.gui_channel_directory)
        Route.Connect('/system/channeldirectory/updates',
                      self.gui_list_updates)

        Core.messaging.expose_function(self.is_channel_broken,
                                       '_StoreService:IsChannelBroken')

        Core.runtime.create_thread(self.start)
 def __init__(self, system):
   SystemService.__init__(self, system)
   self.processing_updates = {}
   self.pending_updates = []
   self.update_lock = Thread.Lock()
   self.agent_lock = Thread.Lock()
   self.searching = False
   if AGENT_INFO_KEY in Dict:
     self.agent_info = Dict[AGENT_INFO_KEY]
   else:
     self.agent_info = {}
     
   Log.Debug("Starting the agent service")
   
   self.media_types = {
     1: 'Movie',
     2: 'TV_Show',
     8: 'Artist',
     9: 'Album',
    13: 'Photo',
   }
   
   self.dummy_agents = {
     'Movie': 'Home Movies',
     'TV_Show': 'Home Movie Series'
   }
   
   # Create a model accessor
   self.accessor = Framework.modelling.ModelAccessor(
     Core,
     'metadata',
     Core.storage.join_path(Core.framework_path, 'Models', 'Metadata', '__init__.pym'),
     Core.storage.join_path(Core.app_support_path, 'Metadata')
   )
   
   self.access_point = self.accessor.get_access_point(Core.identifier)
   
   # WIP: Create separate combiners for different languages
   if Core.config.root_path:
     self.combiners = {}
     self.combiner = None
     
   else:
     # Create a single bundle combiner when running against PMS
     self.combiner = Framework.modelling.BundleCombiner(
       Core,
       Core.storage.join_path(Core.app_support_path, 'Metadata'),
       Core.storage.join_path(Core.plugin_support_path, 'Metadata Combination')
     )
     self.combiners = None
   
   # Create a queue for dispatching tasks in parallel, and a queue for notifying PMS of updated metadata bundles
   self.queue = Core.runtime.taskpool.create_limiting_queue(Core.config.agentservice_update_limit)
   self.notify_queue = Core.runtime.taskpool.create_limiting_queue(1)
     
   # Connect routes
   Route.Connect('/system/agents/search', self.search)
   Route.Connect('/system/agents/update', self.update)
   Route.Connect('/system/agents', self.list)
   Route.Connect('/system/agents/{identifier}/config/{mediaType}', self.get_agent_configuration)
   Route.Connect('/system/agents/{identifier}/config/{mediaType}', self.set_agent_configuration, method='PUT')
   Route.Connect('/system/agents/contributors', self.list_contributors)
   Route.Connect('/system/agents/attribution', self.get_attribution_string)
   Route.Connect('/system/agents/attribution/image', self.get_attribution_image)
   Route.Connect('/system/agents/media/get', self.media_get)
   Route.Connect('/system/agents/{identifier}/searchOne', self.search_one, method='POST')
   
   if Core.config.enable_external_debugging:
     Route.Connect('/system/debug/agentservice/status', self.debug_status_agentservice)
   
   Core.messaging.expose_function(self.search, '_AgentService:Search')
   Core.messaging.expose_function(self.update_agent_info, '_AgentService:UpdateInfo')
   
   # Set the _core attribute of the Media class - we don't use AgentKit in the System bundle, so
   # we need to do this here so retrieving media trees works.
   setattr(Framework.api.agentkit.Media, '_core', Core)
 def __init__(self, system):
   SystemService.__init__(self, system)
   Log.Debug("Starting the player service")
   
   Route.Connect("/player/{player_controller}/{command}", self.process_remote_command)
   Route.Connect("/system/players/{player}/{player_controller}/{command}", self.process_legacy_remote_command)
  def __init__(self, system):
    SystemService.__init__(self, system)
    Log.Debug("Starting the proxy service")

    Route.Connect('/system/proxy', self.do_proxy, method=['GET', 'POST', 'PUT', 'DELETE'])
示例#20
0
    def __init__(self, system):
        SystemService.__init__(self, system)
        Log.Debug("Starting the install service")

        self.installing = False
        self.stage = Core.storage.join_path(Core.storage.data_path,
                                            'DataItems', 'Stage')
        self.inactive = Core.storage.join_path(Core.storage.data_path,
                                               'DataItems', 'Deactivated')

        try:
            Core.storage.remove_tree(self.stage)
        except:
            Log.Error("Unable to remove staging root")
        Core.storage.make_dirs(self.stage)

        try:
            Core.storage.remove_tree(self.inactive)
        except:
            Log.Error("Unable to remove inactive root")
        Core.storage.make_dirs(self.inactive)

        if HISTORY_KEY in Dict:
            self.history = Dict[HISTORY_KEY]
        else:
            self.history = list()
        self.history_lock = Thread.Lock()

        Route.Connect('/system/appstore/apps/{identifier}/install',
                      self.gui_install)
        Route.Connect('/system/appstore/apps/{identifier}/update',
                      self.gui_update)
        Route.Connect('/system/appstore/apps/{identifier}/restart',
                      self.gui_restart)
        Route.Connect('/system/appstore/apps/{identifier}/reset',
                      self.gui_reset)
        Route.Connect('/system/appstore/apps/{identifier}/uninstall',
                      self.gui_uninstall)
        Route.Connect('/system/appstore/updates/install',
                      self.gui_install_all_updates)
        Route.Connect('/system/appstore/history', self.gui_update_history_menu)

        Route.Connect('/system/plexonline/apps/{identifier}/install',
                      self.gui_install)
        Route.Connect('/system/plexonline/apps/{identifier}/update',
                      self.gui_update)
        Route.Connect('/system/plexonline/apps/{identifier}/restart',
                      self.gui_restart)
        Route.Connect('/system/plexonline/apps/{identifier}/reset',
                      self.gui_reset)
        Route.Connect('/system/plexonline/apps/{identifier}/uninstall',
                      self.gui_uninstall)
        Route.Connect('/system/plexonline/updates/install',
                      self.gui_install_all_updates)
        Route.Connect('/system/plexonline/history',
                      self.gui_update_history_menu)

        Route.Connect('/system/channeldirectory/history',
                      self.gui_update_history_menu)
        Route.Connect('/system/channeldirectory/updates/install',
                      self.gui_install_all_updates)