Пример #1
0
def COMMUNITY():

    i = 0
    dp.create(
        AddonTitle,
        "[COLOR blue]We are getting the list of developers from our server.[/COLOR]",
        '[COLOR yellow]Please Wait...[/COLOR]', '')
    dp.update(0)
    namelist = []
    urllist = []
    hiddenlist = []
    useragentlist = []
    countlist = []
    totallist = []
    deslist = []
    iconlist = []
    fanartlist = []
    link = Common.OPEN_URL(Community_List).replace('\n', '').replace('\r', '')
    match = re.compile(
        'name="(.+?)".+?rl="(.+?)".+?rotected="(.+?)".+?mg="(.+?)".+?anart="(.+?)".+?seragent="(.+?)".+?ontact="(.+?)"'
    ).findall(link)
    dis_links = len(match)
    for name, url, hidden, iconimage, fanart, useragent, contact in match:
        if useragent.lower() == "null":
            useragent == "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.73 Safari/537.36"
        i = i + 1
        dis_count = str(i)
        progress = 100 * int(i) / int(dis_links)
        dp.update(
            progress, "Getting details of developer " + str(dis_count) +
            " of " + str(dis_links), '',
            "[COLOR white][B]FOUND - [/B] " + name + "[/COLOR]")
        developer = str(
            name.replace('[COLOR white][B]',
                         '').replace('[/B][/COLOR]',
                                     '').replace('[/B][/COLOR]',
                                                 '').replace(' BUILDS', ''))
        developer = developer.upper()
        description = str(developer + "," + hidden + "," + contact)
        namelist.append(name)
        urllist.append(url)
        hiddenlist.append(hidden)
        useragentlist.append(useragent)
        countlist.append(
            str(Common.count(developer + "DEVEL_COUNT", TEMP_FILE)))
        totallist.append(str(Common.count(developer + "TOTAL_DEV", TEMP_FILE)))
        deslist.append(description)
        iconlist.append(iconimage)
        fanartlist.append(fanart)
        combinedlists = list(
            zip(countlist, totallist, namelist, urllist, hiddenlist, deslist,
                iconlist, fanartlist, useragentlist))
    tup = sorted(combinedlists, key=lambda x: int(x[0]), reverse=True)
    dp.close()
    rank = 1
    for count, total, name, url, hidden, description, iconimage, fanart, ua in tup:
        developer = str(
            name.replace('[COLOR white][B]',
                         '').replace('[/B][/COLOR]',
                                     '').replace('[/B][/COLOR]',
                                                 '').replace(' BUILDS', ''))
        countfail = count
        try:
            count2 = int(count)
            count3 = "{:,}".format(count2)
            count = str(count3)
        except:
            count = countfail
        if hidden != "false":
            url = hidden + "|SPLIT|" + url + "|SPLIT|" + ua
            if rank == 1:
                bname = "[B] | [COLOR gold] This Week:[/COLOR][COLOR gold] " + count + " - [COLOR gold]Total:[/COLOR][COLOR gold] " + total + "[/COLOR] - [COLOR red][PASSWORD PROTECTED][/COLOR][/B][/COLOR]"
                Common.addDir(
                    "[B][COLOR gold]1st - " + developer + "[/B][/COLOR]" +
                    bname, url, 93, iconimage, fanart, description)
                rank = rank + 1
            elif rank == 2:
                bname = "[B] | [COLOR silver] This Week:[/COLOR][COLOR silver] " + count + " - [COLOR silver]Total:[/COLOR][COLOR silver] " + total + "[/COLOR] - [COLOR red][PASSWORD PROTECTED][/COLOR][/B][/COLOR]"
                Common.addDir(
                    "[B][COLOR silver]2nd - " + developer + "[/B][/COLOR]" +
                    bname, url, 93, iconimage, fanart, description)
                rank = rank + 1
            elif rank == 3:
                bname = "[B] | [COLOR orange] This Week:[/COLOR][COLOR orange] " + count + " - [COLOR orange]Total:[/COLOR][COLOR orange] " + total + "[/COLOR] - [COLOR red][PASSWORD PROTECTED][/COLOR][/B][/COLOR]"
                Common.addDir(
                    "[B][COLOR orange]3rd - " + developer + "[/B][/COLOR]" +
                    bname, url, 93, iconimage, fanart, description)
                rank = rank + 1
                Common.addItem(
                    "[COLOR white]-----------------------------------------------[/COLOR]",
                    url, 17, ICON, FANART, description)
            else:
                bname = " | [COLOR white] This Week:[/COLOR][COLOR yellowgreen][B] " + count + " - [COLOR white]Total:[/COLOR][COLOR yellowgreen][B] " + total + "[/COLOR] - [COLOR red][PASSWORD PROTECTED][/COLOR][/B][/COLOR]"
                Common.addDir("[COLOR white]" + developer + "[/COLOR]" + bname,
                              url, 93, iconimage, fanart, description)
        else:
            url = url + "|SPLIT|" + ua
            if rank == 1:
                bname = "[B] | [COLOR gold] This Week:[/COLOR][COLOR gold] " + count + "[/COLOR] - [COLOR gold]Total:[/COLOR][COLOR gold] " + total + "[/B][/COLOR]"
                Common.addDir(
                    "[B][COLOR gold]1st - " + developer + "[/COLOR][/B]" +
                    bname, url, 93, iconimage, fanart, description)
                rank = rank + 1
            elif rank == 2:
                bname = "[B] | [COLOR silver] This Week:[/COLOR][COLOR silver] " + count + "[/COLOR] - [COLOR silver]Total:[/COLOR][COLOR silver] " + total + "[/B][/COLOR]"
                Common.addDir(
                    "[B][COLOR silver]2nd - " + developer + "[/COLOR][/B]" +
                    bname, url, 93, iconimage, fanart, description)
                rank = rank + 1
            elif rank == 3:
                bname = "[B] | [COLOR orange] This Week:[/COLOR][COLOR orange] " + count + "[/COLOR] - [COLOR orange]Total:[/COLOR][COLOR orange] " + total + "[/B][/COLOR]"
                Common.addDir(
                    "[B][COLOR orange]3rd - " + developer + "[/COLOR][/B]" +
                    bname, url, 93, iconimage, fanart, description)
                rank = rank + 1
                Common.addItem(
                    "[COLOR white]-----------------------------------------------[/COLOR]",
                    url, 17, ICON, FANART, description)
            else:
                bname = " | [COLOR white] This Week:[/COLOR][COLOR yellowgreen][B] " + count + "[/B][/COLOR] - [COLOR white]Total:[/COLOR][COLOR yellowgreen][B] " + total + "[/B][/COLOR]"
                Common.addDir("[COLOR white]" + developer + "[/COLOR]" + bname,
                              url, 93, iconimage, fanart, description)

    Common.addItem(
        '[B][COLOR yellowgreen]HOW TO ADD YOUR BUILDS TO THE LIST[/COLOR][/B]',
        BASEURL, 17, COMMUNITY_ICON, FANART, '')
Пример #2
0
def SHOWCOMMUNITYBUILDS(name, url, description):

    try:
        contact = description.split(',')[2]
    except:
        contact = "Unknown"

    if not contact == "Unknown":
        Common.addItem(
            "[COLOR white][B]Contact Details: [/COLOR][COLOR yellowgreen]" +
            str(contact) + "[/B][/COLOR]", "url", 999, ICON, FANART,
            description)

    try:
        url, ua = url.split("|SPLIT|")
    except:
        passed = 0

        try:
            hidden, url, ua = url.split("|SPLIT|")
        except:
            dialog.ok(
                AddonTitle,
                'Sorry, an error occured! You are using a shortcut, please go through the wizards main menu to get to your desired location. If you do not know how to update from the wizard main menu please ask your build maker for assistence as I cannot help with this issue.'
            )
            quit()

        vq = Common._get_keyboard(heading="Please Enter Your Password")
        title = vq

        if len(title) == 0:
            quit()

        if title == hidden:
            passed = 1

        if passed == 0:
            dialog.ok(
                AddonTitle, "Sorry the password entered was not found.",
                '[COLOR smokewhite]Thank you for using ECHO Wizard[/COLOR]')
            sys.exit(0)

    original = url

    xbmc_version = xbmc.getInfoLabel("System.BuildVersion")
    version = float(xbmc_version[:4])
    codename = "Decline"

    i = 0
    dp.create(
        AddonTitle,
        "[COLOR blue]We are getting the list of builds from our server.[/COLOR]",
        '[COLOR yellow]Please Wait...[/COLOR]', '')
    dp.update(0)

    if version >= 16.0 and version < 17.0:
        codename = 'Jarvis'
    if version >= 17.0 and version < 18.0:
        codename = 'Krypton'

    v = str(version)
    vv = v.split(".")[0]
    vvv = vv + ".9"
    www = vv + ".0"
    version_start = float(www)
    version_end = float(vvv)

    if 'endlessflix' in url:
        protected_wizards.Endless_Install()

    if 'CALL_THE_BEAST' in url:
        protected_wizards.Beast_Install()
        url = url.replace('CALL_THE_BEAST', '')

    i = 0
    dp.create(
        AddonTitle,
        "[COLOR blue]We are getting the list of developers from our server.[/COLOR]",
        '[COLOR yellow]Please Wait...[/COLOR]', '')
    dp.update(0)
    namelist = []
    urllist = []
    countlist = []
    deslist = []
    iconlist = []
    fanartlist = []
    totallist = []
    combinedlists = []
    desca = description
    developer = desca.split(',')[0]
    hidden = desca.split(',')[1]
    a = 0
    b = 0

    link = Common.OPEN_URL_CUSTOM(url,
                                  ua).replace('\n',
                                              '').replace('\r',
                                                          '').replace(',', '')

    link = link.replace("<notice></notice>", "<notice>null</notice>").replace(
        "<platform></platform>", "<platform>16.1</platform>").replace(
            "<youtube></youtube>", "<youtube>null</youtube>").replace(
                "<thumbnail></thumbnail>",
                "<thumbnail>null</thumbnail>").replace(
                    "<fanart></fanart>", "<fanart>null</fanart>").replace(
                        "<version></version>",
                        "<version>null</version>").replace(
                            "<build_image></build_image>",
                            "<build_image>null</build_image>")
    match = re.compile('<item>(.+?)</item>').findall(link)
    match2 = re.compile(
        'name="(.+?)".+?rl="(.+?)".+?mg="(.+?)".+?anart="(.+?)"').findall(link)
    dis_links1 = len(match)
    dis_links2 = len(match2)
    dis_links = dis_links1 + dis_links2
    for item in match:
        name = re.compile('<title>(.+?)</title>').findall(item)[0]
        url = re.compile('<link>(.+?)</link>').findall(item)[0]
        try:
            build_version = re.compile('<version>(.+?)</version>').findall(
                item)[0]
        except:
            build_version = "null"
        try:
            notice = re.compile('<notice>(.+?)</notice>').findall(item)[0]
        except:
            notice = "null"
        try:
            platform = re.compile('<platform>(.+?)</platform>').findall(
                item)[0]
        except:
            platform = "16.1"

        tubes = re.compile('<youtube>(.+?)</youtube>').findall(item)
        if len(tubes) > 1:
            youtube_id = "multi"
        else:
            try:
                youtube_id = re.compile('<youtube>(.+?)</youtube>').findall(
                    item)[0]
            except:
                youtube_id = "null"
        try:
            iconimage = re.compile('<thumbnail>(.+?)</thumbnail>').findall(
                item)[0]
        except:
            iconimage = ICON
        try:
            fanart = re.compile('<fanart>(.+?)</fanart>').findall(item)[0]
        except:
            fanart = FANART
        try:
            build_image = re.compile(
                '<build_image>(.+?)</build_image>').findall(item)[0]
        except:
            build_image = "null"
        if iconimage.lower() == "null":
            iconimage = ICON
        if fanart.lower() == "null":
            fanart = FANART
        if platform == "16":
            platform = "16.1"
        if "16.0" in platform:
            platform = "16.1"
        if not "." in platform:
            platform = platform + ".0"
            platform = float(platform)
        else:
            platform = float(platform)
        i = i + 1
        dis_count = str(i)
        progress = 100 * int(i) / int(dis_links)
        dp.update(
            progress, "Getting details for developer " + str(dis_count) +
            " of " + str(dis_links), '',
            "[COLOR white][B]FOUND - [/B] " + name + "[/COLOR]")
        found = 1
        description = "null" + "," + developer + "," + youtube_id + "," + notice + "," + build_image + "," + contact
        name2 = name
        url = name2 + "," + url + "," + original
        name = name.lower()
        name = name.replace('(krypton)', '').replace('(jarvis)', '').replace(
            'jarvis ', '').replace('krypton ', '')
        if build_version.lower() == "null":
            name = "[COLOR silver][B]" + name.title() + "[/B][/COLOR]"
        else:
            name = "[COLOR silver][B]" + name.title(
            ) + "[/COLOR] - [COLOR yellowgreen]Ver: " + build_version + "[/B][/COLOR] "
        if platform >= version_start and platform < version_end:
            namelist.append(name)
            urllist.append(url)
            countlist.append(str(Common.count(name2, TEMP_FILE)))
            totallist.append(
                str(Common.count(name2 + "TOTAL_COUNT", TEMP_FILE)))
            deslist.append(description)
            iconlist.append(iconimage)
            fanartlist.append(fanart)
            combinedlists = list(
                zip(countlist, totallist, namelist, urllist, deslist, iconlist,
                    fanartlist))
    for name, url, iconimage, fanart in match2:
        i = i + 1
        dis_count = str(i)
        progress = 100 * int(i) / int(dis_links)
        dp.update(
            progress, "Getting details for developer " + str(dis_count) +
            " of " + str(dis_links), '',
            "[COLOR white][B]FOUND - [/B] " + name + "[/COLOR]")
        found = 1
        description = "null" + "," + developer + "," + contact
        name2 = name
        url = name2 + "," + url
        name = name.lower()
        name = name.replace('(krypton)', '').replace('(jarvis)', '').replace(
            'jarvis ', '').replace('krypton ', '')
        name = "[COLOR silver][B]" + name.title() + "[/B][/COLOR]"

        if codename.lower() == "jarvis":
            if not "krypton" in name2.lower():
                namelist.append(name)
                urllist.append(url)
                countlist.append(str(Common.count(name2, TEMP_FILE)))
                totallist.append(
                    str(Common.count(name2 + "TOTAL_COUNT", TEMP_FILE)))
                deslist.append(description)
                iconlist.append(iconimage)
                fanartlist.append(fanart)
                combinedlists = list(
                    zip(countlist, totallist, namelist, urllist, deslist,
                        iconlist, fanartlist))
        else:
            if codename.lower() in name2.lower():
                namelist.append(name)
                urllist.append(url)
                countlist.append(str(Common.count(name2, TEMP_FILE)))
                totallist.append(
                    str(Common.count(name2 + "TOTAL_COUNT", TEMP_FILE)))
                deslist.append(description)
                iconlist.append(iconimage)
                fanartlist.append(fanart)
                combinedlists = list(
                    zip(countlist, totallist, namelist, urllist, deslist,
                        iconlist, fanartlist))

    tup = sorted(combinedlists, key=lambda x: int(x[0]), reverse=True)
    for count, total, name, url, description, iconimage, fanart in tup:
        countfail = count
        try:
            count2 = int(count)
            count3 = "{:,}".format(count2)
            count = str(count3)
        except:
            count = countfail
        a = a + 1
        if "skip" in name.lower():
            name = name.replace('skip', '')
            Common.addItem(name, url, 999, iconimage, fanart, description)
        else:
            bname = "- [COLOR white]Week:[/COLOR] [COLOR yellowgreen][B]" + count + "[/B][/COLOR][COLOR white] - Total:[/COLOR] [COLOR yellowgreen][B]" + total + "[/B][/COLOR]"
            Common.addDir(name + bname, url, 97, iconimage, fanart,
                          description)

    if a == 0:
        dialog.ok(
            AddonTitle, "[COLOR white]Sorry, no builds were found for " +
            codename + "![/COLOR]")
        sys, exit(1)

    try:
        f = open(COM_NOTICE, mode='r')
        msg = f.read()
        f.close()
        Common.TextBox(
            '[COLOR yellowgreen][B]ECHO Wizard Community Builds[/B][/COLOR]',
            "%s" % msg)
    except:
        pass