Exemple #1
0
 def _custom(self):
     self.LOGLINES = []
     current_skin = xbmc.getSkinDir()
     skin, skin_values = self._get_skin_info(current_skin)
     self.LOGLINES.append('using skin values of:')
     self.LOGLINES.append(skin_values)
     display = Show('script.harmony.control-menu.xml',
                    self.SETTINGS['ADDONPATH'],
                    skin,
                    skin_values['res'],
                    skin_values=skin_values,
                    title=self.TITLE,
                    buttons=self.BUTTONS)
     display.show()
     while not display.CLOSED and not KODIMONITOR.abortRequested():
         self.LOGLINES.append(
             'the current returned value from display is: %s' %
             str(display.DIALOGRETURN))
         self.LOGLINES.append(
             'the current returned close status from display is: %s' %
             str(display.CLOSED))
         if display.DIALOGRETURN is not None:
             break
         KODIMONITOR.waitForAbort(1)
     self.LOGLINES = self.LOGLINES + display.LOGLINES
     self.LOGLINES.append('the final returned value from display is: %s' %
                          str(display.DIALOGRETURN))
     self.LOGLINES.append(
         'the final returned close status from display is: %s' %
         str(display.CLOSED))
     d_return = display.DIALOGRETURN
     del display
     return d_return, self.LOGLINES
Exemple #2
0
def setview():
    skin = xbmc.getSkinDir().lower()
    win = xbmcgui.Window(xbmcgui.getCurrentWindowId())
    viewtype = str(win.getFocusId())
    addon.setSetting('setview', ';'.join([skin, viewtype]))
    addon.setSetting('customview', 'true')
    viewName = xbmc.getInfoLabel('Container.Viewmode')
    notify(i18n('dflt_view_set'), '{0} {1}'.format(i18n('dflt_set'), viewName))
    xbmc.executebuiltin('Container.Refresh')
Exemple #3
0
def eod(handle=addon_handle, cache=True):
    if addon.getSetting('customview') == 'true':
        skin = xbmc.getSkinDir().lower()
        viewtype = 55 if 'estuary' in skin else 50
        setview = addon.getSetting('setview')
        if ';' in setview:
            currentskin, viewno = setview.split(';')
            if currentskin == skin:
                viewtype = viewno
        xbmc.executebuiltin("Container.SetViewMode(%s)" % str(viewtype))
    xbmcplugin.endOfDirectory(handle, cacheToDisc=cache)
Exemple #4
0
 def _custom(self):
     self.LOGLINES = []
     count = 0
     delay = self.SETTINGS['player_autoclose_delay']
     autoclose = self.SETTINGS['player_autoclose']
     current_skin = xbmc.getSkinDir()
     skin, skin_values = self._get_skin_info(current_skin)
     self.LOGLINES.append('using skin values of:')
     self.LOGLINES.append(skin_values)
     display = Show('script.audioprofiles-apmenu.xml',
                    self.SETTINGS['ADDONPATH'],
                    skin,
                    skin_values['res'],
                    skin_values=skin_values,
                    title=self.TITLE,
                    buttons=self.BUTTONS)
     display.show()
     while (KODIPLAYER.isPlaying() or self.FORCEDIALOG
            ) and not display.CLOSED and not KODIMONITOR.abortRequested():
         self.LOGLINES.append(
             'the current returned value from display is: %s' %
             str(display.DIALOGRETURN))
         self.LOGLINES.append(
             'the current returned close status from display is: %s' %
             str(display.CLOSED))
         if autoclose and not self.FORCEDIALOG:
             if count >= delay or display.DIALOGRETURN is not None:
                 break
             count = count + 1
         else:
             if display.DIALOGRETURN is not None:
                 break
         KODIMONITOR.waitForAbort(1)
     self.LOGLINES = self.LOGLINES + display.LOGLINES
     self.LOGLINES.append('the final returned value from display is: %s' %
                          str(display.DIALOGRETURN))
     self.LOGLINES.append(
         'the final returned close status from display is: %s' %
         str(display.CLOSED))
     d_return = display.DIALOGRETURN
     del display
     return d_return, self.LOGLINES
from xml.dom.minidom import parse
import os
import sys
import math
from traceback import format_exc
from kodi_six import xbmc, xbmcaddon, xbmcgui, xbmcvfs
from contextlib import contextmanager

ADDON_ID = "script.skin.helper.colorpicker"
ADDON = xbmcaddon.Addon(ADDON_ID)
ADDON_PATH = ADDON.getAddonInfo('path')
COLORFILES_PATH = xbmc.translatePath(
    "special://profile/addon_data/%s/colors/" % ADDON_ID)
SKINCOLORFILES_PATH = xbmc.translatePath(
    "special://profile/addon_data/%s/colors/" % xbmc.getSkinDir())
SKINCOLORFILE = xbmc.translatePath("special://skin/extras/colors/colors.xml")
WINDOW = xbmcgui.Window(10000)
SUPPORTS_PIL = False
PYTHON3 = True if sys.version_info.major == 3 else False

# HELPERS ###########################################


def log_msg(msg, level=xbmc.LOGDEBUG):
    '''log message to kodi log'''
    xbmc.log("Skin Helper Service ColorPicker --> %s" % msg, level=level)


def log_exception(modulename, exceptiondetails):
    '''helper to properly log an exception'''
    log_msg("Exception in %s ! --> %s" % (modulename, exceptiondetails),
Exemple #6
0
addItem = xbmcplugin.addDirectoryItem
addItems = xbmcplugin.addDirectoryItems
directory = xbmcplugin.endOfDirectory
content = xbmcplugin.setContent
setproperty = xbmcplugin.setProperty
setcategory = xbmcplugin.setPluginCategory
resolve = xbmcplugin.setResolvedUrl
sortmethod = xbmcplugin.addSortMethod

infoLabel = xbmc.getInfoLabel
condVisibility = xbmc.getCondVisibility
jsonrpc = xbmc.executeJSONRPC  # keeping this for compatibility
keyboard = xbmc.Keyboard
sleep = xbmc.sleep
execute = xbmc.executebuiltin
skin = xbmc.getSkinDir()
player = xbmc.Player
monitor = xbmc.Monitor
wait = monitor().waitForAbort
aborted = monitor().abortRequested
cleanmovietitle = xbmc.getCleanMovieTitle

transPath = xbmc.translatePath
skinPath = transPath('special://skin/')
addonPath = transPath(addonInfo('path'))
legalfilename = xbmc.makeLegalFilename

dataPath = transPath(addonInfo('profile'))

window = xbmcgui.Window(10000)
dialog = xbmcgui.Dialog()
#v.0.3.4

from kodi_six import xbmc, xbmcaddon

ADDON = xbmcaddon.Addon()
ADDONNAME = ADDON.getAddonInfo('id')
ADDONLONGNAME = ADDON.getAddonInfo('name')
ADDONVERSION = ADDON.getAddonInfo('version')
ADDONPATH = ADDON.getAddonInfo('path')
ADDONDATAPATH = xbmc.translatePath(ADDON.getAddonInfo('profile'))
ADDONICON = xbmc.translatePath('%s/icon.png' % ADDONPATH)
ADDONLANGUAGE = ADDON.getLocalizedString
SKINNAME = xbmc.getSkinDir()


def _get_setting(setting_name, default, thetype="string"):
    if thetype.lower() == "bool":
        if ADDON.getSetting(setting_name).lower() == 'true':
            return True
        if ADDON.getSetting(setting_name).lower() == 'false':
            return False
        return default
    if thetype.lower() == "int":
        try:
            return int(ADDON.getSetting(setting_name))
        except ValueError:
            return default
    if thetype.lower() == "number":
        try:
            return float(ADDON.getSetting(setting_name))
        except ValueError: