Esempio n. 1
0
def addTVShows(contentList, strm_name='', strm_type='Other'):
    showsList = []
    showtitle = strm_name
    pagesDone = 0
    sectiveContent = contentList
    #     while pagesDone < int(PAGINGTVshows):
    j = 100 / len(contentList)

    for detailInfo in contentList:
        detailInfo = stringUtils.removeHTMLTAGS(detailInfo)
        filetypes = re.search('"filetype" *: *"(.*?)",', detailInfo)
        showtitles = re.search('"showtitle" *: *"(.*?)",', detailInfo)
        if showtitles:
            showtitle = showtitles.group(1)
        try:
            if filetypes:
                filetype = filetypes.group(1)
                files = re.search('"file" *: *"(.*?)",', detailInfo)

                if filetype != 'file':
                    getEpisodes(
                        stringUtils.uni(
                            jsonUtils.requestList(files.group(1), 'video')),
                        strm_name.strip(), strm_type, j)
                else:
                    getEpisodes(detailInfo, strm_name, strm_type, j)
                thisDialog.dialogeBG.update(j, showtitle)
                j = j + 100 / len(contentList)
        except IOError as (errno, strerror):
            print("I/O error({0}): {1}").format(errno, strerror)
        except ValueError:
            print("No valid integer in line.")
Esempio n. 2
0
def update(strm_name, url, media_type, thelist):
    plex_details = stringUtils.uni(
        jsonUtils.requestList("plugin://plugin.video.plexbmc", media_type))
    for plex_detail in plex_details:
        plex_detail = stringUtils.removeHTMLTAGS(plex_detail)
        label = re.search('"label" *: *"(.*?)",', plex_detail)
        if label and strm_name.replace(
                '++RenamedTitle++', '') == stringUtils.cleanByDictReplacements(
                    label.group(1)):
            serverurl = re.search('"file" *: *"(.*?)",', plex_detail).group(1)
            if url != serverurl:
                for entry in thelist:
                    if entry.split("|")[1] == strm_name:
                        newentry = '|'.join([
                            entry.split("|")[0],
                            entry.split("|")[1].decode("utf-8"), serverurl
                        ]) + '\n'
                        thelist = stringUtils.replaceStringElem(
                            thelist, entry, newentry)
                        thefile = xbmc.translatePath(
                            os.path.join(profile, 'MediaList.xml'))
                        with open(thefile.decode("utf-8"), 'w') as output_file:
                            for linje in thelist:
                                if not linje.startswith('\n'):
                                    output_file.write(
                                        linje.strip().encode('utf-8') + '\n')
                                else:
                                    output_file.write(linje.strip())
                        break
                url = serverurl
    return url
Esempio n. 3
0
def addMovies(contentList, strm_name='', strm_type='Other'):
    movieList = []
    pagesDone = 0
    file = ''
    j = 100 / (len(contentList) * int(PAGINGMovies))

    while pagesDone < int(PAGINGMovies):
        if not contentList[0] == "palyableSingleMedia":
            for detailInfo in contentList:
                detailInfo = stringUtils.removeHTMLTAGS(detailInfo)
                files = re.search('"file" *: *"(.*?)",', detailInfo)
                filetypes = re.search('"filetype" *: *"(.*?)",', detailInfo)
                labels = re.search('"label" *: *"(.*?)",', detailInfo)
                thumbnails = re.search('"thumbnail" *: *"(.*?)",', detailInfo)
                fanarts = re.search('"fanart" *: *"(.*?)",', detailInfo)
                descriptions = re.search('"description" *: *"(.*?)",',
                                         detailInfo)
                try:
                    if filetypes and labels and files:
                        filetype = filetypes.group(1)
                        label = (stringUtils.cleanLabels(labels.group(1)))
                        file = (files.group(1).replace("\\\\", "\\"))

                        if fanarts:
                            fanart = fanarts.group(1)
                        else:
                            fanart = ''

                        if addon.getSetting('Link_Type') == '0':
                            link = sys.argv[0] + "?url=" + urllib.quote_plus(
                                file) + "&mode=" + str(
                                    10) + "&name=" + urllib.quote_plus(
                                        label
                                    ) + "&fanart=" + urllib.quote_plus(fanart)
                        else:
                            link = file

                        if label and strm_name:

                            label = str(
                                utils.multiple_reSub(label.strip(),
                                                     dictReplacements))
                            thisDialog.dialogeBG.update(
                                j, ADDON_NAME + ": Writing File: ",
                                " Video: " + label)
                            movieList.append([
                                os.path.join(strm_type),
                                str(
                                    utils.multiple_reSub(
                                        label.strip(), dictReplacements)), link
                            ])
                            j = j + 100 / (len(contentList) *
                                           int(PAGINGMovies))
                except IOError as (errno, strerror):
                    print("I/O error({0}): {1}").format(errno, strerror)
                except ValueError:
                    print("No valid integer in line.")
                except:
Esempio n. 4
0
def getTVShowFromList(showList, strm_name='', strm_type='Other'):
    pagesDone = 0
    file = ''

    while pagesDone < int(PAGINGTVshows):
        strm_type = strm_type.replace('Shows-Collection', 'TV-Shows')
        try:
            for detailInfo in showList:
                detailInfo = stringUtils.removeHTMLTAGS(detailInfo)
                filetypes = re.search('"filetype" *: *"(.*?)",', detailInfo)
                if filetypes:
                    filetype = filetypes.group(1)
                    files = re.search('"file" *: *"(.*?)",', detailInfo)
                    episodes = re.search('"episode" *: *(.*?),', detailInfo)
                    seasons = re.search('"season" *: *(.*?),', detailInfo)
                    showtitles = re.search('"showtitle" *: *"(.*?)",',
                                           detailInfo)
                    labels = re.search('"label" *: *"(.*?)",', detailInfo)

                    if labels:
                        label = str(labels.group(1).lstrip().rstrip())
                    else:
                        label = "None"

                    if showtitles:
                        showtitle = str(showtitles.group(1).lstrip().rstrip())
                    else:
                        label = "None"

                    if not fileSys.isInMediaList(
                            label, strm_type
                    ) and label != "" and label != ">>>" and label != "None" and files.group(
                            1).find("playMode=play") == "-1":
                        fileSys.writeMediaList(
                            files.group(1).lstrip().rstrip(), label, strm_type)

                    if files and filetype != 'file' and label != ">>>":
                        addTVShows(stringUtils.uni(
                            jsonUtils.requestList(files.group(1), 'video')),
                                   strm_name="",
                                   strm_type=strm_type)
                    else:
                        if showtitles and seasons == "-1" and episodes == "-1":
                            xbmc.executebuiltin(
                                'Notification(%s, %s, %d, %s)' %
                                (ADDON_NAME, "ShowsList", 1000, ""))
                            getEpisodes(
                                stringUtils.uni(
                                    jsonUtils.requestList(
                                        files.group(1), 'video')),
                                strm_name.strip(), strm_type)

        except IOError as (errno, strerror):
            print("I/O error({0}): {1}").format(errno, strerror)
        except ValueError:
            print("No valid integer in line.")
Esempio n. 5
0
def addTVShowsSST(contentList, strm_name='', strm_type='Other'):
    showsList = []
    showtitle = strm_name
    pagesDone = 0
    sectiveContent = contentList
    #     while pagesDone < int(PAGINGTVshows):
    for detailInfo in contentList:
        detailInfo = stringUtils.removeHTMLTAGS(detailInfo)
        filetypes = re.search('"filetype" *: *"(.*?)",', detailInfo)
        try:
            if filetypes:
                filetype = filetypes.group(1)
                files = re.search('"file" *: *"(.*?)",', detailInfo)
                if filetype != 'file':
                    contentListSub = stringUtils.uni(
                        jsonUtils.requestList(files.group(1), 'video'))
                    for detailInfo in contentListSub:
                        while filetype != "file":
                            detailInfo = stringUtils.removeHTMLTAGS(detailInfo)
                            filetypes = re.search('"filetype" *: *"(.*?)",',
                                                  detailInfo)

                            if filetype != 'file':
                                detailInfo = stringUtils.uni(
                                    jsonUtils.requestList(
                                        files.group(1), 'video'))
                            else:
                                getEpisodes(stringUtils.uni(detailInfo),
                                            strm_name.strip(), strm_type)

                            getEpisodes(stringUtils.uni(detailInfo),
                                        strm_name.strip(), strm_type)

        except IOError as (errno, strerror):
            print("I/O error({0}): {1}").format(errno, strerror)
        except ValueError:
            print("No valid integer in line.")
Esempio n. 6
0
def getEpisodes(episodesListRaw, strm_name, strm_type, j=0):
    episodesList = []
    typeChange = []

    try:
        if type(episodesListRaw) is unicode:
            typeChange.append(episodesListRaw)
            episodesListRaw = typeChange

        for detailInfo in episodesListRaw:

            detailInfo = stringUtils.removeHTMLTAGS(detailInfo)
            files = re.search('"file" *: *"(.*?)",', detailInfo)
            filetypes = re.search('"filetype" *: *"(.*?)",', detailInfo)
            labels = re.search('"label" *: *"(.*?)",', detailInfo)
            thumbnails = re.search('"thumbnail" *: *"(.*?)",', detailInfo)
            fanarts = re.search('"fanart" *: *"(.*?)",', detailInfo)
            descriptions = re.search('"description" *: *"(.*?)",', detailInfo)
            episodes = re.search('"episode" *: *(.*?),', detailInfo)
            seasons = re.search('"season" *: *(.*?),', detailInfo)
            showtitles = re.search('"showtitle" *: *"(.*?)",', detailInfo)

            if filetypes:
                if filetypes.group(1) == 'directory':
                    contentList = stringUtils.uni(
                        jsonUtils.requestList(files.group(1), 'video'))
                    continue

                if showtitles and seasons and episodes:
                    filetype = filetypes.group(1)
                    label = (stringUtils.cleanLabels(labels.group(1)))
                    file = (files.group(1).replace("\\\\", "\\"))
                    strm_name = str(
                        utils.multiple_reSub(strm_name.strip(),
                                             dictReplacements))
                    showtitle = utils.multiple_reSub((showtitles.group(1)),
                                                     dictReplacements)
                    season = (utils.multiple_reSub(
                        (seasons.group(1)).replace("-", ""), dictReplacements))
                    episode = (utils.multiple_reSub(
                        (episodes.group(1)).replace("-",
                                                    ""), dictReplacements))
                    episodesHDF = re.search('Folge.(\\d+)&', file)

                    if file.find("hdfilme") != "-1" and episodesHDF:
                        episode = re.search('Folge.(\\d+)&', file).group(1)

                    if not descriptions:
                        description = ''
                    else:
                        description = stringUtils.cleanLabels(
                            descriptions.group(1))

                    if fanarts:
                        fanart = fanarts.group(1)
                    else:
                        fanart = ''

                    if addon.getSetting('Link_Type') == '0':
                        link = sys.argv[0] + "?url=" + urllib.quote_plus(
                            file
                        ) + "&mode=" + str(10) + "&name=" + urllib.quote_plus(
                            label) + "&fanart=" + urllib.quote_plus(fanart)
                    else:
                        link = file


#
                    if strm_name.find("++RenamedTitle++") != -1:
                        showtitle = strm_name.strip().replace(
                            '++RenamedTitle++', '')
                    if showtitle != "" and strm_type != "":
                        episodesList.append([
                            os.path.join(
                                xbmc.translatePath(strm_type + "//" +
                                                   (utils.multiple_reSub(
                                                       showtitle.strip(),
                                                       dictReplacements)))),
                            str('s' + season),
                            str('e' + episode), link
                        ])

    except IOError as (errno, strerror):
        print("I/O error({0}): {1}").format(errno, strerror)
Esempio n. 7
0
def addAlbum(contentList, strm_name='', strm_type='Other', PAGINGalbums="1"):
    albumList = []
    pagesDone = 0
    file = ''
    j = 100 / (len(contentList) * int(PAGINGalbums))

    while pagesDone < int(PAGINGalbums):
        if not contentList[0] == "palyableSingleMedia":
            albumThumbnails = re.search('"thumbnail" *: *"(.*?)",',
                                        str(contentList))
            if albumThumbnails:
                aThumb = urlUtils.stripUnquoteURL(albumThumbnails.group(1))

            for detailInfo in contentList:
                detailInfo = stringUtils.removeHTMLTAGS(detailInfo)
                files = re.search('"file" *: *"(.*?)",', detailInfo)
                filetypes = re.search('"filetype" *: *"(.*?)",', detailInfo)
                labels = re.search('"label" *: *"(.*?)",', detailInfo)
                thumbnails = re.search('"thumbnail" *: *"(.*?)",', detailInfo)
                fanarts = re.search('"fanart" *: *"(.*?)",', detailInfo)
                descriptions = re.search('"description" *: *"(.*?)",',
                                         detailInfo)
                tracks = re.search('"track" *: *(.*?),', detailInfo)
                durations = re.search('"duration" *: *"(.*?)",', detailInfo)

                try:
                    if filetypes and labels and files:
                        filetype = filetypes.group(1)
                        label = (stringUtils.cleanLabels(labels.group(1)))
                        file = (files.group(1).replace("\\\\", "\\"))

                        if fanarts:
                            fanart = fanarts.group(1)
                        else:
                            fanart = ''

                        if addon.getSetting('Link_Type') == '0':
                            link = sys.argv[0] + "?url=" + urllib.quote_plus(
                                file) + "&mode=" + str(
                                    10) + "&name=" + urllib.quote_plus(
                                        label
                                    ) + "&fanart=" + urllib.quote_plus(fanart)
                        else:
                            link = file
                        if thumbnails:
                            thumb = urlUtils.stripUnquoteURL(
                                thumbnails.group(1))
                        else:
                            thumb = ""
                        if label and strm_name:
                            label = str(
                                utils.multiple_reSub(label.strip(),
                                                     dictReplacements))
                        if tracks:
                            track = tracks.group(1)
                        try:
                            album = re.search('"album" *: *"(.*?)",',
                                              detailInfo).group(1).strip()
                            try:
                                artist = utils.multiple_reSub(
                                    re.search('"artist" *: *"(.*?)",',
                                              detailInfo).group(1).strip(),
                                    dictReplacements)
                            except:
                                artist = utils.multiple_reSub(
                                    re.search('"artist"*:*."(.*?)".,',
                                              detailInfo).group(1).strip(),
                                    dictReplacements)
                            pass
                            titl = utils.multiple_reSub(
                                re.search('"title" *: *(.*?),',
                                          detailInfo).group(1).strip(),
                                dictReplacements)
                            types = utils.multiple_reSub(
                                re.search('"type" *: *(.*?),',
                                          detailInfo).group(1).strip(),
                                dictReplacements)
                            filename = utils.multiple_reSub(
                                str(label).strip(), dictReplacements)
                        except:
                            filename = utils.multiple_reSub(
                                str(label).strip(), dictReplacements)
                            pass

                        thisDialog.dialogeBG.update(
                            j, ADDON_NAME + ": Writing File: ",
                            " Title: " + label)
                        path = os.path.join(strm_type, artist.strip(),
                                            album.strip())
                        if album and artist and label and path and link and track:
                            albumList.append([
                                path,
                                label.strip(), link, album, artist, track,
                                thumb
                            ])
                        j = j + 100 / (len(contentList) * int(PAGINGalbums))
                except IOError as (errno, strerror):
                    print("I/O error({0}): {1}").format(errno, strerror)
                except ValueError:
                    print("No valid integer in line.")
                except:
Esempio n. 8
0
def getEpisodes(episodesListRaw, strm_name, strm_type, j=0, pagesDone=0):
    episodesList = []
    typeChange = []

    try:
        if type(episodesListRaw) is unicode:
            typeChange.append(episodesListRaw)
            episodesListRaw = typeChange

        for detailInfo in episodesListRaw:
            utils.addon_log("detailInfo: " + detailInfo)
            detailInfo = stringUtils.removeHTMLTAGS(detailInfo)
            files = re.search('"file" *: *"(.*?)",', detailInfo)
            filetypes = re.search('"filetype" *: *"(.*?)",', detailInfo)
            labels = re.search('"label" *: *"(.*?)",', detailInfo)
            thumbnails = re.search('"thumbnail" *: *"(.*?)",', detailInfo)
            fanarts = re.search('"fanart" *: *"(.*?)",', detailInfo)
            descriptions = re.search('"description" *: *"(.*?)",', detailInfo)
            episodes = re.search('"episode" *: *(.*?),', detailInfo)
            seasons = re.search('"season" *: *(.*?),', detailInfo)
            showtitles = re.search('"showtitle" *: *"(.*?)",', detailInfo)
            provGeneral = re.search(
                '%s(.*)'
                "\\/\\?"
                '' % (r"plugin://plugin.video."), detailInfo)
            provXST = re.search('%s(.*)'
                                "\&function"
                                '' % (r"site="), detailInfo)
            listName = strm_name

            if filetypes:
                if provGeneral:
                    listName = provGeneral.group(1)
                    if provXST:
                        listName = listName + ": " + provXST.group(1)

                if filetypes.group(1) == 'directory':
                    contentList = stringUtils.uni(
                        jsonUtils.requestList(files.group(1), 'video'))
                    continue
                if showtitles and seasons and episodes:
                    filetype = filetypes.group(1)
                    label = (stringUtils.cleanLabels(labels.group(1)))
                    file = (files.group(1).replace("\\\\", "\\"))
                    strm_name = str(
                        stringUtils.cleanByDictReplacements(strm_name.strip()))
                    showtitle = stringUtils.cleanByDictReplacements(
                        (showtitles.group(1)))
                    season = stringUtils.cleanByDictReplacements(
                        seasons.group(1).replace("-", ""))
                    episode = stringUtils.cleanByDictReplacements(
                        episodes.group(1).replace("-", ""))
                    episodesHDF = re.search('Folge.(\\d+)&', file)

                    if file.find("hdfilme") != "-1" and episodesHDF:
                        episode = re.search('Folge.(\\d+)&', file).group(1)

                    if not descriptions:
                        description = ''
                    else:
                        description = stringUtils.cleanLabels(
                            descriptions.group(1))

                    if fanarts:
                        fanart = fanarts.group(1)
                    else:
                        fanart = ''

                    if strm_name.find("++RenamedTitle++") != -1:
                        showtitle = strm_name.strip().replace(
                            '++RenamedTitle++', '')
                    if showtitle != "" and strm_type != "":
                        episodesList.append([
                            strm_type,
                            str('s' + season),
                            str('e' + episode), file,
                            stringUtils.cleanByDictReplacements(
                                showtitle.strip()), listName
                        ])

    except IOError as (errno, strerror):
        print("I/O error({0}): {1}").format(errno, strerror)
Esempio n. 9
0
def addMovies(contentList, strm_name='', strm_type='Other', provider="n.a"):
    movieList = []
    listName = strm_name
    pagesDone = 0
    file = ''
    filetype = ''
    j = len(contentList) * int(PAGINGMovies) / 100

    while pagesDone < int(PAGINGMovies):
        if not contentList[0] == "palyableSingleMedia":
            for detailInfo in contentList:
                detailInfo = stringUtils.removeHTMLTAGS(detailInfo)
                files = re.search('"file" *: *"(.*?)",', detailInfo)
                filetypes = re.search('"filetype" *: *"(.*?)",', detailInfo)
                labels = re.search('"label" *: *"(.*?)",', detailInfo)
                thumbnails = re.search('"thumbnail" *: *"(.*?)",', detailInfo)
                fanarts = re.search('"fanart" *: *"(.*?)",', detailInfo)
                descriptions = re.search('"description" *: *"(.*?)",',
                                         detailInfo)
                provGeneral = re.search(
                    '%s(.*)'
                    "\\/\\?"
                    '' % (r"plugin://plugin.video."), detailInfo)
                provXST = re.search('%s(.*)'
                                    "\&function"
                                    '' % (r"site="), detailInfo)

                try:
                    if filetypes and labels and files:
                        filetype = filetypes.group(1)
                        label = (stringUtils.cleanLabels(labels.group(1)))
                        file = (files.group(1).replace("\\\\", "\\"))

                        if provGeneral:
                            listName = provGeneral.group(1)
                            if provXST:
                                listName = listName + ": " + provXST.group(1)

                        if fanarts:
                            fanart = fanarts.group(1)
                        else:
                            fanart = ''

                        link = file

                        if label and strm_name:
                            label = str(
                                stringUtils.cleanByDictReplacements(
                                    label.strip()))
                            thisDialog.dialogeBG.update(
                                j, ADDON_NAME + ": Gettin Movies: ",
                                " Video: " + label)
                            if filetype == 'file':
                                movieList.append([
                                    os.path.join(
                                        strm_type,
                                        strm_name.strip().replace(
                                            '++RenamedTitle++', '')),
                                    str(
                                        stringUtils.cleanByDictReplacements(
                                            label.strip())), link, listName
                                ])
                            j = j + len(contentList) * int(PAGINGMovies) / 100
                except IOError as (errno, strerror):
                    print("I/O error({0}): {1}").format(errno, strerror)
                except ValueError:
                    print("No valid integer in line.")
                except: