示例#1
0
def run():
    log = StandardLogger(ADDON_ID, os.path.basename(__file__)).log

    log('My OSMC opening')
    try:

        with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as open_socket:
            open_socket.connect('/var/tmp/osmc.settings.sockfile')
            open_socket.sendall(b'open')

    except:
        log('My OSMC failed to open')
        lang = LangRetriever(xbmcaddon.Addon(ADDON_ID)).lang
        _ = xbmcgui.Dialog().ok(lang(32047),
                                '[CR]'.join([lang(32007),
                                             lang(32005)]))

    log('My OSMC closing')
示例#2
0
def run():
    log = StandardLogger(ADDON_ID, os.path.basename(__file__)).log

    log('My OSMC opening')
    try:

        message = 'open'
        with closing(socket.socket(socket.AF_UNIX,
                                   socket.SOCK_STREAM)) as open_socket:
            open_socket.connect('/var/tmp/osmc.settings.sockfile')
            if not isinstance(message, (bytes, bytearray)):
                message = message.encode('utf-8', 'ignore')
            open_socket.sendall(message)

    except:
        log('My OSMC failed to open')
        lang = LangRetriever(xbmcaddon.Addon(ADDON_ID)).lang
        _ = xbmcgui.Dialog().ok(lang(32047),
                                '[CR]'.join([lang(32007),
                                             lang(32005)]))

    log('My OSMC closing')
示例#3
0
 def lang(self, value):
     if not self._lang:
         retriever = LangRetriever(self.addon)
         self._lang = retriever.lang
     return self._lang(value)
示例#4
0
import subprocess
import tarfile
import traceback
from copy import deepcopy
from io import open

import xbmc
import xbmcaddon
import xbmcgui
import xbmcvfs
from osmccommon.osmc_language import LangRetriever
from osmccommon.osmc_logging import StandardLogger

ADDON_ID = 'script.module.osmcsetting.updates'
ADDON = xbmcaddon.Addon(ADDON_ID)
LANG = LangRetriever(ADDON)

TIME_PATTERN = '%Y_%m_%d_%H_%M_%S'
READ_PATTERN = '%Y-%m-%d %H:%M:%S'
APPENDAGE = '[0-9|_]*'
FILE_PATTERN = 'OSMCBACKUP_%s.tar.gz'
LOCATIONS = {
    'backup_addons': '{kodi_folder}addons/',
    'backup_addon_data': '{kodi_folder}userdata/addon_data/',
    'backup_Database': '{kodi_folder}userdata/Database/',
    'backup_keymaps': '{kodi_folder}userdata/keymaps/',
    'backup_library': '{kodi_folder}userdata/library/',
    'backup_playlists': '{kodi_folder}userdata/playlists/',
    'backup_profilesF': '{kodi_folder}userdata/profiles/',
    'backup_Thumbnails': '{kodi_folder}userdata/Thumbnails/',
    'backup_Savestates': '{kodi_folder}userdata/Savestates/',
示例#5
0
from . import osmc_settings_gui
from . import osmc_ubiquifonts
from . import osmc_walkthru

try:
    import queue as Queue
except ImportError:
    import Queue

ADDON_ID = 'service.osmc.settings'
ADDON = xbmcaddon.Addon(ADDON_ID)

DIALOG = xbmcgui.Dialog()

log = StandardLogger(ADDON_ID, os.path.basename(__file__)).log
lang = LangRetriever(ADDON).lang


class Main(object):
    def __init__(self, window):
        log('main addon starting')

        self.window = window
        self.set_version()

        # queue for communication with the comm and Main
        self.parent_queue = Queue.Queue()

        # create socket, listen for comms
        self.listener = Communicator(
            self.parent_queue, socket_file='/var/tmp/osmc.settings.sockfile')