Пример #1
0
def resolve(url):
    actions = [
        ("plugin://plugin.video.yatp/?action=play&torrent=%s", "plugin.video.yatp", "YATP-Yet Another Torrent Player"),
        ("plugin://plugin.video.quasar/play?uri=%s", "plugin.video.quasar", "Quasar"),
    ]
    if not xbmcvfs.exists(os.path.dirname(torrent_path)):
        try:
            xbmcvfs.mkdirs(os.path.dirname(torrent_path))
        except:
            os.mkdir(os.path.dirname(torrent_path))

    file = urllib2.urlopen(url)
    output = open(torrent_path, "wb")
    output.write(file.read())
    output.close()

    choice = int(control.setting("torrentPlayer"))
    action = actions[choice]
    if choice == 0:
        url = torrent_path

    if addonInstaller.isInstalled(action[1]):
        return action[0] % url
    else:
        control.infoDialog(
            "Torrent player not installed. Install it or select a different torrent player.",
            heading=action[2],
            time=6000,
        )
    return ""
Пример #2
0
def resolve(url):
    actions = [("plugin://plugin.video.yatp/?action=play&torrent=%s",
                "plugin.video.yatp", "YATP-Yet Another Torrent Player"),
               ("plugin://plugin.video.quasar/play?uri=%s",
                "plugin.video.quasar", "Quasar")]
    if not xbmcvfs.exists(os.path.dirname(torrent_path)):
        try:
            xbmcvfs.mkdirs(os.path.dirname(torrent_path))
        except:
            os.mkdir(os.path.dirname(torrent_path))

    file = urllib2.urlopen(url)
    output = open(torrent_path, 'wb')
    output.write(file.read())
    output.close()

    choice = int(control.setting('torrentPlayer'))
    action = actions[choice]
    if choice == 0:
        url = torrent_path

    if addonInstaller.isInstalled(action[1]):
        return action[0] % url
    else:
        control.infoDialog(
            'Torrent player not installed. Install it or select a different torrent player.',
            heading=action[2],
            time=6000)
    return ''
Пример #3
0
                'title': a[0],
                'plot': 'Install addon'
            },
            img=a[3],
            fanart=fanart,
            is_folder=True)

    addon.end_of_directory()

elif mode[0] == 'install':
    id = args['id'][0]
    key = args['key'][0]
    name = args['name'][0]

    from resources.lib.modules import addonInstaller
    if not addonInstaller.isInstalled(id):
        addonInstaller.install(key)
    else:
        from resources.lib.modules import control
        control.infoDialog('%s already installed' % name)

elif mode[0] == 'blogs':
    sources = os.listdir(AddonPath + '/resources/lib/sources/blogs')
    sources.remove('__init__.py')
    for source in sources:
        if '.pyo' not in source and '__init__' not in source:
            #try:
            source = source.replace('.py', '')
            exec "from resources.lib.sources.blogs import %s" % source
            info = eval(source + ".info()")
            addon.add_item({
Пример #4
0
elif mode[0]=='addon_installer':
    from resources.lib.modules import addonInstaller
    addons = addonInstaller.get_addons()
    for a in addons:
        addon.add_item({'mode': 'install', 'id':a[2], 'key':a[1], 'name':a[0]}, {'title': a[0], 'plot': 'Install addon'}, img=a[3], fanart=fanart, is_folder=True)

    addon.end_of_directory()

elif mode[0]=='install':
    id = args['id'][0]
    key = args['key'][0]
    name = args['name'][0]

    from resources.lib.modules import addonInstaller
    if not addonInstaller.isInstalled(id):
        addonInstaller.install(key)
    else:
        from resources.lib.modules import control
        control.infoDialog('%s already installed'%name)

elif mode[0]=='blogs':
    sources = os.listdir(AddonPath + '/resources/lib/sources/blogs')
    sources.remove('__init__.py')
    for source in sources:
        if '.pyo' not in source and '__init__' not in source:
            #try:
                source = source.replace('.py','')
                exec "from resources.lib.sources.blogs import %s"%source
                info = eval(source+".info()")
                addon.add_item({'mode': 'open_blog', 'site': info.mode}, {'title': info.name}, img=icon_path(info.icon), fanart=fanart,is_folder=True)