Example #1
0
def addMovies(contentList, strm_name='', strm_type='Other', provider="n.a"):
    movieList = []
    pagesDone = 0
    file = ''
    filetype = ''
    j = len(contentList) * int(PAGINGMovies) / 100

    if len(contentList) == 0:
        return

    while pagesDone < int(PAGINGMovies):
        if not contentList[0] == "palyableSingleMedia":
            for detailInfo in contentList:
                file = detailInfo.get('file').replace(
                    "\\\\", "\\") if detailInfo.get('file',
                                                    None) is not None else None
                filetype = detailInfo.get('filetype', None)
                label = detailInfo.get('label').strip() if detailInfo.get(
                    'label', None) is not None else None
                imdbnumber = detailInfo.get('imdbnumber').strip(
                ) if detailInfo.get('imdbnumber', None) is not None else None

                try:
                    if label and strm_name:
                        label = stringUtils.cleanLabels(label)
                        if HIDE_tile_in_OV == "true" and label.find(
                                "[OV]") > -1:
                            get_title_with_OV = False
                        else:
                            get_title_with_OV = True

                        provider = getProvider(file)

                        thisDialog.dialogeBG.update(
                            j, ADDON_NAME + ": Getting Movies: ",
                            " Video: " + label)
                        if filetype is not None and filetype == 'file' and get_title_with_OV == True:
                            m_path = stringUtils.getMovieStrmPath(
                                strm_type, strm_name, label)
                            m_title = stringUtils.getStrmname(label)
                            movieList.append({
                                'path': m_path,
                                'title': m_title,
                                'url': file,
                                'provider': provider,
                                'imdbnumber': imdbnumber
                            })
                        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:
Example #2
0
                except ValueError:
                    print ("No valid integer in line.")
                except:
                    guiTools.infoDialog("Unexpected error: " + str(sys.exc_info()[1])+ (". See your Kodi.log!"))
                    utils.addon_log(("Unexpected error: ") + str(sys.exc_info()[1]))
                    print ("Unexpected error:"), sys.exc_info()[0]
                    raise

            pagesDone += 1
            if filetype != '' and filetype != 'file' and pagesDone < int(PAGINGMovies):
                contentList = jsonUtils.requestList(file, 'video').get('files', [])
            else:
                pagesDone = int(PAGINGMovies)            
        else:
            provider = getProvider(contentList[1])
            m_path = stringUtils.getMovieStrmPath(strm_type, strm_name)
            m_title = stringUtils.cleanByDictReplacements(stringUtils.getStrmname(strm_name))
            movieList.append({'path': m_path, 'title':  m_title, 'url': contentList[1], 'provider': provider})
            pagesDone = int(PAGINGMovies)

    return movieList

def getProvider(entry):
    provider = None
    provGeneral = re.search('%s([^\/\?]*)' % ("plugin:\/\/"), entry)
    provXST = re.search('%s(.*)'"\&function"'' % (r"site="), entry)

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