Exemple #1
0
def main():
    set_property(
        "syncing_library",
        int((time.time() -
             plugin.get_setting(SETTING_UPDATE_LIBRARY_INTERVAL, int) * 60)))
    set_property(
        "updating_library",
        int((time.time() -
             plugin.get_setting(SETTING_UPDATE_LIBRARY_INTERVAL, int) * 60)))
    set_property(
        "updating_library_music",
        int((time.time() -
             plugin.get_setting(SETTING_UPDATE_LIBRARY_INTERVAL, int) * 60)))

    go_idle(15)
    if plugin.get_setting(SETTING_TOTAL_SETUP_DONE, bool) == False:
        xbmc.executebuiltin(
            'RunPlugin(plugin://plugin.video.chappaai/setup/total)')
        plugin.set_setting(SETTING_TOTAL_SETUP_DONE, "true")
    if plugin.get_setting(SETTING_AUTOPATCH, bool) == True:
        patch("auto")
    xbmc.executebuiltin(
        "RunPlugin(plugin://plugin.video.chappaai/movies/batch_add_to_library)"
    )
    next_update = future(0)
    while not xbmc.abortRequested:
        if next_update <= future(0):
            next_update = future(
                plugin.get_setting(SETTING_UPDATE_LIBRARY_INTERVAL, int) * 60 *
                60)
            update_library()
        go_idle(30 * 60)
Exemple #2
0
def settings_set_default_channeler(media):
    channelers = active_channelers(media)
    channelers.insert(0, ADDON_PICKER)
    media = media.replace('es',
                          'e').replace('ws', 'w').replace('all', '').replace(
                              'os', 'o').replace('vs', 'v s')
    selection = dialogs.select(
        "{0}".format(
            _("Select %s") %
            "{0} {1}".format(_("Default").lower(),
                             _("Player").lower())),
        [p.title for p in channelers])
    if selection >= 0:
        selected = channelers[selection].id
        if media == "movies":
            plugin.set_setting(SETTING_MOVIES_DEFAULT_CHANNELER, selected)
        elif media == "tvshows":
            plugin.set_setting(SETTING_TV_DEFAULT_CHANNELER, selected)
        elif media == "music":
            plugin.set_setting(SETTING_MUSIC_DEFAULT_CHANNELER, selected)
        elif media == "musicvideos":
            plugin.set_setting(SETTING_MUSICVIDEOS_DEFAULT_CHANNELER, selected)
        elif media == "live":
            plugin.set_setting(SETTING_LIVE_DEFAULT_CHANNELER, selected)
        else:
            raise Exception("invalid parameter %s" % media)
Exemple #3
0
def toggle_between_skins():
    if xbmc.getCondVisibility("Skin.HasSetting(Contexting)") != True: contexting = False
    else: contexting = True
    if xbmc.getCondVisibility("Skin.HasSetting(Toggling)") != True: toggling = False
    else: toggling = True
    current_skin = str(xbmc.executeJSONRPC('{"jsonrpc":"2.0", "method":"Settings.GetSettingValue","params":{"setting":"lookandfeel.skin"}, "id":1}')).replace('{"id":1,"jsonrpc":"2.0","result":{"value":"','').replace('"}}','')
    primary_skin = plugin.get_setting(SETTING_PRIMARY_SKIN, unicode)
    if primary_skin == "": plugin.set_setting(SETTING_PRIMARY_SKIN, current_skin)
    alternate_skin = plugin.get_setting(SETTING_ALTERNATE_SKIN, unicode)
    if alternate_skin == "": 
        if primary_skin != "skin.confluence" and primary_skin != "": plugin.set_setting(SETTING_ALTERNATE_SKIN, "skin.confluence")
        else: 
            dialogs.notify(msg="Alternate skin", title="Not set", delay=5000, image=get_icon_path("metalliq"))
            return openSettings(addonid, 5.7)
    if primary_skin != alternate_skin and primary_skin != "" and alternate_skin != "" and xbmc.getCondVisibility('System.HasAddon(%s)' % primary_skin) and xbmc.getCondVisibility('System.HasAddon(%s)' % alternate_skin):
        if current_skin != primary_skin: 
            xbmc.executeJSONRPC('{"jsonrpc":"2.0", "method":"Settings.SetSettingValue","params":{"setting":"lookandfeel.skin","value":"%s"}, "id":1}' % primary_skin)
            xbmc.executebuiltin('SetFocus(11)')
            xbmc.executebuiltin('Action(Select)')
        else: 
            xbmc.executeJSONRPC('{"jsonrpc":"2.0", "method":"Settings.SetSettingValue","params":{"setting":"lookandfeel.skin","value":"%s"}, "id":1}' % alternate_skin)
            xbmc.executebuiltin('SetFocus(11)')
            xbmc.executebuiltin('Action(Select)')
        xbmc.sleep(2000)
        if contexting == False and xbmc.getCondVisibility("Skin.HasSetting(Contexting)") == True: toggle_context_player()
        elif contexting == True and xbmc.getCondVisibility("Skin.HasSetting(Contexting)") == False: toggle_context_player()
        else: pass
        if toggling == False and xbmc.getCondVisibility("Skin.HasSetting(Toggling)") == True: toggle_preferred_toggle()
        elif toggling == True and xbmc.getCondVisibility("Skin.HasSetting(Toggling)") == False: toggle_preferred_toggle()
        else: pass
Exemple #4
0
def settings_set_default_player_fromcontext(media):
    players = active_players(media)
    players.insert(0, ADDON_SELECTOR)
    selection = dialogs.select(
        "{0}".format(
            _("Select %s") % "{0} {1}".format("context",
                                              _("Player").lower())),
        [p.title for p in players])
    if selection >= 0:
        selected = players[selection].id
        if media == "movies":
            plugin.set_setting(SETTING_MOVIES_DEFAULT_PLAYER_FROM_CONTEXT,
                               selected)
        elif media == "tvshows":
            plugin.set_setting(SETTING_TV_DEFAULT_PLAYER_FROM_CONTEXT,
                               selected)
        elif media == "musicvideos":
            plugin.set_setting(SETTING_MUSICVIDEOS_DEFAULT_PLAYER_FROM_CONTEXT,
                               selected)
        elif media == "music":
            plugin.set_setting(SETTING_MUSIC_DEFAULT_PLAYER_FROM_CONTEXT,
                               selected)
        elif media == "live":
            plugin.set_setting(SETTING_LIVE_DEFAULT_PLAYER_FROM_CONTEXT,
                               selected)
        else:
            raise Exception("invalid parameter %s" % media)
    plugin.open_settings()
Exemple #5
0
def toggle_between_skins():
    if xbmc.getCondVisibility("Skin.HasSetting(Contexting)") != True: contexting = False
    else: contexting = True
    if xbmc.getCondVisibility("Skin.HasSetting(Toggling)") != True: toggling = False
    else: toggling = True
    current_skin = str(xbmc.executeJSONRPC('{"jsonrpc":"2.0", "method":"Settings.GetSettingValue","params":{"setting":"lookandfeel.skin"}, "id":1}')).replace('{"id":1,"jsonrpc":"2.0","result":{"value":"','').replace('"}}','')
    primary_skin = plugin.get_setting(SETTING_PRIMARY_SKIN, unicode)
    if primary_skin == "": plugin.set_setting(SETTING_PRIMARY_SKIN, current_skin)
    alternate_skin = plugin.get_setting(SETTING_ALTERNATE_SKIN, unicode)
    if alternate_skin == "":
        if primary_skin != "skin.confluence" and primary_skin != "": plugin.set_setting(SETTING_ALTERNATE_SKIN, "skin.confluence")
        else:
            dialogs.notify(msg="Alternate skin", title="Not set", delay=5000, image=get_icon_path("metalliq"))
            return openSettings(addonid, 5.7)
    if primary_skin != alternate_skin and primary_skin != "" and alternate_skin != "" and xbmc.getCondVisibility('System.HasAddon(%s)' % primary_skin) and xbmc.getCondVisibility('System.HasAddon(%s)' % alternate_skin):
        if current_skin != primary_skin:
            xbmc.executeJSONRPC('{"jsonrpc":"2.0", "method":"Settings.SetSettingValue","params":{"setting":"lookandfeel.skin","value":"%s"}, "id":1}' % primary_skin)
            xbmc.executebuiltin('SetFocus(11)')
            xbmc.executebuiltin('Action(Select)')
        else:
            xbmc.executeJSONRPC('{"jsonrpc":"2.0", "method":"Settings.SetSettingValue","params":{"setting":"lookandfeel.skin","value":"%s"}, "id":1}' % alternate_skin)
            xbmc.executebuiltin('SetFocus(11)')
            xbmc.executebuiltin('Action(Select)')
        xbmc.sleep(2000)
        if contexting == False and xbmc.getCondVisibility("Skin.HasSetting(Contexting)") == True: toggle_context_player()
        elif contexting == True and xbmc.getCondVisibility("Skin.HasSetting(Contexting)") == False: toggle_context_player()
        else: pass
        if toggling == False and xbmc.getCondVisibility("Skin.HasSetting(Toggling)") == True: toggle_preferred_toggle()
        elif toggling == True and xbmc.getCondVisibility("Skin.HasSetting(Toggling)") == False: toggle_preferred_toggle()
        else: pass
Exemple #6
0
def toggle_between_skins():
    if xbmc.getCondVisibility("Skin.HasSetting(Contexting)") != True:
        contexting = False
    else:
        contexting = True
    if xbmc.getCondVisibility("Skin.HasSetting(Toggling)") != True:
        toggling = False
    else:
        toggling = True
    current_skin = (
        str(
            xbmc.executeJSONRPC(
                '{"jsonrpc":"2.0", "method":"Settings.GetSettingValue","params":{"setting":"lookandfeel.skin"}, "id":1}'
            )
        )
        .replace('{"id":1,"jsonrpc":"2.0","result":{"value":"', "")
        .replace('"}}', "")
    )
    primary_skin = plugin.get_setting(SETTING_PRIMARY_SKIN, converter=str)
    alternate_skin = plugin.get_setting(SETTING_ALTERNATE_SKIN, converter=str)
    if primary_skin == "":
        plugin.set_setting(SETTING_PRIMARY_SKIN, current_skin)
    if alternate_skin == "":
        if primary_skin != "skin.confluence":
            plugin.set_setting(SETTING_ALTERNATE_SKIN, "skin.confluence")
        else:
            plugin.notify(
                msg="Alternate skin", title="Not set", delay=5000, image=get_icon_path("metalliq")
            ), openSettings(addonid, 5.5)
    if (
        primary_skin != alternate_skin
        and primary_skin != ""
        and alternate_skin != ""
        and xbmc.getCondVisibility("System.HasAddon(%s)" % primary_skin)
        and xbmc.getCondVisibility("System.HasAddon(%s)" % alternate_skin)
    ):
        if current_skin != primary_skin:
            xbmc.executeJSONRPC(
                '{"jsonrpc":"2.0", "method":"Settings.SetSettingValue","params":{"setting":"lookandfeel.skin","value":"%s"}, "id":1}'
                % primary_skin
            )
            xbmc.executebuiltin("SetFocus(11)")
            xbmc.executebuiltin("Action(Select)")
        else:
            xbmc.executeJSONRPC(
                '{"jsonrpc":"2.0", "method":"Settings.SetSettingValue","params":{"setting":"lookandfeel.skin","value":"%s"}, "id":1}'
                % alternate_skin
            )
            xbmc.executebuiltin("SetFocus(11)")
            xbmc.executebuiltin("Action(Select)")
        if toggling == False:
            xbmc.executebuiltin("Skin.Reset(Toggling)")
        else:
            xbmc.executebuiltin("Skin.SetBool(Toggling)")
        if contexting == False:
            xbmc.executebuiltin("Skin.Reset(Contexting)")
        else:
            xbmc.executebuiltin("Skin.SetBool(Contexting)")
Exemple #7
0
def trakt_refresh_token():
    data = {        
        "client_id": CLIENT_ID,
        "client_secret": CLIENT_SECRET,
        "redirect_uri": "urn:ietf:wg:oauth:2.0:oob",
        "grant_type": "refresh_token",
        "refresh_token": plugin.get_setting(SETTING_TRAKT_REFRESH_TOKEN, unicode)
    }
    response = call_trakt("oauth/token", data=data, with_auth=False)
    if response:
        plugin.set_setting(SETTING_TRAKT_ACCESS_TOKEN, response["access_token"])
        plugin.set_setting(SETTING_TRAKT_REFRESH_TOKEN, response["refresh_token"])
Exemple #8
0
def trakt_refresh_token():
    data = {        
        "client_id": CLIENT_ID,
        "client_secret": CLIENT_SECRET,
        "redirect_uri": "urn:ietf:wg:oauth:2.0:oob",
        "grant_type": "refresh_token",
        "refresh_token": plugin.get_setting(SETTING_TRAKT_REFRESH_TOKEN, unicode)
    }
    response = call_trakt("oauth/token", data=data, with_auth=False)
    if response:
        plugin.set_setting(SETTING_TRAKT_ACCESS_TOKEN, response["access_token"])
        plugin.set_setting(SETTING_TRAKT_REFRESH_TOKEN, response["refresh_token"])
Exemple #9
0
def main():
    go_idle(45)
    if plugin.get_setting(SETTING_TOTAL_SETUP_DONE, bool) == False:
        xbmc.executebuiltin('RunPlugin(plugin://plugin.video.metalliq/setup/total)')
        plugin.set_setting(SETTING_TOTAL_SETUP_DONE, "true")
    #xbmc.executebuiltin("RunPlugin(plugin://plugin.video.metalliq/movies/batch_add_to_library)")
    next_update = future(0)
    while not xbmc.abortRequested:
        if next_update <= future(0):
            next_update = future(plugin.get_setting(SETTING_UPDATE_LIBRARY_INTERVAL, int) * 60 * 60)
            update_library()
        go_idle(30*60)
def main():
    go_idle(45)
    if plugin.get_setting(SETTING_TOTAL_SETUP_DONE, converter=bool) == False:
        xbmc.executebuiltin("RunPlugin(plugin://plugin.video.metalliq/totalsetup/)")
        plugin.set_setting(SETTING_TOTAL_SETUP_DONE, "true")
    xbmc.executebuiltin("RunPlugin(plugin://plugin.video.metalliq/movies/batch_add_to_library)")
    next_update = future(0)
    while not xbmc.abortRequested:
        if next_update <= future(0):
            next_update = future(UPDATE_LIBRARY_INTERVAL)
            update_library()
        go_idle(30 * 60)
Exemple #11
0
def settings_set_default_player(media):
    players = active_players(media)
    players.insert(0, ADDON_SELECTOR)

    selection = dialogs.select(_("Select player"), [p.title for p in players])
    if selection >= 0:
        selected = players[selection].id
        if media == "movies":
            plugin.set_setting(SETTING_MOVIES_DEFAULT_PLAYER, selected)
        elif media == "tvshows":
            plugin.set_setting(SETTING_TV_DEFAULT_PLAYER, selected)
        else:
            raise Exception("invalid parameter %s" % media)

    plugin.open_settings()
Exemple #12
0
def settings_set_default_player_fromcontext(media):
    players = active_players(media)
    players.insert(0, ADDON_SELECTOR)
    
    selection = dialogs.select(_("Select player"), [p.title for p in players])
    if selection >= 0:
        selected = players[selection].id
        if media == "movies":
            plugin.set_setting(SETTING_MOVIES_DEFAULT_PLAYER_FROM_CONTEXT, selected)
        elif media == "tvshows":
            plugin.set_setting(SETTING_TV_DEFAULT_PLAYER_FROM_CONTEXT, selected)
        else:
            raise Exception("invalid parameter %s" % media)
    
    plugin.open_settings()
Exemple #13
0
def settings_set_default_channeler(media):
    channelers = active_channelers(media)
    channelers.insert(0, ADDON_PICKER)
    media = media.replace("es", "e").replace("ws", "w").replace("all", "").replace("os", "o").replace("vs", "v s")
    selection = dialogs.select(_("Select default " + media + " player for guide"), [p.title for p in channelers])
    if selection >= 0:
        selected = channelers[selection].id
        if media == "movies":
            plugin.set_setting(SETTING_MOVIES_DEFAULT_CHANNELER, selected)
        elif media == "tvshows":
            plugin.set_setting(SETTING_TV_DEFAULT_CHANNELER, selected)
        elif media == "music":
            plugin.set_setting(SETTING_MUSIC_DEFAULT_CHANNELER, selected)
        elif media == "musicvideos":
            plugin.set_setting(SETTING_MUSICVIDEOS_DEFAULT_CHANNELER, selected)
        elif media == "live":
            plugin.set_setting(SETTING_LIVE_DEFAULT_CHANNELER, selected)
        else:
            raise Exception("invalid parameter %s" % media)
Exemple #14
0
def settings_set_default_channeler(media):
    channelers = active_channelers(media)
    channelers.insert(0, ADDON_PICKER)
    media = media.replace('es','e').replace('ws','w').replace('all','').replace('os','o').replace('vs','v s')
    selection = dialogs.select("{0}".format(_("Select %s") % "{0} {1}".format(_("Default").lower(), _("Player").lower())), [p.title for p in channelers])
    if selection >= 0:
        selected = channelers[selection].id
        if media == "movies":
            plugin.set_setting(SETTING_MOVIES_DEFAULT_CHANNELER, selected)
        elif media == "tvshows":
            plugin.set_setting(SETTING_TV_DEFAULT_CHANNELER, selected)
        elif media == "music":
            plugin.set_setting(SETTING_MUSIC_DEFAULT_CHANNELER, selected)
        elif media == "musicvideos":
            plugin.set_setting(SETTING_MUSICVIDEOS_DEFAULT_CHANNELER, selected)
        elif media == "live":
            plugin.set_setting(SETTING_LIVE_DEFAULT_CHANNELER, selected)
        else:
            raise Exception("invalid parameter %s" % media)
Exemple #15
0
def settings_set_default_player(media):
    players = active_players(media)
    players.insert(0, ADDON_SELECTOR)
    selection = dialogs.select(_("Select player"), [p.title for p in players])
    if selection >= 0:
        selected = players[selection].id
        if media == "movies":
            plugin.set_setting(SETTING_MOVIES_DEFAULT_PLAYER, selected)
        elif media == "tvshows":
            plugin.set_setting(SETTING_TV_DEFAULT_PLAYER, selected)
        elif media == "music":
            plugin.set_setting(SETTING_MUSIC_DEFAULT_PLAYER, selected)
        elif media == "musicvideos":
            plugin.set_setting(SETTING_MUSICVIDEOS_DEFAULT_PLAYER, selected)
        elif media == "live":
            plugin.set_setting(SETTING_LIVE_DEFAULT_PLAYER, selected)
        else:
            raise Exception("invalid parameter %s" % media)
    plugin.open_settings()
Exemple #16
0
def settings_set_default_player_fromcontext(media):
    players = active_players(media)
    players.insert(0, ADDON_SELECTOR)
    selection = dialogs.select("{0}".format(_("Select %s") % "{0} {1}".format("context", _("Player").lower())), [p.title for p in players])
    if selection >= 0:
        selected = players[selection].id
        if media == "movies":
            plugin.set_setting(SETTING_MOVIES_DEFAULT_PLAYER_FROM_CONTEXT, selected)
        elif media == "tvshows":
            plugin.set_setting(SETTING_TV_DEFAULT_PLAYER_FROM_CONTEXT, selected)
        elif media == "musicvideos":
            plugin.set_setting(SETTING_MUSICVIDEOS_DEFAULT_PLAYER_FROM_CONTEXT, selected)
        elif media == "music":
            plugin.set_setting(SETTING_MUSIC_DEFAULT_PLAYER_FROM_CONTEXT, selected)
        elif media == "live":
            plugin.set_setting(SETTING_LIVE_DEFAULT_PLAYER_FROM_CONTEXT, selected)
        else:
            raise Exception("invalid parameter %s" % media)
    plugin.open_settings()
Exemple #17
0
def settings_set_players(media):
    players = get_players(media)
    players = sorted(players,key=lambda player: player.clean_title.lower())

    # Get selection by user
    selected = None
    try:
        result = dialogs.multiselect(_("Enable players"), [p.clean_title for p in players])
        if result is not None:
            selected = [players[i].id for i in result]
    except:
        msg = "Kodi 16 required. Do you want to enable all players instead?"
        if dialogs.yesno(_("Warning"), _(msg)):
            selected = [p.id for p in players]
    
    if selected is not None:
        if media == "movies":
            plugin.set_setting(SETTING_MOVIES_ENABLED_PLAYERS, selected)
        elif media == "tvshows":
            plugin.set_setting(SETTING_TV_ENABLED_PLAYERS, selected)
        elif media == "live":
            plugin.set_setting(SETTING_LIVE_ENABLED_PLAYERS, selected)
        else:
            raise Exception("invalid parameter %s" % media)
    
    plugin.open_settings()
Exemple #18
0
def settings_set_players(media):
    players = get_players(media)
    players = sorted(players,key=lambda player: player.clean_title.lower())

    # Get selection by user
    selected = None
    try:
        result = dialogs.multiselect(_("Enable players"), [p.clean_title for p in players])
        if result is not None:
            selected = [players[i].id for i in result]
    except:
        msg = "Kodi 16 required. Do you want to enable all players instead?"
        if dialogs.yesno(_("Warning"), _(msg)):
            selected = [p.id for p in players]
    
    if selected is not None:
        if media == "movies":
            plugin.set_setting(SETTING_MOVIES_ENABLED_PLAYERS, selected)
        elif media == "tvshows":
            plugin.set_setting(SETTING_TV_ENABLED_PLAYERS, selected)
        elif media == "live":
            plugin.set_setting(SETTING_LIVE_ENABLED_PLAYERS, selected)
        else:
            raise Exception("invalid parameter %s" % media)
    
    plugin.open_settings()
Exemple #19
0
def trakt_authenticate():
    code = trakt_get_device_code()
    token = trakt_get_device_token(code)
    if token:
        expires_at = time.time() + 60 * 60 * 24 * 30  #*3
        plugin.set_setting(SETTING_TRAKT_EXPIRES_AT, str(expires_at))
        plugin.set_setting(SETTING_TRAKT_ACCESS_TOKEN, token["access_token"])
        plugin.set_setting(SETTING_TRAKT_REFRESH_TOKEN, token["refresh_token"])
        return True
    return False
Exemple #20
0
def trakt_authenticate():
    code = trakt_get_device_code()
    token = trakt_get_device_token(code)
    if token:
        expires_at = time.time() + 60*60*24*30#*3
        plugin.set_setting(SETTING_TRAKT_EXPIRES_AT, str(expires_at))
        plugin.set_setting(SETTING_TRAKT_ACCESS_TOKEN, token["access_token"])
        plugin.set_setting(SETTING_TRAKT_REFRESH_TOKEN, token["refresh_token"])
        return True
    return False
Exemple #21
0
def settings_set_channelers():
    medias = ["movies", "tvshows", "live"]
    for media in medias:
        channelers = get_channelers(media)
        selected = [p.id for p in channelers]
        if selected is not None:
            if media == "movies":
                plugin.set_setting(SETTING_MOVIES_ENABLED_CHANNELERS, selected)
            elif media == "tvshows":
                plugin.set_setting(SETTING_TV_ENABLED_CHANNELERS, selected)
            elif media == "live":
                plugin.set_setting(SETTING_LIVE_ENABLED_CHANNELERS, selected)
            else:
                raise Exception("invalid parameter %s" % media)
    print "MetalliQ Guidance: Movie, TV and Live players enabled"
    return True
Exemple #22
0
def settings_set_channelers():
    medias = ["movies","tvshows","live"]
    for media in medias:
        channelers = get_channelers(media)
        selected = [p.id for p in channelers]
        if selected is not None:
            if media == "movies":
                plugin.set_setting(SETTING_MOVIES_ENABLED_CHANNELERS, selected)
            elif media == "tvshows":
                plugin.set_setting(SETTING_TV_ENABLED_CHANNELERS, selected)
            elif media == "live":
                plugin.set_setting(SETTING_LIVE_ENABLED_CHANNELERS, selected)
            else:
                raise Exception("invalid parameter %s" % media)
    print "MetalliQ Guidance: Movie, TV and Live players enabled"
    return True
Exemple #23
0
def settings_set_players(media):
    players = get_players(media)
    players = sorted(players,key=lambda player: player.clean_title.lower())

    # Get selection by user
    selected = None
    mediatype = media.replace('es','e').replace('ws','w')
    try:
        msg = "Do you want to enable all "+mediatype+" players?"
        if dialogs.yesno(_("Enable all "+mediatype+" players"), _(msg)):
            enableall = True
            selected = [p.id for p in players]
        else:
            enableall = False
            result = dialogs.multiselect(_("Select "+mediatype+" players to enable"), [p.clean_title for p in players])
            if result is not None:
                selected = [players[i].id for i in result]
    except:
        if enableall == False:
            msg = "Kodi 16 required for manual multi-selection. Do you want to enable all "+mediatype+" players instead?"
            if dialogs.yesno(_("Warning"), _(msg)):
                selected = [p.id for p in players]
            else:
                return
        elif enableall == True:
            selected = [p.id for p in players]
        else:
            pass
    
    if selected is not None:
        if media == "movies":
            plugin.set_setting(SETTING_MOVIES_ENABLED_PLAYERS, selected)
        elif media == "tvshows":
            plugin.set_setting(SETTING_TV_ENABLED_PLAYERS, selected)
        elif media == "live":
            plugin.set_setting(SETTING_LIVE_ENABLED_PLAYERS, selected)
        else:
            raise Exception("invalid parameter %s" % media)
    
    plugin.open_settings()
Exemple #24
0
def clear_trakt():
    msg = "{0} {1} {2}?".format(_("Remove"), "Trakt", _("Settings").lower())
    if dialogs.yesno("{0} {1}".format(_("Unlock"), "Trakt"), msg):
        plugin.set_setting(SETTING_TRAKT_ACCESS_TOKEN, "")
        plugin.set_setting(SETTING_TRAKT_REFRESH_TOKEN, "")
        plugin.set_setting(SETTING_TRAKT_EXPIRES_AT, "")
Exemple #25
0
def settings_set_players(media):
    playericon = get_icon_path("player")
    if media == "all":
        medias = ["live"]
        for media in medias:
            mediatype = media.replace('es', 'e').replace('ws', 'w').replace(
                '_', '').replace('all', '').replace('ve', 've')
            players = get_players(media)
            selected = [p.id for p in players]
            if selected is not None:
                if media == "live":
                    plugin.set_setting(SETTING_LIVE_ENABLED_PLAYERS, selected)
                else:
                    raise Exception("invalid parameter %s" % media)
            plugin.notify(msg=_('cCloudMeta Enabled'),
                          title=_('Enabled'),
                          delay=1000,
                          image=get_icon_path("icon"))
        plugin.notify(msg=_('cCloudMeta'),
                      title=_('Enabled'),
                      delay=1000,
                      image=get_icon_path("icon"))
        return
    else:
        mediatype = media.replace('es', 'e ').replace('ws', 'w ').replace(
            'all', '').replace('ve', 've ').replace('_', '')
        players = get_players(media)
        players = sorted(players,
                         key=lambda player: player.clean_title.lower())
        version = xbmc.getInfoLabel('System.BuildVersion')
        selected = None
        if version.startswith('16') or version.startswith('17'):
            msg = "Do you want to enable all " + mediatype + "players?"
            if dialogs.yesno(_("Enable all " + mediatype + "players"), _(msg)):
                selected = [p.id for p in players]
            else:
                result = dialogs.multiselect(
                    _("Select " + mediatype + "players to enable"),
                    [p.clean_title for p in players])
                if result is not None:
                    selected = [players[i].id for i in result]
        else:
            selected = None
            msg = "Kodi 16 is required for multi-selection. Do you want to enable all " + mediatype + "players instead?"
            if dialogs.yesno(_("Enable all " + mediatype + "players"), _(msg)):
                selected = [p.id for p in players]
            else:
                result = dialogs.multichoice(
                    _("Select " + mediatype + "players to enable"),
                    [p.clean_title for p in players])
                if result is not None:
                    selected = [players[i].id for i in result]
        if selected is not None:
            if media == "live":
                plugin.set_setting(SETTING_LIVE_ENABLED_PLAYERS, selected)
            else:
                raise Exception("invalid parameter %s" % media)
        plugin.notify(msg=_('All ' + mediatype + 'players'),
                      title=_('Updated'),
                      delay=1000,
                      image=get_icon_path("player"))
Exemple #26
0
def settings_set_players(media):
    playericon = get_icon_path("player")
    medias = ["movies", "tvshows", "musicvideos", "music", "live"]
    if media == "all":
        for media in medias:
            mediatype = (
                media.replace("es", "e").replace("ws", "w").replace("all", "").replace("os", "o").replace("vs", "v s")
            )
            players = get_players(media)
            selected = [p.id for p in players]
            if selected is not None:
                if media == "movies":
                    plugin.set_setting(SETTING_MOVIES_ENABLED_PLAYERS, selected)
                elif media == "tvshows":
                    plugin.set_setting(SETTING_TV_ENABLED_PLAYERS, selected)
                elif media == "musicvideos":
                    plugin.set_setting(SETTING_MUSICVIDEOS_ENABLED_PLAYERS, selected)
                elif media == "music":
                    plugin.set_setting(SETTING_MUSIC_ENABLED_PLAYERS, selected)
                elif media == "live":
                    plugin.set_setting(SETTING_LIVE_ENABLED_PLAYERS, selected)
                else:
                    raise Exception("invalid parameter %s" % media)
            plugin.notify(
                msg=_("All " + mediatype + " players"), title=_("Enabled"), delay=1000, image=get_icon_path("player")
            )
        plugin.notify(msg=_("All players"), title=_("Enabled"), delay=1000, image=get_icon_path("player"))
        return True
    elif media == "tvportal":
        players = get_players("live")
        selected = [p.id for p in players]
        plugin.set_setting(SETTING_LIVE_ENABLED_PLAYERS, selected)
        return
    else:
        mediatype = (
            media.replace("es", "e ").replace("ws", "w ").replace("all", "").replace("ve", "ve ").replace("_", "")
        )
        players = get_players(media)
        players = sorted(players, key=lambda player: player.clean_title.lower())
        version = xbmc.getInfoLabel("System.BuildVersion")
        selected = None
        if version.startswith("16") or version.startswith("17"):
            msg = "Do you want to enable all " + mediatype + "players?"
            if dialogs.yesno(_("Enable all " + mediatype + "players"), _(msg)):
                selected = [p.id for p in players]
            else:
                result = dialogs.multiselect(
                    _("Select " + mediatype + "players to enable"), [p.clean_title for p in players]
                )
                if result is not None:
                    selected = [players[i].id for i in result]
        else:
            selected = None
            msg = "Kodi 16 is required for multi-selection. Do you want to enable all " + mediatype + "players instead?"
            if dialogs.yesno(_("Enable all " + mediatype + "players"), _(msg)):
                selected = [p.id for p in players]
            else:
                result = dialogs.multichoice(
                    _("Select " + mediatype + "players to enable"), [p.clean_title for p in players]
                )
                if result is not None:
                    selected = [players[i].id for i in result]
        if selected is not None:
            if media == "movies":
                plugin.set_setting(SETTING_MOVIES_ENABLED_PLAYERS, selected)
            elif media == "tvshows":
                plugin.set_setting(SETTING_TV_ENABLED_PLAYERS, selected)
            elif media == "musicvideos":
                plugin.set_setting(SETTING_MUSICVIDEOS_ENABLED_PLAYERS, selected)
            elif media == "music":
                plugin.set_setting(SETTING_MUSIC_ENABLED_PLAYERS, selected)
            elif media == "live":
                plugin.set_setting(SETTING_LIVE_ENABLED_PLAYERS, selected)
            else:
                raise Exception("invalid parameter %s" % media)
        plugin.notify(
            msg=_("All " + mediatype + "players"), title=_("Updated"), delay=1000, image=get_icon_path("player")
        )
    plugin.open_settings()
Exemple #27
0
def settings_set_players(media):
    playericon = get_icon_path("player")
    medias = ["movies", "tvshows", "musicvideos", "music", "live"]
    if media == "all":
        for med in medias:
            mediatype = med.replace('es', 'e').replace('ws', 'w').replace(
                'all', '').replace('os', 'o').replace('vs', 'v s').replace(
                    'tv', 'TV').replace('musicvideo',
                                        'Music video').replace('live', 'TV')
            players = get_players(med)
            selected = [p.id for p in players]
            if selected is not None:
                if med == "movies":
                    plugin.set_setting(SETTING_MOVIES_ENABLED_PLAYERS,
                                       selected)
                elif med == "tvshows":
                    plugin.set_setting(SETTING_TV_ENABLED_PLAYERS, selected)
                elif med == "musicvideos":
                    plugin.set_setting(SETTING_MUSICVIDEOS_ENABLED_PLAYERS,
                                       selected)
                elif med == "music":
                    plugin.set_setting(SETTING_MUSIC_ENABLED_PLAYERS, selected)
                elif med == "live":
                    plugin.set_setting(SETTING_LIVE_ENABLED_PLAYERS, selected)
                else:
                    raise Exception("invalid parameter %s" % media)
            dialogs.notify(msg="{0} {1}".format(
                _(mediatype).capitalize(),
                _("Player").lower()),
                           title=_('Enabled'),
                           delay=1000,
                           image=get_icon_path("player"))
        dialogs.notify(msg="{0}".format(_("Player")),
                       title="{0} {1}".format(_("All"),
                                              _('Enabled').lower()),
                       delay=1000,
                       image=get_icon_path("player"))
        return True
    elif media == "tvportal":
        players = get_players("live")
        selected = [p.id for p in players]
        plugin.set_setting(SETTING_LIVE_ENABLED_PLAYERS, selected)
        return
    else:
        mediatype = media.replace('es', 'e').replace('ws', 'w').replace(
            'all', '').replace('os', 'o').replace('vs', 'v s').replace(
                'tv', 'TV').replace('musicvideo',
                                    'Music video').replace('live', 'TV')
        players = get_players(media)
        players = sorted(players,
                         key=lambda player: player.clean_title.lower())
        version = xbmc.getInfoLabel('System.BuildVersion')
        selected = None
        if version.startswith('16') or version.startswith('17'):
            msg = "Do you want to enable all " + mediatype + "players?"
            if dialogs.yesno(_("Enable all " + mediatype + "players"), _(msg)):
                selected = [p.id for p in players]
            else:
                result = dialogs.multiselect(
                    _("Select " + mediatype + "players to enable"),
                    [p.clean_title for p in players])
                if result is not None:
                    selected = [players[i].id for i in result]
        else:
            selected = None
            msg = "Kodi 16 is required for multi-selection. Do you want to enable all " + mediatype + "players instead?"
            if dialogs.yesno(
                    "{0} {1} {2} {3}s".format(_("Enable"),
                                              _("All").lower(), mediatype,
                                              _("Player").lower()), _(msg)):
                selected = [p.id for p in players]
            else:
                result = dialogs.multichoice(
                    "{0}: {1} {2} {3}".format(_("Enable"), _("Select"),
                                              _("Player").lower()),
                    [p.clean_title for p in players])
                if result is not None:
                    selected = [players[i].id for i in result]
        if selected is not None:
            if media == "movies":
                plugin.set_setting(SETTING_MOVIES_ENABLED_PLAYERS, selected)
            elif media == "tvshows":
                plugin.set_setting(SETTING_TV_ENABLED_PLAYERS, selected)
            elif media == "musicvideos":
                plugin.set_setting(SETTING_MUSICVIDEOS_ENABLED_PLAYERS,
                                   selected)
            elif media == "music":
                plugin.set_setting(SETTING_MUSIC_ENABLED_PLAYERS, selected)
            elif media == "live":
                plugin.set_setting(SETTING_LIVE_ENABLED_PLAYERS, selected)
            else:
                raise Exception("invalid parameter %s" % media)
        dialogs.notify(msg="{0} {1} {2}".format(_("Enable"),
                                                _(mediatype).lower(),
                                                _("Player").lower()),
                       title=_('Done'),
                       delay=1000,
                       image=get_icon_path("player"))
    plugin.open_settings()
Exemple #28
0
def settings_set_players(media):
    playericon = get_icon_path("player")
    medias = ["movies","tvshows","musicvideos","music","live"]
    if media == "all":
        for med in medias:
            mediatype = med.replace('es','e').replace('ws','w').replace('all','').replace('os','o').replace('vs','v s').replace('tv','TV').replace('musicvideo','Music video').replace('live','TV')
            players = get_players(med)
            selected = [p.id for p in players]
            if selected is not None:
                if med == "movies":
                    plugin.set_setting(SETTING_MOVIES_ENABLED_PLAYERS, selected)
                elif med == "tvshows":
                    plugin.set_setting(SETTING_TV_ENABLED_PLAYERS, selected)
                elif med == "musicvideos":
                    plugin.set_setting(SETTING_MUSICVIDEOS_ENABLED_PLAYERS, selected)
                elif med == "music":
                    plugin.set_setting(SETTING_MUSIC_ENABLED_PLAYERS, selected)
                elif med == "live":
                    plugin.set_setting(SETTING_LIVE_ENABLED_PLAYERS, selected)
                else:
                    raise Exception("invalid parameter %s" % media)
            dialogs.notify(msg="{0} {1}".format(_(mediatype).capitalize(), _("Player").lower()), title=_('Enabled'), delay=1000, image=get_icon_path("player"))
        dialogs.notify(msg="{0}".format(_("Player")), title="{0} {1}".format(_("All"), _('Enabled').lower()), delay=1000, image=get_icon_path("player"))
        return True
    elif media == "tvportal":
        players = get_players("live")
        selected = [p.id for p in players]
        plugin.set_setting(SETTING_LIVE_ENABLED_PLAYERS, selected)
        return
    else:
        mediatype = media.replace('es','e').replace('ws','w').replace('all','').replace('os','o').replace('vs','v s').replace('tv','TV').replace('musicvideo','Music video').replace('live','TV')
        players = get_players(media)
        players = sorted(players,key=lambda player: player.clean_title.lower())
        version = xbmc.getInfoLabel('System.BuildVersion')
        selected = None
        if version.startswith('16') or version.startswith('17'):
            msg = "Do you want to enable all "+mediatype+"players?"
            if dialogs.yesno(_("Enable all "+mediatype+"players"), _(msg)):
                selected = [p.id for p in players]
            else:
                result = dialogs.multiselect(_("Select "+mediatype+"players to enable"), [p.clean_title for p in players])
                if result is not None:
                    selected = [players[i].id for i in result]
        else:
            selected = None
            msg = "Kodi 16 is required for multi-selection. Do you want to enable all "+mediatype+"players instead?"
            if dialogs.yesno("{0} {1} {2} {3}s".format(_("Enable"), _("All").lower(), mediatype, _("Player").lower()), _(msg)):
                selected = [p.id for p in players]
            else:
                result = dialogs.multichoice("{0}: {1} {2} {3}".format(_("Enable"), _("Select"), _("Player").lower()), [p.clean_title for p in players])
                if result is not None:
                    selected = [players[i].id for i in result]
        if selected is not None:
            if media == "movies":
                plugin.set_setting(SETTING_MOVIES_ENABLED_PLAYERS, selected)
            elif media == "tvshows":
                plugin.set_setting(SETTING_TV_ENABLED_PLAYERS, selected)
            elif media == "musicvideos":
                plugin.set_setting(SETTING_MUSICVIDEOS_ENABLED_PLAYERS, selected)
            elif media == "music":
                plugin.set_setting(SETTING_MUSIC_ENABLED_PLAYERS, selected)
            elif media == "live":
                plugin.set_setting(SETTING_LIVE_ENABLED_PLAYERS, selected)
            else:
                raise Exception("invalid parameter %s" % media)
        dialogs.notify(msg="{0} {1} {2}".format(_("Enable"), _(mediatype).lower(), _("Player").lower()), title=_('Done'), delay=1000, image=get_icon_path("player"))
    plugin.open_settings()
Exemple #29
0
def patch(mode):
    import xbmcaddon
    adir = "special://home/addons/"
    AUTOS = eval(plugin.get_setting(SETTING_AUTOPATCHES, unicode))
    #    try: AUTOS = plugin.get_setting(SETTING_AUTOPATCHES, unicode)
    #    except: AUTOS = [[], [], [], []]
    #    return [p for p in get_players() if p.id in AUTOS]
    #    xbmc.log("QQQQQ AUTOS = {0}".format(str(AUTOS)), xbmc.LOGNOTICE)
    INSTALLED = [i for i in xbmcvfs.listdir(adir)[0]]
    PATCHES = [
        [], ["resources/lib/modules/control.py", "pass", "sys.exit()"],
        [
            "default.py", "",
            "\n    cool_down_active = kodi.get_setting('cool_down') == 'true'\n    if not salts_utils.is_salts() or cool_down_active:\n        kodi.notify(msg=i18n('playback_limited'))\n        return False"
        ],
        [
            "lib/dudehere/routines/scrapers/__init__.py", "",
            "\n\t\tif self._caller not in ALLOWED_CALLERS and self._caller: \n\t\t\tplugin.log('Caller not allowed')\n\t\t\tplugin.raise_error('Violation', 'This addon is not allowed.', 'Please do not use %s with %s' % (self._caller, ADDON_NAME))\n\t\t\tif return_sources:\n\t\t\t\treturn [], [], []\n\t\t\telse:\n\t\t\t\treturn []"
        ]
    ]
    if mode == "auto":
        if AUTOS != [[], [], [], []]:
            ADDONS = AUTOS
        else:
            if dialogs.yesno(
                    '{0}: Patch'.format(plugin.name),
                    '{0}.[CR]{1} & {2}'.format(
                        _("%s not found") % 'Auto-patches', _("Enable"),
                        _("Continue?"))):
                return patch("all")
            else:
                plugin.set_setting(SETTING_AUTOPATCH, "false")
                return
    else:
        ADDONS = [
            [],
            [
                i for i in INSTALLED if i.startswith("plugin.video.")
                and xbmcvfs.exists("{0}{1}/{2}".format(adir, i, PATCHES[1][0]))
            ],
            [
                i for i in INSTALLED if i.startswith("plugin.video.")
                and xbmcvfs.exists("{0}{1}/{2}".format(adir, i, PATCHES[2][0]))
            ],
            [
                i for i in INSTALLED if i.startswith("script.module.")
                and xbmcvfs.exists("{0}{1}/{2}".format(adir, i, PATCHES[3][0]))
            ]
        ]
    count = 0
    for i in range(1, len(ADDONS)):
        for a in ADDONS[i]:
            count = count + 1
            b = "{0}{1}/{2}".format(adir, a, PATCHES[i][0])
            c = xbmcvfs.File(b)
            d = c.read()
            c.close()
            if PATCHES[i][2] in d:
                ADDON = xbmcaddon.Addon(a)
                if mode == "auto" or dialogs.yesno(
                        '{0}: Patch "{1}"?'.format(plugin.name,
                                                   ADDON.getAddonInfo("name")),
                        '"{0}" {1} block-code.[CR]{2}'.format(
                            ADDON.getAddonInfo("name"), _("contains"),
                            _("Would you like to remove it from the library?").
                            replace(_("Library").lower(),
                                    _("Add-on").lower()))):
                    h = xbmcvfs.File(b, 'w')
                    d = d.replace(PATCHES[i][2], PATCHES[i][1])
                    result = h.write(d)
                    h.close()
                    if mode != "auto" and dialogs.yesno(
                            "{0}: {1} Patch?".format(plugin.name, _("Auto")),
                            '"{0}"[CR]{1} {2} re-patching?'.format(
                                ADDON.getAddonInfo("name"), _("Enable"),
                                _("Auto").lower())):
                        if ADDON.getAddonInfo("id") not in AUTOS[i]:
                            AUTOS[i].append(ADDON.getAddonInfo("id"))
    if AUTOS != [[], [], [], []] and AUTOS != ADDONS:
        plugin.set_setting(SETTING_AUTOPATCHES, AUTOS)
Exemple #30
0
def clear_trakt():
    msg = "{0} {1} {2}?".format(_("Remove"), "Trakt", _("Settings").lower())
    if dialogs.yesno("{0} {1}".format(_("Unlock"), "Trakt"), msg):
        plugin.set_setting(SETTING_TRAKT_ACCESS_TOKEN, "")
        plugin.set_setting(SETTING_TRAKT_REFRESH_TOKEN, "")
        plugin.set_setting(SETTING_TRAKT_EXPIRES_AT, "")
Exemple #31
0
def settings_set_players(media):
    playericon = get_icon_path("player")
    if media == "all":
        medias = ["movies","tvshows","live"]
        for media in medias:
            mediatype = media.replace('es','e ').replace('ws','w ').replace('all','').replace('ve','ve ')
            players = get_players(media)
            selected = [p.id for p in players]
            if selected is not None:
                if media == "movies":
                    plugin.set_setting(SETTING_MOVIES_ENABLED_PLAYERS, selected)
                elif media == "tvshows":
                    plugin.set_setting(SETTING_TV_ENABLED_PLAYERS, selected)
                elif media == "live":
                    plugin.set_setting(SETTING_LIVE_ENABLED_PLAYERS, selected)
                else:
                    raise Exception("invalid parameter %s" % media)
            plugin.notify(msg=_('All '+mediatype+'players'), title=_('Enabled'), delay=1000, image=get_icon_path("player"))
        plugin.notify(msg=_('All players'), title=_('Enabled'), delay=1000, image=get_icon_path("player"))
        return
    else:
        mediatype = media.replace('es','e ').replace('ws','w ').replace('all','').replace('ve','ve ')
        players = get_players(media)
        players = sorted(players,key=lambda player: player.clean_title.lower())
        version = xbmc.getInfoLabel('System.BuildVersion')
        if version.startswith('16') or version.startswith('17'):
            msg = "Do you want to enable all "+mediatype+"players?"
            if dialogs.yesno(_("Enable all "+mediatype+"players"), _(msg)):
                selected = [p.id for p in players]
            else:
                result = dialogs.multiselect(_("Select "+mediatype+"players to enable"), [p.clean_title for p in players])
                if result is not None:
                    selected = [players[i].id for i in result]
        else:
            selected = None
            msg = "Kodi 16 is required for multi-selection. Do you want to enable all "+mediatype+"players instead?"
            if dialogs.yesno(_("Enable all "+mediatype+"players"), _(msg)):
                selected = [p.id for p in players]
            else:
                result = dialogs.multichoice(_("Select "+mediatype+"players to enable"), [p.clean_title for p in players])
                if result is not None:
                    selected = [players[i].id for i in result]
        if selected is not None:
            if media == "movies":
                plugin.set_setting(SETTING_MOVIES_ENABLED_PLAYERS, selected)
            elif media == "tvshows":
                plugin.set_setting(SETTING_TV_ENABLED_PLAYERS, selected)
            elif media == "live":
                plugin.set_setting(SETTING_LIVE_ENABLED_PLAYERS, selected)
            else:
                raise Exception("invalid parameter %s" % media)
        plugin.notify(msg=_('All '+mediatype+'players'), title=_('Updated'), delay=1000, image=get_icon_path("player"))