예제 #1
0
def getSources(video):
    if video.get('tvdb', '0') == '0':
        # movie
        arguments = ['name', 'title', 'year', 'imdb', None, None, None,
                     None, None, None, None]
    else:
        # tv
        arguments = ['name', 'title', 'year', 'imdb', 'tvdb', 'season', 'episode',
                     'show', 'show_alt', 'date', 'genre']
    args = [
        video.get(arg, None) if arg is not None else None
        for arg in arguments
    ]

    src = sources()
    src.sources = src.getSources(*args)
    return src.sourcesFilter()
예제 #2
0
def getSources(video):
    if video.get('tvdb', '0') == '0':
        # movie
        arguments = [
            'name', 'title', 'year', 'imdb', None, None, None, None, None,
            None, None
        ]
    else:
        # tv
        arguments = [
            'name', 'title', 'year', 'imdb', 'tvdb', 'season', 'episode',
            'show', 'show_alt', 'date', 'genre'
        ]
    args = [
        video.get(arg, None) if arg is not None else None for arg in arguments
    ]

    src = sources()
    src.sources = src.getSources(*args)
    return src.sourcesFilter()
예제 #3
0
def resolveUrl(name, url, audio, image, fanart, playable, content):
    try:
        if '.f4m' in url:
            label = cleantitle(name)
            ext = url.split('?')[0].split('&')[0].split('|')[0].rsplit(
                '.')[-1].replace('/', '').lower()
            if not ext == 'f4m': raise Exception()
            from modules.libraries.f4mproxy.F4mProxy import f4mProxyHelper
            return f4mProxyHelper().playF4mLink(url, label, None, None, '',
                                                image)

        #legacy issue, will be removed later
        if 'afdah.org' in url and not '</source>' in url:
            url += '<source>afdah</source>'

        if '</source>' in url:
            source = re.compile('<source>(.+?)</source>').findall(url)[0]
            url = re.compile('(.+?)<source>').findall(url)[0]

            for i in ['_mv', '_tv', '_mv_tv']:
                try:
                    call = __import__('modules.sources.%s%s' % (source, i),
                                      globals(), locals(), ['object'],
                                      -1).source()
                except:
                    pass

            from modules import sources
            d = sources.sources()

            url = call.get_sources(url, d.hosthdfullDict, d.hostsdfullDict,
                                   d.hostlocDict)

            if type(url) == list and len(url) == 1:
                url = url[0]['url']

            elif type(url) == list:
                url = sorted(url, key=lambda k: k['quality'])
                for i in url:
                    i.update(
                        (k, '720p') for k, v in i.iteritems() if v == 'HD')
                for i in url:
                    i.update(
                        (k, '480p') for k, v in i.iteritems() if v == 'SD')
                q = [i['quality'].upper() for i in url]
                u = [i['url'] for i in url]
                select = control.selectDialog(q)
                if select == -1: return
                url = u[select]

            url = call.resolve(url)

        from modules import resolvers
        url = resolvers.request(url)

        if type(url) == list and len(url) == 1:
            url = url[0]['url']

        elif type(url) == list:
            url = sorted(url, key=lambda k: k['quality'])
            for i in url:
                i.update((k, '720p') for k, v in i.iteritems() if v == 'HD')
            for i in url:
                i.update((k, '480p') for k, v in i.iteritems() if v == 'SD')
            q = [i['quality'].upper() for i in url]
            u = [i['url'] for i in url]
            select = control.selectDialog(q)
            if select == -1: return
            url = u[select]

        if url == None: raise Exception()
    except:
        return control.infoDialog('Unplayable stream')
        pass

    if playable == 'true':
        item = control.item(path=url)
        return control.resolve(int(sys.argv[1]), True, item)
    else:
        label = cleantitle(name)
        item = control.item(path=url, iconImage=image, thumbnailImage=image)
        item.setInfo(type='Video', infoLabels={'title': label})
        control.playlist.clear()
        control.player.play(url, item)
예제 #4
0
def addDownload(name, url, image, provider=None):
    try:

        def download():
            return []

        result = cache.get(download, 600000000, table='rel_dl')
        result = [i['name'] for i in result]
    except:
        pass

    if name in result:
        return control.infoDialog('Item Already In Your Queue', name)

    try:
        if not provider == None:
            from modules.sources import sources
            url = sources().sourcesResolve(url, provider)
            if url == None: raise Exception()

        #legacy issue, will be removed later
        if 'afdah.org' in url and not '</source>' in url:
            url += '<source>afdah</source>'

        if '</source>' in url:
            source = re.compile('<source>(.+?)</source>').findall(url)[0]
            url = re.compile('(.+?)<source>').findall(url)[0]

            for i in ['_mv', '_tv', '_mv_tv']:
                try:
                    call = __import__('modules.sources.%s%s' % (source, i),
                                      globals(), locals(), ['object'],
                                      -1).source()
                except:
                    pass

            from modules import sources
            d = sources.sources()

            url = call.get_sources(url, d.hosthdfullDict, d.hostsdfullDict,
                                   d.hostlocDict)

            if type(url) == list:
                url = sorted(url, key=lambda k: k['quality'])
                url = url[0]['url']

            url = call.resolve(url)

        from modules import resolvers
        url = resolvers.request(url)

        if type(url) == list:
            url = sorted(url, key=lambda k: k['quality'])
            url = url[0]['url']

        if url == None: raise Exception()
    except:
        return control.infoDialog('Unplayable stream')
        pass

    try:
        u = url.split('|')[0]
        try:
            headers = dict(urlparse.parse_qsl(url.rsplit('|', 1)[1]))
        except:
            headers = dict('')

        ext = os.path.splitext(urlparse.urlparse(u).path)[1][1:].lower()
        if ext == 'm3u8': raise Exception()
        #if not ext in ['mp4', 'mkv', 'flv', 'avi', 'mpg']: ext = 'mp4'
        dest = name + '.' + ext

        req = urllib2.Request(u, headers=headers)
        resp = urllib2.urlopen(req, timeout=30)
        size = int(resp.headers['Content-Length'])
        size = ' %.2f GB' % (float(size) / 1073741824)

        no = control.yesnoDialog(dest, 'Complete file is' + size,
                                 'Continue with download?',
                                 name + ' - ' + 'Confirm Download', 'Confirm',
                                 'Cancel')

        if no: return
    except:
        return control.infoDialog('Unable to download')
        pass

    def download():
        return [{'name': name, 'url': url, 'image': image}]

    result = cache.get(download, 600000000, table='rel_dl')
    result = [i for i in result if not i['url'] == url]

    def download():
        return result + [{'name': name, 'url': url, 'image': image}]

    result = cache.get(download, 0, table='rel_dl')

    control.infoDialog('Item Added to Queue', name)
예제 #5
0
def resolveSource(source):
    src = sources().sourcesResolve(source['url'],
                                   source['provider']).split('|')[0]
    return src
예제 #6
0
elif action == 'stopDownload':
    from modules.libraries import downloader
    downloader.stopDownload()

elif action == 'statusDownload':
    from modules.libraries import downloader
    downloader.statusDownload()

elif action == 'trailer':
    from modules.libraries import trailer
    trailer.trailer().play(name, url)

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

elif action == 'play':
    from modules.sources import sources
    sources().play(name, title, year, imdb, tvdb, season, episode, show,
                   show_alt, date, genre, url)

elif action == 'addPlayableItem':
    from modules.sources import sources
    sources().addPlayableItem(name, title, year, imdb, tvdb, season, episode,
                              show, show_alt, date, genre, meta)

elif action == 'playItem':
    from modules.sources import sources
    sources().playItem(content, name, imdb, tvdb, url, source, provider)
예제 #7
0
def resolveSource(source):
    src = sources().sourcesResolve(source['url'],
                                   source['provider']).split('|')[0]
    return src
예제 #8
0
    years().movies()

elif action == 'channels_movies':
    from modules.v4 import channels
    channels().movies()

elif action == 'userlists_movies':
    from modules.v4 import userlists
    userlists().movies()

elif action == 'userlists_shows':
    from modules.v4 import userlists
    userlists().shows()

elif action == 'trailer':
    from modules.libraries.trailer import trailer
    trailer().play(name, url)

elif action == 'play':
    from modules.sources import sources
    sources().play(name, title, year, imdb, tvdb, season, episode, show, show_alt, date, genre, url)

elif action == 'addPlayableItem':
    from modules.sources import sources
    sources().addPlayableItem(name, title, year, imdb, tvdb, season, episode, show, show_alt, date, genre, meta)

elif action == 'playItem':
    from modules.sources import sources
    sources().playItem(content, name, imdb, tvdb, url, source, provider)

예제 #9
0
def main(argv):

    #------------------------------------------------------
    #Simple instruction parser code
    #Commands = CommandParser(argv)
    #Command = Commands[0]
    #------------------------------------------------------
    #This two lines are the multiinstruction parser code
    #To switch to the Simple parser just comment two lines above
    # and uncomment both lines of the Simple instructions parser code
    Commands = MultiCommandParser(argv)
    lenCommands = len(Commands) - 1
    for ps,Command in enumerate(Commands):
    #------------------------------------------------------
        if 'shorthelp' in Command:
            if Command == 'shorthelp':
                exitcode = helpFun(argv,['.Txt','.SPE', '.spe','.mca','.info'],extBool=False)
            if  ps == lenCommands:
                return exitcode

        elif Command[0] in MainOptD['help']:
            exitcode = helpFun(argv,['.Txt','.SPE','.spe', '.mca','.info'],extBool=True)
            if  ps == lenCommands:
                return exitcode

        elif Command[0] in MainOptD['autoPeak']:
            pid = TryFork()
            if pid == 0:
                exitcode = autoPeakFun(Command)
            else:
                exitcode = 0
            if  ps == lenCommands:
                return exitcode

        elif Command[0] in MainOptD['query']:
            exitcode = QueryFun(Command)
            if  ps == lenCommands:
                return exitcode

        elif Command[0] in MainOptD['test']:
            pid = TryFork()
            if pid == 0:
                exitcode = TestFun()
            else:
                exitcode = 0
            if  ps == lenCommands:
                return exitcode

        elif Command[0] in MainOptD['isotope']:
            exitcode = isotopeFun(Command)
            if  ps == lenCommands:
                return exitcode

        elif Command[0] in MainOptD['sum']:
            pid = TryFork()
            if pid == 0:
                exitcode = SumFun(Command)
            else:
                exitcode = 0
            if  ps == lenCommands:
                return exitcode

        elif Command[0] in MainOptD['rank']:
            exitcode = rankImp(Command)
            return exitcode

        elif Command[0] in MainOptD['sub']:
            pid = TryFork()
            if pid == 0:
               exitcode = SubFun(Command)
            else:
               exitcode = 0
            if  ps == lenCommands:
                return exitcode

        elif Command[0] in MainOptD['stats']:
            pid = TryFork()
            if pid == 0:
                exitcode = statsFun(Command)
            else:
                exitcode = 0
            if  ps == lenCommands:
                return exitcode

        elif Command[0] in MainOptD['energy']:
            exitcode = energyFun(Command)
            if  ps == lenCommands:
                return exitcode

        elif Command[0] in MainOptD['parent']:
            exitcode = Parent(Command)
            if  ps == lenCommands:
                return exitcode

        elif Command[0] in MainOptD['normint']:
            exitcode = NormIntensity(Command)
            if  ps == lenCommands:
                return exitcode

        elif Command[0] in MainOptD['2file']:
            exitcode = DataFile2hgeFile(Command)
            if  ps == lenCommands:
                return exitcode

        elif Command[0] in MainOptD['efficiency']:
            pid = TryFork()
            if pid == 0:
                exitcode = efficencyFun(Command)
            else:
                exitcode = 0
            if  ps == lenCommands:
                return exitcode

        elif Command[0] in MainOptD['rankAdv']:
            exitcode = rankAdvFun(Command)
            return exitcode

        elif Command[0] in MainOptD['fuzzy']:
            exitcode = fuzzyrankFun(Command)
            return exitcode

        elif Command[0] in MainOptD['halfSort']:
            exitcode = halfSortFun(Command)
            return exitcode

        elif Command[0] in MainOptD['chainRank']:
            exitcode = ChainRankFun(Command)
            return exitcode

        elif Command[0] in MainOptD['distance']:
            exitcode = rankDist(Command)
            return exitcode
        elif Command[0] in MainOptD['probability']:
            exitcode = rankProb(Command)
            return exitcode

        elif Command[0] in MainOptD['signalNoise']:
            exitcode = signal2noise(Command)
            return exitcode

        elif Command[0] in MainOptD['sources']:
            exitcode = sources(Command)
            return exitcode
        
        else:
            pid = TryFork()
            if pid == 0:
                exitcode = noOption(Command)
            else:
                exitcode = 0
            if  ps == lenCommands:
                return exitcode
예제 #10
0
def resolveUrl(name, url, audio, image, fanart, playable, content):
    try:
        if '.f4m'in url:
            label = cleantitle(name)
            ext = url.split('?')[0].split('&')[0].split('|')[0].rsplit('.')[-1].replace('/', '').lower()
            if not ext == 'f4m': raise Exception()
            from modules.libraries.f4mproxy.F4mProxy import f4mProxyHelper
            return f4mProxyHelper().playF4mLink(url, label, None, None,'',image)


        #legacy issue, will be removed later
        if 'afdah.org' in url and not '</source>' in url: url += '<source>afdah</source>'

        if '</source>' in url:
            source = re.compile('<source>(.+?)</source>').findall(url)[0]
            url = re.compile('(.+?)<source>').findall(url)[0]

            for i in ['_mv', '_tv', '_mv_tv']:
                try: call = __import__('modules.sources.%s%s' % (source, i), globals(), locals(), ['object'], -1).source()
                except: pass

            from modules import sources ; d = sources.sources()

            url = call.get_sources(url, d.hosthdfullDict, d.hostsdfullDict, d.hostlocDict)

            if type(url) == list and len(url) == 1:
                url = url[0]['url']

            elif type(url) == list:
                url = sorted(url, key=lambda k: k['quality'])
                for i in url: i.update((k, '720p') for k, v in i.iteritems() if v == 'HD')
                for i in url: i.update((k, '480p') for k, v in i.iteritems() if v == 'SD')
                q = [i['quality'].upper() for i in url]
                u = [i['url'] for i in url]
                select = control.selectDialog(q)
                if select == -1: return
                url = u[select]

            url = call.resolve(url)


        from modules import resolvers
        url = resolvers.request(url)

        if type(url) == list and len(url) == 1:
            url = url[0]['url']

        elif type(url) == list:
            url = sorted(url, key=lambda k: k['quality'])
            for i in url: i.update((k, '720p') for k, v in i.iteritems() if v == 'HD')
            for i in url: i.update((k, '480p') for k, v in i.iteritems() if v == 'SD')
            q = [i['quality'].upper() for i in url]
            u = [i['url'] for i in url]
            select = control.selectDialog(q)
            if select == -1: return
            url = u[select]

        if url == None: raise Exception()
    except:
        return control.infoDialog('Unplayable stream')
        pass


    if playable == 'true':
        item = control.item(path=url)
        return control.resolve(int(sys.argv[1]), True, item)
    else:
        label = cleantitle(name)
        item = control.item(path=url, iconImage=image, thumbnailImage=image)
        item.setInfo( type='Video', infoLabels = {'title': label} )
        control.playlist.clear()
        control.player.play(url, item)
예제 #11
0
def addDownload(name, url, image, provider=None):
    try:
        def download(): return []
        result = cache.get(download, 600000000, table='rel_dl')
        result = [i['name'] for i in result]
    except:
        pass

    if name in result:
        return control.infoDialog('Item Already In Your Queue', name)

    try:
        if not provider == None:
            from modules.sources import sources
            url = sources().sourcesResolve(url, provider)
            if url == None: raise Exception()


        #legacy issue, will be removed later
        if 'afdah.org' in url and not '</source>' in url: url += '<source>afdah</source>'

        if '</source>' in url:
            source = re.compile('<source>(.+?)</source>').findall(url)[0]
            url = re.compile('(.+?)<source>').findall(url)[0]

            for i in ['_mv', '_tv', '_mv_tv']:
                try: call = __import__('modules.sources.%s%s' % (source, i), globals(), locals(), ['object'], -1).source()
                except: pass

            from modules import sources ; d = sources.sources()

            url = call.get_sources(url, d.hosthdfullDict, d.hostsdfullDict, d.hostlocDict)

            if type(url) == list:
                url = sorted(url, key=lambda k: k['quality'])
                url = url[0]['url']

            url = call.resolve(url)


        from modules import resolvers
        url = resolvers.request(url)

        if type(url) == list:
            url = sorted(url, key=lambda k: k['quality'])
            url = url[0]['url']

        if url == None: raise Exception()
    except:
        return control.infoDialog('Unplayable stream')
        pass

    try:
        u = url.split('|')[0]
        try: headers = dict(urlparse.parse_qsl(url.rsplit('|', 1)[1]))
        except: headers = dict('')

        ext = os.path.splitext(urlparse.urlparse(u).path)[1][1:].lower()
        if ext == 'm3u8': raise Exception()
        #if not ext in ['mp4', 'mkv', 'flv', 'avi', 'mpg']: ext = 'mp4'
        dest = name + '.' + ext

        req = urllib2.Request(u, headers=headers)
        resp = urllib2.urlopen(req, timeout=30)
        size = int(resp.headers['Content-Length'])
        size = ' %.2f GB' % (float(size) / 1073741824)

        no = control.yesnoDialog(dest, 'Complete file is' + size, 'Continue with download?', name + ' - ' + 'Confirm Download', 'Confirm', 'Cancel')

        if no: return
    except:
        return control.infoDialog('Unable to download')
        pass

    def download(): return [{'name': name, 'url': url, 'image': image}]
    result = cache.get(download, 600000000, table='rel_dl')
    result = [i for i in result if not i['url'] == url]
    def download(): return result + [{'name': name, 'url': url, 'image': image}]
    result = cache.get(download, 0, table='rel_dl')

    control.infoDialog('Item Added to Queue', name)