Python xbmc 模块,getSkinDir() 实例源码

我们从Python开源项目中,提取了以下28个代码示例,用于说明如何使用xbmc.getSkinDir()

项目:script.skin.helper.skinbackup    作者:marcelveldt    | 项目源码 | 文件源码
def backup_skinsettings(self, dest_file, filters, temp_path):
        '''backup the skinsettings (guisettings)'''
        # save guisettings
        skinfile = xbmcvfs.File(dest_file, "w")
        skinsettings = self.get_skinsettings(filters)
        skinfile.write(repr(skinsettings))
        skinfile.close()
        # copy any custom skin images or themes
        for item in ["custom_images/", "themes/"]:
            custom_images_folder = u"special://profile/addon_data/%s/%s" % (xbmc.getSkinDir(), item)
            if xbmcvfs.exists(custom_images_folder):
                custom_images_folder_temp = os.path.join(temp_path, item)
                for file in xbmcvfs.listdir(custom_images_folder)[1]:
                    source = os.path.join(custom_images_folder, file)
                    dest = os.path.join(custom_images_folder_temp, file)
                    copy_file(source, dest)
项目:plugin.audio.tidal2    作者:arnesongit    | 项目源码 | 文件源码
def add_list_items(self, items, content=None, end=True, withNextPage=False):
        TidalSession.add_list_items(self, items, content=content, end=end, withNextPage=withNextPage)
        if end:
            try:
                self.save_album_cache()
                kodiVersion = xbmc.getInfoLabel('System.BuildVersion').split()[0]
                kodiVersion = kodiVersion.split('.')[0]
                skinTheme = xbmc.getSkinDir().lower()
                if 'onfluence' in skinTheme:
                    if kodiVersion <= '16':
                        xbmc.executebuiltin('Container.SetViewMode(506)')
                    elif content == 'musicvideos':
                        xbmc.executebuiltin('Container.SetViewMode(511)')
                    elif content == 'artists':
                        xbmc.executebuiltin('Container.SetViewMode(512)')
                    else:
                        xbmc.executebuiltin('Container.SetViewMode(506)')
                elif 'estuary' in skinTheme:
                    xbmc.executebuiltin('Container.SetViewMode(55)')
            except:
                pass
项目:plugin.video.jen    作者:midraal    | 项目源码 | 文件源码
def save_view_mode(content):
    viewid = get_view_id()
    skin = xbmc.getSkinDir()
    koding.Create_Table("addonviews", view_spec)
    koding.Remove_From_Table(
        "addonviews", {"skin": skin,
                       "content": content})
    koding.Add_To_Table("addonviews", {
        "skin": skin,
        "content": content,
        "viewid": viewid,
    })
    icon = xbmcaddon.Addon().getAddonInfo('icon')
    xbmcgui.Dialog().notification(xbmcaddon.Addon().getAddonInfo('name'),
                                  _("View set for %s") % content,
                                  icon)
项目:repository.midraal    作者:midraal    | 项目源码 | 文件源码
def save_view_mode(content):
    viewid = get_view_id()
    skin = xbmc.getSkinDir()
    koding.Create_Table("addonviews", view_spec)
    koding.Remove_From_Table(
        "addonviews", {"skin": skin,
                       "content": content})
    koding.Add_To_Table("addonviews", {
        "skin": skin,
        "content": content,
        "viewid": viewid,
    })
    icon = xbmcaddon.Addon().getAddonInfo('icon')
    xbmcgui.Dialog().notification(xbmcaddon.Addon().getAddonInfo('name'),
                                  _("View set for %s") % content,
                                  icon)
项目:screensaver.kaster    作者:enen92    | 项目源码 | 文件源码
def set_property(self):
        if "estuary" in xbmc.getSkinDir():
            self.setProperty("clockfont", "fontclock")
        else:
            self.setProperty("clockfont", "fontmainmenu")
        # Set skin properties as settings
        for setting in ["hide-clock-info", "hide-kodi-logo", "hide-weather-info", "hide-pic-info"]:
            self.setProperty(setting, kodiutils.get_setting(setting))
        # Set animations
        if kodiutils.get_setting_as_int("animation") == 1:
            self.setProperty("animation","panzoom")
        return
项目:script.skin.helper.skinbackup    作者:marcelveldt    | 项目源码 | 文件源码
def __init__(self):
        self.userthemes_path = u"special://profile/addon_data/%s/themes/" % xbmc.getSkinDir()
        if not xbmcvfs.exists(self.userthemes_path):
            xbmcvfs.mkdir(self.userthemes_path)
        self.skinthemes_path = u"special://skin/extras/skinthemes/"
        if xbmcvfs.exists("special://home/addons/resource.skinthemes.%s/resources/" % get_skin_name()):
            self.skinthemes_path = u"special://home/addons/resource.skinthemes.%s/resources/" % get_skin_name()
        self.addon = xbmcaddon.Addon(ADDON_ID)
项目:script.skin.helper.skinbackup    作者:marcelveldt    | 项目源码 | 文件源码
def backup_skinshortcuts(self, dest_path):
        '''backup skinshortcuts including images'''
        source_path = u'special://profile/addon_data/script.skinshortcuts/'
        if not xbmcvfs.exists(dest_path):
            xbmcvfs.mkdir(dest_path)
        for file in xbmcvfs.listdir(source_path)[1]:
            file = file.decode("utf-8")
            sourcefile = source_path + file
            destfile = dest_path + file
            if xbmc.getCondVisibility("SubString(Skin.String(skinshortcuts-sharedmenu),false)"):
                # User is not sharing menu, so strip the skin name out of the destination file
                destfile = destfile.replace("%s." % (xbmc.getSkinDir()), "")
            if (file.endswith(".DATA.xml") and (not xbmc.getCondVisibility(
                    "SubString(Skin.String(skinshortcuts-sharedmenu),false)") or file.startswith(xbmc.getSkinDir()))):
                xbmcvfs.copy(sourcefile, destfile)
                # parse shortcuts file and look for any images - if found copy them to addon folder
                self.backup_skinshortcuts_images(destfile, dest_path)

            elif file.endswith(".properties") and xbmc.getSkinDir() in file:
                if xbmc.getSkinDir() in file:
                    destfile = dest_path + file.replace(xbmc.getSkinDir(), "SKINPROPERTIES")
                    copy_file(sourcefile, destfile)
                    self.backup_skinshortcuts_properties(destfile, dest_path)
            else:
                # just copy the remaining files
                copy_file(sourcefile, destfile)
项目:script.skin.helper.skinbackup    作者:marcelveldt    | 项目源码 | 文件源码
def backup_skinshortcuts_images(shortcutfile, dest_path):
        '''parse skinshortcuts file and copy images to backup location'''
        shortcutfile = xbmc.translatePath(shortcutfile).decode("utf-8")
        doc = parse(shortcutfile)
        listing = doc.documentElement.getElementsByTagName('shortcut')
        for shortcut in listing:
            defaultid = shortcut.getElementsByTagName('defaultID')
            if defaultid:
                defaultid = defaultid[0].firstChild
                if defaultid:
                    defaultid = defaultid.data
                if not defaultid:
                    defaultid = shortcut.getElementsByTagName('label')[0].firstChild.data
                thumb = shortcut.getElementsByTagName('thumb')
                if thumb:
                    thumb = thumb[0].firstChild
                    if thumb:
                        thumb = thumb.data
                        if thumb and (thumb.endswith(".jpg") or thumb.endswith(".png") or thumb.endswith(".gif")):
                            thumb = get_clean_image(thumb)
                            extension = thumb.split(".")[-1]
                            newthumb = os.path.join(dest_path, "%s-thumb-%s.%s" %
                                                    (xbmc.getSkinDir(), normalize_string(defaultid), extension))
                            newthumb_vfs = "special://profile/addon_data/script.skinshortcuts/%s-thumb-%s.%s" % (
                                xbmc.getSkinDir(), normalize_string(defaultid), extension)
                            if xbmcvfs.exists(thumb):
                                copy_file(thumb, newthumb)
                                shortcut.getElementsByTagName('thumb')[0].firstChild.data = newthumb_vfs
        # write changes to skinshortcuts file
        shortcuts_file = xbmcvfs.File(shortcutfile, "w")
        shortcuts_file.write(doc.toxml(encoding='utf-8'))
        shortcuts_file.close()
项目:script.skin.helper.skinbackup    作者:marcelveldt    | 项目源码 | 文件源码
def get_skinsettings(filters=None):
        '''get all active skin settings'''
        all_skinsettings = []
        guisettings_path = 'special://profile/addon_data/%s/settings.xml' % xbmc.getSkinDir()
        if xbmcvfs.exists(guisettings_path):
            doc = parse(xbmc.translatePath(guisettings_path).decode("utf-8"))
            skinsettings = doc.documentElement.getElementsByTagName('setting')
            for skinsetting in skinsettings:
                settingname = skinsetting.attributes['id'].nodeValue
                settingtype = skinsetting.attributes['type'].nodeValue
                if isinstance(settingname, unicode):
                    settingname = settingname.encode("utf-8")
                # we must grab the actual values because the xml file only updates at restarts
                if settingtype == "bool":
                    if "$INFO" not in settingname and xbmc.getCondVisibility("Skin.HasSetting(%s)" % settingname):
                        settingvalue = "true"
                    else:
                        settingvalue = "false"
                else:
                    settingvalue = xbmc.getInfoLabel("Skin.String(%s)" % settingname)
                if not filters:
                    # no filter - just add all settings we can find
                    all_skinsettings.append((settingtype, settingname, settingvalue))
                else:
                    # only select settings defined in our filters
                    for filteritem in filters:
                        if filteritem.lower() in settingname.lower():
                            all_skinsettings.append((settingtype, settingname, settingvalue))
        return all_skinsettings
项目:script.skin.helper.skinbackup    作者:marcelveldt    | 项目源码 | 文件源码
def restore_skinshortcuts(temp_path):
        '''restore skinshortcuts files'''
        source_path = temp_path + u"skinshortcuts/"
        if xbmcvfs.exists(source_path):
            dest_path = u'special://profile/addon_data/script.skinshortcuts/'
            for filename in xbmcvfs.listdir(source_path)[1]:
                filename = filename.decode("utf-8")
                sourcefile = source_path + filename
                destfile = dest_path + filename
                if filename == "SKINPROPERTIES.properties":
                    destfile = dest_path + filename.replace("SKINPROPERTIES", xbmc.getSkinDir())
                elif xbmc.getCondVisibility("SubString(Skin.String(skinshortcuts-sharedmenu),false)"):
                    destfile = "%s-" % (xbmc.getSkinDir())
                copy_file(sourcefile, destfile)
项目:script.skin.helper.skinbackup    作者:marcelveldt    | 项目源码 | 文件源码
def get_skin_name():
    ''' get the skin name filtering out any beta prefixes and such.'''
    skin_name = xbmc.getSkinDir().decode("utf-8")
    skin_name = skin_name.replace("skin.", "")
    skin_name = skin_name.replace(".kryptonbeta", "")
    skin_name = skin_name.replace(".jarvisbeta", "")
    skin_name = skin_name.replace(".leiabeta", "")
    return skin_name
项目:script.matchcenter    作者:enen92    | 项目源码 | 文件源码
def getskinfolder():
    #if "skin.aeon.nox" in xbmc.getSkinDir(): return "skin.aeon.nox.5"
    #else: 
    return "default"
项目:tvalacarta    作者:tvalacarta    | 项目源码 | 文件源码
def set_view(view_mode, view_code=0):
    _log("set_view view_mode='"+view_mode+"', view_code="+str(view_code))

    # Set the content for extended library views if needed
    if view_mode==MOVIES:
        _log("set_view content is movies")
        xbmcplugin.setContent( int(sys.argv[1]) ,"movies" )
    elif view_mode==TV_SHOWS:
        _log("set_view content is tvshows")
        xbmcplugin.setContent( int(sys.argv[1]) ,"tvshows" )
    elif view_mode==SEASONS:
        _log("set_view content is seasons")
        xbmcplugin.setContent( int(sys.argv[1]) ,"seasons" )
    elif view_mode==EPISODES:
        _log("set_view content is episodes")
        xbmcplugin.setContent( int(sys.argv[1]) ,"episodes" )

    # Reads skin name
    skin_name = xbmc.getSkinDir()
    _log("set_view skin_name='"+skin_name+"'")

    try:
        if view_code==0:
            _log("set_view view mode is "+view_mode)
            view_codes = ALL_VIEW_CODES.get(view_mode)
            view_code = view_codes.get(skin_name)
            _log("set_view view code for "+view_mode+" in "+skin_name+" is "+str(view_code))
            xbmc.executebuiltin("Container.SetViewMode("+str(view_code)+")")
        else:
            _log("set_view view code forced to "+str(view_code))
            xbmc.executebuiltin("Container.SetViewMode("+str(view_code)+")")
    except:
        _log("Unable to find view code for view mode "+str(view_mode)+" and skin "+skin_name)
项目:tvalacarta    作者:tvalacarta    | 项目源码 | 文件源码
def set_view(view_mode, view_code=0):
    _log("set_view view_mode='"+view_mode+"', view_code="+str(view_code))

    # Set the content for extended library views if needed
    if view_mode==MOVIES:
        _log("set_view content is movies")
        xbmcplugin.setContent( int(sys.argv[1]) ,"movies" )
    elif view_mode==TV_SHOWS:
        _log("set_view content is tvshows")
        xbmcplugin.setContent( int(sys.argv[1]) ,"tvshows" )
    elif view_mode==SEASONS:
        _log("set_view content is seasons")
        xbmcplugin.setContent( int(sys.argv[1]) ,"seasons" )
    elif view_mode==EPISODES:
        _log("set_view content is episodes")
        xbmcplugin.setContent( int(sys.argv[1]) ,"episodes" )

    # Reads skin name
    skin_name = xbmc.getSkinDir()
    _log("set_view skin_name='"+skin_name+"'")

    try:
        if view_code==0:
            _log("set_view view mode is "+view_mode)
            view_codes = ALL_VIEW_CODES.get(view_mode)
            view_code = view_codes.get(skin_name)
            _log("set_view view code for "+view_mode+" in "+skin_name+" is "+str(view_code))
            xbmc.executebuiltin("Container.SetViewMode("+str(view_code)+")")
        else:
            _log("set_view view code forced to "+str(view_code))
            xbmc.executebuiltin("Container.SetViewMode("+str(view_code)+")")
    except:
        _log("Unable to find view code for view mode "+str(view_mode)+" and skin "+skin_name)
项目:kodi-vk.inpos.ru    作者:inpos    | 项目源码 | 文件源码
def switch_view():
    skin_used = xbmc.getSkinDir()
    if skin_used == 'skin.confluence':
        xbmc.executebuiltin('Container.SetViewMode(500)') # ??? "??????".
    elif skin_used == 'skin.aeon.nox':
        xbmc.executebuiltin('Container.SetViewMode(512)') # ??? "????-?????"
项目:plugin.video.stream-cinema    作者:bbaronSVK    | 项目源码 | 文件源码
def action(self, data):
        if self.scid is None:
            return
        url = "%s/Stats" % (sctop.BASE_URL)
        data.update({'est': self.estimateFinishTime})
        data.update({'se': self.se, 'ep': self.ep})
        data.update({'ver': sctop.addonInfo('version')})
        try:
            data.update({'state': bool(xbmc.getCondVisibility("!Player.Paused"))})
            data.update({'ws': xbmcgui.Window(10000).getProperty('ws.ident'), 'vip': xbmcgui.Window(10000).getProperty('ws.vip')})
            data.update({'vd': xbmcgui.Window(10000).getProperty('ws.days')})
            data.update({'skin':xbmc.getSkinDir()})
            if 'bitrate' in self.stream:
                util.debug("[SC] action bitrate")
                data.update({'bt': self.stream['bitrate']})
            else:
                util.debug("[SC] action no bitrate")
        except:
            pass
        try:
            if self.itemDuration > 0:
                data.update({'dur': self.itemDuration})
        except Exception:
            pass
        self.log("[SC] action: %s" % str(data))
        url = self.parent.provider._url(url)
        sctop.post_json(url, data, {'X-UID': sctop.uid})
项目:pelisalacarta-ce    作者:pelisalacarta-ce    | 项目源码 | 文件源码
def get_viewmode_id(parent_item):
    # viewmode_json habria q guardarlo en un archivo y crear un metodo para q el user fije sus preferencias en:
    # user_files, user_movies, user_tvshows, user_season y user_episodes.
    viewmode_json = {'skin.confluence': {'default_files': 50,
                                         'default_movies': 515,
                                         'default_tvshows': 508,
                                         'default_seasons': 503,
                                         'default_episodes': 504,
                                         'view_list': 50,
                                         'view_thumbnails': 500,
                                         'view_movie_with_plot': 503},
                     'skin.estuary': {'default_files': 50,
                                      'default_movies': 54,
                                      'default_tvshows': 502,
                                      'default_seasons': 500,
                                      'default_episodes': 53,
                                      'view_list': 50,
                                      'view_thumbnails': 500,
                                      'view_movie_with_plot': 54}}

    # Si el parent_item tenia fijado un viewmode usamos esa vista...
    if parent_item.viewmode == 'movie':
        # Remplazamos el antiguo viewmode 'movie' por 'thumbnails'
        parent_item.viewmode = 'thumbnails'

    if parent_item.viewmode in ["list", "movie_with_plot", "thumbnails"]:
        view_name = "view_" + parent_item.viewmode

        '''elif isinstance(parent_item.viewmode, int):
            # only for debug
            viewName = parent_item.viewmode'''

    # ...sino ponemos la vista por defecto en funcion del viewcontent
    else:
        view_name = "default_" + parent_item.viewcontent

    skin_name = xbmc.getSkinDir()
    if skin_name not in viewmode_json:
        skin_name = 'skin.confluence'
    view_skin = viewmode_json[skin_name]
    return view_skin.get(view_name, 50)
项目:pelisalacarta-ce    作者:pelisalacarta-ce    | 项目源码 | 文件源码
def set_view(view_mode, view_code=0):
    _log("set_view view_mode='"+view_mode+"', view_code="+str(view_code))

    # Set the content for extended library views if needed
    if view_mode==MOVIES:
        _log("set_view content is movies")
        xbmcplugin.setContent( int(sys.argv[1]) ,"movies" )
    elif view_mode==TV_SHOWS:
        _log("set_view content is tvshows")
        xbmcplugin.setContent( int(sys.argv[1]) ,"tvshows" )
    elif view_mode==SEASONS:
        _log("set_view content is seasons")
        xbmcplugin.setContent( int(sys.argv[1]) ,"seasons" )
    elif view_mode==EPISODES:
        _log("set_view content is episodes")
        xbmcplugin.setContent( int(sys.argv[1]) ,"episodes" )

    # Reads skin name
    skin_name = xbmc.getSkinDir()
    _log("set_view skin_name='"+skin_name+"'")

    try:
        if view_code==0:
            _log("set_view view mode is "+view_mode)
            view_codes = ALL_VIEW_CODES.get(view_mode)
            view_code = view_codes.get(skin_name)
            _log("set_view view code for "+view_mode+" in "+skin_name+" is "+str(view_code))
            xbmc.executebuiltin("Container.SetViewMode("+str(view_code)+")")
        else:
            _log("set_view view code forced to "+str(view_code))
            xbmc.executebuiltin("Container.SetViewMode("+str(view_code)+")")
    except:
        _log("Unable to find view code for view mode "+str(view_mode)+" and skin "+skin_name)
项目:plugin.video.streamondemand-pureita    作者:orione7    | 项目源码 | 文件源码
def set_view(view_mode, view_code=0):
    _log("set_view view_mode='"+view_mode+"', view_code="+str(view_code))

    # Set the content for extended library views if needed
    if view_mode==MOVIES:
        _log("set_view content is movies")
        xbmcplugin.setContent( int(sys.argv[1]) ,"movies" )
    elif view_mode==TV_SHOWS:
        _log("set_view content is tvshows")
        xbmcplugin.setContent( int(sys.argv[1]) ,"tvshows" )
    elif view_mode==SEASONS:
        _log("set_view content is seasons")
        xbmcplugin.setContent( int(sys.argv[1]) ,"seasons" )
    elif view_mode==EPISODES:
        _log("set_view content is episodes")
        xbmcplugin.setContent( int(sys.argv[1]) ,"episodes" )

    # Reads skin name
    skin_name = xbmc.getSkinDir()
    _log("set_view skin_name='"+skin_name+"'")

    try:
        if view_code==0:
            _log("set_view view mode is "+view_mode)
            view_codes = ALL_VIEW_CODES.get(view_mode)
            view_code = view_codes.get(skin_name)
            _log("set_view view code for "+view_mode+" in "+skin_name+" is "+str(view_code))
            xbmc.executebuiltin("Container.SetViewMode("+str(view_code)+")")
        else:
            _log("set_view view code forced to "+str(view_code))
            xbmc.executebuiltin("Container.SetViewMode("+str(view_code)+")")
    except:
        _log("Unable to find view code for view mode "+str(view_mode)+" and skin "+skin_name)
项目:plugin.program.indigo    作者:tvaddonsco    | 项目源码 | 文件源码
def set_view(view_mode, view_code=0):
    if get_setting('auto-view') == 'true':

        # Set the content for extended library views if needed
        xbmcplugin.setContent(int(sys.argv[1]), view_mode)
        if view_mode == MOVIES:
            xbmcplugin.setContent(int(sys.argv[1]), "movies")
        elif view_mode == TV_SHOWS:
            xbmcplugin.setContent(int(sys.argv[1]), "tvshows")
        elif view_mode == SEASONS:
            xbmcplugin.setContent(int(sys.argv[1]), "seasons")
        elif view_mode == EPISODES:
            xbmcplugin.setContent(int(sys.argv[1]), "episodes")
        elif view_mode == THUMBNAIL:
            xbmcplugin.setContent(int(sys.argv[1]), "thumbnail")
        elif view_mode == LIST:
            xbmcplugin.setContent(int(sys.argv[1]), "list")
        elif view_mode == SETS:
            xbmcplugin.setContent(int(sys.argv[1]), "sets")

        skin_name = xbmc.getSkinDir()  # Reads skin name
        try:
            if view_code == 0:
                view_codes = ALL_VIEW_CODES.get(view_mode)
                # kodi.log(view_codes)
                view_code = view_codes.get(skin_name)
                # kodi.log(view_code)
                xbmc.executebuiltin("Container.SetViewMode(" + str(view_code) + ")")
            # kodi.log("Setting First view code "+str(view_code)+" for view mode "+str(view_mode)+" and skin "+skin_name)
            else:
                xbmc.executebuiltin("Container.SetViewMode(" + str(view_code) + ")")
            # kodi.log("Setting Second view code for view mode "+str(view_mode)+" and skin "+skin_name)
        except:
            # kodi.log("Unable to find view code "+str(view_code)+" for view mode "+str(view_mode)+" and skin "+skin_name)
            pass
        # else:
        #   xbmc.executebuiltin("Container.SetViewMode(sets)")
项目:plugin.video.youtube    作者:jdf76    | 项目源码 | 文件源码
def get_skin_id(self):
        return xbmc.getSkinDir()
项目:plugin.video.youtube    作者:Kolifanes    | 项目源码 | 文件源码
def get_skin_id(self):
        return xbmc.getSkinDir()
项目:plugin.video.jen    作者:midraal    | 项目源码 | 文件源码
def set_list_view_mode(content):
    skin = xbmc.getSkinDir()
    koding.reset_db()
    match = koding.Get_From_Table("addonviews", {
        "skin": skin,
        "content": content
    })
    if match:
        match = match[0]
        xbmc.executebuiltin('Container.SetViewMode(%s)' % str(match["viewid"]))
项目:repository.midraal    作者:midraal    | 项目源码 | 文件源码
def set_list_view_mode(content):
    skin = xbmc.getSkinDir()
    koding.reset_db()
    match = koding.Get_From_Table("addonviews", {
        "skin": skin,
        "content": content
    })
    if match:
        match = match[0]
        xbmc.executebuiltin('Container.SetViewMode(%s)' % str(match["viewid"]))
项目:kan-for-kodi    作者:dvircohen    | 项目源码 | 文件源码
def set_view(view_mode, view_code=0):
    _log("set_view view_mode='"+view_mode+"', view_code="+str(view_code))

    # Set the content for extended library views if needed
    if view_mode==MOVIES:
        _log("set_view content is movies")
        xbmcplugin.setContent( int(sys.argv[1]) ,"movies" )
    elif view_mode==TV_SHOWS:
        _log("set_view content is tvshows")
        xbmcplugin.setContent( int(sys.argv[1]) ,"tvshows" )
    elif view_mode==SEASONS:
        _log("set_view content is seasons")
        xbmcplugin.setContent( int(sys.argv[1]) ,"seasons" )
    elif view_mode==EPISODES:
        _log("set_view content is episodes")
        xbmcplugin.setContent( int(sys.argv[1]) ,"episodes" )

    # Reads skin name
    skin_name = xbmc.getSkinDir()
    _log("set_view skin_name='"+skin_name+"'")

    try:
        if view_code==0:
            _log("set_view view mode is "+view_mode)
            view_codes = ALL_VIEW_CODES.get(view_mode)
            view_code = view_codes.get(skin_name)
            _log("set_view view code for "+view_mode+" in "+skin_name+" is "+str(view_code))
            xbmc.executebuiltin("Container.SetViewMode("+str(view_code)+")")
        else:
            _log("set_view view code forced to "+str(view_code))
            xbmc.executebuiltin("Container.SetViewMode("+str(view_code)+")")
    except:
        _log("Unable to find view code for view mode "+str(view_mode)+" and skin "+skin_name)
项目:script.skin.helper.skinbackup    作者:marcelveldt    | 项目源码 | 文件源码
def restore(self, filename="", silent=False):
        '''restore skin settings from file'''

        if not filename:
            filename = self.get_restorefilename()

        progressdialog = None
        if not silent:
            progressdialog = xbmcgui.DialogProgress(self.addon.getLocalizedString(32006))
            progressdialog.create(self.addon.getLocalizedString(32007))

        if filename and xbmcvfs.exists(filename):
            # create temp path
            temp_path = self.create_temp()
            if not filename.endswith("zip"):
                # assume that passed filename is actually a skinsettings file
                skinsettingsfile = filename
            else:
                # copy zip to temp directory and unzip
                skinsettingsfile = temp_path + "guisettings.txt"
                if progressdialog:
                    progressdialog.update(0, "unpacking backup...")
                zip_temp = u'%sskinbackup-%s.zip' % (ADDON_DATA, datetime.now().strftime('%Y-%m-%d-%H-%M'))
                copy_file(filename, zip_temp, True)
                unzip_fromfile(zip_temp, temp_path)
                delete_file(zip_temp)
                # copy skinshortcuts preferences
                self.restore_skinshortcuts(temp_path)
                # restore any custom skin images or themes
                for directory in ["custom_images/", "themes/"]:
                    custom_images_folder = u"special://profile/addon_data/%s/%s" % (xbmc.getSkinDir(), directory)
                    custom_images_folder_temp = temp_path + directory
                    if xbmcvfs.exists(custom_images_folder_temp):
                        for file in xbmcvfs.listdir(custom_images_folder_temp)[1]:
                            xbmcvfs.copy(custom_images_folder_temp + file,
                                         custom_images_folder + file)
            # restore guisettings
            if xbmcvfs.exists(skinsettingsfile):
                self.restore_guisettings(skinsettingsfile, progressdialog)

            # cleanup temp
            recursive_delete_dir(temp_path)
            progressdialog.close()
        if not silent:
            xbmcgui.Dialog().ok(self.addon.getLocalizedString(32006), self.addon.getLocalizedString(32009))
项目:plugin.video.stream-cinema    作者:bbaronSVK    | 项目源码 | 文件源码
def system(self, data, cl=False):
        util.debug("[SC] SYSYEM CL: %s" % str(cl));
        if cl is False and "setContent" in data:
            xbmcplugin.setContent(int(sys.argv[1]), data["setContent"])
            '''
            view_mode=data["setContent"].lower()
            skin_name=xbmc.getSkinDir() # nacitame meno skinu
            util.debug("[SC] skin_name='"+skin_name+"'")
            try:
                util.debug("[SC] view mode is "+view_mode)
                view_codes=sctop.ALL_VIEW_CODES.get(view_mode)
                view_code=view_codes.get(skin_name)
                util.debug("[SC] view code for "+view_mode+" in "+skin_name+" is "+str(view_code))
                xbmc.executebuiltin("Container.SetViewMode("+str(view_code)+")")
                #xbmc.executebuiltin("Container.Refresh")
            except:
                util.debug("[SC] Unable to find view code for view mode "+str(view_mode)+" and skin "+skin_name)
            '''

        if cl is False and "setPluginCategory" in data:
            xbmcplugin.setPluginCategory(int(sys.argv[1]), data["setPluginCategory"])

        if cl is False and "addSortMethod" in data:
            xbmcplugin.addSortMethod(int(sys.argv[1]), sctop.sortmethod[int(data["addSortMethod"])])

        if cl is False and data.get('addSortMethods'):
            for m in data.get("addSortMethods"):
                xbmcplugin.addSortMethod(int(sys.argv[1]), sctop.sortmethod[int(m)])

        if cl is False and "setPluginFanart" in data:
            xbmcplugin.setPluginFanart(int(sys.argv[1]), data["setPluginFanart"])

        if cl is False and "version" in data:
            util.info("[SC] kontrola verzie: %s %s" % (str(sctop.addonInfo('version')), data["version"]))
            if sctop.addonInfo('version') != data["version"] and sctop.getSetting('ver') != data['version']:
                try:
                    sctop.dialog.ok(sctop.getString(30954), sctop.getString(30955) % str(data['version']))
                except:
                    pass
                xbmc.executebuiltin('UpdateAddonRepos')
                sctop.setSetting('ver', data['version'])
            if sctop.getSettingAsBool('cachemigrate') == '' or sctop.getSettingAsBool('cachemigrate') is False:
                self.parent.cacheMigrate()
                pass
            pass

        if cl is False and "focus" in data:
            self.parent.system = {"focus": data['focus']}

        if cl is True and "focus" in data:
            try:
                self.parent.endOfDirectory()
                util.debug("[SC] nastavujem focus na: %d" % int(data['focus']))
                xel = xbmcgui.Window(xbmcgui.getCurrentWindowId())
                ctr = xel.getControl(xel.getFocusId())
                ctr.selectItem(int(data['focus']))
            except Exception, e:
                util.debug("[SC] error focus :-( %s" % str(traceback.format_exc()))
                pass
项目:addon    作者:alfa-addon    | 项目源码 | 文件源码
def get_viewmode_id(parent_item):

    # viewmode_json habria q guardarlo en un archivo y crear un metodo para q el user fije sus preferencias en:
    # user_files, user_movies, user_tvshows, user_season y user_episodes.
    viewmode_json = {'skin.confluence': {'default_files': 50,
                                         'default_movies': 515,
                                         'default_tvshows': 508,
                                         'default_seasons': 503,
                                         'default_episodes': 504,
                                         'view_list': 50,
                                         'view_thumbnails': 500,
                                         'view_movie_with_plot': 503},
                     'skin.estuary': {'default_files': 50,
                                      'default_movies': 54,
                                      'default_tvshows': 502,
                                      'default_seasons': 500,
                                      'default_episodes': 53,
                                      'view_list': 50,
                                      'view_thumbnails': 500,
                                      'view_movie_with_plot': 54}}

    # Si el parent_item tenia fijado un viewmode usamos esa vista...
    if parent_item.viewmode == 'movie':
        # Remplazamos el antiguo viewmode 'movie' por 'thumbnails'
        parent_item.viewmode = 'thumbnails'

    if parent_item.viewmode in ["list", "movie_with_plot", "thumbnails"]:
        view_name = "view_" + parent_item.viewmode

        '''elif isinstance(parent_item.viewmode, int):
            # only for debug
            viewName = parent_item.viewmode'''

    # ...sino ponemos la vista por defecto en funcion del viewcontent
    else:
        view_name = "default_" + parent_item.viewcontent

    skin_name = xbmc.getSkinDir()
    if skin_name not in viewmode_json:
        skin_name = 'skin.confluence'
    view_skin = viewmode_json[skin_name]
    return view_skin.get(view_name, 50)