Пример #1
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)

    from resources.lib.indexers import phstreams

    url = phstreams.resolveUrl(url)

    if url == None:
        return control.infoDialog('Unplayable stream')

    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)
Пример #2
0
elif action == 'searchDirectory':
    from resources.lib.indexers import phstreams
    phstreams.searchDirectory()

elif action == 'searchDirectory2':
    from resources.lib.indexers import phstreams
    phstreams.searchDirectory(url)

elif action == 'clearSearch':
    from resources.lib.indexers import phstreams
    phstreams.clearSearch()

elif action == 'resolveUrl':
    from resources.lib.indexers import phstreams
    phstreams.resolveUrl(url)

elif action == 'openDialog':
    from resources.lib.modules import phdialogs
    phdialogs.openDialog(url,audio)

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

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

elif action == 'downloader':
    from resources.lib.modules import downloader
Пример #3
0
elif action == 'searchDirectory':
    from resources.lib.indexers import phstreams
    phstreams.searchDirectory()

elif action == 'searchDirectory2':
    from resources.lib.indexers import phstreams
    phstreams.searchDirectory(url)

elif action == 'clearSearch':
    from resources.lib.indexers import phstreams
    phstreams.clearSearch()

elif action == 'resolveUrl':
    from resources.lib.indexers import phstreams
    phstreams.resolveUrl(name, url, audio, image, fanart, playable, content)

elif action == 'openDialog':
    from resources.lib.libraries import phdialogs
    phdialogs.openDialog(url,audio)

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

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

elif action == 'downloader':
    from resources.lib.libraries import downloader
Пример #4
0
elif action == 'searchDirectory':
    from resources.lib.indexers import phstreams
    phstreams.searchDirectory()

elif action == 'searchDirectory2':
    from resources.lib.indexers import phstreams
    phstreams.searchDirectory(url)

elif action == 'clearSearch':
    from resources.lib.indexers import phstreams
    phstreams.clearSearch()

elif action == 'resolveUrl':
    from resources.lib.indexers import phstreams
    phstreams.resolveUrl(name, url, audio, image, fanart, playable, content)

elif action == 'openDialog':
    from resources.lib.libraries import phdialogs
    phdialogs.openDialog(url, audio)

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

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

elif action == 'downloader':
    from resources.lib.libraries import downloader