コード例 #1
0
def register_plugin():
    """
Register plugin hooks.

:since: v0.2.00
    """

    Hook.register("dNG.pas.user.Profile.delete", delete)
コード例 #2
0
    def __enter__(self):
        """
python.org: Enter the runtime context related to this object.

:since: v0.2.00
        """

        Hook.register("dNG.pas.Status.onShutdown", self.stop)
コード例 #3
0
def register_plugin():
    """
Register plugin hooks.

:since: v0.2.00
    """

    Hook.register("dNG.pas.user.Profile.delete", delete)
コード例 #4
0
def register_plugin():
    """
Register plugin hooks.

:since: v0.2.00
    """

    Hook.register("dNG.pas.upnp.SsdpRequest.filterHeaders", filter_headers)
コード例 #5
0
ファイル: mp_core.py プロジェクト: dNG-git/mp_core
def register_plugin():
    """
Register plugin hooks.

:since: v0.2.00
    """

    Hook.register("dNG.pas.upnp.Resource.onRootContainerAdded", on_root_container_added)
    Hook.register("dNG.pas.upnp.Resource.onRootContainerDeleted", on_root_container_deleted)
コード例 #6
0
def register_plugin():
    """
Register plugin hooks.

:since: v0.2.00
    """

    Hook.register("dNG.pas.http.Server.onStartup", on_startup)
    Hook.register("dNG.pas.http.Wsgi.onStartup", on_startup)
コード例 #7
0
def register_plugin():
    """
Register plugin hooks.

:since: v0.1.00
    """

    Hook.register("dNG.pas.Database.applySchema.after", after_apply_schema)
    Hook.register("dNG.pas.Database.loadAll", load_all)
コード例 #8
0
def register_plugin():
    """
Register plugin hooks.

:since: v0.2.00
    """

    Hook.register("dNG.pas.Database.applySchema.after", after_apply_schema)
    Hook.register("dNG.pas.Database.loadAll", load_all)
コード例 #9
0
ファイル: pas_upnp.py プロジェクト: dNG-git/pas_upnp
def register_plugin():
    """
Register plugin hooks.

:since: v0.2.00
    """

    Hook.register("dNG.pas.upnp.ControlPoint.onDeviceAdded", on_device_added)
    Hook.register("dNG.pas.upnp.ControlPoint.onStartup", on_startup)
コード例 #10
0
def register_plugin():
#
	"""
Register plugin hooks.

:since: v0.1.00
	"""

	Hook.register("dNG.pas.http.Form.sendEMail", send_email)
コード例 #11
0
def register_plugin():
    """
Register plugin hooks.

:since: v0.2.00
    """

    Hook.register("dNG.pas.user.Profile.changesConfirmed", changes_confirmed)
    Hook.register("dNG.pas.user.Profile.registrationValidated", registration_validated)
コード例 #12
0
ファイル: pas_upnp.py プロジェクト: dNG-git/pas_upnp
def register_plugin():
    """
Register plugin hooks.

:since: v0.2.00
    """

    Hook.register("dNG.pas.http.Server.onShutdown", on_shutdown)
    Hook.register("dNG.pas.http.Server.onStartup", on_startup)
    Hook.register("dNG.pas.http.Wsgi.onShutdown", on_shutdown)
    Hook.register("dNG.pas.http.Wsgi.onStartup", on_startup)
    Hook.register("dNG.pas.upnp.ControlPoint.onHostDeviceAdded", on_host_device_added)
コード例 #13
0
    def _on_run(self, args):
        """
Callback for execution.

:param args: Parsed command line arguments

:since: v0.2.00
        """

        # pylint: disable=attribute-defined-outside-init

        Settings.read_file("{0}/settings/pas_global.json".format(Settings.get("path_data")))
        Settings.read_file("{0}/settings/pas_core.json".format(Settings.get("path_data")), True)
        Settings.read_file("{0}/settings/pas_tasks_daemon.json".format(Settings.get("path_data")), True)
        if (args.additional_settings is not None): Settings.read_file(args.additional_settings, True)

        if (not Settings.is_defined("pas_tasks_daemon_listener_address")): raise IOException("No listener address defined for the TasksDaemon")

        if (args.reload_plugins):
            client = BusClient("pas_tasks_daemon")
            client.request("dNG.pas.Plugins.reload")
        elif (args.stop):
            client = BusClient("pas_tasks_daemon")

            pid = client.request("dNG.pas.Status.getOSPid")
            client.request("dNG.pas.Status.stop")

            self._wait_for_os_pid(pid)
        else:
            self.cache_instance = NamedLoader.get_singleton("dNG.data.cache.Content", False)
            if (self.cache_instance is not None): Settings.set_cache_instance(self.cache_instance)

            self.log_handler = NamedLoader.get_singleton("dNG.data.logging.LogHandler", False)

            if (self.log_handler is not None):
                Hook.set_log_handler(self.log_handler)
                NamedLoader.set_log_handler(self.log_handler)
            #

            Hook.load("tasks")
            Hook.register("dNG.pas.Status.getOSPid", self.get_os_pid)
            Hook.register("dNG.pas.Status.getTimeStarted", self.get_time_started)
            Hook.register("dNG.pas.Status.getUptime", self.get_uptime)
            Hook.register("dNG.pas.Status.stop", self.stop)

            self.server = BusServer("pas_tasks_daemon")
            self._set_time_started(time())

            if (self.log_handler is not None): self.log_handler.info("TasksDaemon starts listening", context = "pas_tasks")

            Hook.call("dNG.pas.Status.onStartup")
            Hook.call("dNG.pas.tasks.Daemon.onStartup")

            self.set_mainloop(self.server.run)
コード例 #14
0
def register_plugin():
    """
Register plugin hooks.

:since: v1.0.0
    """

    Hook.register("dNG.pas.http.Server.onShutdown", on_shutdown)
    Hook.register("dNG.pas.http.Server.onStartup", on_startup)
    Hook.register("dNG.pas.http.Wsgi.onShutdown", on_shutdown)
    Hook.register("dNG.pas.http.Wsgi.onStartup", on_startup)
コード例 #15
0
ファイル: mp_core.py プロジェクト: dNG-git/mp_core
def register_plugin():
    """
Register plugin hooks.

:since: v0.2.00
    """

    Hook.register("dNG.pas.http.l10n.upnp.Control.init", init_control_l10n)
    Hook.register("dNG.pas.http.Server.onStartup", on_startup)
    Hook.register("dNG.pas.http.Wsgi.onStartup", on_startup)
コード例 #16
0
ファイル: resource_scanner.py プロジェクト: dNG-git/mp_core
    def __init__(self, _id):
        """
Constructor __init__(ResourceScanner)

:since: v0.2.00
        """

        AbstractLrtHook.__init__(self)

        self.id = None
        """
Encapsulating UPnP resource ID
        """
        self.refresh_time = None
        """
Refresh time
        """
        self.vfs_url = None
        """
UPnP encapsulated VFS URL
        """

        self.context_id = "mp.tasks.ResourceScanner"
        self.independent_scheduling = True

        entry_data = None

        with Connection.get_instance():
            is_auto_maintained = False
            resource = MpEntry.load_encapsulating_entry(_id)

            if (isinstance(resource, MpEntry)):
                entry_data = resource.get_data_attributes("resource")
                is_auto_maintained = resource.is_supported("auto_maintenance")
            #

            if (is_auto_maintained):
                if (self.log_handler is not None): self.log_handler.debug("mp.ResourceScanner ignores auto maintained resource ID '{0}'", _id, context = "mp_server")
            elif (entry_data is not None):
                self.id = resource.get_resource_id()
                self.vfs_url = resource.get_vfs_url()

                vfs_scheme = WatcherImplementation.get_scheme_from_vfs_url_if_supported(self.vfs_url)
                vfs_watcher = None

                if (vfs_scheme is not None):
                    with ResourceScanner._lock:
                        if (len(ResourceScanner._watcher_instances) < 1):
                            Hook.register("dNG.pas.upnp.ControlPoint.onShutdown", ResourceScanner.stop)
                        #

                        if (vfs_scheme not in ResourceScanner._watcher_instances):
                            ResourceScanner._watcher_instances[vfs_scheme] = WatcherImplementation.get_instance(vfs_scheme)
                        #

                        vfs_watcher = ResourceScanner._watcher_instances[vfs_scheme]
                    #
                #

                is_watched = False

                if (vfs_watcher is not None and (not vfs_watcher.is_synchronous())):
                    is_watched = (vfs_watcher.is_watched(self.vfs_url, ResourceScanner.on_watcher_event)
                                  or vfs_watcher.register(self.vfs_url, ResourceScanner.on_watcher_event)
                                 )
                #

                if (not is_watched): self.refresh_time = Settings.get("mp_core_entry_scanner_refresh_time", 300)
            elif (self.log_handler is not None): self.log_handler.warning("mp.ResourceScanner refused to scan '{0}'", _id, context = "mp_server")
コード例 #17
0
ファイル: mp.py プロジェクト: dNG-git/mp_loader
    def _on_run(self, args):
        """
Callback for execution.

:param args: Parsed command line arguments

:since: v0.2.00
        """

        Settings.read_file("{0}/settings/pas_global.json".format(Settings.get("path_data")))
        Settings.read_file("{0}/settings/pas_core.json".format(Settings.get("path_data")), True)
        Settings.read_file("{0}/settings/pas_http.json".format(Settings.get("path_data")))
        Settings.read_file("{0}/settings/pas_upnp.json".format(Settings.get("path_data")))
        Settings.read_file("{0}/settings/mp/server.json".format(Settings.get("path_data")))
        if (args.additional_settings is not None): Settings.read_file(args.additional_settings, True)

        if (args.reload_plugins):
            client = BusClient("mp_bus")
            client.request("dNG.pas.Plugins.reload")
        elif (args.stop):
            client = BusClient("mp_bus")

            pid = client.request("dNG.pas.Status.getOSPid")
            client.request("dNG.pas.Status.stop")

            self._wait_for_os_pid(pid)
        else:
            self.log_handler = NamedLoader.get_singleton("dNG.data.logging.LogHandler", False)

            if (self.log_handler is not None):
                Hook.set_log_handler(self.log_handler)
                NamedLoader.set_log_handler(self.log_handler)
            #

            self.cache_instance = NamedLoader.get_singleton("dNG.data.cache.Content", False)
            if (self.cache_instance is not None): Settings.set_cache_instance(self.cache_instance)

            Hook.load("http")
            Hook.load("mp")
            Hook.load("tasks")
            Hook.register("dNG.pas.Status.getOSPid", self.get_os_pid)
            Hook.register("dNG.pas.Status.getTimeStarted", self.get_time_started)
            Hook.register("dNG.pas.Status.getUptime", self.get_uptime)
            Hook.register("dNG.pas.Status.stop", self.stop)

            self.server = BusServer("mp_bus")
            self._set_time_started(time())

            http_server = HttpServer.get_instance()

            if (http_server is not None):
                Hook.register("dNG.pas.Status.onStartup", http_server.start)
                Hook.register("dNG.pas.Status.onShutdown", http_server.stop)

                database_tasks = DatabaseTasks.get_instance()
                Hook.register("dNG.pas.Status.onStartup", database_tasks.start)
                Hook.register("dNG.pas.Status.onShutdown", database_tasks.stop)

                memory_tasks = MemoryTasks.get_instance()
                Hook.register("dNG.pas.Status.onStartup", memory_tasks.start)
                Hook.register("dNG.pas.Status.onShutdown", memory_tasks.stop)

                upnp_control_point = ControlPoint.get_instance()
                Hook.register("dNG.pas.Status.onStartup", upnp_control_point.start)
                Hook.register("dNG.pas.Status.onShutdown", upnp_control_point.stop)

                if (self.log_handler is not None): self.log_handler.info("mp starts listening", context = "mp_server")
                Hook.call("dNG.pas.Status.onStartup")

                self.set_mainloop(self.server.run)
コード例 #18
0
ファイル: pas_tasks.py プロジェクト: dNG-git/pas_tasks
def register_plugin():
    """
Register plugin hooks.

:since: v0.2.00
    """

    Hook.register("dNG.pas.Status.onShutdown", on_shutdown)
    Hook.register("dNG.pas.Status.onStartup", on_startup)
    Hook.register("dNG.pas.Tasks.call", call)
    Hook.register("dNG.pas.tasks.Persistent.isRegistered", is_persistent_task_registered)
    Hook.register("dNG.pas.tasks.Persistent.add", add_persistent_task)
    Hook.register("dNG.pas.tasks.Persistent.call", call_persistent_task)
    Hook.register("dNG.pas.tasks.Persistent.get", get_persistent_task)
    Hook.register("dNG.pas.tasks.Persistent.registerTimeout", register_persistent_timeout_task)
    Hook.register("dNG.pas.tasks.Persistent.remove", remove_persistent_task)
    Hook.register("dNG.pas.tasks.Persistent.reregisterTimeout", reregister_persistent_timeout_task)
    Hook.register("dNG.pas.tasks.Persistent.unregisterTimeout", unregister_persistent_timeout_task)
コード例 #19
0
ファイル: mp_core.py プロジェクト: dNG-git/mp_core
def register_plugin():
    """
Register plugin hooks.

:since: v0.2.00
    """

    Hook.register("dNG.pas.upnp.ControlPoint.onShutdown", on_control_point_shutdown)
    Hook.register("dNG.pas.upnp.ControlPoint.onStartup", on_control_point_startup)
    Hook.register("dNG.pas.upnp.Resource.getItemResourceContent", get_item_resource_content)
    Hook.register("dNG.pas.upnp.Resource.getRootResourceContent", get_root_resource_content)
    Hook.register("dNG.pas.upnp.Resource.getSearchSegments", get_search_segments)
    Hook.register("dNG.pas.upnp.Resource.getSearchableDidlFields", get_searchable_didl_fields)
    Hook.register("dNG.pas.upnp.Resource.getSortableDidlFields", get_sortable_didl_fields)

    Hook.register("mp.upnp.MpResource.applyValueDerivedDbCondition", CommonMpEntrySegment.apply_value_derived_db_condition)