示例#1
0
def PLAY_URL(name,url,iconimage):

	name,url = url.split('|SPLIT|')

	dp = common.GET_LUCKY()
	ref_url = url
	result = common.open_url(url)
	url = re.compile("video_url:.+?'(.+?)',",re.DOTALL).findall(result)[0]
	choice = dialog.select("[COLOR red]Please select an option[/COLOR]", ['[COLOR pink]Watch Video[/COLOR]','[COLOR pink]Add to Favourites[/COLOR]','[COLOR pink]Download Video[/COLOR]'])

	if choice == 1:
		a=open(FAVOURITES_FILE).read()
		b=a.replace('#START OF FILE#', '#START OF FILE#\n<item>\n<name>'+str(name)+'</name>\n<link>'+str(url)+'</link>\n<site>PornFun</site>\n<icon>'+str(iconimage)+'</icon>\n</item>\n')
		f= open(FAVOURITES_FILE, mode='w')
		f.write(str(b))
		f.close()
		dp.close()
		dialog.ok(AddonTitle, "[COLOR pink]" + name + " has been added to your favourites. You can access your favourites on the main menu.[/COLOR]")
		quit()
	
	elif choice == 2:
		try:
			download_location   = plugintools.get_setting("download_location")
			download_folder = xbmc.translatePath(download_location)
			_in = url
			name = name.replace(' ','_').replace('[COLOR','').replace('[/COLOR','').replace('[I]','').replace(']','').replace('|','').replace('%','').replace('-','').replace('[/I','').replace('[/B','').replace('[','').replace('/','').replace(':','')
			_out = download_folder + name + '.mp4'
			dp.close()
			a=open(DOWNLOADS_FILE).read()
			b=a.replace('#START OF FILE#', '#START OF FILE#\n<item>\n<name>'+str(_out)+'</name>\n<icon>'+str(iconimage)+'</icon>\n</item>\n')
			f= open(DOWNLOADS_FILE, mode='w')
			f.write(str(b))
			f.close()
			downloader.download(_in,_out,dp=None)
			dialog.ok(AddonTitle, "[COLOR pink]Your video has been successfully downloaded and can be viewed from the Your Downloads section on the main menu.[/COLOR]") 
		except: 
			try:
				os.remove(_out)
			except: pass
			dp.close()
			dialog.ok(AddonTitle, "[COLOR pink]Sorry, there was an error trying to download the video.[/COLOR]")
			quit()
	
	elif choice == 0:
		history_on_off  = plugintools.get_setting("history_setting")
		if history_on_off == "true":	
			date_now = datetime.datetime.now().strftime("%d-%m-%Y")
			time_now = datetime.datetime.now().strftime("%H:%M")
			a=open(HISTORY_FILE).read()
			b=a.replace('#START OF FILE#', '#START OF FILE#\n<item>\n<date>'+str(date_now)+'</date>\n<time>'+str(time_now)+'</time>\n<name>'+str(name)+'</name>\n<link>'+str(url)+'</link>\n<site>PornFun</site>\n<icon>'+str(iconimage)+'</icon>\n</item>\n')
			f= open(HISTORY_FILE, mode='w')
			f.write(str(b))
			f.close()

		liz = xbmcgui.ListItem(name, iconImage=iconimage, thumbnailImage=iconimage)
		dp.close()
		xbmc.Player ().play(url, liz, False)
	else:
		dp.close()
		quit()
示例#2
0
def PLAYERCORE_WINDOWS():

    pass_me = 0
    if os.path.isfile(PLAYER_CORE):
        pass_me = 1
        try:
            os.remove(PLAYER_CORE)
        except:
            pass

    if pass_me == 0:
        name = "[COLOR white][B]playercorefactory.xml[/B][/COLOR]"
        url = BASEURL + base64.b64decode(
            b'a29kaS9wbGF5ZXJjb3JlZmFjdG9yeS93aW5kb3dzLnppcA==')
        description = "NULL"
        #Check is the packages folder exists, if not create it.
        path = xbmc.translatePath(
            os.path.join('special://home/addons', 'packages'))
        if not os.path.exists(path):
            os.makedirs(path)
        buildname = name
        dp = xbmcgui.DialogProgress()
        dp.create(AddonTitle,
                  "Downaloading the playercorefactory.xml file for",
                  "the Windows OS. Please Wait......")
        buildname = "build"
        lib = os.path.join(path, buildname + '.zip')

        try:
            os.remove(lib)
        except:
            pass

        dialog = xbmcgui.Dialog()
        downloader.download(url, lib, dp)
        addonfolder = xbmc.translatePath(
            os.path.join('special://home', 'userdata'))
        time.sleep(2)
        dp.update(0, "", "Extracting Zip Please Wait", "")
        installer.unzip(lib, addonfolder, dp)
        time.sleep(1)
        try:
            os.remove(lib)
        except:
            pass

        dialog.ok(AddonTitle,
                  "[COLOR white]playercorefactory.xml installed![/COLOR]", '',
                  "[COLOR white]Thank you for using ECHO Wizard![/COLOR]")

    xbmc.executebuiltin("Container.Refresh")
示例#3
0
def INSTALL_KEYMAP(name, url, description):

    name, url = url.split("|SPLIT|")

    KEYBOARD_FILE = xbmc.translatePath(
        os.path.join('special://home/userdata/keymaps/', 'keyboard.xml'))
    if os.path.isfile(KEYBOARD_FILE):
        try:
            os.remove(KEYBOARD_FILE)
        except:
            pass
    #Check is the packages folder exists, if not create it.
    path = xbmc.translatePath(os.path.join('special://home/addons',
                                           'packages'))
    if not os.path.exists(path):
        os.makedirs(path)
    path_key = xbmc.translatePath(
        os.path.join('special://home/userdata', 'keymaps'))
    if not os.path.exists(path_key):
        os.makedirs(path_key)
    buildname = name
    dp = xbmcgui.DialogProgress()
    dp.create(AddonTitle, "", "", "[B]Build: [/B]" + buildname)
    buildname = "build"
    lib = os.path.join(path, buildname + '.zip')

    try:
        os.remove(lib)
    except:
        pass

    dialog = xbmcgui.Dialog()
    downloader.download(url, lib, dp)
    addonfolder = xbmc.translatePath(os.path.join('special://', 'home'))
    time.sleep(2)
    dp.update(0, "Extracting Zip Please Wait", "", " ")
    unzip(lib, addonfolder, dp)
    time.sleep(1)
    send_to_count = name + "|SPLIT|Keymaps"
    add_download = Common.add_one(send_to_count)
    try:
        os.remove(lib)
    except:
        pass

    xbmc.executebuiltin("Container.Refresh")
    dialog.ok(AddonTitle,
              "[COLOR white]Custom Keymap settings installed![/COLOR]",
              "[COLOR white]Thank you for using ECHO Wizard![/COLOR]")
示例#4
0
def INSTALLAPK_INSTALLER(name, url, description):
    dialog = xbmcgui.Dialog()
    name, url = url.split('#!')
    dialog.ok(AddonTitle, str(name))

    #add_download = Common.add_one_addons_week(name)

    path = xbmc.translatePath(os.path.join('/storage/emulated/0/Download', ''))
    dp = xbmcgui.DialogProgress()
    dp.create(AddonTitle, "", "", 'APK: ' + name)
    new_name = name.replace(' ', '')
    lib = os.path.join(path, name + '.apk')
    downloader.download(url, lib, dp)
    dialog = xbmcgui.Dialog()

    dialog.ok(AddonTitle, "Launching the APK to be installed",
              "Follow the install process to complete.")
    xbmc.executebuiltin(
        'StartAndroidActivity("","android.intent.action.VIEW","application/vnd.android.package-archive","file:'
        + lib + '")')
示例#5
0
def INSTALLAPK(name, url, description):
    if "NULL" in url:
        dialog = xbmcgui.Dialog()
        dialog.ok(
            ADDONTITLE,
            "[B][COLOR smokewhite]Not a valid selection, please try again.[/COLOR][/B]",
            '[COLOR smokewhite]Thank you for using Pickle Tools[/COLOR]')
        sys.exit(1)

    path = xbmc.translatePath(os.path.join('/storage/emulated/0/Download', ''))
    dp = xbmcgui.DialogProgress()
    dp.create(ADDONTITLE, "", "", 'APK: ' + name)
    lib = os.path.join(path, name + '.apk')
    downloader.download(url, lib, dp)
    dialog = xbmcgui.Dialog()
    dialog.ok(ADDONTITLE, "Launching the APK to be installed",
              "Follow the install process to complete.")
    xbmc.executebuiltin(
        'StartAndroidActivity("","android.intent.action.VIEW","application/vnd.android.package-archive","file:'
        + lib + '")')
示例#6
0
def INSTALL_FANRIFFIC(name, url, description):

    buildname, url = url.split("|SPLIT|")

    choice = xbmcgui.Dialog().yesno(
        AddonTitle,
        '[COLOR white]Do you wish to download the ' + buildname +
        ' theme?[/COLOR]',
        '',
        yeslabel='[B][COLOR yellowgreen]YES[/COLOR][/B]',
        nolabel='[B][COLOR lightskyblue]NO[/COLOR][/B]')
    if choice == 0:
        sys.exit(1)

    path = xbmc.translatePath(os.path.join('special://home/addons',
                                           'packages'))
    if not os.path.exists(path):
        os.makedirs(path)
    dp = xbmcgui.DialogProgress()
    dp.create(AddonTitle, "Please wait while we get everything ready to",
              "download the " + buildname + " build.",
              "[B]Build: [/B]" + buildname)
    lib = os.path.join(path, 'theme.zip')

    try:
        os.remove(lib)
    except:
        pass

    downloader.download(url, lib, dp)
    addonfolder = xbmc.translatePath(os.path.join('special://', 'home'))
    dp.update(0, "Extracting Zip Please Wait", "", " ")
    unzip(lib, addonfolder, dp)
    send_to_count = buildname + "|SPLIT|Fanriffic"
    add_download = Common.add_one(send_to_count)
    dialog = xbmcgui.Dialog()
    dialog.ok(
        AddonTitle,
        "The theme has now been installed. To save the changes you must now force close Kodi."
    )
    Common.killxbmc()
示例#7
0
def INSTALLEXE(name, url, description):
    if "NULL" in url:
        dialog = xbmcgui.Dialog()
        dialog.ok(
            ADDONTITLE,
            "[B][COLOR smokewhite]Not a valid selection, please try again.[/COLOR][/B]",
            '[COLOR smokewhite]Thank you for using Pickle Tools[/COLOR]')
        sys.exit(1)

    path = xbmc.translatePath(os.path.join('special://home/', 'Downloads'))
    if not os.path.exists(path):
        os.makedirs(path)
    dp = xbmcgui.DialogProgress()
    dp.create(ADDONTITLE, "", "", 'File: ' + name)
    lib = os.path.join(path, name)
    downloader.download(url, lib, dp)
    dialog = xbmcgui.Dialog()
    dialog.ok(
        ADDONTITLE,
        "[COLOR smokewhite]Download complete, File Location: [/COLOR][COLOR white]"
        + lib + "[/COLOR]")
示例#8
0
def INSTALL_ADVANCED(name, url, description):

    name, url = url.split("|SPLIT|")

    #Check is the packages folder exists, if not create it.
    path = xbmc.translatePath(os.path.join('special://home/addons',
                                           'packages'))
    if not os.path.exists(path):
        os.makedirs(path)
    buildname = name
    dp = xbmcgui.DialogProgress()
    dp.create(AddonTitle, "", "", "[B]Build: [/B]" + buildname)
    buildname = "build"
    lib = os.path.join(path, buildname + '.zip')

    try:
        os.remove(lib)
    except:
        pass

    dialog = xbmcgui.Dialog()
    downloader.download(url, lib, dp)

    addonfolder = xbmc.translatePath(os.path.join('special://', 'home'))
    time.sleep(2)
    dp.update(0, "Extracting Zip Please Wait", "", " ")
    unzip(lib, addonfolder, dp)
    time.sleep(1)
    try:
        os.remove(lib)
    except:
        pass
    send_to_count = name + "|SPLIT|Advanced Settings"
    add_download = Common.add_one(send_to_count)
    xbmc.executebuiltin("Container.Refresh")

    dialog.ok(
        AddonTitle, "[COLOR white]Advanced Settings installed![/COLOR]",
        "[COLOR white]You should now see an imporvment in buffering[/COLOR]",
        "[COLOR white]Thank you for using ECHO Wizard![/COLOR]")
示例#9
0
def PLAY_URL(name, url, iconimage):

    name, url = url.split('|SPLIT|')
    dp = common.GET_LUCKY()

    choice = dialog.select(
        "[COLOR red]Please select an option[/COLOR]",
        ['[COLOR pink]Source 1[/COLOR]', '[COLOR pink]Source 2[/COLOR]'])
    if choice == 0: url = url
    elif choice == 1: url = url + '2/'
    else: quit()

    ref_url = url

    urlresolve = 0
    headers = {
        'User-Agent':
        'Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36'
    }
    holdingpage = net.http_GET(url, headers).content
    if "openload" in holdingpage:
        match = re.compile('src="https://openload.co/(.+?)"').findall(
            holdingpage)[0]
        url = "https://openload.co/" + match
        import urlresolver
        if urlresolver.HostedMediaFile(url).valid_url():
            urlresolve = 1
    else:
        net.save_cookies(TEMP_COOKIES)
        try:
            match = re.compile('src="http://www.porn00.org/king/(.+?)"'
                               ).findall(holdingpage)[0]
            id = 'king'
        except:
            try:
                match = re.compile('http://www.porn00.org/server/(.+?)"'
                                   ).findall(holdingpage)[0]
                id = 'server'
            except:
                try:
                    match = re.compile('http://www.porn00.org/play/(.+?)"'
                                       ).findall(holdingpage)[0]
                    id = 'play'
                except:
                    try:
                        match = re.compile(
                            'http://www.porn00.org/player/(.+?)"').findall(
                                holdingpage)[0]
                        id = 'player'
                    except:
                        try:
                            id, match = re.compile(
                                'http://www.porn00.org/(.+?)/(.+?)"').findall(
                                    holdingpage)[0]
                        except:
                            quit()

        url = 'http://www.porn00.org/' + id + '/' + match
        net.set_cookies(TEMP_COOKIES)
        linkpage = net.http_GET(url, headers).content
        links = re.compile('file\: "(.+?)",').findall(linkpage)

        try:
            url = links[-1]
        except:
            try:
                url = links[0]
            except:
                dialog.ok(
                    AddonTitle,
                    "There was an error playing this video. Please select another."
                )
                quit()

    choice = dialog.select("[COLOR red]Please select an option[/COLOR]", [
        '[COLOR pink]Watch Video[/COLOR]',
        '[COLOR pink]Add to Favourites[/COLOR]',
        '[COLOR pink]Download Video[/COLOR]'
    ])

    if choice == 1:
        a = open(FAVOURITES_FILE).read()
        b = a.replace(
            '#START OF FILE#',
            '#START OF FILE#\n<item>\n<name>' + str(name) + '</name>\n<link>' +
            str(url) + '</link>\n<site>Porn00</site>\n<icon>' +
            str(iconimage) + '</icon>\n</item>\n')
        f = open(FAVOURITES_FILE, mode='w')
        f.write(str(b))
        f.close()
        dp.close()
        dialog.ok(
            AddonTitle, "[COLOR pink]" + name +
            " has been added to your favourites. You can access your favourites on the main menu.[/COLOR]"
        )
        quit()

    elif choice == 2:
        try:
            download_location = plugintools.get_setting("download_location")
            download_folder = xbmc.translatePath(download_location)
            _in = url
            name = name.replace(' ', '_').replace('[COLOR', '').replace(
                '[/COLOR', '').replace('[I]', '').replace(']', '').replace(
                    '|', '').replace('%', '').replace('-', '').replace(
                        '[/I', '').replace('[/B', '').replace('[', '').replace(
                            '/', '').replace(':', '')
            _out = download_folder + name + '.mp4'
            dp.close()
            a = open(DOWNLOADS_FILE).read()
            b = a.replace(
                '#START OF FILE#',
                '#START OF FILE#\n<item>\n<name>' + str(_out) +
                '</name>\n<icon>' + str(iconimage) + '</icon>\n</item>\n')
            f = open(DOWNLOADS_FILE, mode='w')
            f.write(str(b))
            f.close()
            downloader.download(_in, _out, dp=None)
            dialog.ok(
                AddonTitle,
                "[COLOR pink]Your video has been successfully downloaded and can be viewed from the Your Downloads section on the main menu.[/COLOR]"
            )
        except:
            try:
                os.remove(_out)
            except:
                pass
            dp.close()
            dialog.ok(
                AddonTitle,
                "[COLOR pink]Sorry, there was an error trying to download the video.[/COLOR]"
            )
            quit()

    elif choice == 0:
        history_on_off = plugintools.get_setting("history_setting")
        if history_on_off == "true":
            date_now = datetime.datetime.now().strftime("%d-%m-%Y")
            time_now = datetime.datetime.now().strftime("%H:%M")
            a = open(HISTORY_FILE).read()
            b = a.replace(
                '#START OF FILE#', '#START OF FILE#\n<item>\n<date>' +
                str(date_now) + '</date>\n<time>' + str(time_now) +
                '</time>\n<name>' + str(name) + '</name>\n<link>' + str(url) +
                '</link>\n<site>Porn00</site>\n<icon>' + str(iconimage) +
                '</icon>\n</item>\n')
            f = open(HISTORY_FILE, mode='w')
            f.write(str(b))
            f.close()

        if urlresolve == 1:
            url = urlresolver.HostedMediaFile(url).resolve()
        else:
            url = url + '|User-Agent=Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.220203.207 Safari/537.36&Referer=' + ref_url
        liz = xbmcgui.ListItem(name,
                               iconImage=iconimage,
                               thumbnailImage=iconimage)
        dp.close()
        xbmc.Player().play(url, liz, False)
    else:
        dp.close()
        quit()
示例#10
0
def PLAY_URL(name,url,iconimage):

	name,url,iconimage = url.split('|SPLIT|')
	name = name.replace('[COLOR white]','').replace('[/COLOR]','').replace(' - ','')
	ref_url = url
	id = url.split("/")[-2]
	if len(id) > 4:
		start = id[0:4]
	else: start = "0"
	if "/hd/" in url:
		base = 'http://cdn.justporno.sex/video_hd/'
	else: base = 'http://cdn.justporno.sex/video/'
	url = base + str(start) + "/" + id + ".mp4"
	dp = common.GET_LUCKY()
	#result = common.open_url(url)
	#url = re.compile('<iframe src="(.+?)" frameborder="0" scrolling="no"></iframe>',re.DOTALL).findall(result)[0]
	#video = common.open_url(url)
	#common.TextBoxes("%s" % video)
	#url = re.compile("video_url.+?'(.+?)'",re.DOTALL).findall(video)[0]
	url = url.replace("['",'').replace("']",'').replace('%3A%2F%2F','://').replace('%2F','/').replace('amp;','')
	choice = dialog.select("[COLOR red]Please select an option[/COLOR]", ['[COLOR pink]Watch Video[/COLOR]','[COLOR pink]Add to Favourites[/COLOR]','[COLOR pink]Download Video[/COLOR]'])

	if choice == 1:
		a=open(FAVOURITES_FILE).read()
		b=a.replace('#START OF FILE#', '#START OF FILE#\n<item>\n<name>'+str(name)+'</name>\n<link>'+str(url)+'</link>\n<site>Just Porno TV</site>\n<icon>'+str(iconimage)+'</icon>\n</item>\n')
		f= open(FAVOURITES_FILE, mode='w')
		f.write(str(b))
		f.close()
		dp.close()
		dialog.ok(AddonTitle, "[COLOR pink]" + name + " has been added to your favourites. You can access your favourites on the main menu.[/COLOR]")
		quit()
	
	elif choice == 2:
		try:
			download_location   = plugintools.get_setting("download_location")
			download_folder = xbmc.translatePath(download_location)
			_in = url
			name = name.replace(' ','_').replace('[COLOR','').replace('[/COLOR','').replace('[I]','').replace(']','').replace('|','').replace('%','').replace('-','').replace('[/I','').replace('[/B','').replace('[','').replace('/','').replace(':','')
			_out = download_folder + name + '.mp4'
			dp.close()
			a=open(DOWNLOADS_FILE).read()
			b=a.replace('#START OF FILE#', '#START OF FILE#\n<item>\n<name>'+str(_out)+'</name>\n<icon>'+str(iconimage)+'</icon>\n</item>\n')
			f= open(DOWNLOADS_FILE, mode='w')
			f.write(str(b))
			f.close()
			downloader.download(_in,_out,dp=None)
			dialog.ok(AddonTitle, "[COLOR pink]Your video has been successfully downloaded and can be viewed from the Your Downloads section on the main menu.[/COLOR]") 
		except: 
			try:
				os.remove(_out)
			except: pass
			dp.close()
			dialog.ok(AddonTitle, "[COLOR pink]Sorry, there was an error trying to download the video.[/COLOR]")
			quit()
	
	elif choice == 0:
		history_on_off  = plugintools.get_setting("history_setting")
		if history_on_off == "true":	
			date_now = datetime.datetime.now().strftime("%d-%m-%Y")
			time_now = datetime.datetime.now().strftime("%H:%M")
			a=open(HISTORY_FILE).read()
			b=a.replace('#START OF FILE#', '#START OF FILE#\n<item>\n<date>'+str(date_now)+'</date>\n<time>'+str(time_now)+'</time>\n<name>'+str(name)+'</name>\n<link>'+str(url)+'</link>\n<site>Just Porno TV</site>\n<icon>'+str(iconimage)+'</icon>\n</item>\n')
			f= open(HISTORY_FILE, mode='w')
			f.write(str(b))
			f.close()

		url = url + '|User-Agent=Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36&Referer=' + ref_url
		liz = xbmcgui.ListItem(name, iconImage=iconimage, thumbnailImage=iconimage)
		dp.close()
		xbmc.Player ().play(url, liz, False)
		quit()
	else:
		dp.close()
		quit()
示例#11
0
def PLAY_URL(name, url, iconimage):

    name, url, iconimage = url.split('|SPLIT|')
    name = name.replace("[COLOR orangered]HD[/COLOR][COLOR white] - ",
                        '').replace("[COLOR yellow]SD[/COLOR][COLOR white] - ",
                                    '').replace('[/COLOR]',
                                                '').replace(' - ', '')
    dp = common.GET_LUCKY()
    url = "http://www.youporn.com" + url
    ref_url = url
    result = common.open_url(url)
    match = re.compile('sources: {(.+?)}', re.DOTALL).findall(result)
    a = str(match)
    match = a.replace('\\', '')
    try:
        url1 = re.compile("1080_60.+?'(.+?)',").findall(match)[0]
    except:
        url1 = "null"
    try:
        url2 = re.compile("1080.+?'(.+?)',").findall(match)[0]
    except:
        url2 = "null"
    try:
        url3 = re.compile("720_60+?'(.+?)',").findall(match)[0]
    except:
        url3 = "null"
    try:
        url4 = re.compile("720.+?'(.+?)',").findall(match)[0]
    except:
        url4 = "null"
    try:
        url5 = re.compile("480.+?'(.+?)',").findall(match)[0]
    except:
        url5 = "null"
    try:
        url6 = re.compile("240.+?'(.+?)',").findall(match)[0]
    except:
        url6 = "null"

    if "http" in url1:
        url_play = url1
    elif "http" in url2:
        url_play = url2
    elif "http" in url3:
        url_play = url3
    elif "http" in url4:
        url_play = url4
    elif "http" in url5:
        url_play = url5
    elif "http" in url6:
        url_play = url6

    url = url_play

    choice = dialog.select("[COLOR red]Please select an option[/COLOR]", [
        '[COLOR pink]Watch Video[/COLOR]',
        '[COLOR pink]Add to Favourites[/COLOR]',
        '[COLOR pink]Download Video[/COLOR]'
    ])

    if choice == 1:
        a = open(FAVOURITES_FILE).read()
        b = a.replace(
            '#START OF FILE#',
            '#START OF FILE#\n<item>\n<name>' + str(name) + '</name>\n<link>' +
            str(url) + '</link>\n<site>YouPorn</site>\n<icon>' +
            str(iconimage) + '</icon>\n</item>\n')
        f = open(FAVOURITES_FILE, mode='w')
        f.write(str(b))
        f.close()
        dp.close()
        dialog.ok(
            AddonTitle, "[COLOR pink]" + name +
            " has been added to your favourites. You can access your favourites on the main menu.[/COLOR]"
        )
        quit()

    elif choice == 2:
        try:
            download_location = plugintools.get_setting("download_location")
            download_folder = xbmc.translatePath(download_location)
            _in = url
            name = name.replace(' ', '_').replace('[COLOR', '').replace(
                '[/COLOR', '').replace('[I]', '').replace(']', '').replace(
                    '|', '').replace('%', '').replace('-', '').replace(
                        '[/I', '').replace('[/B', '').replace('[', '').replace(
                            '/', '').replace(':', '')
            _out = download_folder + name + '.mp4'
            dp.close()
            a = open(DOWNLOADS_FILE).read()
            b = a.replace(
                '#START OF FILE#',
                '#START OF FILE#\n<item>\n<name>' + str(_out) +
                '</name>\n<icon>' + str(iconimage) + '</icon>\n</item>\n')
            f = open(DOWNLOADS_FILE, mode='w')
            f.write(str(b))
            f.close()
            downloader.download(_in, _out, dp=None)
            dialog.ok(
                AddonTitle,
                "[COLOR pink]Your video has been successfully downloaded and can be viewed from the Your Downloads section on the main menu.[/COLOR]"
            )
        except:
            try:
                os.remove(_out)
            except:
                pass
            dp.close()
            dialog.ok(
                AddonTitle,
                "[COLOR pink]Sorry, there was an error trying to download the video.[/COLOR]"
            )
            quit()

    elif choice == 0:
        history_on_off = plugintools.get_setting("history_setting")
        if history_on_off == "true":
            date_now = datetime.datetime.now().strftime("%d-%m-%Y")
            time_now = datetime.datetime.now().strftime("%H:%M")
            a = open(HISTORY_FILE).read()
            b = a.replace(
                '#START OF FILE#', '#START OF FILE#\n<item>\n<date>' +
                str(date_now) + '</date>\n<time>' + str(time_now) +
                '</time>\n<name>' + str(name) + '</name>\n<link>' + str(url) +
                '</link>\n<site>YouPorn</site>\n<icon>' + str(iconimage) +
                '</icon>\n</item>\n')
            f = open(HISTORY_FILE, mode='w')
            f.write(str(b))
            f.close()

        url = url + '|User-Agent=Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36&Referer=' + ref_url
        liz = xbmcgui.ListItem(name,
                               iconImage=iconimage,
                               thumbnailImage=iconimage)
        dp.close()
        xbmc.Player().play(url, liz, False)
    else:
        dp.close()
        quit()
示例#12
0
    from resources.lib.modules import trakt
    trakt.manager(name, imdb, tvdb, content)

elif action == 'authTrakt':
    from resources.lib.modules import trakt
    trakt.authTrakt()

elif action == 'rdAuthorize':
    from resources.lib.modules import debrid
    debrid.rdAuthorize()

elif action == 'download':
    import json
    from resources.lib.sources import sources
    from resources.lib.modules import downloader
    try: downloader.download(name, image, sources().sourcesResolve(json.loads(source)[0]))
    except: pass

elif action == 'play':
    from resources.lib.sources import sources
    sources().play(title, year, imdb, tvdb, season, episode, tvshowtitle, premiered, meta, url)

elif action == 'sources':
    from resources.lib.sources import sources
    sources().addItem(title, year, imdb, tvdb, season, episode, tvshowtitle, premiered, meta)

elif action == 'playItem':
    from resources.lib.sources import sources
    sources().playItem(source)

elif action == 'alterSources':
示例#13
0
def PLAY_URL(name, url, iconimage):

    name, url, iconimage = url.split('|SPLIT|')
    name = name.replace('[COLOR white]', '').replace('[/COLOR]',
                                                     '').replace(' - ', '')
    ref_url = url
    dp = common.GET_LUCKY()
    try:
        result = common.open_url(url).replace('/n', '')
    except:
        dialog.ok(AddonTitle, "Error connecting to website. Please try again.")
        quit()
    url = re.compile("\'file\'.+?\'(.+?)\',").findall(result)[0]
    url = url.replace("['", '').replace("']", '').replace(
        '%3A%2F%2F', '://').replace('%2F', '/').replace('amp;', '')
    choice = dialog.select("[COLOR red]Please select an option[/COLOR]", [
        '[COLOR pink]Watch Video[/COLOR]',
        '[COLOR pink]Add to Favourites[/COLOR]',
        '[COLOR pink]Download Video[/COLOR]'
    ])

    if choice == 1:
        a = open(FAVOURITES_FILE).read()
        b = a.replace(
            '#START OF FILE#',
            '#START OF FILE#\n<item>\n<name>' + str(name) + '</name>\n<link>' +
            str(url) + '</link>\n<site>XNGX</site>\n<icon>' + str(iconimage) +
            '</icon>\n</item>\n')
        f = open(FAVOURITES_FILE, mode='w')
        f.write(str(b))
        f.close()
        dp.close()
        dialog.ok(
            AddonTitle, "[COLOR pink]" + name +
            " has been added to your favourites. You can access your favourites on the main menu.[/COLOR]"
        )
        quit()

    elif choice == 2:
        try:
            download_location = plugintools.get_setting("download_location")
            download_folder = xbmc.translatePath(download_location)
            _in = url
            name = name.replace(' ', '_').replace('[COLOR', '').replace(
                '[/COLOR', '').replace('[I]', '').replace(']', '').replace(
                    '|', '').replace('%', '').replace('-', '').replace(
                        '[/I', '').replace('[/B', '').replace('[', '').replace(
                            '/', '').replace(':', '')
            _out = download_folder + name + '.mp4'
            dp.close()
            a = open(DOWNLOADS_FILE).read()
            b = a.replace(
                '#START OF FILE#',
                '#START OF FILE#\n<item>\n<name>' + str(_out) +
                '</name>\n<icon>' + str(iconimage) + '</icon>\n</item>\n')
            f = open(DOWNLOADS_FILE, mode='w')
            f.write(str(b))
            f.close()
            downloader.download(_in, _out, dp=None)
            dialog.ok(
                AddonTitle,
                "[COLOR pink]Your video has been successfully downloaded and can be viewed from the Your Downloads section on the main menu.[/COLOR]"
            )
        except:
            try:
                os.remove(_out)
            except:
                pass
            dp.close()
            dialog.ok(
                AddonTitle,
                "[COLOR pink]Sorry, there was an error trying to download the video.[/COLOR]"
            )
            quit()

    elif choice == 0:
        history_on_off = plugintools.get_setting("history_setting")
        if history_on_off == "true":
            date_now = datetime.datetime.now().strftime("%d-%m-%Y")
            time_now = datetime.datetime.now().strftime("%H:%M")
            a = open(HISTORY_FILE).read()
            b = a.replace(
                '#START OF FILE#', '#START OF FILE#\n<item>\n<date>' +
                str(date_now) + '</date>\n<time>' + str(time_now) +
                '</time>\n<name>' + str(name) + '</name>\n<link>' + str(url) +
                '</link>\n<site>NXGX</site>\n<icon>' + str(iconimage) +
                '</icon>\n</item>\n')
            f = open(HISTORY_FILE, mode='w')
            f.write(str(b))
            f.close()

        url = url + '|User-Agent=Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36'
        liz = xbmcgui.ListItem(name,
                               iconImage=iconimage,
                               thumbnailImage=iconimage)
        dp.close()
        xbmc.Player().play(url, liz, False)
        quit()
    else:
        dp.close()
        quit()
示例#14
0
def downloadItem(name, url):
    from resources.lib.modules import downloader
    downloader.download(name, url)
示例#15
0
def routing(_argv):

    params = dict(urllib_parse.parse_qsl(_argv.replace('?', '')))

    action = params.get('action')

    name = params.get('name')

    title = params.get('title')

    year = params.get('year')

    imdb = params.get('imdb')

    tvdb = params.get('tvdb')

    tmdb = params.get('tmdb')

    season = params.get('season')

    episode = params.get('episode')

    tvshowtitle = params.get('tvshowtitle')

    premiered = params.get('premiered')

    url = params.get('url')

    image = params.get('image')

    meta = params.get('meta')

    select = params.get('select')

    query = params.get('query')

    source = params.get('source')

    content = params.get('content')

    status = params.get('status')

    rtype = params.get('rtype')

    windowedtrailer = params.get('windowedtrailer')
    windowedtrailer = int(windowedtrailer) if windowedtrailer in ('0',
                                                                  '1') else 0

    if action == None:
        from resources.lib.indexers import navigator
        from resources.lib.modules import cache
        cache.cache_version_check()
        navigator.navigator().root()

    elif action == 'furkNavigator':
        from resources.lib.indexers import navigator
        navigator.navigator().furk()

    elif action == 'furkMetaSearch':
        from resources.lib.indexers import furk
        furk.furk().furk_meta_search(url)

    elif action == 'furkSearch':
        from resources.lib.indexers import furk
        furk.furk().search()

    elif action == 'furkUserFiles':
        from resources.lib.indexers import furk
        furk.furk().user_files()

    elif action == 'furkSearchNew':
        from resources.lib.indexers import furk
        furk.furk().search_new()

    elif action == 'movieNavigator':
        from resources.lib.indexers import navigator
        navigator.navigator().movies()

    elif action == 'movieliteNavigator':
        from resources.lib.indexers import navigator
        navigator.navigator().movies(lite=True)

    elif action == 'mymovieNavigator':
        from resources.lib.indexers import navigator
        navigator.navigator().mymovies()

    elif action == 'mymovieliteNavigator':
        from resources.lib.indexers import navigator
        navigator.navigator().mymovies(lite=True)

    elif action == 'tvNavigator':
        from resources.lib.indexers import navigator
        navigator.navigator().tvshows()

    elif action == 'tvliteNavigator':
        from resources.lib.indexers import navigator
        navigator.navigator().tvshows(lite=True)

    elif action == 'mytvNavigator':
        from resources.lib.indexers import navigator
        navigator.navigator().mytvshows()

    elif action == 'mytvliteNavigator':
        from resources.lib.indexers import navigator
        navigator.navigator().mytvshows(lite=True)

    elif action == 'downloadNavigator':
        from resources.lib.indexers import navigator
        navigator.navigator().downloads()

    elif action == 'libraryNavigator':
        from resources.lib.indexers import navigator
        navigator.navigator().library()

    elif action == 'toolNavigator':
        from resources.lib.indexers import navigator
        navigator.navigator().tools()

    elif action == 'searchNavigator':
        from resources.lib.indexers import navigator
        navigator.navigator().search()

    elif action == 'viewsNavigator':
        from resources.lib.indexers import navigator
        navigator.navigator().views()

    elif action == 'cacheNavigator':
        from resources.lib.indexers import navigator
        navigator.navigator().cache_functions()

    elif action == 'logNavigator':
        from resources.lib.indexers import navigator
        navigator.navigator().log_functions()

    elif action == 'clearCache':
        from resources.lib.indexers import navigator
        navigator.navigator().clearCache()

    elif action == 'clearCacheProviders':
        from resources.lib.indexers import navigator
        navigator.navigator().clearCacheProviders()

    elif action == 'clearDebridCheck':
        from resources.lib.indexers import navigator
        navigator.navigator().clearDebridCheck()

    elif action == 'clearCacheSearch':
        from resources.lib.indexers import navigator
        navigator.navigator().clearCacheSearch(select)

    elif action == 'clearAllCache':
        from resources.lib.indexers import navigator
        navigator.navigator().clearCacheAll()

    elif action == 'infoCheck':
        from resources.lib.indexers import navigator
        navigator.navigator().infoCheck('')

    elif action == 'uploadLog':
        from resources.lib.indexers import navigator
        navigator.navigator().uploadLog()

    elif action == 'emptyLog':
        from resources.lib.indexers import navigator
        navigator.navigator().emptyLog()

    elif action == 'viewLog':
        from resources.lib.modules import log_utils
        log_utils.view_log()

    elif action == 'movies':
        from resources.lib.indexers import movies
        movies.movies().get(url)

    elif action == 'moviePage':
        from resources.lib.indexers import movies
        movies.movies().get(url)

    elif action == 'movieWidget':
        from resources.lib.indexers import movies
        movies.movies().widget()

    elif action == 'movieSearch':
        from resources.lib.indexers import movies
        movies.movies().search()

    elif action == 'movieSearchnew':
        from resources.lib.indexers import movies
        movies.movies().search_new()

    elif action == 'movieSearchterm':
        from resources.lib.indexers import movies
        movies.movies().search_term(name)

    elif action == 'movieMosts':
        from resources.lib.indexers import movies
        movies.movies().mosts()

    elif action == 'movieGenres':
        from resources.lib.indexers import movies
        movies.movies().genres()

    elif action == 'movieLanguages':
        from resources.lib.indexers import movies
        movies.movies().languages()

    elif action == 'movieCertificates':
        from resources.lib.indexers import movies
        movies.movies().certifications()

    elif action == 'movieYears':
        from resources.lib.indexers import movies
        movies.movies().years()

    elif action == 'movieDecades':
        from resources.lib.indexers import movies
        movies.movies().decades()

    elif action == 'movieKeywords':
        from resources.lib.indexers import movies
        movies.movies().keywords()

    elif action == 'movieKeywords2':
        from resources.lib.indexers import movies
        movies.movies().keywords2()

    elif action == 'movieCustomLists':
        from resources.lib.indexers import movies
        movies.movies().custom_lists()

    elif action == 'movieUserlists':
        from resources.lib.indexers import movies
        movies.movies().userlists()

    elif action == 'channels':
        from resources.lib.indexers import channels
        channels.channels().get()

    elif action == 'tvshows':
        from resources.lib.indexers import tvshows
        tvshows.tvshows().get(url)

    elif action == 'tvshowPage':
        from resources.lib.indexers import tvshows
        tvshows.tvshows().get(url)

    elif action == 'tvSearch':
        from resources.lib.indexers import tvshows
        tvshows.tvshows().search()

    elif action == 'tvSearchnew':
        from resources.lib.indexers import tvshows
        tvshows.tvshows().search_new()

    elif action == 'tvSearchterm':
        from resources.lib.indexers import tvshows
        tvshows.tvshows().search_term(name)

    elif action == 'tvMosts':
        from resources.lib.indexers import tvshows
        tvshows.tvshows().mosts()

    elif action == 'tvGenres':
        from resources.lib.indexers import tvshows
        tvshows.tvshows().genres()

    elif action == 'tvNetworks':
        from resources.lib.indexers import tvshows
        tvshows.tvshows().networks()

    elif action == 'tvLanguages':
        from resources.lib.indexers import tvshows
        tvshows.tvshows().languages()

    elif action == 'tvCertificates':
        from resources.lib.indexers import tvshows
        tvshows.tvshows().certifications()

    elif action == 'tvUserlists':
        from resources.lib.indexers import tvshows
        tvshows.tvshows().userlists()

    elif action == 'peopleSearch':
        from resources.lib.indexers import people
        people.People().search(content)

    elif action == 'peopleSearchnew':
        from resources.lib.indexers import people
        people.People().search_new(content)

    elif action == 'peopleSearchterm':
        from resources.lib.indexers import people
        people.People().search_term(name, content)

    elif action == 'persons':
        from resources.lib.indexers import people
        people.People().persons(url, content)

    elif action == 'moviePerson':
        from resources.lib.indexers import people
        people.People().persons(url, content='movies')

    elif action == 'tvPerson':
        from resources.lib.indexers import people
        people.People().persons(url, content='tvshows')

    elif action == 'personsSelect':
        from resources.lib.indexers import people
        people.People().getPeople(name, url)

    elif action == 'seasons':
        from resources.lib.indexers import episodes
        episodes.seasons().get(tvshowtitle, year, imdb, tmdb, meta)

    elif action == 'episodes':
        from resources.lib.indexers import episodes
        episodes.episodes().get(tvshowtitle, year, imdb, tmdb, meta, season,
                                episode)

    elif action == 'calendar':
        from resources.lib.indexers import episodes
        episodes.episodes().calendar(url)

    elif action == 'tvWidget':
        from resources.lib.indexers import episodes
        episodes.episodes().widget()

    elif action == 'calendars':
        from resources.lib.indexers import episodes
        episodes.episodes().calendars()

    elif action == 'episodeUserlists':
        from resources.lib.indexers import episodes
        episodes.episodes().userlists()

    elif action == 'refresh':
        from resources.lib.modules import control
        control.refresh()

    elif action == 'queueItem':
        from resources.lib.modules import control
        control.queueItem()

    elif action == 'openSettings':
        from resources.lib.modules import control
        control.openSettings(query)

    elif action == 'artwork':
        from resources.lib.modules import control
        control.artwork()

    elif action == 'addView':
        from resources.lib.modules import views
        views.addView(content)

    elif action == 'moviePlaycount':
        from resources.lib.modules import playcount
        playcount.movies(imdb, query)

    elif action == 'episodePlaycount':
        from resources.lib.modules import playcount
        playcount.episodes(imdb, tmdb, season, episode, query)

    elif action == 'tvPlaycount':
        from resources.lib.modules import playcount
        playcount.tvshows(name, imdb, tmdb, season, query)

    elif action == 'yt_trailer':
        from resources.lib.modules import control, trailer
        if not control.condVisibility('System.HasAddon(plugin.video.youtube)'):
            control.installAddon('plugin.video.youtube')
        trailer.YT_trailer().play(name, url, tmdb, imdb, season, episode,
                                  windowedtrailer)

    elif action == 'tmdb_trailer':
        from resources.lib.modules import control, trailer
        if not control.condVisibility('System.HasAddon(plugin.video.youtube)'):
            control.installAddon('plugin.video.youtube')
        trailer.TMDb_trailer().play(tmdb, imdb, season, episode,
                                    windowedtrailer)

    elif action == 'imdb_trailer':
        from resources.lib.modules import trailer
        trailer.IMDb_trailer().play(imdb, name, tmdb, season, episode,
                                    windowedtrailer)

    elif action == 'traktManager':
        from resources.lib.modules import trakt
        trakt.manager(name, imdb, tmdb, content)

    elif action == 'authTrakt':
        from resources.lib.modules import trakt
        trakt.authTrakt()

    elif action == 'smuSettings':
        try:
            import resolveurl
            resolveurl.display_settings()
        except:
            pass

    elif action == 'oathscrapersettings':
        from resources.lib.modules import control
        control.openSettings('0.0', 'script.module.oathscrapers')

    elif action == 'installOrion':
        from resources.lib.modules import control
        control.installAddon('script.module.orion')
        control.sleep(200)
        control.refresh()

    elif action == 'orionsettings':
        from resources.lib.modules import control
        control.openSettings('0.0', 'script.module.orion')

    elif action == 'download':
        import simplejson as json
        from resources.lib.modules import sources
        from resources.lib.modules import downloader
        try:
            downloader.download(
                name, image,
                sources.sources().sourcesResolve(json.loads(source)[0], True))
        except:
            pass

    elif action == 'play':
        from resources.lib.modules import control
        control.busy()
        from resources.lib.modules import sources
        sources.sources().play(title,
                               year,
                               imdb,
                               tmdb,
                               season,
                               episode,
                               tvshowtitle,
                               premiered,
                               meta,
                               select,
                               unfiltered=False)

    elif action == 'playUnfiltered':
        from resources.lib.modules import control
        control.busy()
        from resources.lib.modules import sources
        sources.sources().play(title,
                               year,
                               imdb,
                               tmdb,
                               season,
                               episode,
                               tvshowtitle,
                               premiered,
                               meta,
                               select,
                               unfiltered=True)

    elif action == 'addItem':
        from resources.lib.modules import sources
        sources.sources().addItem(title)

    elif action == 'playItem':
        from resources.lib.modules import sources
        sources.sources().playItem(title, source)

    elif action == 'alterSources':
        from resources.lib.modules import sources
        sources.sources().alterSources(url, meta)

    elif action == 'clearSources':
        from resources.lib.modules import sources
        sources.sources().clearSources()

    elif action == 'random':
        from sys import argv
        if rtype == 'movie':
            from resources.lib.indexers import movies
            rlist = movies.movies().get(url, create_directory=False)
            r = argv[0] + '?action=play'
        elif rtype == 'episode':
            from resources.lib.indexers import episodes
            rlist = episodes.episodes().get(tvshowtitle,
                                            year,
                                            imdb,
                                            tmdb,
                                            meta,
                                            season,
                                            create_directory=False)
            r = argv[0] + '?action=play'
        elif rtype == 'season':
            from resources.lib.indexers import episodes
            rlist = episodes.seasons().get(tvshowtitle,
                                           year,
                                           imdb,
                                           tmdb,
                                           None,
                                           create_directory=False)
            r = argv[0] + '?action=random&rtype=episode'
        elif rtype == 'show':
            from resources.lib.indexers import tvshows
            rlist = tvshows.tvshows().get(url, create_directory=False)
            r = argv[0] + '?action=random&rtype=season'
        from random import randint
        import simplejson as json
        try:
            from resources.lib.modules import control
            rand = randint(1, len(rlist)) - 1
            for p in [
                    'title', 'year', 'imdb', 'tmdb', 'season', 'episode',
                    'tvshowtitle', 'premiered', 'select'
            ]:
                if rtype == 'show' and p == 'tvshowtitle':
                    try:
                        r += '&' + p + '=' + urllib_parse.quote_plus(
                            rlist[rand]['title'])
                    except:
                        pass
                else:
                    if rtype == 'movie':
                        rlist[rand]['title'] = rlist[rand]['originaltitle']
                    elif rtype == 'episode':
                        rlist[rand]['tvshowtitle'] = urllib_parse.unquote_plus(
                            rlist[rand]['tvshowtitle'])
                    try:
                        r += '&' + p + '=' + urllib_parse.quote_plus(
                            rlist[rand][p])
                    except:
                        pass
            try:
                r += '&meta=' + urllib_parse.quote_plus(json.dumps(
                    rlist[rand]))
            except:
                r += '&meta={}'
            if rtype == 'movie':
                try:
                    control.infoDialog(
                        '%s (%s)' %
                        (rlist[rand]['title'], rlist[rand]['year']),
                        control.lang(32536),
                        time=20000)
                except:
                    pass
            elif rtype == 'episode':
                try:
                    control.infoDialog(
                        '%s - %01dx%02d . %s' %
                        (urllib_parse.unquote_plus(rlist[rand]['tvshowtitle']),
                         int(rlist[rand]['season']), int(
                             rlist[rand]['episode']), rlist[rand]['title']),
                        control.lang(32536),
                        time=20000)
                except:
                    pass
            control.execute('RunPlugin(%s)' % r)
        except:
            from resources.lib.modules import control
            control.infoDialog(control.lang(32537), time=8000)

    elif action == 'movieToLibrary':
        from resources.lib.modules import libtools
        libtools.libmovies().add(name, title, year, imdb, tmdb)

    elif action == 'moviesToLibrary':
        from resources.lib.modules import libtools
        libtools.libmovies().range(url)

    elif action == 'moviesToLibrarySilent':
        from resources.lib.modules import libtools
        libtools.libmovies().silent(url)

    elif action == 'tvshowToLibrary':
        from resources.lib.modules import libtools
        libtools.libtvshows().add(tvshowtitle, year, imdb, tmdb)

    elif action == 'tvshowsToLibrary':
        from resources.lib.modules import libtools
        libtools.libtvshows().range(url)

    elif action == 'tvshowsToLibrarySilent':
        from resources.lib.modules import libtools
        libtools.libtvshows().silent(url)

    elif action == 'updateLibrary':
        from resources.lib.modules import libtools
        libtools.libepisodes().update(query)

    elif action == 'service':
        from resources.lib.modules import libtools
        libtools.libepisodes().service()

    elif action == 'syncTraktStatus':
        from resources.lib.modules import trakt
        trakt.syncTraktStatus()

    elif action == 'changelog':
        from resources.lib.modules import changelog
        changelog.get()

    elif action == 'cleanSettings':
        from resources.lib.modules import control
        control.clean_settings()

    elif action == 'tvcredits':
        from resources.lib.modules import credits
        credits.Credits().get_tv(tmdb, status)

    elif action == 'moviecredits':
        from resources.lib.modules import credits
        credits.Credits().get_movies(tmdb, status)
示例#16
0
def PLAY_URL(name, url, iconimage):

    name, url = url.split('|SPLIT|')
    name = name.replace(
        '[COLOR white] - [/COLOR][COLOR deepskyblue]HD[/COLOR] - [COLOR white]',
        '').replace(
            '[COLOR white] - [/COLOR][COLOR orange]SD[/COLOR] - [COLOR white]',
            '').replace('[/COLOR]', '').replace(' - ', '')
    ref_url = url
    result = common.open_url(url)
    match = re.compile('html>(.+?)</html>', re.DOTALL).findall(result)
    a = str(match)
    match = a.replace('\\', '')

    choice = dialog.select("[COLOR red]Please select an option[/COLOR]", [
        '[COLOR pink]Watch Video[/COLOR]',
        '[COLOR pink]Add to Favourites[/COLOR]',
        '[COLOR pink]Download Video[/COLOR]'
    ])

    dp = common.GET_LUCKY()

    if choice == 1:
        a = open(FAVOURITES_FILE).read()
        b = a.replace(
            '#START OF FILE#',
            '#START OF FILE#\n<item>\n<name>' + str(name) + '</name>\n<link>' +
            str(url) + '</link>\n<site>P**n.com</site>\n<icon>' +
            str(iconimage) + '</icon>\n</item>\n')
        f = open(FAVOURITES_FILE, mode='w')
        f.write(str(b))
        f.close()
        dp.close()
        dialog.ok(
            AddonTitle, "[COLOR pink]" + name +
            " has been added to your favourites. You can access your favourites on the main menu.[/COLOR]"
        )
        quit()

    elif choice == 2:
        try:
            try:
                size1 = re.compile(
                    'MP4 1080p<span class="hd"></span><span class="l1">(.+?)</span></a><a href=".+?"'
                ).findall(match)[0]
                url1 = re.compile(
                    'MP4 1080p<span class="hd"></span><span class="l1">.+?</span></a><a href="(.+?)"'
                ).findall(match)[0]
            except:
                size1 = "null"
                url1 = "null"
            try:
                size2 = re.compile(
                    'MP4 720p<span class="hd"></span><span class="l1">(.+?)</span></a><a href=".+?.mp4"'
                ).findall(match)[0]
                url2 = re.compile(
                    'MP4 720p<span class="hd"></span><span class="l1">.+?</span></a><a href="(.+?)"'
                ).findall(match)[0]
            except:
                size2 = "null"
                url2 = "null"
            try:
                size3 = re.compile(
                    'MP4 480p.+?<span class="l1">(.+?)</span></a><a href=".+?.mp4"'
                ).findall(match)[0]
                url3 = re.compile(
                    'MP4 480p.+?<span class="l1">.+?</span></a><a href="(.+?)"'
                ).findall(match)[0]
            except:
                size3 = "null"
                url3 = "null"
            try:
                size4 = re.compile(
                    'MP4 360p.+?<span class="l1">(.+?)</span></a><a href=".+?.mp4"'
                ).findall(match)[0]
                url4 = re.compile(
                    'MP4 360p.+?<span class="l1">.+?</span></a><a href="(.+?)"'
                ).findall(match)[0]
            except:
                size4 = "null"
                url4 = "null"
            if "download" in url1:
                choice = dialog.select(
                    "[COLOR red]Please select an option[/COLOR]", [
                        '[COLOR deepskyblue]Download 1080p ' + str(size1) +
                        '[/COLOR]', '[COLOR deepskyblue]Download 720p ' +
                        str(size2) + '[/COLOR]',
                        '[COLOR deepskyblue]Download 480p ' + str(size3) +
                        '[/COLOR]', '[COLOR deepskyblue]Download 360p ' +
                        str(size4) + '[/COLOR]'
                    ])
                if choice == 0: url_play = url1
                elif choice == 1: url_play = url2
                elif choice == 2: url_play = url3
                elif choice == 3: url_play = url4
            elif "download" in url2:
                choice = dialog.select(
                    "[COLOR red]Please select an option[/COLOR]", [
                        '[COLOR deepskyblue]Download 720p ' + str(size2) +
                        '[/COLOR]', '[COLOR deepskyblue]Download 480p ' +
                        str(size3) + '[/COLOR]',
                        '[COLOR deepskyblue]Download 360p ' + str(size4) +
                        '[/COLOR]'
                    ])
                if choice == 0: url_play = url2
                elif choice == 1: url_play = url3
                elif choice == 2: url_play = url4
            elif "download" in url3:
                choice = dialog.select(
                    "[COLOR red]Please select an option[/COLOR]", [
                        '[COLOR deepskyblue]Download 480p ' + str(size3) +
                        '[/COLOR]', '[COLOR deepskyblue]Download 360p ' +
                        str(size4) + '[/COLOR]'
                    ])
                if choice == 0: url_play = url3
                elif choice == 1: url_play = url4
            elif "download" in url4:
                url_play = url4

            download_location = plugintools.get_setting("download_location")
            download_folder = xbmc.translatePath(download_location)
            _in = 'http://www.p**n.com/' + url_play
            name = name.replace(' ', '_').replace('[COLOR', '').replace(
                '[/COLOR', '').replace('[I]', '').replace(']', '').replace(
                    '|', '').replace('%', '').replace('-', '').replace(
                        '[/I', '').replace('[/B', '').replace('[', '').replace(
                            '/', '').replace(':', '')
            _out = download_folder + name + '.mp4'
            dp.close()
            a = open(DOWNLOADS_FILE).read()
            b = a.replace(
                '#START OF FILE#',
                '#START OF FILE#\n<item>\n<name>' + str(_out) +
                '</name>\n<icon>' + str(iconimage) + '</icon>\n</item>\n')
            f = open(DOWNLOADS_FILE, mode='w')
            f.write(str(b))
            f.close()
            downloader.download(_in, _out, dp=None)
            dialog.ok(
                AddonTitle,
                "[COLOR pink]Your video has been successfully downloaded and can be viewed from the Your Downloads section on the main menu.[/COLOR]"
            )
        except:
            try:
                os.remove(_out)
            except:
                pass
            dp.close()
            dialog.ok(
                AddonTitle,
                "[COLOR pink]Sorry, there was an error trying to download the video.[/COLOR]"
            )
            quit()

    elif choice == 0:
        history_on_off = plugintools.get_setting("history_setting")
        if history_on_off == "true":
            date_now = datetime.datetime.now().strftime("%d-%m-%Y")
            time_now = datetime.datetime.now().strftime("%H:%M")
            a = open(HISTORY_FILE).read()
            b = a.replace(
                '#START OF FILE#', '#START OF FILE#\n<item>\n<date>' +
                str(date_now) + '</date>\n<time>' + str(time_now) +
                '</time>\n<name>' + str(name) + '</name>\n<link>' + str(url) +
                '</link>\n<site>P**n.com</site>\n<icon>' + str(iconimage) +
                '</icon>\n</item>\n')
            f = open(HISTORY_FILE, mode='w')
            f.write(str(b))
            f.close()

        url_play = re.compile('{id:".+?",url:"(.+?)"').findall(match)[-1]

        url = url_play + '|User-Agent=Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36&Referer=' + ref_url
        liz = xbmcgui.ListItem(name,
                               iconImage=iconimage,
                               thumbnailImage=iconimage)
        dp.close()
        xbmc.Player().play(url, liz, False)
    else:
        dp.close()
        quit()
示例#17
0
def INSTALL(name, url, description):

    urla = url
    desca = description

    notice2, description, fresh, youtube, skin_used, build_notice = desca.split(
        ',')
    name, url = urla.split(',')
    wipeme = 0
    xxl = 0
    skipskin = 0
    skin_swapped = 0
    skin = xbmc.getSkinDir()
    KODIV = float(xbmc.getInfoLabel("System.BuildVersion")[:4])
    skinswapped = 0
    SKIP_FAVS = 0

    if "lose your favourites" in notice2.lower():
        SKIP_FAVS = 1

    if not "skin." in skin_used:
        skin_used = "NULL"

    if fresh == "1":
        wipeme = 1
    else:
        wipeme = 0
        skipskin = 1

    #SWITCH THE SKIN IF THE CURRENT SKIN IS NOT CONFLUENCE
    if skin not in ['skin.confluence', 'skin.estuary'] and skipskin == 0:
        skin = 'skin.estuary' if KODIV >= 17 else 'skin.confluence'
        skinSwitch.swapSkins(skin)
        skinswapped = 1
        time.sleep(2)

    #IF A SKIN SWAP HAS HAPPENED CHECK IF AN OK DIALOG (CONFLUENCE INFO SCREEN) IS PRESENT, PRESS OK IF IT IS PRESENT
    if skinswapped == 1:
        if not xbmc.getCondVisibility("Window.isVisible(yesnodialog)"):
            xbmc.executebuiltin("Action(Select)")

    #IF THERE IS NOT A YES NO DIALOG (THE SCREEN ASKING YOU TO SWITCH TO CONFLUENCE) THEN SLEEP UNTIL IT APPEARS
    if skinswapped == 1:
        while not xbmc.getCondVisibility("Window.isVisible(yesnodialog)"):
            time.sleep(1)

    #WHILE THE YES NO DIALOG IS PRESENT PRESS LEFT AND THEN SELECT TO CONFIRM THE SWITCH TO CONFLUENCE.
    if skinswapped == 1:
        while xbmc.getCondVisibility("Window.isVisible(yesnodialog)"):
            xbmc.executebuiltin("Action(Left)")
            xbmc.executebuiltin("Action(Select)")
            time.sleep(1)

    skin = xbmc.getSkinDir()

    #CHECK IF THE SKIN IS NOT CONFLUENCE
    if skin not in ['skin.confluence', 'skin.estuary']:
        if skin_swapped == 1:
            choice = xbmcgui.Dialog().yesno(
                AddonTitle,
                '[COLOR lightskyblue][B]ERROR: AUTOSWITCH WAS NOT SUCCESSFUL[/B][/COLOR]',
                '[COLOR lightskyblue][B]CLICK YES TO MANUALLY SWITCH TO CONFLUENCE NOW[/B][/COLOR]',
                '[COLOR lightskyblue][B]YOU CAN PRESS NO AND ATTEMPT THE AUTO SWITCH AGAIN IF YOU WISH[/B][/COLOR]',
                yeslabel='[B][COLOR green]YES[/COLOR][/B]',
                nolabel='[B][COLOR lightskyblue]NO[/COLOR][/B]')
            if choice == 1:
                xbmc.executebuiltin("ActivateWindow(appearancesettings)")
                return
            else:
                sys.exit(1)

    if wipeme == 1:
        found_trakt = 0
        link = Common.OPEN_URL(BASEURL +
                               base64.b64decode(b'b3RoZXIvcmRfdHJha3QueG1s'))
        plugins = re.compile('<plugin>(.+?)</plugin>').findall(link)
        for match in plugins:
            ADDONPATH = xbmc.translatePath(os.path.join(ADDON_DATA, match))
            ADDONSETTINGS = xbmc.translatePath(
                os.path.join(ADDONPATH, 'settings.xml'))
            EXCLUDEMOVE = xbmc.translatePath(
                os.path.join(EXCLUDES_FOLDER, match + '_settings.xml'))

            if os.path.isfile(ADDONSETTINGS):
                found_trakt = 1

        if SKIP_FAVS == 1:
            keep_kodi_favs = 0
            keep_trakt_rd = 0

            if found_trakt == 1:
                found_a = 0
                dialog = xbmcgui.Dialog()
                choice = dialog.select(
                    '[COLOR lightskyblue][B]TRAKT AND RD SETTINGS DETECTED[/B][/COLOR]',
                    [
                        '[COLOR yellowgreen][B]Yes, Keep Trakt & Real Debrid Settings[/B][/COLOR]',
                        '[COLOR lightskyblue][B]No, Remove My Settings[/B][/COLOR]'
                    ])
                if choice == 0:
                    keep_trakt_rd = 1
                    found_a = 1
                if choice == 1:
                    keep_trakt_rd = 0
                    found_a = 1
                if found_a == 0:
                    sys.exit(1)
        else:
            found_favourites = 0
            if os.path.isfile(FAVS):
                found_favourites = 1

            keep_kodi_favs = 0
            keep_trakt_rd = 0

            if found_favourites == 1 and found_trakt == 1:
                found_c = 0
                dialog = xbmcgui.Dialog()
                choice = dialog.select(
                    '[COLOR lightskyblue][B]TRAKT, RD & FAVOURITES DETECTED[/B][/COLOR]',
                    [
                        '[COLOR lightskyblue][B]KEEP BOTH RD, TRAKT & FAVOURITES[/B][/COLOR]',
                        '[COLOR yellowgreen][B]Only Keep Trakt & Real Debrid Settings[/B][/COLOR]',
                        '[COLOR yellowgreen][B]Only Keep Kodi Favourites[/B][/COLOR]',
                        '[COLOR lightskyblue][B]Remove All Settings & Favourites[/B][/COLOR]'
                    ])
                if choice == 0:
                    keep_trakt_rd = 1
                    keep_kodi_favs = 1
                    found_c = 1
                if choice == 1:
                    keep_trakt_rd = 1
                    keep_kodi_favs = 0
                    found_c = 1
                if choice == 2:
                    keep_trakt_rd = 0
                    keep_kodi_favs = 1
                    found_c = 1
                if choice == 3:
                    keep_trakt_rd = 0
                    keep_kodi_favs = 0
                    found_c = 1
                if found_c == 0:
                    sys.exit(1)

            if found_favourites == 1 and found_trakt == 0:
                found_b = 0
                dialog = xbmcgui.Dialog()
                choice = dialog.select(
                    '[COLOR lightskyblue][B]KODI FAVOURITES DETECTED[/B][/COLOR]',
                    [
                        '[COLOR yellowgreen][B]Yes, Keep Favourites[/B][/COLOR]',
                        '[COLOR lightskyblue][B]No Use The Builds Favourites[/B][/COLOR]'
                    ])
                if choice == 0:
                    found_b = 1
                    keep_kodi_favs = 1
                if choice == 1:
                    found_b = 1
                    keep_kodi_favs = 0
                if found_b == 0:
                    sys.exit(1)

            if found_favourites == 0 and found_trakt == 1:
                found_a = 0
                dialog = xbmcgui.Dialog()
                choice = dialog.select(
                    '[COLOR lightskyblue][B]TRAKT AND RD SETTINGS DETECTED[/B][/COLOR]',
                    [
                        '[COLOR yellowgreen][B]Yes, Keep Trakt & Real Debrid Settings[/B][/COLOR]',
                        '[COLOR lightskyblue][B]No, Remove My Settings[/B][/COLOR]'
                    ])
                if choice == 0:
                    keep_trakt_rd = 1
                    found_a = 1
                if choice == 1:
                    keep_trakt_rd = 0
                    found_a = 1
                if found_a == 0:
                    sys.exit(1)

        if keep_trakt_rd == 1:
            backuprestore.AUTO_BACKUP_RD_TRAKT()

        wipe.WIPERESTORE(keep_kodi_favs)

    path = xbmc.translatePath(os.path.join('special://home/addons',
                                           'packages'))
    if not os.path.exists(path):
        os.makedirs(path)
    buildname = name
    dp = xbmcgui.DialogProgress()
    dp.create(AddonTitle, "Please wait while we get everything ready to",
              "download the " + buildname + " build.",
              "[B]Build: [/B]" + buildname)
    buildname = "build"
    lib = os.path.join(path, buildname + '.zip')

    try:
        os.remove(lib)
    except:
        pass

    if description.lower() != "null":
        hash = "null"
        while hash.lower() != description.lower():
            dialog = xbmcgui.Dialog()
            downloader.download(url, lib, dp)
            addonfolder = xbmc.translatePath(os.path.join(
                'special://', 'home'))
            dp.update(0, "", "Checking Zip File Integrity", "Please Wait..")
            hash = hashlib.md5(open(lib, 'rb').read()).hexdigest()
            if hash.lower() != description.lower():
                choice = xbmcgui.Dialog().yesno(
                    AddonTitle,
                    'Error: Unfortunatly the ZIP file hash does not match.',
                    'The file has therefore been flagged as corrupt.',
                    'Would you like to download the file again?',
                    nolabel='[B][COLOR lightskyblue]NO[/COLOR][/B]',
                    yeslabel='[B][COLOR yellowgreen]YES[/COLOR][/B]')
                if choice == 0:
                    try:
                        os.remove(lib)
                    except:
                        pass
                    sys.exit(1)
                else:
                    try:
                        os.remove(lib)
                    except:
                        pass
    else:
        dialog = xbmcgui.Dialog()
        downloader.download(url, lib, dp)
        addonfolder = xbmc.translatePath(os.path.join('special://', 'home'))
    dp.update(0, "Extracting Zip Please Wait", " ", " ")
    unzip(lib, addonfolder, dp)
    try:
        os.remove(lib)
    except:
        pass

    send_to_count = name + "|SPLIT|ECHO"
    add_download = Common.add_one(send_to_count)

    if os.path.isfile(FAVS_NEW):
        if os.path.isfile(FAVS):
            try:
                os.remove(FAVS)
                os.rename(FAVS_NEW, FAVS)
            except:
                pass
        else:
            try:
                os.rename(FAVS_NEW, FAVS)
            except:
                pass

    MARKER_TRAKT = xbmc.translatePath(os.path.join(TMP_TRAKT, 'marker.xml'))
    if os.path.isfile(MARKER_TRAKT):
        backup_zip = xbmc.translatePath(
            os.path.join(TMP_TRAKT, 'Restore_RD_Trakt_Settings.zip'))
        backuprestore.AUTO_READ_ZIP_TRAKT(backup_zip)
        _out = xbmc.translatePath(os.path.join('special://', 'home/tmp_trakt'))
        try:
            os.remove(MARKER_TRAKT)
            shutil.rmtree(_out)
            shutil.rmdir(_out)
        except:
            pass

    skin_swapped = 0
    skin = xbmc.getSkinDir()
    if "skin." in skin_used:
        #SWITCH THE SKIN IF THE CURRENT SKIN IS NOT CONFLUENCE
        if skin not in [skin_used]:
            skin_swapped = 1
            xbmc.executebuiltin("UpdateAddonRepos")
            xbmc.executebuiltin("UpdateLocalAddons")
            xbmc.executebuiltin("RefreshRSS")
            skin = skin_used if KODIV >= 17 else skin_used
            skinSwitch.swapSkins(skin)
            time.sleep(1)

        #IF A SKIN SWAP HAS HAPPENED CHECK IF AN OK DIALOG (CONFLUENCE INFO SCREEN) IS PRESENT, PRESS OK IF IT IS PRESENT
        if not xbmc.getCondVisibility("Window.isVisible(yesnodialog)"):
            xbmc.executebuiltin("Action(Select)")

        #IF THERE IS NOT A YES NO DIALOG (THE SCREEN ASKING YOU TO SWITCH TO CONFLUENCE) THEN SLEEP UNTIL IT APPEARS
        while not xbmc.getCondVisibility("Window.isVisible(yesnodialog)"):
            time.sleep(1)

    #WHILE THE YES NO DIALOG IS PRESENT PRESS LEFT AND THEN SELECT TO CONFIRM THE SWITCH TO CONFLUENCE.
        while xbmc.getCondVisibility("Window.isVisible(yesnodialog)"):
            xbmc.executebuiltin("Action(Left)")
            xbmc.executebuiltin("Action(Select)")
            time.sleep(1)

    skin = xbmc.getSkinDir()

    if skin != skin_used:
        if skin_swapped == 1:
            choice = xbmcgui.Dialog().yesno(
                AddonTitle,
                '[COLOR lightskyblue][B]ERROR: AUTOSWITCH WAS NOT SUCCESSFUL[/B][/COLOR]',
                '[COLOR lightskyblue][B]CLICK YES TO MANUALLY SWITCH NOW[/B][/COLOR]',
                '',
                yeslabel='[B][COLOR green]YES[/COLOR][/B]',
                nolabel='[B][COLOR lightskyblue]NO[/COLOR][/B]')
            if choice == 1:
                xbmc.executebuiltin("ActivateWindow(appearancesettings)")
                return
            else:
                sys.exit(1)

    if skin_swapped == 1:
        dialog.ok(
            AddonTitle,
            '[B][COLOR smokewhite]Your build has been installed.[/COLOR][/B]',
            '[B][COLOR orangered]YOU DO NOT NEED TO CLOSE KODI[/COLOR][/B].',
            '[COLOR white]Please press OK to enjoy your build![/COLOR]')
        xbmc.executebuiltin("ActivateWindow(Home)")
        sys.exit(1)
    else:
        dialog.ok(
            AddonTitle,
            "To save changes you now need to force close Kodi, Press OK to force close Kodi"
        )
        Common.killxbmc()
示例#18
0
def INSTALL_COMMUNITY(name, url, description):

    urla = url
    name, url, skin_used, developer = urla.split(',')
    skin = xbmc.getSkinDir()
    KODIV = float(xbmc.getInfoLabel("System.BuildVersion")[:4])
    skinswapped = 0

    raw_name = name.split('-')[0]

    if not "skin." in skin_used:
        skin_used = "NULL"

    #SWITCH THE SKIN IF THE CURRENT SKIN IS NOT CONFLUENCE
    if skin not in ['skin.confluence', 'skin.estuary']:
        choice = xbmcgui.Dialog().yesno(
            AddonTitle,
            '[COLOR lightskyblue][B]We can see that you are not using the default confluence skin.[/B][/COLOR]',
            '[COLOR lightskyblue][B]CLICK YES TO ATTEMPT TO AUTO SWITCH TO CONFLUENCE[/B][/COLOR]',
            '[COLOR lightskyblue][B]PLEASE DO NOT DO PRESS ANY BUTTONS OR MOVE THE MOUSE WHILE THIS PROCESS IS TAKING PLACE, IT IS AUTOMATIC[/B][/COLOR]',
            yeslabel='[B][COLOR green]YES[/COLOR][/B]',
            nolabel='[B][COLOR lightskyblue]NO[/COLOR][/B]')
        if choice == 0:
            sys.exit(1)
        skin = 'skin.estuary' if KODIV >= 17 else 'skin.confluence'
        skinSwitch.swapSkins(skin)
        skinswapped = 1
        time.sleep(1)

    #IF A SKIN SWAP HAS HAPPENED CHECK IF AN OK DIALOG (CONFLUENCE INFO SCREEN) IS PRESENT, PRESS OK IF IT IS PRESENT
    if skinswapped == 1:
        if not xbmc.getCondVisibility("Window.isVisible(yesnodialog)"):
            xbmc.executebuiltin("Action(Select)")

    #IF THERE IS NOT A YES NO DIALOG (THE SCREEN ASKING YOU TO SWITCH TO CONFLUENCE) THEN SLEEP UNTIL IT APPEARS
    if skinswapped == 1:
        while not xbmc.getCondVisibility("Window.isVisible(yesnodialog)"):
            time.sleep(1)

    #WHILE THE YES NO DIALOG IS PRESENT PRESS LEFT AND THEN SELECT TO CONFIRM THE SWITCH TO CONFLUENCE.
    if skinswapped == 1:
        while xbmc.getCondVisibility("Window.isVisible(yesnodialog)"):
            xbmc.executebuiltin("Action(Left)")
            xbmc.executebuiltin("Action(Select)")
            time.sleep(1)

    skin = xbmc.getSkinDir()

    #CHECK IF THE SKIN IS NOT CONFLUENCE
    if skin not in ['skin.confluence', 'skin.estuary']:
        if skinswapped == 1:
            choice = xbmcgui.Dialog().yesno(
                AddonTitle,
                '[COLOR lightskyblue][B]ERROR: AUTOSWITCH WAS NOT SUCCESFULL[/B][/COLOR]',
                '[COLOR lightskyblue][B]CLICK YES TO MANUALLY SWITCH TO CONFLUENCE NOW[/B][/COLOR]',
                '[COLOR lightskyblue][B]YOU CAN PRESS NO AND ATTEMPT THE AUTO SWITCH AGAIN IF YOU WISH[/B][/COLOR]',
                yeslabel='[B][COLOR green]YES[/COLOR][/B]',
                nolabel='[B][COLOR lightskyblue]NO[/COLOR][/B]')
            if choice == 1:
                xbmc.executebuiltin("ActivateWindow(appearancesettings)")
                return
            else:
                sys.exit(1)

    found_trakt = 0
    link = Common.OPEN_URL(BASEURL +
                           base64.b64decode(b'b3RoZXIvcmRfdHJha3QueG1s'))
    plugins = re.compile('<plugin>(.+?)</plugin>').findall(link)
    for match in plugins:
        ADDONPATH = xbmc.translatePath(os.path.join(ADDON_DATA, match))
        ADDONSETTINGS = xbmc.translatePath(
            os.path.join(ADDONPATH, 'settings.xml'))
        EXCLUDEMOVE = xbmc.translatePath(
            os.path.join(EXCLUDES_FOLDER, match + '_settings.xml'))

        if os.path.isfile(ADDONSETTINGS):
            found_trakt = 1

    found_favourites = 0
    if os.path.isfile(FAVS):
        found_favourites = 1

    keep_kodi_favs = 0
    keep_trakt_rd = 0

    if found_favourites == 1 and found_trakt == 1:
        found_c = 0
        dialog = xbmcgui.Dialog()
        choice = dialog.select(
            '[COLOR lightskyblue][B]TRAKT, RD & FAVOURITES DETECTED[/B][/COLOR]',
            [
                '[COLOR lightskyblue][B]KEEP BOTH RD, TRAKT & FAVOURITES[/B][/COLOR]',
                '[COLOR yellowgreen][B]Only Keep Trakt & Real Debrid Settings[/B][/COLOR]',
                '[COLOR yellowgreen][B]Only Keep Kodi Favourites[/B][/COLOR]',
                '[COLOR lightskyblue][B]Remove All Settings & Favourites[/B][/COLOR]'
            ])
        if choice == 0:
            keep_trakt_rd = 1
            keep_kodi_favs = 1
            found_c = 1
        if choice == 1:
            keep_trakt_rd = 1
            keep_kodi_favs = 0
            found_c = 1
        if choice == 2:
            keep_trakt_rd = 0
            keep_kodi_favs = 1
            found_c = 1
        if choice == 3:
            keep_trakt_rd = 0
            keep_kodi_favs = 0
            found_c = 1
        if found_c == 0:
            sys.exit(1)

    if found_favourites == 1 and found_trakt == 0:
        found_b = 0
        dialog = xbmcgui.Dialog()
        choice = dialog.select(
            '[COLOR lightskyblue][B]KODI FAVOURITES DETECTED[/B][/COLOR]', [
                '[COLOR yellowgreen][B]Yes, Keep Favourites[/B][/COLOR]',
                '[COLOR lightskyblue][B]No Use The Builds Favourites[/B][/COLOR]'
            ])
        if choice == 0:
            found_b = 1
            keep_kodi_favs = 1
        if choice == 1:
            found_b = 1
            keep_kodi_favs = 0
        if found_b == 0:
            sys.exit(1)

    if found_favourites == 0 and found_trakt == 1:
        found_a = 0
        dialog = xbmcgui.Dialog()
        choice = dialog.select(
            '[COLOR lightskyblue][B]TRAKT AND RD SETTINGS DETECTED[/B][/COLOR]',
            [
                '[COLOR yellowgreen][B]Yes, Keep Trakt & Real Debrid Settings[/B][/COLOR]',
                '[COLOR lightskyblue][B]No, Remove My Settings[/B][/COLOR]'
            ])
        if choice == 0:
            keep_trakt_rd = 1
            found_a = 1
        if choice == 1:
            keep_trakt_rd = 0
            found_a = 1
        if found_a == 0:
            sys.exit(1)

    if keep_trakt_rd == 1:
        backuprestore.AUTO_BACKUP_RD_TRAKT()

    wipe.WIPERESTORE(keep_kodi_favs)

    path = xbmc.translatePath(os.path.join('special://home/addons',
                                           'packages'))
    if not os.path.exists(path):
        os.makedirs(path)
    buildname = name
    raw_name_string = str(raw_name)
    raw_name = raw_name_string.replace('[B]', '').replace('[/B]', '')
    dp = xbmcgui.DialogProgress()
    dp.create(AddonTitle, "Please wait while we get everything ready to",
              "download the " + raw_name + " build.", " ")
    buildname = "build"
    lib = os.path.join(path, buildname + '.zip')
    try:
        os.remove(lib)
    except:
        pass
    dialog = xbmcgui.Dialog()
    dp.update(0, "", "", "[B]Build: [/B]" + raw_name)
    downloader.download(url, lib, dp)
    addonfolder = xbmc.translatePath(os.path.join('special://', 'home'))
    dp.update(0, "", "Extracting Zip File", "")
    unzip(lib, addonfolder, dp)
    time.sleep(1)
    send_to_count = name + "|SPLIT|" + developer
    add_download = Common.add_one(send_to_count)
    try:
        os.remove(lib)
    except:
        pass

    if os.path.isfile(FAVS_NEW):
        if os.path.isfile(FAVS):
            try:
                os.remove(FAVS)
                os.rename(FAVS_NEW, FAVS)
            except:
                pass
        else:
            try:
                os.rename(FAVS_NEW, FAVS)
            except:
                pass

    MARKER_TRAKT = xbmc.translatePath(os.path.join(TMP_TRAKT, 'marker.xml'))
    if os.path.isfile(MARKER_TRAKT):
        backup_zip = xbmc.translatePath(
            os.path.join(TMP_TRAKT, 'Restore_RD_Trakt_Settings.zip'))
        backuprestore.AUTO_READ_ZIP_TRAKT(backup_zip)
        _out = xbmc.translatePath(os.path.join('special://', 'home/tmp_trakt'))
        try:
            os.remove(MARKER_TRAKT)
            shutil.rmtree(_out)
            shutil.rmdir(_out)
        except:
            pass

    skin_swapped = 0
    skin = xbmc.getSkinDir()
    if "skin." in skin_used:
        #SWITCH THE SKIN IF THE CURRENT SKIN IS NOT CONFLUENCE
        if skin not in [skin_used]:
            skin_swapped = 1
            xbmc.executebuiltin("UpdateAddonRepos")
            xbmc.executebuiltin("UpdateLocalAddons")
            xbmc.executebuiltin("RefreshRSS")
            skin = skin_used if KODIV >= 17 else skin_used
            skinSwitch.swapSkins(skin)
            time.sleep(1)

        #IF A SKIN SWAP HAS HAPPENED CHECK IF AN OK DIALOG (CONFLUENCE INFO SCREEN) IS PRESENT, PRESS OK IF IT IS PRESENT
        if not xbmc.getCondVisibility("Window.isVisible(yesnodialog)"):
            xbmc.executebuiltin("Action(Select)")

        #IF THERE IS NOT A YES NO DIALOG (THE SCREEN ASKING YOU TO SWITCH TO CONFLUENCE) THEN SLEEP UNTIL IT APPEARS
        while not xbmc.getCondVisibility("Window.isVisible(yesnodialog)"):
            time.sleep(1)

    #WHILE THE YES NO DIALOG IS PRESENT PRESS LEFT AND THEN SELECT TO CONFIRM THE SWITCH TO CONFLUENCE.
        while xbmc.getCondVisibility("Window.isVisible(yesnodialog)"):
            xbmc.executebuiltin("Action(Left)")
            xbmc.executebuiltin("Action(Select)")
            time.sleep(1)

    skin = xbmc.getSkinDir()

    if skin != skin_used:
        if skin_swapped == 1:
            choice = xbmcgui.Dialog().yesno(
                AddonTitle,
                '[COLOR lightskyblue][B]ERROR: AUTOSWITCH WAS NOT SUCCESFULL[/B][/COLOR]',
                '[COLOR lightskyblue][B]CLICK YES TO MANUALLY SWITCH NOW[/B][/COLOR]',
                '',
                yeslabel='[B][COLOR green]YES[/COLOR][/B]',
                nolabel='[B][COLOR lightskyblue]NO[/COLOR][/B]')
            if choice == 1:
                xbmc.executebuiltin("ActivateWindow(appearancesettings)")
                return
            else:
                sys.exit(1)

    if skin_swapped == 1:
        open(COMMUNITY_BUILD, 'w')
        dialog.ok(
            AddonTitle,
            '[B][COLOR smokewhite]Your build has been installed.[/COLOR][/B]',
            '[B][COLOR orangered]YOU DO NOT NEED TO CLOSE KODI[/COLOR][/B].',
            '[COLOR white]Please press OK to enjoy your build![/COLOR]')
        xbmc.executebuiltin("ActivateWindow(Home)")
        sys.exit(1)
    else:
        open(COMMUNITY_BUILD, 'w')
        dialog.ok(
            AddonTitle,
            "To save changes you now need to force close Kodi, Press OK to force close Kodi"
        )
        Common.killxbmc()
示例#19
0
def INSTALLLIB(name, url, description):

    dp = xbmcgui.DialogProgress()
    dp.create(AddonTitle, "", "", "")

    if "Android" in name:
        if not xbmc.getCondVisibility('system.platform.android'):
            dialog = xbmcgui.Dialog()
            dialog.ok(
                AddonTitle + " - Android",
                "[B][COLOR smokewhite]Sorry, this file is only for Android devices[/COLOR][/B]",
                '[COLOR smokewhite]Thank you for using ECHO Wizard[/COLOR]')
            sys.exit(1)
        else:
            name = "librtmp.so"
            path = xbmc.translatePath(os.path.join('special://home', ''))

    if "Windows" in name:
        if not xbmc.getCondVisibility('system.platform.windows'):
            dialog = xbmcgui.Dialog()
            dialog.ok(
                AddonTitle + " - Windows",
                "[B][COLOR smokewhite]Sorry, this file is only for Windows devices[/COLOR][/B]",
                '[COLOR smokewhite]Thank you for using ECHO Wizard[/COLOR]')
            sys.exit(1)
        else:
            name = "librtmp.dll"
            path = 'C:\Program Files (x86)\Kodi\system\players\dvdplayer'
            if not os.path.exists(path):
                path = 'C:\Program Files\Kodi\system\players\dvdplayer'
            lib = os.path.join(path, name)
            try:
                os.remove(lib)
            except:
                dialog = xbmcgui.Dialog()
                dialog.ok(
                    AddonTitle + " - Windows",
                    "[B][COLOR smokewhite]Sorry, we could not remove the old lib file[/COLOR][/B]",
                    '[COLOR smokewhite]Please run Kodi as ADMINISTRATOR and try again.[/COLOR]'
                )
                sys.exit(1)

    if "Linux" in name:
        if not xbmc.getCondVisibility('system.platform.linux'):
            dialog = xbmcgui.Dialog()
            dialog.ok(
                AddonTitle + " - Linux",
                "[B][COLOR smokewhite]Sorry, this file is only for Linux devices[/COLOR][/B]",
                '[COLOR smokewhite]Thank you for using ECHO Wizard[/COLOR]')
            sys.exit(1)
        else:
            name = "librtmp.so.1"
            path = xbmc.translatePath(os.path.join('special://home', ''))

    if "osx" in name:
        if not xbmc.getCondVisibility('system.platform.osx'):
            dialog = xbmcgui.Dialog()
            dialog.ok(
                AddonTitle + " - MacOSX",
                "[B][COLOR smokewhite]Sorry, this file is only for MacOSX devices[/COLOR][/B]",
                '[COLOR smokewhite]Thank you for using ECHO Wizard[/COLOR]')
            sys.exit(1)
        else:
            name = "librtmp.1.dylib"
            path = xbmc.translatePath(os.path.join('special://home', ''))

    if "ATV" in name:
        if not xbmc.getCondVisibility('system.platform.atv2'):
            dialog = xbmcgui.Dialog()
            dialog.ok(
                AddonTitle + " - ATV",
                "[B][COLOR smokewhite]Sorry, this file is only for ATV devices[/COLOR][/B]",
                '[COLOR smokewhite]Thank you for using ECHO Wizard[/COLOR]')
            sys.exit(1)
        else:
            name = "librtmp.1.dylib"
            path = xbmc.translatePath(os.path.join('special://home', ''))

    if "iOS" in name:
        if not xbmc.getCondVisibility('system.platform.ios'):
            dialog = xbmcgui.Dialog()
            dialog.ok(
                AddonTitle + " - iOS",
                "[B][COLOR smokewhite]Sorry, this file is only for iOS devices[/COLOR][/B]",
                '[COLOR smokewhite]Thank you for using ECHO Wizard[/COLOR]')
            sys.exit(1)
        else:
            name = "librtmp.1.dylib"
            path = xbmc.translatePath(os.path.join('special://home', ''))

    if "RPi" in name:
        if not xbmc.getCondVisibility('system.platform.rpi'):
            dialog = xbmcgui.Dialog()
            dialog.ok(
                AddonTitle + " - RPi",
                "[B][COLOR smokewhite]Sorry, this file is only for RPi devices[/COLOR][/B]",
                '[COLOR smokewhite]Thank you for using ECHO Wizard[/COLOR]')
            sys.exit(1)
        else:
            name = "librtmp.1.so"
            path = xbmc.translatePath(os.path.join('special://home', ''))

    lib = os.path.join(path, name)
    try:
        os.remove(lib)
    except:
        pass
    downloader.download(url, lib, dp)
    dialog = xbmcgui.Dialog()
    dialog.ok(
        AddonTitle,
        "[COLOR smokewhite]Download complete, Lib Location: [/COLOR][COLOR white]"
        + lib + "[/COLOR]")
示例#20
0
def router(params):
    action = params.get('action')
    id = params.get('id')
    name = params.get('name')
    title = params.get('title')
    year = params.get('year')
    imdb = params.get('imdb')
    tmdb = params.get('tmdb')
    tvdb = params.get('tvdb')
    season = params.get('season')
    episode = params.get('episode')
    tvshowtitle = params.get('tvshowtitle')
    type = params.get('type')
    url = params.get('url')
    query = params.get('query')
    source = params.get('source')

    if action is None:
        from resources.lib.menus import navigator
        isUpdate = control.homeWindow.getProperty('venom.updated')
        if isUpdate == 'true':
            control.execute(
                'RunPlugin(plugin://plugin.video.venom/?action=tools_cleanSettings)'
            )
            control.homeWindow.clearProperty('venom.updated')
            from resources.lib.modules import changelog
            changelog.get()
        navigator.Navigator().root()

    ####################################################
    #---MOVIES
    ####################################################
    elif action == 'movieNavigator':
        from resources.lib.menus import navigator
        navigator.Navigator().movies()

    elif action == 'movieliteNavigator':
        from resources.lib.menus import navigator
        navigator.Navigator().movies(lite=True)

    elif action == 'mymovieNavigator':
        from resources.lib.menus import navigator
        navigator.Navigator().mymovies()

    elif action == 'mymovieliteNavigator':
        from resources.lib.menus import navigator
        navigator.Navigator().mymovies(lite=True)

    elif action == 'movies':
        from resources.lib.menus import movies
        movies.Movies().get(url)

    elif action == 'moviePage':
        from resources.lib.menus import movies
        movies.Movies().get(url)

    elif action == 'tmdbmovies':
        from resources.lib.menus import movies
        movies.Movies().getTMDb(url)

    elif action == 'tmdbmoviePage':
        from resources.lib.menus import movies
        movies.Movies().getTMDb(url)

    elif action == 'movieSearch':
        from resources.lib.menus import movies
        movies.Movies().search()

    elif action == 'movieSearchnew':
        from resources.lib.menus import movies
        movies.Movies().search_new()

    elif action == 'movieSearchterm':
        from resources.lib.menus import movies
        movies.Movies().search_term(name)

    elif action == 'moviePerson':
        from resources.lib.menus import movies
        movies.Movies().person()

    elif action == 'movieGenres':
        from resources.lib.menus import movies
        movies.Movies().genres()

    elif action == 'movieLanguages':
        from resources.lib.menus import movies
        movies.Movies().languages()

    elif action == 'movieCertificates':
        from resources.lib.menus import movies
        movies.Movies().certifications()

    elif action == 'movieYears':
        from resources.lib.menus import movies
        movies.Movies().years()

    elif action == 'moviePersons':
        from resources.lib.menus import movies
        movies.Movies().persons(url)

    elif action == 'moviesUnfinished':
        from resources.lib.menus import movies
        movies.Movies().unfinished(url)

    elif action == 'movieUserlists':
        from resources.lib.menus import movies
        movies.Movies().userlists()

    elif action == 'movies_traktUnfinishedManager':
        from resources.lib.menus import movies
        movies.Movies().unfinishedManager()

    ####################################################
    #---Collections
    ####################################################
    elif action and action.startswith('collections'):
        if action == 'collections_Navigator':
            from resources.lib.menus import collections
            collections.Collections().collections_Navigator()
        elif action == 'collections_Boxset':
            from resources.lib.menus import collections
            collections.Collections().collections_Boxset()
        elif action == 'collections_Kids':
            from resources.lib.menus import collections
            collections.Collections().collections_Kids()
        elif action == 'collections_BoxsetKids':
            from resources.lib.menus import collections
            collections.Collections().collections_BoxsetKids()
        elif action == 'collections_Superhero':
            from resources.lib.menus import collections
            collections.Collections().collections_Superhero()
        elif action == 'collections_MartialArts':
            from resources.lib.menus import collections
            collections.Collections().collections_martial_arts()
        elif action == 'collections_MartialArtsActors':
            from resources.lib.menus import collections
            collections.Collections().collections_martial_arts_actors()
        elif action == 'collections':
            from resources.lib.menus import collections
            collections.Collections().get(url)

    ####################################################
    #---Furk
    ####################################################
    elif action and action.startswith('furk'):
        if action == "furkNavigator":
            from resources.lib.menus import navigator
            navigator.Navigator().furk()
        elif action == "furkUserFiles":
            from resources.lib.menus import furk
            furk.Furk().user_files()
        elif action == "furkMetaSearch":
            from resources.lib.menus import furk
            furk.Furk().furk_meta_search(url)
        elif action == "furkSearch":
            from resources.lib.menus import furk
            furk.Furk().search()
        elif action == "furkSearchNew":
            from resources.lib.menus import furk
            furk.Furk().search_new()

    ####################################################
    # TV Shows
    ####################################################
    # if action and action.startswith('tv_'):
    elif action == 'tvNavigator':
        from resources.lib.menus import navigator
        navigator.Navigator().tvshows()

    elif action == 'tvliteNavigator':
        from resources.lib.menus import navigator
        navigator.Navigator().tvshows(lite=True)

    elif action == 'mytvNavigator':
        from resources.lib.menus import navigator
        navigator.Navigator().mytvshows()

    elif action == 'mytvliteNavigator':
        from resources.lib.menus import navigator
        navigator.Navigator().mytvshows(lite=True)

    elif action == 'tvshows':
        from resources.lib.menus import tvshows
        tvshows.TVshows().get(url)

    elif action == 'tvshowPage':
        from resources.lib.menus import tvshows
        tvshows.TVshows().get(url)

    elif action == 'tmdbTvshows':
        from resources.lib.menus import tvshows
        tvshows.TVshows().getTMDb(url)

    elif action == 'tmdbTvshowPage':
        from resources.lib.menus import tvshows
        tvshows.TVshows().getTMDb(url)

    elif action == 'tvmazeTvshows':
        from resources.lib.menus import tvshows
        tvshows.TVshows().getTVmaze(url)

    elif action == 'tvmazeTvshowPage':
        from resources.lib.menus import tvshows
        tvshows.TVshows().getTVmaze(url)

    elif action == 'tvSearch':
        from resources.lib.menus import tvshows
        tvshows.TVshows().search()

    elif action == 'tvSearchnew':
        from resources.lib.menus import tvshows
        tvshows.TVshows().search_new()

    elif action == 'tvSearchterm':
        from resources.lib.menus import tvshows
        tvshows.TVshows().search_term(name)

    elif action == 'tvPerson':
        from resources.lib.menus import tvshows
        tvshows.TVshows().person()

    elif action == 'tvGenres':
        from resources.lib.menus import tvshows
        tvshows.TVshows().genres()

    elif action == 'tvNetworks':
        from resources.lib.menus import tvshows
        tvshows.TVshows().networks()

    elif action == 'tvLanguages':
        from resources.lib.menus import tvshows
        tvshows.TVshows().languages()

    elif action == 'tvCertificates':
        from resources.lib.menus import tvshows
        tvshows.TVshows().certifications()

    elif action == 'tvPersons':
        from resources.lib.menus import tvshows
        tvshows.TVshows().persons(url)

    elif action == 'tvUserlists':
        from resources.lib.menus import tvshows
        tvshows.TVshows().userlists()

    elif action == 'tvOriginals':
        from resources.lib.menus import tvshows
        tvshows.TVshows().originals()

    elif action == 'shows_traktHiddenManager':
        from resources.lib.menus import tvshows
        tvshows.TVshows().traktHiddenManager()

    ####################################################
    #---SEASONS
    ####################################################
    elif action == 'seasons':
        from resources.lib.menus import seasons
        art = params.get('art')
        seasons.Seasons().get(tvshowtitle, year, imdb, tmdb, tvdb, art)

    ####################################################
    #---EPISODES
    ####################################################
    elif action == 'episodes':
        from resources.lib.menus import episodes
        meta = params.get('meta')
        episodes.Episodes().get(tvshowtitle, year, imdb, tmdb, tvdb, meta,
                                season, episode)

    elif action == 'calendar':
        from resources.lib.menus import episodes
        episodes.Episodes().calendar(url)

    elif action == 'upcomingProgress':
        from resources.lib.menus import episodes
        episodes.Episodes().upcoming_progress(url)

    elif action == 'calendars':
        from resources.lib.menus import episodes
        episodes.Episodes().calendars()

    elif action == 'episodesUnfinished':
        from resources.lib.menus import episodes
        episodes.Episodes().unfinished(url)

    elif action == 'episodesUserlists':
        from resources.lib.menus import episodes
        episodes.Episodes().userlists()

    elif action == 'episodes_traktUnfinishedManager':
        from resources.lib.menus import episodes
        episodes.Episodes().unfinishedManager()

    ####################################################
    #---Premium Services
    ####################################################
    elif action == 'premiumNavigator':
        from resources.lib.menus import navigator
        navigator.Navigator().premium_services()

    elif action and action.startswith('pm_'):
        if action == 'pm_ServiceNavigator':
            from resources.lib.menus import navigator
            navigator.Navigator().premiumize_service()
        elif action == 'pm_AccountInfo':
            from resources.lib.debrid import premiumize
            premiumize.Premiumize().account_info_to_dialog()
        # elif action == 'pm_Authorize':
        # from resources.lib.debrid import premiumize
        # premiumize.Premiumize().auth()
        elif action == 'pm_MyFiles':
            from resources.lib.debrid import premiumize
            premiumize.Premiumize().my_files_to_listItem(id, name)
        elif action == 'pm_Transfers':
            from resources.lib.debrid import premiumize
            premiumize.Premiumize().user_transfers_to_listItem()
        elif action == 'pm_Rename':
            from resources.lib.debrid import premiumize
            premiumize.Premiumize().rename(type, id, name)
        elif action == 'pm_Delete':
            from resources.lib.debrid import premiumize
            premiumize.Premiumize().delete(type, id, name)
        elif action == 'pm_DeleteTransfer':
            from resources.lib.debrid import premiumize
            premiumize.Premiumize().delete_transfer(id, name)
        elif action == 'pm_ClearFinishedTransfers':  # disabled for now till PM fixes
            from resources.lib.debrid import premiumize
            premiumize.Premiumize().clear_finished_transfers()

    elif action and action.startswith('rd_'):
        if action == 'rd_ServiceNavigator':
            from resources.lib.menus import navigator
            navigator.Navigator().realdebrid_service()
        elif action == 'rd_AccountInfo':
            from resources.lib.debrid import realdebrid
            realdebrid.RealDebrid().account_info_to_dialog()
        # elif action == 'rd_Authorize':
        # from resources.lib.debrid import realdebrid
        # realdebrid.RealDebrid().auth()
        elif action == 'rd_UserTorrentsToListItem':
            from resources.lib.debrid import realdebrid
            realdebrid.RealDebrid().user_torrents_to_listItem()
        elif action == 'rd_MyDownloads':
            from resources.lib.debrid import realdebrid
            realdebrid.RealDebrid().my_downloads_to_listItem(int(query))
        elif action == 'rd_BrowseUserTorrents':
            from resources.lib.debrid import realdebrid
            realdebrid.RealDebrid().browse_user_torrents(id)
        elif action == 'rd_DeleteUserTorrent':
            from resources.lib.debrid import realdebrid
            realdebrid.RealDebrid().delete_user_torrent(id, name)
        elif action == 'rd_DeleteDownload':
            from resources.lib.debrid import realdebrid
            realdebrid.RealDebrid().delete_download(id, name)

    elif action and action.startswith('ad_'):
        if action == 'ad_ServiceNavigator':
            from resources.lib.menus import navigator
            navigator.Navigator().alldebrid_service()
        elif action == 'ad_AccountInfo':
            from resources.lib.debrid import alldebrid
            alldebrid.AllDebrid().account_info_to_dialog()
        # elif action == 'ad_Authorize':
        # from resources.lib.debrid import alldebrid
        # alldebrid.AllDebrid().auth()
        elif action == 'ad_Transfers':
            from resources.lib.debrid import alldebrid
            alldebrid.AllDebrid().user_transfers_to_listItem()
        elif action == 'ad_CloudStorage':
            from resources.lib.debrid import alldebrid
            alldebrid.AllDebrid().user_cloud_to_listItem()
        elif action == 'ad_BrowseUserCloud':
            from resources.lib.debrid import alldebrid
            alldebrid.AllDebrid().browse_user_cloud(source)
        elif action == 'ad_DeleteTransfer':
            from resources.lib.debrid import alldebrid
            alldebrid.AllDebrid().delete_transfer(id, name, silent=False)
        elif action == 'ad_RestartTransfer':
            from resources.lib.debrid import alldebrid
            alldebrid.AllDebrid().restart_transfer(id, name, silent=False)

    ####################################################
    #---Anime
    ####################################################
    elif action and action.startswith('anime_'):
        if action == 'anime_Navigator':
            from resources.lib.menus import navigator
            navigator.Navigator().anime()
        elif action == 'anime_Movies':
            from resources.lib.menus import movies
            movies.Movies().get(url)
        elif action == 'anime_TVshows':
            from resources.lib.menus import tvshows
            tvshows.TVshows().get(url)

    ####################################################
    #---YouTube
    ####################################################
    elif action == 'youtube':
        from resources.lib.menus import youtube
        if id is None: youtube.yt_index().root(action)
        else: youtube.yt_index().get(action, id)

    elif action == 'sectionItem':
        pass  # Placeholder. This is a non-clickable menu item for notes, etc.

    ####################################################
    #---Download
    ####################################################
    elif action and action.startswith('download'):
        if action == 'downloadNavigator':
            from resources.lib.menus import navigator
            navigator.Navigator().downloads()
        elif action == 'download':
            caller = params.get('caller')
            image = params.get('image')
            if caller == 'sources':  # future, move to downloader module for pack support
                control.busy()
                try:
                    from json import loads as jsloads
                    from resources.lib.modules import sources
                    from resources.lib.modules import downloader
                    downloader.download(
                        name, image,
                        sources.Sources().sourcesResolve(jsloads(source)[0]),
                        title)
                except:
                    import traceback
                    traceback.print_exc()
            if caller == 'premiumize':
                control.busy()
                try:
                    from resources.lib.modules import downloader
                    from resources.lib.debrid import premiumize
                    downloader.download(
                        name, image,
                        premiumize.Premiumize().add_headers_to_url(
                            url.replace(' ', '%20')))
                except:
                    import traceback
                    traceback.print_exc()
            if caller == 'realdebrid':
                control.busy()
                try:
                    from resources.lib.modules import downloader
                    from resources.lib.debrid import realdebrid
                    if type == 'unrestrict':
                        downloader.download(
                            name, image,
                            realdebrid.RealDebrid().unrestrict_link(
                                url.replace(' ', '%20')))
                    else:
                        downloader.download(name, image,
                                            url.replace(' ', '%20'))
                except:
                    import traceback
                    traceback.print_exc()
            if caller == 'alldebrid':
                control.busy()
                try:
                    from resources.lib.modules import downloader
                    from resources.lib.debrid import alldebrid
                    downloader.download(
                        name, image,
                        alldebrid.AllDebrid().unrestrict_link(
                            url.replace(' ', '%20')))
                except:
                    import traceback
                    traceback.print_exc()

    ####################################################
    #---Tools
    ####################################################
    elif action and action.startswith('tools_'):
        if action == 'tools_ShowNews':
            from resources.lib.modules import newsinfo
            newsinfo.news()
        elif action == 'tools_ShowChangelog':
            from resources.lib.modules import changelog
            changelog.get()
        elif action == 'tools_ShowHelp':
            from resources.help import help
            help.get(name)
        elif action == 'tools_LanguageInvoker':
            from resources.lib.modules import language_invoker
            language_invoker.set_reuselanguageinvoker()
        elif action == 'tools_toolNavigator':
            from resources.lib.menus import navigator
            navigator.Navigator().tools()
        elif action == 'tools_traktToolsNavigator':
            from resources.lib.menus import navigator
            navigator.Navigator().traktTools()
        elif action == 'tools_searchNavigator':
            from resources.lib.menus import navigator
            navigator.Navigator().search()
        elif action == 'tools_viewsNavigator':
            from resources.lib.menus import navigator
            navigator.Navigator().views()
        elif action == 'tools_addView':
            from resources.lib.modules import views
            content = params.get('content')
            views.addView(content)
        elif action == 'tools_resetViewTypes':
            from resources.lib.modules import views
            views.clearViews()
        elif action == 'tools_cleanSettings':
            from resources.lib.modules import clean_settings
            clean_settings.clean_settings()
        elif action == 'tools_openMyAccount':
            from myaccounts import openMASettings
            from resources.lib.modules import my_accounts
            openMASettings(query)
            control.sleep(500)
            while control.condVisibility('Window.IsVisible(addonsettings)'
                                         ) or control.homeWindow.getProperty(
                                             'myaccounts.active') == 'true':
                control.sleep(500)
            control.sleep(100)
            my_accounts.syncMyAccounts()
            control.sleep(100)
            if params.get('opensettings') == 'true':
                control.openSettings(params.get('query2'),
                                     'plugin.video.venom')
        elif action == 'tools_syncMyAccount':
            from resources.lib.modules import my_accounts
            my_accounts.syncMyAccounts()
            if params.get('opensettings') == 'true':
                control.openSettings(query, 'plugin.video.venom')
        elif action == 'tools_traktAcctMyAccounts':
            control.execute(
                'RunScript(script.module.myaccounts, action=traktAcct)')
        elif action == 'tools_adAcctMyAccounts':
            control.execute(
                'RunScript(script.module.myaccounts, action=alldebridAcct)')
        elif action == 'tools_pmAcctMyAccounts':
            control.execute(
                'RunScript(script.module.myaccounts, action=premiumizeAcct)')
        elif action == 'tools_rdAcctMyAccounts':
            control.execute(
                'RunScript(script.module.myaccounts, action=realdebridAcct)')
        elif action == 'tools_openSettings':
            control.openSettings(query)
        elif action == 'tools_contextVenomSettings':
            control.openSettings('0.0', 'context.venom')
            control.trigger_widget_refresh()
        elif action == 'tools_fenomscrapersSettings':
            control.openSettings('0.0', 'script.module.fenomscrapers')
        elif action == 'tools_traktManager':
            from resources.lib.modules import trakt
            watched = (params.get('watched')
                       == 'True') if params.get('watched') else None
            unfinished = (params.get('unfinished')
                          == 'True') if params.get('unfinished') else False
            trakt.manager(name,
                          imdb,
                          tvdb,
                          season,
                          episode,
                          watched=watched,
                          unfinished=unfinished)
        elif action == 'tools_cachesyncMovies':
            from resources.lib.modules import trakt
            trakt.cachesyncMovies(int(params.get('timeout')))
        elif action == 'tools_cachesyncTVShows':
            from resources.lib.modules import trakt
            trakt.cachesyncTVShows(int(params.get('timeout')))
        elif action == 'tools_syncTraktProgress':
            from resources.lib.modules import trakt
            trakt.sync_progress()
        elif action == 'tools_syncTraktWatched':
            from resources.lib.modules import trakt
            trakt.sync_watched()

    ####################################################
    #---Play
    ####################################################
    elif action and action.startswith('play_'):
        if action == 'play_Item':
            from resources.lib.modules import sources
            premiered = params.get('premiered')
            meta = params.get('meta')
            select = params.get('select')
            rescrape = params.get('rescrape')
            sources.Sources().play(title, year, imdb, tmdb, tvdb, season,
                                   episode, tvshowtitle, premiered, meta,
                                   select, rescrape)

            # if episode and control.homeWindow.getProperty('venom.isplaying.playlist') != 'true':
            # if int(episode) != 1: control.playlist.clear()
            # import xbmc
            # enable_playnext = control.setting('enable.playnext') == 'true'
            # media_type = 'movie' if tvshowtitle is None else 'episode'
            # rescrape = params.get('rescrape')
            # select = params.get('select')
            # if control.homeWindow.getProperty('venom.isplaying.playlist') == 'true' or enable_playnext is False or media_type == 'movie' or rescrape or select == '0':
            # try:
            # if control.homeWindow.getProperty('venom.isplaying.playlist') == 'true':
            # xbmc.log('[ plugin.video.venom ] venom.isplaying.playlist = %s' % control.homeWindow.getProperty('venom.isplaying.playlist'), 1)
            # from resources.lib.modules import sources
            # premiered = params.get('premiered')
            # meta = params.get('meta')
            # xbmc.log('[ plugin.video.venom ] control.playlist.size() = %s' % control.playlist.size(), 1)
            # xbmc.log('[ plugin.video.venom ] control.playlist.getposition() = %s' % control.playlist.getposition(), 1)
            # xbmc.log('[ plugin.video.venom ] Calling....sources.Sources().play()', 1)
            # if int(control.playlist.getposition()) == -1 or (int(control.playlist.getposition()) == (control.playlist.size() - 1)):
            # control.homeWindow.clearProperty('venom.isplaying.playlist')
            # sources.Sources().play(title, year, imdb, tmdb, tvdb, season, episode, tvshowtitle, premiered, meta, select, rescrape)
            # except:
            # import traceback
            # traceback.print_exc()
            # else:
            # try:
            # xbmc.log('[ plugin.video.venom ] control.playlist.size() = %s' % control.playlist.size(), 1)
            # is_widget = 'plugin' not in control.infoLabel('Container.PluginName')
            # if is_widget:
            # control.playlist.clear()
            # control.cancelPlayback()

            # # control.playlist.clear()
            # # control.cancelPlayback()

            # if control.playlist.size() <= 1:
            # current_ep = episode
            # xbmc.log('[ plugin.video.venom ] current_ep = %s' % current_ep, 1)
            # from json import dumps as jsdumps
            # from resources.lib.menus import episodes
            # meta = params.get('meta')
            # items = episodes.Episodes().get(tvshowtitle, year, imdb, tmdb, tvdb, meta, season, episode, create_directory=False)
            # control.playlist.clear()
            # for i in items:
            # title = i['title']
            # systitle = quote_plus(title)
            # year = i['year']
            # imdb = i['imdb']
            # tmdb = i['tmdb']
            # tvdb = i['tvdb']
            # season = i['season']
            # episode = i['episode']
            # tvshowtitle = i['tvshowtitle']
            # systvshowtitle = quote_plus(tvshowtitle)
            # premiered = i['premiered']
            # sysmeta = quote_plus(jsdumps(i))
            # url = 'plugin://plugin.video.venom/?action=play_Item&title=%s&year=%s&imdb=%s&tmdb=%s&tvdb=%s&season=%s&episode=%s&tvshowtitle=%s&premiered=%s&meta=%s&select=1' % (
            # systitle, year, imdb, tmdb, tvdb, season, episode, systvshowtitle, premiered, sysmeta)
            # item = control.item(label=title, offscreen=True)
            # # item.setProperty('IsPlayable', 'true')
            # control.playlist.add(url=url, listitem=item)
            # control.homeWindow.setProperty('venom.isplaying.playlist', 'true')
            # playlist_urls = [control.playlist[i].getPath() for i in range(control.playlist.size())]
            # xbmc.log('[ plugin.video.venom ] control.playlist.size() = %s' % control.playlist.size(), 1)
            # xbmc.log('[ plugin.video.venom ] playlist_urls = %s' % playlist_urls, 1)
            # xbmc.log('[ plugin.video.venom ] Calling....control.player2().play(control.playlist)', 1)
            # control.player2().play(control.playlist)
            # return
            # except:
            # control.homeWindow.clearProperty('venom.isplaying.playlist')
            # import traceback
            # traceback.print_exc()

        elif action == "play_preScrapeNext":
            from resources.lib.modules.player import PlayNext
            PlayNext().prescrapeNext()

        elif action == "play_nextWindowXML":
            from resources.lib.modules.player import PlayNext
            play_next = PlayNext()
            play_next.display_xml()
            del play_next

        elif action == 'play_All':  # context menu works same as "Play from Here"
            control.player2().play(control.playlist)

        elif action == 'play_URL':
            caller = params.get('caller')
            if caller == 'realdebrid':
                from resources.lib.debrid import realdebrid
                if type == 'unrestrict':
                    control.player.play(
                        realdebrid.RealDebrid().unrestrict_link(
                            url.replace(' ', '%20')))
                else:
                    control.player.play(url.replace(' ', '%20'))
            elif caller == 'alldebrid':
                from resources.lib.debrid import alldebrid
                if type == 'unrestrict':
                    control.player.play(alldebrid.AllDebrid().unrestrict_link(
                        url.replace(' ', '%20')))
                else:
                    control.player.play(url.replace(' ', '%20'))
            else:
                control.player.play(url.replace(' ', '%20'))

        elif action == 'play_EpisodesList':  # global context option
            from json import dumps as jsdumps
            from resources.lib.menus import episodes
            meta = params.get('meta')
            items = episodes.Episodes().get(tvshowtitle,
                                            year,
                                            imdb,
                                            tmdb,
                                            tvdb,
                                            meta,
                                            season,
                                            episode,
                                            create_directory=False)
            control.playlist.clear()
            for i in items:
                title = i['title']
                systitle = quote_plus(title)
                year = i['year']
                imdb = i['imdb']
                tmdb = i['tmdb']
                tvdb = i['tvdb']
                season = i['season']
                episode = i['episode']
                tvshowtitle = i['tvshowtitle']
                systvshowtitle = quote_plus(tvshowtitle)
                premiered = i['premiered']
                sysmeta = quote_plus(jsdumps(i))
                url = 'plugin://plugin.video.venom/?action=play_Item&title=%s&year=%s&imdb=%s&tmdb=%s&tvdb=%s&season=%s&episode=%s&tvshowtitle=%s&premiered=%s&meta=%s&select=1' % (
                    systitle, year, imdb, tmdb, tvdb, season, episode,
                    systvshowtitle, premiered, sysmeta)
                item = control.item(label=title, offscreen=True)
                control.playlist.add(url=url, listitem=item)
            control.player2().play(control.playlist)

        elif action == 'play_Trailer':
            from resources.lib.modules import trailer
            windowedtrailer = params.get('windowedtrailer')
            windowedtrailer = int(windowedtrailer) if windowedtrailer in (
                "0", "1") else 0
            trailer.Trailer().play(type, name, year, url, imdb,
                                   windowedtrailer)

        elif action == 'play_Random':
            rtype = params.get('rtype')
            if rtype == 'movie':
                from resources.lib.menus import movies
                rlist = movies.Movies().get(url, create_directory=False)
                xbmc.log('movie rlist=%s' % rlist, 1)
                xbmc.log('url=%s' % url, 1)
                r = 'plugin://plugin.video.venom/?action=play_Item'
            elif rtype == 'episode':
                from resources.lib.menus import episodes
                meta = params.get('meta')
                rlist = episodes.Episodes().get(tvshowtitle,
                                                year,
                                                imdb,
                                                tmdb,
                                                tvdb,
                                                meta,
                                                season,
                                                create_directory=False)
                r = 'plugin://plugin.video.venom/?action=play_Item'
            elif rtype == 'season':
                from resources.lib.menus import seasons
                art = params.get('art')
                rlist = seasons.Seasons().get(tvshowtitle,
                                              year,
                                              imdb,
                                              tmdb,
                                              tvdb,
                                              art,
                                              create_directory=False)
                r = 'plugin://plugin.video.venom/?action=play_Random&rtype=episode'
            elif rtype == 'show':
                from resources.lib.menus import tvshows
                rlist = tvshows.TVshows().get(url, create_directory=False)
                r = 'plugin://plugin.video.venom/?action=play_Random&rtype=season'
            from random import randint
            from json import dumps as jsdumps
            try:
                rand = randint(1, len(rlist)) - 1
                for p in [
                        'title', 'year', 'imdb', 'tmdb', 'tvdb', 'season',
                        'episode', 'tvshowtitle', 'premiered', 'select'
                ]:
                    if rtype == "show" and p == "tvshowtitle":
                        try:
                            r += '&' + p + '=' + quote_plus(
                                rlist[rand]['title'])
                        except:
                            pass
                    else:
                        try:
                            r += '&' + p + '=' + quote_plus(str(
                                rlist[rand][p]))
                        except:
                            pass
                try:
                    r += '&meta=' + quote_plus(jsdumps(rlist[rand]))
                except:
                    r += '&meta=' + quote_plus("{}")
                if rtype == "movie":
                    try:
                        control.notification(
                            title=32536,
                            message='%s (%s)' %
                            (rlist[rand]['title'], rlist[rand]['year']))
                    except:
                        pass
                elif rtype == "episode":
                    try:
                        control.notification(title=32536,
                                             message='%s - %01dx%02d - %s' %
                                             (rlist[rand]['tvshowtitle'],
                                              int(rlist[rand]['season']),
                                              int(rlist[rand]['episode']),
                                              rlist[rand]['title']))
                    except:
                        pass
                control.execute('RunPlugin(%s)' % r)
            except:
                control.notification(message=32537)

    elif action == 'play':  # for support of old style .strm library files
        from resources.lib.modules import sources
        premiered = params.get('premiered')
        meta = params.get('meta')
        select = params.get('select')
        rescrape = params.get('rescrape')
        sources.Sources().play(title, year, imdb, tmdb, tvdb, season, episode,
                               tvshowtitle, premiered, meta, select, rescrape)

    ####################################################
    #---Playlist
    ####################################################
    elif action and action.startswith('playlist_'):
        if action == 'playlist_Manager':
            from resources.lib.modules import playlist
            art = params.get('art')
            meta = params.get('meta')
            playlist.playlistManager(name, url, meta, art)
        elif action == 'playlist_Show':
            from resources.lib.modules import playlist
            playlist.playlistShow()
        elif action == 'playlist_Clear':
            from resources.lib.modules import playlist
            playlist.playlistClear()
        elif action == 'playlist_QueueItem':
            control.queueItem()
            if name is None: control.notification(title=35515, message=35519)
            else: control.notification(title=name, message=35519)

    ####################################################
    #---Playcount
    ####################################################
    elif action and action.startswith('playcount_'):
        if action == 'playcount_Movie':
            from resources.lib.modules import playcount
            playcount.movies(name, imdb, query)
        elif action == 'playcount_Episode':
            from resources.lib.modules import playcount
            playcount.episodes(name, imdb, tvdb, season, episode, query)
        elif action == 'playcount_TVShow':
            from resources.lib.modules import playcount
            playcount.tvshows(name, imdb, tvdb, season, query)

    ####################################################
    #---Source Actions
    ####################################################
    elif action == 'alterSources':
        from resources.lib.modules import sources
        meta = params.get('meta')
        sources.Sources().alterSources(url, meta)

    elif action == 'showDebridPack':
        from resources.lib.modules.sources import Sources
        caller = params.get('caller')
        Sources().debridPackDialog(caller, name, url, source)

    elif action == 'sourceInfo':
        from resources.lib.modules.sources import Sources
        Sources().sourceInfo(source)

    elif action == 'cacheTorrent':
        caller = params.get('caller')
        pack = True if type == 'pack' else False
        if caller == 'RD':
            from resources.lib.debrid.realdebrid import RealDebrid as debrid_function
        elif caller == 'PM':
            from resources.lib.debrid.premiumize import Premiumize as debrid_function
        elif caller == 'AD':
            from resources.lib.debrid.alldebrid import AllDebrid as debrid_function
        success = debrid_function().add_uncached_torrent(url, pack=pack)
        if success:
            from resources.lib.modules import sources
            meta = params.get('meta')
            items = params.get('items')
            sources.Sources().playItem(title, items, source, meta)

    ####################################################
    #---Library Actions
    ####################################################
    elif action and action.startswith('library_'):
        if action == 'library_Navigator':
            from resources.lib.menus import navigator
            navigator.Navigator().library()
        elif action == 'library_movieToLibrary':
            from resources.lib.modules import library
            library.libmovies().add(name, title, year, imdb, tmdb)
        elif action == 'library_moviesToLibrary':
            from resources.lib.modules import library
            library.libmovies().range(url, name)
        elif action == 'library_moviesListToLibrary':
            from resources.lib.menus import movies
            movies.Movies().moviesListToLibrary(url)
        elif action == 'library_moviesToLibrarySilent':
            from resources.lib.modules import library
            library.libmovies().silent(url)
        elif action == 'library_tvshowToLibrary':
            from resources.lib.modules import library
            library.libtvshows().add(tvshowtitle, year, imdb, tmdb, tvdb)
        elif action == 'library_tvshowsToLibrary':
            from resources.lib.modules import library
            library.libtvshows().range(url, name)
        elif action == 'library_tvshowsListToLibrary':
            from resources.lib.menus import tvshows
            tvshows.TVshows().tvshowsListToLibrary(url)
        elif action == 'library_tvshowsToLibrarySilent':
            from resources.lib.modules import library
            library.libtvshows().silent(url)
        elif action == 'library_update':
            control.notification(message=32085)
            from resources.lib.modules import library
            library.libepisodes().update()
            library.libmovies().list_update()
            library.libtvshows().list_update()
            while True:
                if control.condVisibility('Library.IsScanningVideo'):
                    control.sleep(3000)
                    continue
                else:
                    break
            control.sleep(1000)
            control.notification(message=32086)
        elif action == 'library_clean':
            from resources.lib.modules import library
            library.lib_tools().clean()
        elif action == 'library_setup':
            from resources.lib.modules import library
            library.lib_tools().total_setup()
        elif action == 'library_service':
            from resources.lib.modules import library
            library.lib_tools().service()

    ####################################################
    #---Cache
    ####################################################
    elif action and action.startswith('cache_'):
        if action == 'cache_Navigator':
            from resources.lib.menus import navigator
            navigator.Navigator().cf()
        elif action == 'cache_clearAll':
            from resources.lib.menus import navigator
            navigator.Navigator().clearCacheAll()
        elif action == 'cache_clearSources':
            from resources.lib.menus import navigator
            navigator.Navigator().clearCacheProviders()
        elif action == 'cache_clearMeta':
            from resources.lib.menus import navigator
            navigator.Navigator().clearCacheMeta()
        elif action == 'cache_clearCache':
            from resources.lib.menus import navigator
            navigator.Navigator().clearCache()
        elif action == 'cache_clearSearch':
            from resources.lib.menus import navigator
            navigator.Navigator().clearCacheSearch()
        elif action == 'cache_clearSearchPhrase':
            from resources.lib.menus import navigator
            navigator.Navigator().clearCacheSearchPhrase(source, name)
        elif action == 'cache_clearBookmarks':
            from resources.lib.menus import navigator
            navigator.Navigator().clearBookmarks()
        elif action == 'cache_clearBookmark':
            from resources.lib.menus import navigator
            navigator.Navigator().clearBookmark(name, year)
        elif action == 'cache_clearKodiBookmark':  # context.venom action call only
            from resources.lib.database import cache
            cache.clear_local_bookmark(url)
示例#21
0
    set_autoplay_quality()
elif mode == 'playback_menu':
    from resources.lib.modules.utils import playback_menu
    playback_menu()
elif mode == 'playback_kodi_library_menu':
    from resources.lib.modules.utils import playback_kodi_library_menu
    playback_kodi_library_menu()
elif mode == 'refresh_cached_data':
    from resources.lib.modules.nav_utils import refresh_cached_data
    refresh_cached_data()
elif mode == 'clear_cache':
    from resources.lib.modules.nav_utils import clear_cache
    clear_cache(params.get('cache'))
elif mode == 'open_ext_settings':
    from resources.lib.modules.utils import open_ext_settings
    open_ext_settings(params.get("addon"))
elif mode == 'show_text':
    from resources.lib.modules.nav_utils import show_text
    show_text()
elif mode == 'download_file':
    from resources.lib.modules import downloader
    if params.get('db_type') in ('archive', 'furk_file', 'easynews_file'):
        downloader.download(params['name'], params['image'], params['url'])
    else:
        import json
        from resources.lib.modules import sources
        downloader.download(
            params['name'], params['image'],
            sources.Sources().resolve_sources(
                json.loads(params['source'])[0], True))
示例#22
0
                                        path = xbmc.translatePath(
                                            os.path.join(
                                                'special://home/addons',
                                                'packages'))
                                        name = "build"
                                        dp = xbmcgui.DialogProgress()

                                        dp.create(ADDONTITLE, "Downloading ",
                                                  '', 'Please Wait')
                                        lib = os.path.join(path, name + '.zip')
                                        try:
                                            os.remove(lib)
                                        except:
                                            pass

                                        downloader.download(url, lib, dp)
                                        addonfolder = xbmc.translatePath(
                                            os.path.join('special://', 'home'))
                                        time.sleep(2)
                                        dp.update(
                                            0, "",
                                            "Extracting Zip Please Wait")
                                        print '======================================='
                                        print addonfolder
                                        print '======================================='
                                        extract.all_update(
                                            lib, addonfolder, dp)
                                        xbmc.executebuiltin(
                                            "Dialog.Close(busydialog)")
                                        dialog = xbmcgui.Dialog()
                                        dialog.ok(
示例#23
0
文件: default.py 项目: vinhcomp/xml
    from resources.lib.modules import trakt
    trakt.manager(name, imdb, tvdb, content)

elif action == 'authTrakt':
    from resources.lib.modules import trakt
    trakt.authTrakt()

elif action == 'rdAuthorize':
    from resources.lib.modules import debrid
    debrid.rdAuthorize()

elif action == 'download':
    import json
    from resources.lib.sources import sources
    from resources.lib.modules import downloader
    try: downloader.download(name, image, sources().sourcesResolve(json.loads(source)[0]))
    except: pass

elif action == 'play':
    from resources.lib.sources import sources
    sources().play(title, year, imdb, tvdb, season, episode, tvshowtitle, premiered, meta, url)

elif action == 'sources':
    from resources.lib.sources import sources
    sources().addItem(title, year, imdb, tvdb, season, episode, tvshowtitle, premiered, meta)

elif action == 'playItem':
    from resources.lib.sources import sources
    sources().playItem(source)

elif action == 'alterSources':
示例#24
0
文件: default.py 项目: moedje/naughty
def AUTO_UPDATER():

    marker = 0

    try:
        common.open_url("http://www.google.com")
    except:
        dialog.ok(
            AddonTitle,
            '[COLOR orangered]Error: It appears you do not currently have an active internet connection. This will cause false positives in the test. Please try again with an active internet connection.[/COLOR]'
        )
        return

    dp.create(AddonTitle, "Checking for repository updates", '',
              'Please Wait...')
    dp.update(0)
    a = open(GET_REPO_VERSION).read()
    b = a.replace('\n', ' ').replace('\r', ' ')
    match = re.compile(
        'name=".+?".+?version="(.+?)".+?provider-name=".+?">').findall(str(b))
    for item in match:
        dp.update(25)
        new_version = float(item) + 0.01
        url = BASE_REPO_UPDATE + str(new_version) + '.zip'
        try:
            result = common.open_url(url)
            if "Not Found" not in result:
                found = 1
                dp.update(75)
                path = xbmc.translatePath(
                    os.path.join('special://home/addons', 'packages'))
                if not os.path.exists(path):
                    os.makedirs(path)
                lib = os.path.join(path, 'repoupdate.zip')
                try:
                    os.remove(lib)
                except:
                    pass
                dp.update(100)
                dp.update(0, "", "Downloading Update Please Wait", "")
                downloader.download(url, lib, dp)
                addonfolder = xbmc.translatePath(
                    os.path.join('special://', 'home/addons'))
                dp.update(0, "", "Extracting Update Please Wait", "")
                extract.all(lib, addonfolder, dp)
                try:
                    os.remove(lib)
                except:
                    pass
                xbmc.executebuiltin("UpdateLocalAddons")
                xbmc.executebuiltin("UpdateAddonRepos")
                marker = 1
                dialog.ok(
                    AddonTitle,
                    "ECHO XXX repository was updated to " + str(new_version) +
                    ', you may need to restart the addon for changes to take effect'
                )
                time.sleep(2)
        except:
            pass

    dp.update(75, "Checking for addon updates")
    a = open(GET_VERSION).read()
    b = a.replace('\n', ' ').replace('\r', ' ')
    match = re.compile(
        'name=".+?".+?version="(.+?)".+?provider-name=".+?">').findall(str(b))
    for item in match:
        new_version = float(item) + 0.01
        url = BASE_UPDATE + str(new_version) + '.zip'
        try:
            result = common.open_url(url)
            if "Not Found" not in result:
                found = 1
                dp.update(75)
                path = xbmc.translatePath(
                    os.path.join('special://home/addons', 'packages'))
                if not os.path.exists(path):
                    os.makedirs(path)
                lib = os.path.join(path, 'xxx_o_dus_update.zip')
                try:
                    os.remove(lib)
                except:
                    pass
                dp.update(100)
                dp.update(0, "", "Downloading Update Please Wait", "")
                downloader.download(url, lib, dp)
                addonfolder = xbmc.translatePath(
                    os.path.join('special://', 'home/addons'))
                dp.update(0, "", "Extracting Update Please Wait", "")
                extract.all(lib, addonfolder, dp)
                try:
                    os.remove(lib)
                except:
                    pass
                xbmc.executebuiltin("UpdateLocalAddons")
                xbmc.executebuiltin("UpdateAddonRepos")
                dp.update(100)
                dp.close
                marker = 1
                dialog.ok(
                    AddonTitle,
                    "XXX-O-DUS was updated to " + str(new_version) +
                    ', you may need to restart the addon for changes to take effect'
                )
                time.sleep(2)
        except:
            pass

    if dp.iscanceled():
        dp.close()

    return marker
示例#25
0
def SPORTS_DEVIL_FIX():

    SPORTS_DEVIL_FOLDER = xbmc.translatePath(
        os.path.join('special://home/addons', 'plugin.video.SportsDevil'))
    PYDEV_FOLDER = xbmc.translatePath(
        os.path.join('special://home/addons', 'script.module.pydevd'))
    REPO_FOLDER = xbmc.translatePath(
        os.path.join('special://home/addons', 'repository.echo'))
    path = xbmc.translatePath(os.path.join('special://home/addons',
                                           'packages'))

    choice = xbmcgui.Dialog().yesno(
        AddonTitle,
        'This option will remove all traces of Sports Devil (If Installed) and install a clean version along with the ECHO Repo.',
        'Would you like to continue?',
        yeslabel='[B][COLOR yellowgreen]YES[/COLOR][/B]',
        nolabel='[B][COLOR lightskyblue]NO[/COLOR][/B]')
    if choice == 0:
        sys.exit(1)
    dialog = xbmcgui.Dialog()
    if os.path.exists(SPORTS_DEVIL_FOLDER):
        try:
            shutil.rmtree(SPORTS_DEVIL_FOLDER)
        except:
            pass
    if os.path.exists(PYDEV_FOLDER):
        try:
            shutil.rmtree(PYDEV_FOLDER)
        except:
            pass
    purgePath = xbmc.translatePath('special://home/addons/packages')
    for root, dirs, files in os.walk(purgePath):
        file_count = 0
        file_count += len(files)
    for root, dirs, files in os.walk(purgePath):
        file_count = 0
        file_count += len(files)
        if file_count > 0:
            for f in files:
                os.unlink(os.path.join(root, f))
            for d in dirs:
                shutil.rmtree(os.path.join(root, d))

    if not os.path.exists(path):
        os.makedirs(path)

    url = (
        'http://www.echocoder.com/addons/Plugins/dependencies/script.module.pydevd-4.4.0.zip'
    )
    dp = xbmcgui.DialogProgress()
    dp.create(AddonTitle, "", "", "Installing Dependencies")
    lib = os.path.join(path, 'addon.zip')

    try:
        os.remove(lib)
    except:
        pass

    downloader.download(url, lib, dp)
    addonfolder = xbmc.translatePath(os.path.join('special://home', 'addons'))
    time.sleep(2)
    dp.update(0, "", "Extracting Zip Please Wait", "")
    extract.all(lib, addonfolder, dp)
    url = (
        'http://www.echocoder.com/addons/Plugins/plugin.video.SportsDevil.zip')
    dp = xbmcgui.DialogProgress()
    dp.create(AddonTitle, "", "", "Installing Sports Devil")
    lib = os.path.join(path, 'addon.zip')

    try:
        os.remove(lib)
    except:
        pass

    downloader.download(url, lib, dp)
    addonfolder = xbmc.translatePath(os.path.join('special://home', 'addons'))
    time.sleep(2)
    dp.update(0, "", "Extracting Zip Please Wait", "")
    extract.all(lib, addonfolder, dp)
    try:
        os.remove(lib)
    except:
        pass
    xbmc.executebuiltin("UpdateAddonRepos")
    xbmc.executebuiltin("UpdateLocalAddons")

    dialog.ok(
        AddonTitle,
        "[COLOR white]The Sports Devil plugin should now be fixed and working correctly. If you have any issues please turn AUTO UPDATE OFF on Sports Devil and run this fix again.[/COLOR]"
    )
    quit()
示例#26
0
if action and action.startswith('download'):
    if action == 'downloadNavigator':
        from resources.lib.menus import navigator
        navigator.Navigator().downloads()

    elif action == 'download':
        caller = params.get('caller')
        image = params.get('image')
        if caller == 'sources':
            control.busy()
            try:
                from json import loads as jsloads
                from resources.lib.modules import sources
                from resources.lib.modules import downloader
                downloader.download(
                    name, image,
                    sources.Sources().sourcesResolve(jsloads(source)[0]),
                    title)
            except:
                import traceback
                traceback.print_exc()
        if caller == 'premiumize':
            control.busy()
            try:
                from resources.lib.modules import downloader
                from resources.lib.debrid import premiumize
                downloader.download(
                    name, image,
                    premiumize.Premiumize().add_headers_to_url(
                        url.replace(' ', '%20')))
            except:
                import traceback
示例#27
0
elif action == 'authTrakt':
    from resources.lib.modules import trakt
    trakt.authTrakt()

elif action == 'rdAuthorize':
    from resources.lib.modules import debrid
    debrid.rdAuthorize()

elif action == 'download':
    import json
    from resources.lib.sources import sources
    from resources.lib.modules import downloader
    try:
        downloader.download(
            name, image,
            sources().sourcesResolve(json.loads(source)[0], True))
    except:
        pass

elif action == 'play':
    from resources.lib.sources import sources
    sources().play(title, year, imdb, tvdb, season, episode, tvshowtitle,
                   premiered, meta, select)

elif action == 'addItem':
    from resources.lib.sources import sources
    sources().addItem(title)

elif action == 'playItem':
    from resources.lib.sources import sources
示例#28
0
    from resources.lib.modules import trakt

    trakt.authTrakt()

elif action == "rdAuthorize":
    from resources.lib.modules import debrid

    debrid.rdAuthorize()

elif action == "download":
    import json
    from resources.lib.sources import sources
    from resources.lib.modules import downloader

    try:
        downloader.download(name, image, sources().sourcesResolve(json.loads(source)[0], True))
    except:
        pass

elif action == "play":
    from resources.lib.sources import sources

    sources().play(title, year, imdb, tvdb, season, episode, tvshowtitle, premiered, meta, select)
elif action == "play_library":
    from resources.lib.sources import sources

    sources().play_library(title, year, imdb, tvdb, season, episode, tvshowtitle, premiered, meta, select)

elif action == "addItem":
    from resources.lib.sources import sources