Exemple #1
0
def PlayYouTube(name,url,iconimage):
    import yt
    youtube=yt.PlayVideo(url)    
    liz = xbmcgui.ListItem(name, iconImage='DefaultVideo.png', thumbnailImage=iconimage)
    liz.setInfo(type='Video', infoLabels={'Title':name})
    liz.setProperty("IsPlayable","true")
    liz.setPath(str(youtube))
    xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, liz)
def get_PLAYlink(name, url):
    HTML = process.OPEN_URL(url)
    match_youtube = re.compile(
        '<iframe width="560" height="315" src="https://www.youtube.com/embed/(.+?)" frameborder="0" allowfullscreen>'
    ).findall(HTML)
    for url in match_youtube:
        yt.PlayVideo(url)
    match = re.compile('<script data-config="(.+?)" data-height').findall(HTML)
    for playlink in match:
        if 'div' in playlink:
            pass
        else:
            Playlink = (playlink).replace('/v2', '').replace(
                'zeus.json', 'video-sd.mp4?hosting_id=21772').replace(
                    'config.playwire.com', 'cdn.video.playwire.com')
            process.Big_Resolve(name, 'http:' + Playlink)
def Download_Extract(url,video):
    global download_thread
    global endtime
    download_thread = threading.Thread(target=Download_Function, args=[url])
    updatescreen_thread = threading.Thread(target=Update_Screen)
    try:
        download_thread.start()
        starttime = datetime.datetime.now()
        print"###Download Started"
    except:
        dialog.ok('Error','Unable to download updates from server. Please try opening a web browser on your PC to make sure your internet is working correctly. Click OK to try again.')
        return
    try:
        yt.PlayVideo(video)
    except:
        pass
    while xbmc.Player().isPlaying():
        xbmc.sleep(500)
    updatescreen_thread.start()
    while download_thread.isAlive():
        xbmc.sleep(500)

# This is used to get our speedtest results, you probably won't need this
    endtime   = datetime.datetime.fromtimestamp(os.path.getmtime(lib))
    timediff  = endtime-starttime
    libsize   = os.path.getsize(lib) / (128*1024.0)
    timediff = str(timediff).replace(':','')
    speed = libsize / float(timediff)
    writefile = open(timepath, mode='w+')
    writefile.write(str(speed))
    writefile.close()

# Deal with the downloaded file, you'll need to extract but pass through a password because it will be pw protected zip
    if os.path.exists(lib) and zipfile.is_zipfile(lib):
        zin = zipfile.ZipFile(lib, 'r')
        zin.extractall(rootfolder)
        try:
            os.remove(lib)
        except:
            print"### Failed to remove temp file"
        Remove_Textures()
        if not os.path.exists(RunWizard):
            os.makedirs(RunWizard)
        print"### Removed textures"
        KILL_KODI()
Exemple #4
0
def Download_Extract(url, video):
    global download_thread
    global endtime
    if not os.path.exists(RunWizard):
        os.makedirs(RunWizard)
    download_thread = threading.Thread(target=Download_Function, args=[url])
    updatescreen_thread = threading.Thread(target=Update_Screen)
    download_thread.start()
    starttime = datetime.datetime.now()
    try:
        yt.PlayVideo(video)
    except:
        pass
    while xbmc.Player().isPlaying():
        xbmc.sleep(500)
    updatescreen_thread.start()
    while download_thread.isAlive():
        xbmc.sleep(500)
    endtime = datetime.datetime.fromtimestamp(os.path.getmtime(lib))
    timediff = endtime - starttime
    libsize = os.path.getsize(lib) / (128 * 1024.0)
    timediff = str(timediff).replace(':', '')
    speed = libsize / float(timediff)
    writefile = open(timepath, mode='w+')
    writefile.write(str(speed))
    writefile.close()

    if os.path.exists(lib) and zipfile.is_zipfile(lib):
        zin = zipfile.ZipFile(lib, 'r')
        zin.extractall(rootfolder)
        try:
            os.remove(lib)
        except:
            print "### Failed to remove temp file"
        Remove_Textures()
        print "### Removed textures"
        KILL_KODI()
Exemple #5
0
    pass

print str(PATH) + ': ' + str(VERSION)
print "Mode: " + str(mode)
print "URL: " + str(url)
print "Name: " + str(name)
print "IconImage: " + str(iconimage)
#####################################################END PROCESSES##############################################################

if mode == None: Main_Menu()
elif mode == 1: Second_Menu(url)
elif mode == 2:
    if 'youtube' in url:
        url = (url).replace('https://www.youtube.com/watch?v=',
                            '').replace('http://www.youtube.com/watch?v=', '')
        yt.PlayVideo(url)
    else:
        resolve(url)
elif mode == 3:
    Search()
elif mode == 4:
    addon_log("addFavorite")
    try:
        name = name.split('\\ ')[1]
    except:
        pass
    try:
        name = name.split('  - ')[0]
    except:
        pass
    addFavorite(name, url, iconimage, fanart, fav_mode)
Exemple #6
0
def doMenu():
    try:
        import utils
    except:
        doStandard(useScript=False)
        return

    active = [1, 2, 25, 40, 500, 501, 502]  #28 is video Playlist
    window = xbmcgui.getCurrentWindowId()
    utils.log('Window     : %d' % window)
    if window - 10000 not in active:
        doStandard(useScript=False)
        return

    import contextmenu

    # to prevent master profile setting being used in other profiles
    if utils.ADDON.getSetting('CONTEXT') != 'true':
        doStandard(useScript=False)
        return

    folder = xbmc.getInfoLabel('Container.FolderPath')
    #ignore if in Super Favourites
    if utils.ADDONID in folder:
        doStandard(useScript=False)
        return

    choice = 0
    label = xbmc.getInfoLabel('ListItem.Label')
    path = xbmc.getInfoLabel('ListItem.FolderPath')
    filename = xbmc.getInfoLabel('ListItem.FilenameAndPath')
    name = xbmc.getInfoLabel('ListItem.Label')
    thumb = xbmc.getInfoLabel('ListItem.Thumb')
    playable = xbmc.getInfoLabel(
        'ListItem.Property(IsPlayable)').lower() == 'true'
    fanart = xbmc.getInfoLabel('ListItem.Property(Fanart_Image)')
    isFolder = xbmc.getCondVisibility('ListItem.IsFolder') == 1

    try:
        file = xbmc.Player().getPlayingFile()
    except:
        file = None

    isStream = False
    if file:
        isStream = file.startswith('http://')

    #GOTHAM only
    #if hasattr(xbmc.Player(), 'isInternetStream'):
    #    isStream = xbmc.Player().isInternetStream()
    #elif file:
    #    isStream = file.startswith('http://')

    utils.log('**** Context Menu Information ****')
    utils.log('Label      : %s' % label)
    utils.log('Folder     : %s' % folder)
    utils.log('Path       : %s' % path)
    utils.log('Filename   : %s' % filename)
    utils.log('Name       : %s' % name)
    utils.log('Thumb      : %s' % thumb)
    utils.log('Fanart     : %s' % fanart)
    utils.log('Window     : %d' % window)
    utils.log('IsPlayable : %s' % playable)
    utils.log('IsFolder   : %s' % isFolder)
    utils.log('File       : %s' % file)
    utils.log('IsStream   : %s' % isStream)

    menu = []

    #if (len(menu) == 0) and window == 12005: #video playing
    #if isStream:
    #    menu.append(('Download  %s' % label, _DOWNLOAD))
    #    menu.append(('Show Playlist',        _PLAYLIST))
    #else:
    #    return doStandard()
    #cancel download feature for now
    #return doStandard()

    if (len(menu) == 0) and len(path) > 0:
        ytID = ''

        if path.startswith(
                'plugin://plugin.video.youtube') and 'videoid=' in path:
            try:
                ytID = path.rsplit('videoid=', 1)[-1][0:11]
                menu.append((utils.GETTEXT(30104), _PLAYTUBE))
            except:
                ytID = ''

        utils.verifySuperSearch()

        default = getDefaultSearch()

        menu.append((utils.GETTEXT(30047), _ADDTOFAVES))
        menu.append((utils.GETTEXT(30049), _SF_SETTINGS))
        menu.append((utils.GETTEXT(30054), _SEARCH))

        if len(default) > 0:
            menu.append((utils.GETTEXT(30098) % default, _SEARCHDEF))

        menu.append((utils.GETTEXT(30048), _STD_SETTINGS))

    #elif window == 10000: #Home screen
    #    menu.append((utils.GETTEXT(30053), _LAUNCH_SF))
    #    menu.append((utils.GETTEXT(30049), _SF_SETTINGS))

    if len(menu) == 0:
        doStandard()
        return

    xbmcgui.Window(10000).setProperty('SF_MENU_VISIBLE', 'true')
    choice = contextmenu.showMenu(utils.ADDONID, menu)

    if choice == _STD_SETTINGS:
        doStandard()
        return

    xbmc.executebuiltin('Dialog.Close(all, true)')

    if choice == _PLAYLIST:
        xbmc.executebuiltin('ActivateWindow(videoplaylist)')

    #if choice == _DOWNLOAD:
    #    import download
    #    download.download(file, 'c:\\temp\\file.mpg', 'Super Favourites')

    if choice == _PLAYTUBE:
        if len(ytID) != 11:
            return
        import yt
        if not yt.PlayVideo(ytID):
            utils.DialogOK(utils.GETTEXT(30105))

    if choice == _STD_SETTINGS:
        doStandard()

    if choice == _SF_SETTINGS:
        utils.ADDON.openSettings()

    if choice == _ADDTOFAVES:
        if isFolder:
            cmd = 'ActivateWindow(%d,"%s' % (window, path)
        elif path.lower().startswith('script'):
            if path[-1] == '/':
                path = path[:-1]
            cmd = 'RunScript("%s' % path.replace('script://', '')
        elif path.lower().startswith('videodb') and len(filename) > 0:
            cmd = 'PlayMedia("%s' % filename
        #elif path.lower().startswith('musicdb') and len(filename) > 0:
        #    cmd = 'PlayMedia("%s")' % filename
        else:
            cmd = 'PlayMedia("%s&sf_win_id=%d_' % (path, window)

        import urllib
        if '?' in cmd:
            cmd += '&'
        else:
            cmd += '?'

        cmd += 'sf_fanart=%s_")' % urllib.quote_plus(fanart)

        copyFave(name, thumb, cmd)

    if choice == _LAUNCH_SF:
        xbmc.executebuiltin('ActivateWindow(programs,plugin://%s)' %
                            utils.ADDONID)

    if choice == _SEARCH or choice == _SEARCHDEF:
        if utils.ADDON.getSetting('STRIPNUMBERS') == 'true':
            name = clean(name)

        thumb = thumb if len(thumb) > 0 else 'null'
        fanart = fanart if len(fanart) > 0 else 'null'

        _SUPERSEARCH = 0  #declared as  0 in default.py
        _SUPERSEARCHDEF = 10  #declared as 10 in default.py

        mode = _SUPERSEARCH if (choice == _SEARCH) else _SUPERSEARCHDEF
        videoID = 10025  #video

        if window == 10000:  #don't activate on home screen, push to video
            window = videoID

        import urllib

        cmd = 'ActivateWindow(%d,"plugin://%s/?mode=%d&keyword=%s&image=%s&fanart=%s")' % (
            window, utils.ADDONID, mode, urllib.quote_plus(name),
            urllib.quote_plus(thumb), urllib.quote_plus(fanart))
        activateCommand(cmd)
def showVideo():
    import yt
    yt.PlayVideo('-DpU4yOJO_I', forcePlayer=True)
    xbmc.sleep(500)
    while xbmc.Player().isPlaying():
        xbmc.sleep(500)
Exemple #8
0

def setView(content, viewType):
    if content:
        xbmcplugin.setContent(int(sys.argv[1]), content)


if mode == None: Main_Menu()
elif mode == 1: Stand_up()
elif mode == 2: Search()
elif mode == 3: Play_Stage(url)
elif mode == 4: Regex(url)
elif mode == 5: Resolve(url)
elif mode == 8: Search()
elif mode == 7: grab_youtube_playlist(url)
elif mode == 9: yt.PlayVideo(url)

elif mode == 100: Grab_Season(iconimage, url, extra)
elif mode == 101: Grab_Episode(url, name, fanart, extra, iconimage)
elif mode == 102: Get_Sources(name, url, iconimage, fanart)
elif mode == 106: Get_site_link(url, name)
elif mode == 103:
    addon_log("getFavorites")
    getFavorites()
elif mode == 104:
    addon_log("addFavorite")
    try:
        name = name.split('\\ ')[1]
    except:
        pass
    try:
Exemple #9
0
        recommendIMDB(imdb, keyword)

    except:
        winID = xbmcgui.getCurrentWindowId()
        cmd = '%s?mode=%d&keyword=%s&imdb=%s&callback=%s' % (
            sys.argv[0], _RECOMMEND_IMDB, urllib.quote_plus(keyword),
            urllib.quote_plus(imdb), 'callback')
        xbmc.executebuiltin('Container.Refresh(%s)' % cmd)

        cacheToDisc = False
        doEnd = False

elif mode == _PLAYTRAILER:
    import yt
    if not yt.PlayVideo(path):
        utils.DialogOK(GETTEXT(30092))

elif mode == _MAIN:
    main()

else:
    #do nothing
    nItem = 1

#make sure at least 1 line is showing to allow context menu to be displayed
if nItem < 1:
    addDir('', _SEPARATOR, thumbnail=BLANK, isFolder=False)

if doRefresh:
    refresh()