Beispiel #1
0
    def __init__(self, modref):
        ''' inits the plugin
		'''
        self.modref = modref
        self.logger = schnipsllogger.getLogger(__name__)

        # do the plugin specific initialisation first
        self.origin_dir = os.path.dirname(__file__)
        self.config = JsonStorage(self.plugin_id, 'backup', "config.json", {
            'epgloops': 1,
            'epgtimeout': 60,
            'stream_source': 'SatIP Live'
        })
        self.stream_source = self.config.read(
            'stream_source'
        )  # this defines who is the real data provider for the entries found in the EPG data

        self.epgbuffer_file_name = DirectoryMapper.abspath(
            self.plugin_id, 'tmpfs', 'epgbuffer.ts', True)

        self.process = None
        self.epg_storage = JsonStorage(self.plugin_id, 'runtime',
                                       "epgdata.json", {'epgdata': {}})
        self.all_EPG_Data = self.epg_storage.read('epgdata')

        self.timeline = {}

        # at last announce the own plugin
        super().__init__(modref)
        modref.message_handler.add_event_handler(self.plugin_id, 0,
                                                 self.event_listener)
        modref.message_handler.add_query_handler(self.plugin_id, 0,
                                                 self.query_handler)

        # plugin specific stuff
        # each EPG has its own special hardwired categories

        self.categories = [
            {
                'text': 'category_today',
                'value': '{"type": "day", "expression": "today"}'
            },
            {
                'text': 'category_tomorrow',
                'value': '{"type": "day", "expression": "tomorrow"}'
            },
            {
                'text': 'category_now',
                'value': '{"type": "time", "expression": "now"}'
            },
            {
                'text': 'category_evening',
                'value':
                '{"type": "time", "expression": "[\'8 PM\' to tomorrow"}'
            },
        ]
Beispiel #2
0
    def __init__(self, modref):
        ''' inits the plugin
		'''
        self.modref = modref
        self.logger = schnipsllogger.getLogger(__name__)
        # do the plugin specific initialisation first
        self.origin_dir = os.path.dirname(__file__)

        # at last announce the own plugin
        super().__init__(modref)
        modref.message_handler.add_event_handler(self.plugin_id, 0,
                                                 self.event_listener)
        modref.message_handler.add_query_handler(self.plugin_id, 0,
                                                 self.query_handler)

        # plugin specific stuff
        # each EPG has its own special hardwired categories

        self.categories = [
            {
                'text': 'category_last_week',
                'value':
                '{"type": "day", "expression": "[\'-1 week\' to now]"}'
            },
            {
                'text': 'category_last_month',
                'value':
                '{"type": "day", "expression": "[\'-4 week\' to now]"}'
            },
        ]
        # additional to our whoosh db, we need to cache the providers to not have
        # to read through the huge whoosh db at start to reconstruct the provider list again
        self.provider_storage = JsonStorage(self.plugin_id, 'runtime',
                                            "provider_cache.json",
                                            {'provider_cache': []})
        self.providers = set(self.provider_storage.read('provider_cache'))
Beispiel #3
0
from pluginmanager import PluginManager


class ModRef:
    ''' helper class to store references to the global modules
	'''
    def __init__(self):
        self.server = None
        self.message_handler = None


def _(s):
    return s


logger = schnipsllogger.getLogger(__name__)

DirectoryMapper(
    os.path.abspath(os.path.dirname(__file__)), {
        'backup': 'volumes/backup',
        'runtime': 'volumes/runtime',
        'tmpfs': 'volumes/tmpfs',
        'videos': 'volumes/videos',
    })
modref = ModRef()  # create object to store all module instances
modref.message_handler = MessageHandler(modref)
modref.server = Webserver(modref)
plugin_manager = PluginManager(modref, 'plugins')

modref.server.run()