Python xbmc.getSkinDir() Examples

The following are 22 code examples of xbmc.getSkinDir(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module xbmc , or try the search function .
Example #1
Source File: Utils.py    From script.toolbox with GNU General Public License v2.0 7 votes vote down vote up
def export_skinsettings(filter_label=False):
    s_path = xbmc.translatePath('special://profile/addon_data/%s/settings.xml' % xbmc.getSkinDir()).decode("utf-8")
    if not xbmcvfs.exists(s_path):
        xbmcgui.Dialog().ok(ADDON_LANGUAGE(32007), ADDON_LANGUAGE(32008))
        log("settings.xml not found")
        return None
    log("settings.xml found")
    ls = []
    for count, skinsetting in enumerate(parse(s_path).documentElement.getElementsByTagName('setting')):
        s_id = skinsetting.attributes['id'].nodeValue
        s_type = skinsetting.attributes['type'].nodeValue
        if s_type == "string":
            s_value = xbmc.getInfoLabel("Skin.String(%s)" % s_id)
        else:
            s_value = bool(xbmc.getCondVisibility("Skin.HasSetting(%s)" % s_id))
        if not filter_label or filter_label in s_id:
            ls.append((s_type, s_id, s_value))
    if save_to_file(ls, xbmc.getSkinDir() + ".backup"):
        xbmcgui.Dialog().ok(ADDON_LANGUAGE(32005), ADDON_LANGUAGE(32006)) 
Example #2
Source File: default.py    From program.plexus with GNU General Public License v2.0 6 votes vote down vote up
def main_menu():
      addDir('[B]'+translate(30001)+'[/B]',MainURL,10,os.path.join(addonpath,art,'mystreams.png'),2,True)
      if settings.getSetting('addon_history') == "true":
      	addDir('[B]'+translate(30002)+'[/B]',MainURL,8,os.path.join(addonpath,art,'history.png'),2,True)
      	if "confluence" in xbmc.getSkinDir(): addLink('','','plexus')

      addDir('[B][COLOR maroon]'+translate(30003)+'[/COLOR][/B]' + translate(30005),MainURL,4,os.path.join(addonpath,art,'acestream-menu-item.png'),1,False)
      addDir('[B][COLOR maroon]'+translate(30003)+'[/COLOR][/B]' + translate(30006),MainURL,6,os.path.join(addonpath,art,'acestream-menu-item.png'),1,False)

      addDir('[B][COLOR maroon]'+translate(30004)+'[/COLOR][/B]' + translate(30007),MainURL,3,os.path.join(addonpath,art,'sopcast-menu-item.png'),1,False)
      addDir('[B][COLOR maroon]'+translate(30004)+'[/COLOR][/B]' + translate(30008),MainURL,5,os.path.join(addonpath,art,'sopcast-menu-item.png'),1,False)

      #if "confluence" in xbmc.getSkinDir(): addLink('','','plexus')
      #addDir('[B][COLOR maroon]' + translate(40057) + '[/COLOR][/B]',MainURL,300,os.path.join(addonpath,art,'settings.png'),2,True)       
      #break_sopcast is a function used in windows to intentionally break the sopcast.exe setup by renaming one of its codec files. It's ran here to rename the file again in case it failed when played before
      sop.break_sopcast() 
Example #3
Source File: Utils.py    From script.toolbox with GNU General Public License v2.0 6 votes vote down vote up
def import_skinsettings():
    data = read_from_file()
    if not data:
        log("backup not found")
    progressDialog = xbmcgui.DialogProgress(ADDON_LANGUAGE(32010))
    progressDialog.create(ADDON_LANGUAGE(32010))
    xbmc.sleep(200)
    for count, skinsetting in enumerate(data):
        if progressDialog.iscanceled():
            return
        if skinsetting[1].startswith(xbmc.getSkinDir()):
            progressDialog.update((count * 100) / len(data), ADDON_LANGUAGE(32011) + ' %s' % skinsetting[1])
            setting = skinsetting[1].replace(xbmc.getSkinDir() + ".", "")
            if skinsetting[0] == "string":
                if skinsetting[2] is not "":
                    xbmc.executebuiltin("Skin.SetString(%s,%s)" % (setting, skinsetting[2]))
                else:
                    xbmc.executebuiltin("Skin.Reset(%s)" % setting)
            elif skinsetting[0] == "bool":
                if skinsetting[2]:
                    xbmc.executebuiltin("Skin.SetBool(%s)" % setting)
                else:
                    xbmc.executebuiltin("Skin.Reset(%s)" % setting)
        xbmc.sleep(30)
    xbmcgui.Dialog().ok(ADDON_LANGUAGE(32005), ADDON_LANGUAGE(32009)) 
Example #4
Source File: screensaver.py    From screensaver.kaster with GNU General Public License v2.0 6 votes vote down vote up
def set_property(self):
        # Kodi does not yet allow scripts to ship font definitions
        skin = xbmc.getSkinDir()
        if "estuary" in skin:
            self.setProperty("clockfont", "fontclock")
        elif "zephyr" in skin:
            self.setProperty("clockfont", "fontzephyr")
        elif "eminence" in skin:
            self.setProperty("clockfont", "fonteminence")
        elif "aura" in skin:
            self.setProperty("clockfont", "fontaura")
        elif "box" in skin:
            self.setProperty("clockfont", "box")
        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", "hide-overlay", "show-blackbackground"]:
            self.setProperty(setting, kodiutils.get_setting(setting))
        # Set animations
        if kodiutils.get_setting_as_int("animation") == 1:
            self.setProperty("animation","panzoom")
        return 
Example #5
Source File: main_service.py    From script.skin.helper.service with GNU General Public License v2.0 6 votes vote down vote up
def check_skin_version(self):
        '''check if skin changed'''
        try:
            skin = xbmc.getSkinDir()
            skin_addon = xbmcaddon.Addon(id=skin)
            skin_label = skin_addon.getAddonInfo('name').decode("utf-8")
            skin_version = skin_addon.getAddonInfo('version').decode("utf-8")
            this_skin = "%s-%s" % (skin_label, skin_version)
            del skin_addon
            if self.last_skin != this_skin:
                # auto correct skin settings if needed
                self.last_skin = this_skin
                self.win.setProperty("SkinHelper.skinTitle", "%s - %s: %s"
                                     % (skin_label, xbmc.getLocalizedString(19114), skin_version))
                self.win.setProperty("SkinHelper.skin_version", "%s: %s"
                                     % (xbmc.getLocalizedString(19114), skin_version))
                self.win.setProperty("SkinHelper.Version", self.addonversion.replace(".", ""))
                SkinSettings().correct_skin_settings()
        except Exception as exc:
            log_exception(__name__, exc) 
Example #6
Source File: koditidal2.py    From plugin.audio.tidal2 with GNU General Public License v3.0 6 votes vote down vote up
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 
Example #7
Source File: default.py    From program.plexus with GNU General Public License v2.0 6 votes vote down vote up
def main_menu():
      addDir('[B]'+translate(30001)+'[/B]',MainURL,10,os.path.join(addonpath,art,'mystreams.png'),2,True)
      if settings.getSetting('addon_history') == "true":
      	addDir('[B]'+translate(30002)+'[/B]',MainURL,8,os.path.join(addonpath,art,'history.png'),2,True)
      	if "confluence" in xbmc.getSkinDir(): addLink('','','plexus')

      addDir('[B][COLOR maroon]'+translate(30003)+'[/COLOR][/B]' + translate(30005),MainURL,4,os.path.join(addonpath,art,'acestream-menu-item.png'),1,False)
      addDir('[B][COLOR maroon]'+translate(30003)+'[/COLOR][/B]' + translate(30006),MainURL,6,os.path.join(addonpath,art,'acestream-menu-item.png'),1,False)

      addDir('[B][COLOR maroon]'+translate(30004)+'[/COLOR][/B]' + translate(30007),MainURL,3,os.path.join(addonpath,art,'sopcast-menu-item.png'),1,False)
      addDir('[B][COLOR maroon]'+translate(30004)+'[/COLOR][/B]' + translate(30008),MainURL,5,os.path.join(addonpath,art,'sopcast-menu-item.png'),1,False)

      #if "confluence" in xbmc.getSkinDir(): addLink('','','plexus')
      #addDir('[B][COLOR maroon]' + translate(40057) + '[/COLOR][/B]',MainURL,300,os.path.join(addonpath,art,'settings.png'),2,True)       
      #break_sopcast is a function used in windows to intentionally break the sopcast.exe setup by renaming one of its codec files. It's ran here to rename the file again in case it failed when played before
      sop.break_sopcast() 
Example #8
Source File: advancedfunctions.py    From program.plexus with GNU General Public License v2.0 6 votes vote down vote up
def shutdown_hooks():
	opcao= xbmcgui.Dialog().yesno(translate(40000), translate(70027),translate(70028) + str(xbmc.getSkinDir()) )
	if opcao:
		mensagemok(translate(40000),translate(70029),translate(70030))
		mensagemok(translate(40000),translate(70031))
		opcao= xbmcgui.Dialog().yesno(translate(40000), translate(70032) )
		if opcao:
			import xml.etree.ElementTree as ET
			skin_path = xbmc.translatePath("special://skin/")
			tree = ET.parse(os.path.join(skin_path, "addon.xml"))
			try: res = tree.findall("./res")[0]
			except: res = tree.findall("./extension/res")[0]
			xml_specific_folder = str(res.attrib["folder"])
			xml_video_osd = os.path.join(xbmc.translatePath("special://skin/"),xml_specific_folder,"VideoOSD.xml")
			xml_content = readfile(xml_video_osd).replace('PlayerControl(Stop)','RunPlugin(plugin://plugin.video.p2p-streams/?mode=7)')
			try:
				save(xml_video_osd,xml_content)
				xbmc.executebuiltin("Notification(%s,%s,%i,%s)" % (translate(40000), translate(600026), 1,addonpath+"/icon.png"))
			except: mensagemok(translate(40000),'No permissions.')
			opcao= xbmcgui.Dialog().yesno(translate(40000), translate(70033) )
			if opcao:
				from peertopeerutils.keymapeditor import *
				run() 
Example #9
Source File: advancedfunctions.py    From program.plexus with GNU General Public License v2.0 6 votes vote down vote up
def shutdown_hooks():
	opcao= xbmcgui.Dialog().yesno(translate(40000), translate(70027),translate(70028) + str(xbmc.getSkinDir()) )
	if opcao:
		mensagemok(translate(40000),translate(70029),translate(70030))
		mensagemok(translate(40000),translate(70031))
		opcao= xbmcgui.Dialog().yesno(translate(40000), translate(70032) )
		if opcao:
			import xml.etree.ElementTree as ET
			skin_path = xbmc.translatePath("special://skin/")
			tree = ET.parse(os.path.join(skin_path, "addon.xml"))
			try: res = tree.findall("./res")[0]
			except: res = tree.findall("./extension/res")[0]
			xml_specific_folder = str(res.attrib["folder"])
			xml_video_osd = os.path.join(xbmc.translatePath("special://skin/"),xml_specific_folder,"VideoOSD.xml")
			xml_content = readfile(xml_video_osd).replace('PlayerControl(Stop)','RunPlugin(plugin://plugin.video.p2p-streams/?mode=7)')
			try:
				save(xml_video_osd,xml_content)
				xbmc.executebuiltin("Notification(%s,%s,%i,%s)" % (translate(40000), translate(600026), 1,addonpath+"/icon.png"))
			except: mensagemok(translate(40000),'No permissions.')
			opcao= xbmcgui.Dialog().yesno(translate(40000), translate(70033) )
			if opcao:
				from peertopeerutils.keymapeditor import *
				run() 
Example #10
Source File: common.py    From repository.evgen_dev.xbmc-addons with GNU General Public License v2.0 5 votes vote down vote up
def render_items(self, type='movies'):
        self.render(content=type)
        skin = xbmc.getSkinDir()
        if(skin == 'skin.confluence' or skin == 'skin.confluence-ploop'):
            xbmc.executebuiltin("Container.SetViewMode(503)")
            #print skin 
Example #11
Source File: common.py    From repository.evgen_dev.xbmc-addons with GNU General Public License v2.0 5 votes vote down vote up
def render_items(self, type='movies'):
        self.render(content=type)
        skin = xbmc.getSkinDir()
        if(skin == 'skin.confluence' or skin == 'skin.confluence-ploop'):
            xbmc.executebuiltin("Container.SetViewMode(503)")
            #print skin 
Example #12
Source File: common.py    From repository.evgen_dev.xbmc-addons with GNU General Public License v2.0 5 votes vote down vote up
def render_items(self, type='movies'):
        self.render(content=type)
        skin = xbmc.getSkinDir()
        if(skin == 'skin.confluence' or skin == 'skin.confluence-ploop'):
            xbmc.executebuiltin("Container.SetViewMode(503)")
            #print skin 
Example #13
Source File: platformtools.py    From addon with GNU General Public License v3.0 5 votes vote down vote up
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) 
Example #14
Source File: plugintools.py    From tvalacarta with GNU General Public License v3.0 5 votes vote down vote up
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) 
Example #15
Source File: xbmc_context_ui.py    From plugin.video.youtube with GNU General Public License v2.0 5 votes vote down vote up
def get_skin_id(self):
        return xbmc.getSkinDir() 
Example #16
Source File: xswift2.py    From plugin.video.openmeta with GNU General Public License v3.0 5 votes vote down vote up
def get_view_mode_id(self, view_mode):
		view_mode_ids = VIEW_MODES.get(view_mode.lower())
		if view_mode_ids:
			return view_mode_ids.get(xbmc.getSkinDir())
		return None 
Example #17
Source File: platformtools.py    From pelisalacarta-ce with GNU General Public License v3.0 5 votes vote down vote up
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) 
Example #18
Source File: plugintools.py    From pelisalacarta-ce with GNU General Public License v3.0 5 votes vote down vote up
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) 
Example #19
Source File: tvnplayer.py    From filmkodi with Apache License 2.0 5 votes vote down vote up
def endDir(self, sort=False, content=None, viewMode=None, ps=None):
        '''
        ToDo:
        Check is Confluence, not? other View Mode
        Confluence View Modes:
        http://www.xbmchub.com/forums/general-python-development/717-how-set-default-view-type-xbmc-lists.html#post4683
        https://github.com/xbmc/xbmc/blob/master/addons/skin.confluence/720p/MyVideoNav.xml
        '''
        if ps == None:
            ps = int(sys.argv[1])
        if sort == True:
            xbmcplugin.addSortMethod(ps, xbmcplugin.SORT_METHOD_LABEL)
        canBeContent = ["files", "songs", "artists", "albums", "movies", "tvshows", "episodes", "musicvideos"]
        if content in canBeContent:
            xbmcplugin.setContent(ps, content)
        if viewMode != None:
            viewList = {}
            if 'confluence' in xbmc.getSkinDir():
                viewList = {
                    'List': '50',
                    'Big List': '51',
                    'ThumbnailView': '500',
                    'PosterWrapView': '501',
                    'PosterWrapView2_Fanart': '508',
                    'MediaInfo': '504',
                    'MediaInfo2': '503',
                    'MediaInfo3': '515',
                    'WideIconView': '505',
                    'MusicVideoInfoListView': '511',
                    'AddonInfoListView1': '550',
                    'AddonInfoThumbView1': '551',
                    'LiveTVView1': '560'
                }
            if viewMode in viewList:
                view = viewList[viewMode]
            else:
                view = 'None'
            xbmc.executebuiltin("Container.SetViewMode(%s)" % (view))
        xbmcplugin.endOfDirectory(ps) 
Example #20
Source File: viewsetter.py    From plugin.program.indigo with GNU General Public License v3.0 5 votes vote down vote up
def set_view(view_mode, view_code=0):
    if get_setting('auto-view') == 'true':
        try:
            # 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")
        except:
            pass
        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)") 
Example #21
Source File: skinsettings.py    From script.skin.helper.service with GNU General Public License v2.0 5 votes vote down vote up
def save_skin_image(self, skinstring="", multi_image=False, header=""):
        '''let the user select an image and save it to addon_data for easy backup'''
        cur_value = xbmc.getInfoLabel("Skin.String(%s)" % skinstring).decode("utf-8")
        cur_value_org = xbmc.getInfoLabel("Skin.String(%s.org)" % skinstring).decode("utf-8")

        if not multi_image:
            # single image (allow copy to addon_data)
            value = xbmcgui.Dialog().browse(2, header, 'files', '', True, True, cur_value_org).decode("utf-8")
            if value:
                ext = value.split(".")[-1]
                newfile = (u"special://profile/addon_data/%s/custom_images/%s.%s"
                           % (xbmc.getSkinDir(), skinstring + time.strftime("%Y%m%d%H%M%S", time.gmtime()), ext))
                if "special://profile/addon_data/%s/custom_images/" % xbmc.getSkinDir() in cur_value:
                    xbmcvfs.delete(cur_value)
                xbmcvfs.copy(value, newfile)
                xbmc.executebuiltin("Skin.SetString(%s.org,%s)" % (skinstring.encode("utf-8"), value.encode("utf-8")))
                value = newfile
        else:
            # multi image
            if not cur_value_org.startswith("$"):
                delim = "\\" if "\\" in cur_value_org else "/"
                curdir = cur_value_org.rsplit(delim, 1)[0] + delim
            else:
                curdir = ""
            value = xbmcgui.Dialog().browse(0, self.addon.getLocalizedString(32005),
                                            'files', '', True, True, curdir).decode("utf-8")
        return value 
Example #22
Source File: plugintools.py    From tvalacarta with GNU General Public License v3.0 5 votes vote down vote up
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)