Example #1
0
                param[splitparams[0]]=splitparams[1]

    return param

params = get_params()
if params['action'] == 'search' or params['action'] == 'manualsearch':
    item = {}
    item['temp']               = False
    item['rar']                = False
    item['mansearch']          = False
    item['year']               = xbmc.getInfoLabel("VideoPlayer.Year")                           # Year
    item['season']             = str(xbmc.getInfoLabel("VideoPlayer.Season"))                    # Season
    item['episode']            = str(xbmc.getInfoLabel("VideoPlayer.Episode"))                   # Episode
    item['tvshow']             = normalizeString(xbmc.getInfoLabel("VideoPlayer.TVshowtitle"))   # Show
    item['title']              = normalizeString(xbmc.getInfoLabel("VideoPlayer.OriginalTitle")) # try to get original title
    item['file_original_path'] = urllib.parse.unquote(xbmc.Player().getPlayingFile().decode('utf-8'))  # Full path of a playing file
    item['3let_language']      = []

    if 'searchstring' in params:
        item['mansearch'] = True
        item['mansearchstr'] = params['searchstring']

    for lang in urllib.parse.unquote(params['languages']).decode('utf-8').split(","):
        item['3let_language'].append(xbmc.convertLanguage(lang,xbmc.ISO_639_2))

    if item['title'] == "":
        item['title']  = xbmc.getInfoLabel("VideoPlayer.Title")                       # no original title, get just Title
        if item['title'] == os.path.basename(xbmc.Player().getPlayingFile()):         # get movie title and year if is filename
            title, year = xbmc.getCleanMovieTitle(item['title'])
            item['title'] = normalizeString(title.replace('[','').replace(']',''))
            item['year'] = year
Example #2
0
    def onPlayBackStarted(self):
        # Will be called when xbmc starts playing a file
        self.stopAll()

        # Get current file
        try:
            currentFile = self.xbmcplayer.getPlayingFile()
            xbmc.sleep(300)
        except:
            currentFile = ""
            count = 0
            while not currentFile:
                xbmc.sleep(100)
                try:
                    currentFile = self.xbmcplayer.getPlayingFile()
                except:
                    pass

                if count == 5:  # try 5 times
                    log.info("Cancelling playback report...")
                    break
                else:
                    count += 1

        # if we did not get the current file return
        if currentFile == "":
            return

        # process the playing file
        self.currentFile = currentFile

        # We may need to wait for info to be set in kodi monitor
        itemId = window("emby_%s.itemid" % currentFile)
        tryCount = 0
        while not itemId:

            xbmc.sleep(200)
            itemId = window("emby_%s.itemid" % currentFile)
            if tryCount == 20:  # try 20 times or about 10 seconds
                log.info(
                    "Could not find itemId, cancelling playback report...")
                break
            else:
                tryCount += 1

        else:
            log.info("ONPLAYBACK_STARTED: %s itemid: %s" %
                     (currentFile, itemId))

            # Only proceed if an itemId was found.
            embyitem = "emby_%s" % currentFile
            runtime = window("%s.runtime" % embyitem)
            refresh_id = window("%s.refreshid" % embyitem)
            playMethod = window("%s.playmethod" % embyitem)
            itemType = window("%s.type" % embyitem)
            window('emby_skipWatched%s' % itemId, value="true")

            customseek = window('emby_customPlaylist.seektime')
            if window('emby_customPlaylist') == "true" and customseek:
                # Start at, when using custom playlist (play to Kodi from webclient)
                log.info("Seeking to: %s" % customseek)
                self.xbmcplayer.seekTime(int(customseek) / 10000000.0)
                window('emby_customPlaylist.seektime', clear=True)

            try:
                seekTime = self.xbmcplayer.getTime()
            except:
                # at this point we should be playing and if not then bail out
                return

            # Get playback volume
            volume_query = {
                "jsonrpc": "2.0",
                "id": 1,
                "method": "Application.GetProperties",
                "params": {
                    "properties": ["volume", "muted"]
                }
            }
            result = xbmc.executeJSONRPC(json.dumps(volume_query))
            result = json.loads(result)
            result = result.get('result')

            volume = result.get('volume')
            muted = result.get('muted')

            # Postdata structure to send to Emby server
            url = "{server}/emby/Sessions/Playing"
            postdata = {
                'QueueableMediaTypes': "Video",
                'CanSeek': True,
                'ItemId': itemId,
                'MediaSourceId': itemId,
                'PlayMethod': playMethod,
                'VolumeLevel': volume,
                'PositionTicks': int(seekTime * 10000000),
                'IsMuted': muted
            }

            # Get the current audio track and subtitles
            if playMethod == "Transcode":
                # property set in PlayUtils.py
                postdata['AudioStreamIndex'] = window("%sAudioStreamIndex" %
                                                      currentFile)
                postdata['SubtitleStreamIndex'] = window(
                    "%sSubtitleStreamIndex" % currentFile)
            else:
                # Get the current kodi audio and subtitles and convert to Emby equivalent
                tracks_query = {
                    "jsonrpc": "2.0",
                    "id": 1,
                    "method": "Player.GetProperties",
                    "params": {
                        "playerid":
                        1,
                        "properties": [
                            "currentsubtitle", "currentaudiostream",
                            "subtitleenabled"
                        ]
                    }
                }
                result = xbmc.executeJSONRPC(json.dumps(tracks_query))
                tracks_data = None
                try:
                    tracks_data = json.loads(result)
                    tracks_data = tracks_data.get('result')
                except:
                    tracks_data = None

                try:  # Audio tracks
                    indexAudio = tracks_data['currentaudiostream']['index']
                except:
                    indexAudio = 0

                try:  # Subtitles tracks
                    indexSubs = tracks_data['currentsubtitle']['index']
                except:
                    indexSubs = 0

                try:  # If subtitles are enabled
                    subsEnabled = tracks_data['subtitleenabled']
                except:
                    subsEnabled = ""

                # Postdata for the audio
                postdata['AudioStreamIndex'] = indexAudio + 1

                # Postdata for the subtitles
                if subsEnabled and len(
                        xbmc.Player().getAvailableSubtitleStreams()) > 0:

                    # Number of audiotracks to help get Emby Index
                    audioTracks = len(xbmc.Player().getAvailableAudioStreams())
                    mapping = window("%s.indexMapping" % embyitem)

                    if mapping:  # Set in playbackutils.py

                        log.debug("Mapping for external subtitles index: %s" %
                                  mapping)
                        externalIndex = json.loads(mapping)

                        if externalIndex.get(str(indexSubs)):
                            # If the current subtitle is in the mapping
                            postdata['SubtitleStreamIndex'] = externalIndex[
                                str(indexSubs)]
                        else:
                            # Internal subtitle currently selected
                            subindex = indexSubs - len(
                                externalIndex) + audioTracks + 1
                            postdata['SubtitleStreamIndex'] = subindex

                    else:  # Direct paths enabled scenario or no external subtitles set
                        postdata[
                            'SubtitleStreamIndex'] = indexSubs + audioTracks + 1
                else:
                    postdata['SubtitleStreamIndex'] = ""

            # Post playback to server
            log.debug("Sending POST play started: %s." % postdata)
            self.doUtils(url, postBody=postdata, action_type="POST")

            # Ensure we do have a runtime
            try:
                runtime = int(runtime)
            except ValueError:
                try:
                    runtime = int(self.xbmcplayer.getTotalTime())
                    log.info("Runtime is missing, Kodi runtime: %s" % runtime)
                except:
                    runtime = 0
                    log.info("Runtime is missing, Using Zero")

            # Save data map for updates and position calls
            data = {
                'runtime': runtime,
                'item_id': itemId,
                'refresh_id': refresh_id,
                'currentfile': currentFile,
                'AudioStreamIndex': postdata['AudioStreamIndex'],
                'SubtitleStreamIndex': postdata['SubtitleStreamIndex'],
                'playmethod': playMethod,
                'Type': itemType,
                'currentPosition': int(seekTime)
            }

            self.played_info[currentFile] = data
            log.info("ADDING_FILE: %s" % self.played_info)

            ga = GoogleAnalytics()
            ga.sendEventData("PlayAction", itemType, playMethod)
            ga.sendScreenView(itemType)
Example #3
0
 def startv(self):
     self.close()
     finalURL = 'plugin://plugin.video.youtube/play/?video_id=' + self.trailer
     xbmc.Player().play(finalURL)
     debug("Pressed Button")
Example #4
0
windowDialog = xbmcgui.WindowDialog()

button = xbmcgui.ControlButton

image = xbmcgui.ControlImage

keyboard = xbmc.Keyboard

sleep = xbmc.sleep

execute = xbmc.executebuiltin

skin = xbmc.getSkinDir()

player = xbmc.Player()

playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)

resolve = xbmcplugin.setResolvedUrl

openFile = xbmcvfs.File

makeFile = xbmcvfs.mkdir

deleteFile = xbmcvfs.delete

listDir = xbmcvfs.listdir

transPath = translatePath
Example #5
0
def play(name, streamurl, iconimage="DefaultVideo.png"):
    listitem = xbmcgui.ListItem(name,
                                iconImage="DefaultVideo.png",
                                thumbnailImage=iconimage)
    player = xbmc.Player(xbmc.PLAYER_CORE_AUTO)
    player.play(streamurl, listitem)
Example #6
0
 def item_random_play(self):
     playlist = xbmc.PlayList(xbmc.PLAYLIST_MUSIC)
     playlist.clear()
     xbmc.executebuiltin('Action(Queue)')
     playlist.shuffle()
     xbmc.Player().play(playlist)
Example #7
0
File: ui.py Project: bialagary/mw
 def play(self):
     if not self.ump.content_type == self.ump.defs.CT_IMAGE:
         xbmc.Player(xbmc.PLAYER_CORE_MPLAYER).play(self.playlist)
     else:
         self.ump.iwindow.playlist = self.playlist
         self.ump.iwindow.doModal()
Example #8
0
def main():
    params = sys.argv[2][1:]
    params = dict(urlparse.parse_qsl(params))

    cntv = params.get('stream')
    city = params.get('city')
    category = params.get('category')
    replay = params.get('replay')

    if cntv:
        title = params['title']
        thumb = params['thumb']
        pDialog = xbmcgui.DialogProgress()
        pDialog.create(addon.getLocalizedString(30009),
                       addon.getLocalizedString(30010))
        pDialog.update(0)
        try:
            #Locate the M3U8 file
            resp = urllib2.urlopen(
                "http://vdn.live.cntv.cn/api2/live.do?channel=pa://cctv_p2p_hd"
                + cntv)
            data = resp.read()
            data = data.decode('utf-8')
            resp.close()
            if pDialog.iscanceled():
                return

            url = None
            jsondata = loads(data.encode('utf-8'))
            urlsTried = 0
            urlsToTry = 5

            if 'hls_url' in jsondata:
                for i in range(1, urlsToTry + 1):
                    urlsTried += 1
                    pDialog.update(
                        urlsTried * 500 / urlsToTry,
                        "{0} {1} (HLS)".format(addon.getLocalizedString(30011),
                                               "hls%d" % i))
                    url = tryStream(jsondata, "hls%d" % i)
                    if url is not None:
                        break
                    if pDialog.iscanceled():
                        return

            if url is None and 'flv_url' in jsondata:
                for i in range(1, 5):
                    url = tryStream(jsondata, "flv%d" % i)
                    if url is not None:
                        break

            if url is None and 'hds_url' in jsondata:
                for i in range(1, 5):
                    url = tryHDSStream(jsondata, "fds%d" % i)
                    if url is not None:
                        break

            if url is None:
                showNotification(30002)
                pDialog.close()
                return

            auth = urlparse.parse_qs(urlparse.urlparse(url)[4])["AUTH"][0]
            url += "|" + urllib.urlencode({"Cookie": "AUTH=" + auth})
            #print url
            url = getHttp(url)

            pDialog.close()
            li = xbmcgui.ListItem(title, thumbnailImage=thumb)
            li.setInfo(type='Video', infoLabels={'Title': title})
            xbmc.Player().play(url, li)

        except Exception:
            showNotification(30000)
            print(traceback.format_exc())
            pDialog.close()
            return

    elif city:
        for area in cityList:  # find area in cityList
            if area['id'] == city:
                break

        channels = len(area['channel'])
        for i in range(channels):
            key = area['channel'][i].keys()[0]
            addStream(key, area['channel'][i][key])

        xbmcplugin.endOfDirectory(addon_handle)

    elif category:
        if category == "yangshi":
            for item in cctvList:
                addStream(item[0], item[1])

        if category == "weishi":
            for item in weishList:
                addStream(item[0], item[1])

        if category == "shuzi":
            addStream("zhongxuesheng", "CCTV中学生")
            addStream("cctvfxzl", "CCTV发现之旅")
            addStream("xinkedongman", "CCTV新科动漫")
            addStream("zhinan", "CCTV电视指南")

        if category == "chengshi":
            for item in cityList:
                addCity(item['id'], item['area'])

        if category == 'cctvreplay':
            for item in cctvList:
                addStream(item[0], item[1], '?replay=')

        xbmcplugin.endOfDirectory(addon_handle)

    elif replay:
        title = params['title']
        thumb = params['thumb']
        cntvReplay(replay, title, thumb)

    else:
        for title in mainList:
            addCategory(title, mainList[title])

        addCategory('cctvreplay', '央视重播节目')
        xbmcplugin.endOfDirectory(addon_handle)
def files(url):
    dialog = xbmcgui.Dialog()
    fn = dialog.browseSingle(1, 'Kodi', 'music', '', False, False, url)
    xbmc.Player().play(fn)
def mainlist(item):
    logger.info("deportesalacarta.livesportsws lista")
    itemlist = []
    import xbmc
    check=xbmc.getInfoLabel('ListItem.Title')
    
    if item.channel != __channel__:
        item.channel = __channel__
    else:
       if not xbmc.Player().isPlaying():
          xbmc.executebuiltin('xbmc.PlayMedia('+song+')')
    
    
    
    """
        Lo que ocurre con
        url = http://translate.googleusercontent.com/translate_c?depth=1&nv=1&rurl=translate.google.com&sl=ru&tl=es&u=http://lfootball.ws/&usg=ALkJrhgzJfI1TDn3BxGgPbjgAHHS7J0i9g
        Redirecciones:
        1. http://translate.google.com/translate?depth=1&nv=1&rurl=translate.google.com&sl=ru&tl=es&u=http://lfootball.ws/
        2. http://translate.googleusercontent.com/translate_p?nv=1&rurl=translate.google.com&sl=ru&tl=es&u=http://lfootball.ws/&depth=2&usg=ALkJrhgAAAAAVupk4tLINTbmU7JrcQdl0G4V3LtnRM1n
        3. http://translate.googleusercontent.com/translate_c?depth=2&nv=1&rurl=translate.google.com&sl=ru&tl=es&u=http://lfootball.ws/&usg=ALkJrhhhRDwHSDRDN4t27cX5CYZLFFQtmA
        Lo que significa que necesitamos una key nueva cada vez en el argumento "usg" y para llegar a la url 3 debemos hacer la petición 1 y 2 con 'follow_redirects=False' o con la convinación de 'follow_redirects=False' y 'header_to_get="location"'
        """
    
    #### Opción 1: 'follow_redirects=False'
    ## Petición 1
    url = "http://translate.google.com/translate?depth=1&nv=1&rurl=translate.google.com&sl=ru&tl=es&u=http://livesport.ws/football"
    data = dhe( scrapertools.downloadpage(url,follow_redirects=False) )#.decode('cp1251').encode('utf8')
    ## Petición 2
    url = scrapertools.get_match(data, ' src="([^"]+)" name=c ')
    data = dhe( scrapertools.downloadpage(url,follow_redirects=False) )#.decode('cp1251').encode('utf8')
    ## Petición 3
    url = scrapertools.get_match(data, 'URL=([^"]+)"')
    data = dhe( scrapertools.cachePage(url) )#.decode('cp1251').encode('utf8')
    """
        #### Opción 2: 'follow_redirects=False' y 'header_to_get="location"'
        ## Petición 1
        url = "http://translate.google.com/translate?depth=1&nv=1&rurl=translate.google.com&sl=ru&tl=es&u=http://lfootball.ws/"
        data = dhe( scrapertools.downloadpage(url,follow_redirects=False) )#.decode('cp1251').encode('utf8')
        ## Petición 2
        url = scrapertools.get_match(data, ' src="([^"]+)" name=c ')
        url = scrapertools.get_header_from_response(url, header_to_get="location")
        ## Petición 3
        data = dhe( scrapertools.cachePage(url ) )#.decode('cp1251').encode('utf8')
        """
    
    
    
    patrondata = '</h1></div>(.*?)</h2>'
    matchesdata = re.compile(patrondata,re.DOTALL).findall(data)
    for bloque_data in matchesdata:
        
        for bloque_data in matchesdata:
            patrondaygame = '<span class=text>.*?<span class=text>(.*?)</span></a>(.*?)</span> --></li></ul></div>'
            matchesdaygame = re.compile(patrondaygame,re.DOTALL).findall(bloque_data)

            for day , bloque_games in matchesdaygame:
                day = re.sub(r"</span>|<i class=ico><span>de</span></i>|<span class=text>|de","",day)
                day = day.replace("actuales","Hoy")
                day = scrapertools.htmlclean(day)
                dia = scrapertools.get_match(day, '(\d+)')
                mes = re.sub(r"(?i)de |hoy |ayer |mañana |el |día ", "", day)
                mes = scrapertools.find_single_match(mes, '\d+\s*([A-z]+)')
                mes = mes.title()
                mes = month_convert(mes)
                mes = str(mes).zfill(2)
                
                if "hoy" in day or "Hoy" in day:
                    day = day.replace(day,"[COLOR yellow][B]"+day+"[/B][/COLOR]")
                elif "Ayer" in day or "ayer" in day:
                      day = day.replace(day,"[COLOR darkgoldenrod][B]"+day+"[/B][/COLOR]")
                else:
                     day = day.replace(day,"[COLOR greenyellow][B]"+day+"[/B][/COLOR]")
                itemlist.append( Item(channel=__channel__, title=day,action="mainlist",url="",fanart="http://www.easywallprints.com/upload/designs/background-with-soccer-balls-zoom-1.jpg",thumbnail="http://s6.postimg.org/3yl2y4adt/livesportagenda.png",folder=False) )
                
                patron = 'es&u=(.*?)&usg.*?id=event-(.*?)>(.*?)</i>.*?<span class=competition>.*?<span class=competition>(.*?)</span></a>.*?<i class="separator">.*?</span>(.*?)</span>.*?src=(.*?)>.*?src=(.*?)>.*?text-align: left">.*?</span>(.*?)</span>.*?<i class="live-broadcasting-status-(\d)"'#'<a class="link" href="([^"]+)" title="(.*?)".*?<span class="liga"><span>(.*?)</span></span>.*?<span class="date"><span>(.*?)</span></span>'
                matches = re.compile(patron,re.DOTALL).findall(bloque_games)
                for url_info,id_event, hora,competition,team1,thumbnail,fanart,team2 , status in matches:
                    team1 = re.sub(r"-"," ",team1)
                    team2=  re.sub(r"-"," ",team2)
                    competition = re.sub(r"\.","",competition)
                    
                    
                    if status == "4":
                        continue
                    
                    if "00:" in hora:
                        hora = hora.replace("00:","24:")
                    
                    if not "LIVE" in hora:
                       time= re.compile('(\d+):(\d+)',re.DOTALL).findall(hora)
                       for horas, minutos in time:
                           wrong_time =int(horas)
                           value = 2
                           correct_time = wrong_time - value
                           correct_time = str(correct_time)
                           hora = correct_time +":"+ minutos
                           
                           
                    
                
                    if "OFFLINE" in hora:
                        extra = hora
                        title = team1+"-"+team2+"____"
                        title = title.title()
                        fulltitle =title.replace(title,"[COLOR burlywood][B]"+title+"[/B][/COLOR]")
                        title= title.replace(title,"[COLOR burlywood]"+title+"[/COLOR]")
                        action = "mainlist"
                        folder = False
                        evento = ""
                        time = ""
                        fecha = ""
                    else:
                        if "hoy" in day or "Hoy" in day:
                            title = team1+" - "+team2
                            title = title.title()
                            fulltitle =title.replace(title,"[COLOR deepskyblue][B]"+title+"[/B][/COLOR]")
                            if "LIVE" in hora:
                               import time
                               
                               time = "live"
                               fecha = dia+"/"+str(mes)
                               fecha = fecha.strip()
                               evento = team1+" vs "+team2
                               extra= hora
                               hora = u'\u006C\u0456\u0475\u04BC!!'.encode('utf-8')
                               hora = hora.replace(hora,"[COLOR crimson][B]"+hora+"[/B][/COLOR]")
                               
                            else:
                                evento = team1+" vs "+team2
                                time = hora.strip()
                                fecha = dia+"/"+str(mes)
                                fecha = fecha.strip()
                                extra = hora
                                hora = hora.replace(hora,"[COLOR aquamarine][B]"+hora+"[/B][/COLOR]")
                          
                            title = hora+ "  " + title.replace(title,"[COLOR deepskyblue]"+title+"[/COLOR]")+ "[COLOR floralwhite]"+" "+"("+competition+")"+"[/COLOR]"
                            action = "enlaces"
                            folder = True
                        else:
                            title = team1+" - "+team2
                            evento = team1+" vs "+team2
                            time = hora
                            fecha = dia+"/"+mes
                            title = title.title()
                            fulltitle =title.replace(title,"[COLOR mediumaquamarine][B]"+title+"[/B][/COLOR]")
                            title = "[COLOR aquamarine][B]"+hora+"[/B][/COLOR]"+ "  " + title.replace(title,"[COLOR mediumaquamarine]"+title+"[/COLOR]")+ "[COLOR paleturquoise]"+" "+"("+competition+")"+"[/COLOR]"
                            action = "enlaces"
                            folder = True
                            
                    post_id = scrapertools.get_match(url_info,'http.*?livesport.ws\/(.*?)-')
                    url = "http://livesport.ws/engine/modules/sports/sport_refresh.php?from=event&event_id="+id_event+"&tab_id=0&post_id="+post_id
                    
                    itemlist.append( Item(channel=__channel__, title="     "+title,action=action,url=url,thumbnail =urlparse.urljoin(host,thumbnail),fanart =urlparse.urljoin(host,fanart),fulltitle = fulltitle,extra =extra,date=fecha, time=time, evento=evento, context="info_partido",deporte="futbol",folder=folder) )


        

    
    
    return itemlist
Example #11
0
def playLive(url, name):
	listitem = xbmcgui.ListItem(path=url, label=name)  
	listitem.setMimeType('application/vnd.apple.mpegurl')
	xbmc.Player().play(item=url, listitem=listitem)
Example #12
0
    def get(self, name, imdb, season, episode):
        import gzip, StringIO, codecs
        import xmlrpclib, os, re, base64

        try:
            langDict = {
                'Afrikaans': 'afr',
                'Albanian': 'alb',
                'Arabic': 'ara',
                'Armenian': 'arm',
                'Basque': 'baq',
                'Bengali': 'ben',
                'Bosnian': 'bos',
                'Breton': 'bre',
                'Bulgarian': 'bul',
                'Burmese': 'bur',
                'Catalan': 'cat',
                'Chinese': 'chi',
                'Croatian': 'hrv',
                'Czech': 'cze',
                'Danish': 'dan',
                'Dutch': 'dut',
                'English': 'eng',
                'Esperanto': 'epo',
                'Estonian': 'est',
                'Finnish': 'fin',
                'French': 'fre',
                'Galician': 'glg',
                'Georgian': 'geo',
                'German': 'ger',
                'Greek': 'ell',
                'Hebrew': 'heb',
                'Hindi': 'hin',
                'Hungarian': 'hun',
                'Icelandic': 'ice',
                'Indonesian': 'ind',
                'Italian': 'ita',
                'Japanese': 'jpn',
                'Kazakh': 'kaz',
                'Khmer': 'khm',
                'Korean': 'kor',
                'Latvian': 'lav',
                'Lithuanian': 'lit',
                'Luxembourgish': 'ltz',
                'Macedonian': 'mac',
                'Malay': 'may',
                'Malayalam': 'mal',
                'Manipuri': 'mni',
                'Mongolian': 'mon',
                'Montenegrin': 'mne',
                'Norwegian': 'nor',
                'Occitan': 'oci',
                'Persian': 'per',
                'Polish': 'pol',
                'Portuguese': 'por,pob',
                'Portuguese(Brazil)': 'pob,por',
                'Romanian': 'rum',
                'Russian': 'rus',
                'Serbian': 'scc',
                'Sinhalese': 'sin',
                'Slovak': 'slo',
                'Slovenian': 'slv',
                'Spanish': 'spa',
                'Swahili': 'swa',
                'Swedish': 'swe',
                'Syriac': 'syr',
                'Tagalog': 'tgl',
                'Tamil': 'tam',
                'Telugu': 'tel',
                'Thai': 'tha',
                'Turkish': 'tur',
                'Ukrainian': 'ukr',
                'Urdu': 'urd'
            }
            codePageDict = {
                'ara': 'cp1256',
                'ar': 'cp1256',
                'ell': 'cp1253',
                'el': 'cp1253',
                'heb': 'cp1255',
                'he': 'cp1255',
                'tur': 'cp1254',
                'tr': 'cp1254',
                'rus': 'cp1251',
                'ru': 'cp1251'
            }
            quality = [
                'bluray', 'hdrip', 'brrip', 'bdrip', 'dvdrip', 'webrip', 'hdtv'
            ]
            langs = []

            try:
                try:
                    langs = langDict[control.setting(
                        'subtitles.lang.1')].split(',')
                except:
                    langs.append(langDict[control.setting('subtitles.lang.1')])
            except:
                pass

            try:
                try:
                    langs = langs + langDict[control.setting(
                        'subtitles.lang.2')].split(',')
                except:
                    langs.append(langDict[control.setting('subtitles.lang.2')])
            except:
                pass

            try:
                subLang = xbmc.Player().getSubtitles()
            except:
                subLang = ''

            if subLang == langs[0]:
                raise Exception()

            server = xmlrpclib.Server('http://api.opensubtitles.org/xml-rpc',
                                      verbose=0)
            token = server.LogIn('', '', 'en', 'XBMC_Subtitles_v1')
            token = token['token']
            sublanguageid = ','.join(langs)
            imdbid = re.sub('[^0-9]', '', imdb)

            if not (season is None or episode is None):
                result = server.SearchSubtitles(token, [{
                    'sublanguageid': sublanguageid,
                    'imdbid': imdbid,
                    'season': season,
                    'episode': episode
                }])['data']
                fmt = ['hdtv']
            else:
                result = server.SearchSubtitles(token, [{
                    'sublanguageid': sublanguageid,
                    'imdbid': imdbid
                }])['data']
                try:
                    vidPath = xbmc.Player().getPlayingFile()
                except:
                    vidPath = ''
                fmt = re.split('\.|\(|\)|\[|\]|\s|\-', vidPath)
                fmt = [i.lower() for i in fmt]
                fmt = [i for i in fmt if i in quality]

            filter = []
            result = [i for i in result if i['SubSumCD'] == '1']

            for lang in langs:
                filter += [
                    i for i in result if i['SubLanguageID'] == lang and any(
                        x in i['MovieReleaseName'].lower() for x in fmt)
                ]
                filter += [
                    i for i in result if i['SubLanguageID'] == lang and any(
                        x in i['MovieReleaseName'].lower() for x in quality)
                ]
                filter += [i for i in result if i['SubLanguageID'] == lang]

            try:
                lang = xbmc.convertLanguage(filter[0]['SubLanguageID'],
                                            xbmc.ISO_639_1)
            except:
                lang = filter[0]['SubLanguageID']

            content = [
                filter[0]['IDSubtitleFile'],
            ]
            content = server.DownloadSubtitles(token, content)
            content = base64.b64decode(content['data'][0]['data'])
            content = gzip.GzipFile(fileobj=StringIO.StringIO(content)).read()

            subtitle = xbmc.translatePath('special://temp/')
            subtitle = os.path.join(subtitle, 'TemporarySubs.%s.srt' % lang)

            codepage = codePageDict.get(lang, '')
            if codepage and control.setting('subtitles.utf') == 'true':
                try:
                    content_encoded = codecs.decode(content, codepage)
                    content = codecs.encode(content_encoded, 'utf-8')
                except:
                    pass

            file = control.openFile(subtitle, 'w')
            file.write(str(content))
            file.close()
            xbmc.sleep(1000)
            xbmc.Player().setSubtitles(subtitle)
        except:
            import traceback
            traceback.print_exc()
            pass
Example #13
0
import xbmc
import urlparse
import sys
import time

try:
    params = urlparse.parse_qs('&'.join(sys.argv[1:]))
    command = params.get('command', None)
except:
    command = None

if command and command[0] == 'starten':
    xbmc.executebuiltin('CECActivateSource')

elif command and command[0] == 'wechseln':
    xbmc.executebuiltin('CECToggleState')

elif command and command[0] == 'standby':
    xbmc.executebuiltin('CECStandby')

elif command and command[0] == 'stop_und_standby':
    if xbmc.Player().isPlaying():
        xbmc.executebuiltin("PlayerControl(Stop)")
        time.sleep(3)
    xbmc.executebuiltin('CECStandby')
Example #14
0
import urllib, urllib2, re, xbmcplugin, xbmcgui, httplib, htmllib, xbmc

PLUGIN = 'plugin.audio.radiobandit'
VERSION = '0.1'
USER_AGENT = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3'

pl = xbmc.PlayList(1)
pl.clear()

listitem = xbmcgui.ListItem(
    'radio_bandit',
    thumbnailImage='special://home/addons/plugin.audio.radiobandit/icon.png')
url = 'http://stream-ice.mtgradio.com:8080/stat_bandit'

xbmc.PlayList(1).add(url, listitem)

xbmc.Player().play(pl)

xbmc.executebuiltin('XBMC.ActivateWindow(Music,MusicAdd-ons)')
xbmc.executebuiltin('XBMC.ActivateWindow(0)')

#url = 'http://79.136.100.244:80/banditsthlm?MSWMExt=.asf'
Example #15
0
def PlayCam(url, name, check=False, download=0):
    global CAMGIRLPLOT
    global NAME
    CAMGIRLPLOT = ''
    payload = {
        "name": "%s" % name,
        "sabasic": "",
        "sakey": "",
        "sk": "www.redtube.com",
        "userid": 0,
        "version": "9.48.1",
        "platform": "blacklabel",
        "shownFeatures": [],
        "useDebugPerformerData": "false"
    }
    r = requests.post(
        'https://hybridclient.naiadsystems.com/api/v3/setupplayer/',
        data=payload).text
    pJson = json.loads(r)
    if 'error' in pJson:
        utils.notify(name, pJson['msg'])
        return
    performerId = pJson['config']['performer']['id']
    stream = pJson['config']['stream']
    attribJson = pJson['performer']['About']['Attributes']
    NAME = attribJson['Name']

    wssUrl = stream['nodeHost'] + '/socket.io/?performerid=' + str(
        performerId
    ) + '&sserver=' + stream['serverId'] + '&streamid=' + stream[
        'streamId'] + '&sakey=&sessiontype=preview&perfdiscountid=0&minduration=0&goldshowid=0&version=7&referrer=blacklabel/hybrid.client.9.48.1/avchat.swf&usertype=false&lang=en&EIO=3&transport=websocket'
    #utils.kodilog('REDTUBE LIVE wss: ' + wssUrl)
    roomid = get_roomid(wssUrl)
    if not roomid:
        return
    server = pJson['config']['liveservices']['host'].replace(
        'wss:', 'https:') + '/videourl?payload={"puserid":' + str(
            performerId) + ',"roomid":"' + roomid + '","showtype":1,"nginx":1}'
    with requests.get(server) as req:
        r = json.loads(req.text)[0]['url']
    with requests.get(r) as req1:
        try:
            encodings = json.loads(
                req1.text)['formats']['mp4-hls']['encodings']
        except:
            utils.notify(name, 'I\'m currently performing live...')
            return

    sort = sorted(encodings, key=lambda x: int(x['videoWidth']), reverse=True)
    choice = xbmcgui.Dialog().select(
        'Select resolution', [str(item['videoWidth']) for item in sort])
    if choice == -1: return
    videourl = sort[choice]['location']

    CAMGIRLPLOT = CAMGIRLPLOT + '\n[B]Name:[/B] ' + attribJson['Name']
    CAMGIRLPLOT = CAMGIRLPLOT + '\n[B]Country:[/B] ' + attribJson['Country']
    CAMGIRLPLOT = CAMGIRLPLOT + '\n[B]Age:[/B] ' + str(attribJson['Age'])
    CAMGIRLPLOT = CAMGIRLPLOT + '\n[B]Height:[/B] ' + attribJson['Height']
    CAMGIRLPLOT = CAMGIRLPLOT + '\n[B]Weight:[/B] ' + attribJson['Weight']
    CAMGIRLPLOT = CAMGIRLPLOT + '\n[B]About my show:[/B] ' + pJson[
        'performer']['About']['AboutMyShow']
    CAMGIRLPLOT = CAMGIRLPLOT + '\n[B]Last performance:[/B] ' + pJson[
        'performer']['About']['LastPerformance']

    iconimage = xbmc.getInfoImage("ListItem.Thumb")
    listitem = xbmcgui.ListItem(name,
                                iconImage="DefaultVideo.png",
                                thumbnailImage=iconimage)
    listitem.setInfo('video', {
        'Title': name,
        'Genre': 'RedTube Live',
        'Plot': CAMGIRLPLOT
    })
    listitem.setProperty("IsPlayable", "true")

    xbmc.Player().play(videourl, listitem)
    if utils.addon.getSetting("dwnld_stream") == "true" or download == 1:
        utils.dwnld_stream(videourl, name)
Example #16
0
def play_video(path, title):
    item = xbmcgui.ListItem(path=path)
    item.setInfo('video', {'Title': title, 'Plot': title})
    xbmc.Player().play(path, item)
Example #17
0
    def ServiceEntryPoint(self):
        if not self._init_done:
            return
        # Important: Threads depending on abortRequest will not trigger
        # if profile switch happens more than once.
        # Some plumbing
        app.init()
        app.APP.monitor = kodimonitor.KodiMonitor()
        app.APP.player = xbmc.Player()
        # Initialize the PKC playqueues
        PQ.init_playqueues()

        # Server auto-detect
        self.setup = initialsetup.InitialSetup()
        self.setup.setup()

        # Initialize important threads
        self.ws = websocket_client.PMS_Websocket()
        self.alexa = websocket_client.Alexa_Websocket()
        self.sync = sync.Sync()
        self.plexcompanion = plex_companion.PlexCompanion()
        self.playqueue = playqueue.PlayqueueMonitor()

        # Main PKC program loop
        while not self.should_cancel():

            # Check for PKC commands from other Python instances
            plex_command = utils.window('plexkodiconnect.command')
            if plex_command:
                # Commands/user interaction received from other PKC Python
                # instances (default.py and context.py instead of service.py)
                utils.window('plexkodiconnect.command', clear=True)
                task = None
                if plex_command.startswith('PLAY-'):
                    # Add-on path playback!
                    task = playback_starter.PlaybackTask(
                        plex_command.replace('PLAY-', ''))
                elif plex_command.startswith('CONTEXT_menu?'):
                    task = playback_starter.PlaybackTask(
                        'dummy?mode=context_menu&%s' %
                        plex_command.replace('CONTEXT_menu?', ''))
                elif plex_command == 'choose_pms_server':
                    task = backgroundthread.FunctionAsTask(
                        self.choose_pms_server, None)
                elif plex_command == 'switch_plex_user':
                    task = backgroundthread.FunctionAsTask(
                        self.switch_plex_user, None)
                elif plex_command == 'enter_new_pms_address':
                    task = backgroundthread.FunctionAsTask(
                        self.enter_new_pms_address, None)
                elif plex_command == 'toggle_plex_tv_sign_in':
                    task = backgroundthread.FunctionAsTask(
                        self.toggle_plex_tv, None)
                elif plex_command == 'repair-scan':
                    app.SYNC.run_lib_scan = 'repair'
                elif plex_command == 'full-scan':
                    app.SYNC.run_lib_scan = 'full'
                elif plex_command == 'fanart-scan':
                    app.SYNC.run_lib_scan = 'fanart'
                elif plex_command == 'textures-scan':
                    app.SYNC.run_lib_scan = 'textures'
                elif plex_command == 'select-libraries':
                    self.choose_plex_libraries()
                elif plex_command == 'refreshplaylist':
                    self.reset_playlists_and_nodes()
                elif plex_command == 'RESET-PKC':
                    utils.reset()
                elif plex_command == 'EXIT-PKC':
                    LOG.info('Received command from another instance to quit')
                    app.APP.stop_pkc = True
                else:
                    raise RuntimeError('Unknown command: %s', plex_command)
                if task:
                    backgroundthread.BGThreader.addTasksToFront([task])
                continue

            if app.APP.suspend:
                xbmc.sleep(100)
                continue

            if app.APP.update_widgets and not xbmc.getCondVisibility(
                    'Window.IsMedia'):
                '''
                In case an update happened but we were not on the homescreen
                and now we are, force widgets to update. Prevents cursor from
                moving/jumping in libraries
                '''
                app.APP.update_widgets = False
                xbmc.executebuiltin('UpdateLibrary(video)')

            # Before proceeding, need to make sure:
            # 1. Server is online
            # 2. User is set
            # 3. User has access to the server
            if not app.CONN.online:
                # Not online
                server = app.CONN.server
                if not server:
                    # No server info set in add-on settings
                    pass
                elif not self.connection_check_running:
                    self.connection_check_running = True
                    task = backgroundthread.FunctionAsTask(
                        PF.check_connection,
                        self.on_connection_check,
                        server,
                        verifySSL=app.CONN.verify_ssl_cert)
                    backgroundthread.BGThreader.addTasksToFront([task])
                    continue
            elif not app.ACCOUNT.authenticated:
                # Plex server is online, but we're not yet authenticated
                if not self.auth_running:
                    self.auth_running = True
                    task = backgroundthread.FunctionAsTask(
                        self.authenticate, None)
                    backgroundthread.BGThreader.addTasksToFront([task])
                    continue
            elif not self.startup_completed:
                self.startup_completed = True
                self.ws.start()
                self.sync.start()
                self.plexcompanion.start()
                self.playqueue.start()
                if utils.settings('enable_alexa') == 'true':
                    self.alexa.start()

            xbmc.sleep(100)

        # EXITING PKC
        # Tell all threads to terminate (e.g. several lib sync threads)
        LOG.debug('Aborting all threads')
        app.APP.stop_pkc = True
        backgroundthread.BGThreader.shutdown(block=False)
        # Load/Reset PKC entirely - important for user/Kodi profile switch
        # Clear video nodes properties
        library_sync.clear_window_vars()
        # Will block until threads have quit
        app.APP.stop_threads()
Example #18
0
def play(url, name, iconimage=None, ref=None, site=None):

    kodi.busy()

    if not site:
        if 'site=' in url: url, site = url.split('site=')
        else: site = 'Unknown'
    if not name: name = 'Unknown'
    if not iconimage: iconimage = kodi.addonicon
    name = re.sub(r'(\[.+?\])', '', name)
    name = name.lstrip()
    if '] - ' in name: name = name.split('] - ')[-1]

    chatur = False

    if ref:
        if 'chaturbate.com' in ref:
            chatur = True
    else:
        ref = ''
    if 'chaturbate.com' in url:
        chatur = True
        ref = url
        url = adultresolver.resolve(url)
    log_utils.log('Failed to get any playable link for :: %s' % (url),
                  log_utils.LOGERROR)
    if (not isinstance(url, str)):
        try:
            url = multilinkselector(url)
        except:
            pass

    history_on_off = kodi.get_setting("history_setting")
    if history_on_off == "true":
        web_checks = ['http:', 'https:', 'rtmp:']
        locak_checks = ['.mp4']
        if any(f for f in web_checks if f in url): site = site.title()
        elif any(f for f in locak_checks if f in url): site = 'Local File'
        else: site = 'Unknown'

        if chatur:
            history.delEntry(ref)
            history.addHistory(name, ref, site.title(), iconimage)
        else:
            history.delEntry(url)
            history.addHistory(name, url, site.title(), iconimage)

    kodi.idle()

    if 'chaturbate.com' in ref:
        if kodi.get_setting("mobile_mode") == 'true':
            url = url.replace('_fast_aac', '_aac')
        else:
            bandwidth = kodi.get_setting("chaturbate_band")
            if bandwidth == '0': url = url.replace('_fast_aac', '_aac')
            elif bandwidth == '2':
                choice = kodi.dialog.select(
                    "[COLOR white][B]" + name + "[/B][/COLOR]", [
                        '[COLOR white]Play High Bandwidth Stream[/COLOR]',
                        '[COLOR white]Play Low Bandwidth Stream[/COLOR]'
                    ])
                if choice == 1: url = url.replace('_fast_aac', '_aac')
                elif choice == 0: pass
                else: quit()

        liz = xbmcgui.ListItem(name,
                               iconImage=iconimage,
                               thumbnailImage=iconimage)
        xbmc.executebuiltin("Dialog.Close(busydialog)")
        xbmc.Player().play(url, liz, False)

        if kodi.get_setting("chaturbate_subject") == "true":
            sleeper = kodi.get_setting("chaturbate_subject_refresh")
            i = 0

            while not xbmc.Player().isPlayingVideo():
                time.sleep(1)
                i += 1
                if i == 30: quit()
            while xbmc.Player().isPlayingVideo():
                try:
                    r = client.request(ref)
                    subject = re.compile(
                        'default_subject:\s\"([^,]+)",').findall(r)[0]
                    subject = urllib.unquote_plus(subject)
                    kodi.notify(msg=subject,
                                duration=8500,
                                sound=True,
                                icon_path=iconimage)
                except:
                    pass
                time.sleep(int(sleeper))
    else:
        liz = xbmcgui.ListItem(name,
                               iconImage=iconimage,
                               thumbnailImage=iconimage)
        xbmc.executebuiltin("Dialog.Close(busydialog)")
        xbmc.Player().play(url, liz, False)
Example #19
0
 def isPlaying(self):
     return xbmc.Player().isPlaying()
Example #20
0
import xbmc
import xbmcvfs
import xbmcgui
import urllib.request, urllib.error, urllib.parse
import bjsonrpc
from bjsonrpc.handlers import BaseHandler
from quasar.addon import ADDON, ADDON_PATH
from quasar.logger import log
from quasar.config import JSONRPC_EXT_PORT, QUASARD_HOST
from quasar.osarch import PLATFORM
from quasar.util import toUtf8, notify, getLocalizedString, getLocalizedLabel, system_information
from quasar.overlay import OverlayText
from quasar.dialog_select import DialogSelect
from quasar.dialog_insert import DialogInsert

XBMC_PLAYER = xbmc.Player()


class QuasarRPCServer(BaseHandler):
    public_methods_pattern = r'^[A-Za-z]\w+$'

    _objects = {}
    _failures = {}

    def Reset(self):
        for i in self._objects:
            try:
                self._objects[i].hide()
            except:
                pass
        log.info("Resetting RPC objects...")
Example #21
0
def showVideo():
    import yt    
    yt.PlayVideo('-DpU4yOJO_I', forcePlayer=True)
    xbmc.sleep(500)
    while xbmc.Player().isPlaying():
        xbmc.sleep(500)
Example #22
0
elif mode[0][:3] == 'A-Z':
    foldername = args['foldername'][0]
    letter = mode[0][-1:]
    listArtists(query='a=' + letter)
    xbmcplugin.endOfDirectory(addon_handle)

elif mode[0] == 'Artist':
    foldername = args['foldername'][0]
    song = urllib.quote_plus(foldername)
    listSongs(query='a=' + song)
    xbmcplugin.endOfDirectory(addon_handle)

elif mode[0] == 'Song':
    foldername = args['foldername'][0]
    xbmc.Player().play(
        'plugin://plugin.video.youtube/?path=root/video&action=play_video&videoid='
        + foldername)

elif mode[0] == 'folder2':
    # browse by year
    foldername = args['foldername'][0]
    listYears(query='y=1')
    xbmcplugin.endOfDirectory(addon_handle)

elif mode[0][:4] == 'Year':
    foldername = args['foldername'][0]
    year = foldername
    listSongs(query='y=' + year)
    xbmcplugin.endOfDirectory(addon_handle)

elif mode[0] == 'folder3':
Example #23
0
def PlayVideo(url, listitem):
    print 'in PlayVideo %s' % url
    stream_url = urlresolver.HostedMediaFile(url).resolve()
    xbmc.Player().play(stream_url, listitem)
Example #24
0
def playLive(name):
    videoQuality = getVideoQuality()
    url = TWITCHTV.getLiveStream(name, videoQuality)
    xbmc.Player().play(url)
    PLUGIN.set_resolved_url(url)
    execIrcPlugin(name)
Example #25
0
    def reportPlayback(self):

        log.debug("reportPlayback Called")

        # Get current file
        currentFile = self.currentFile
        data = self.played_info.get(currentFile)

        # only report playback if emby has initiated the playback (item_id has value)
        if data:
            # Get playback information
            itemId = data['item_id']
            audioindex = data['AudioStreamIndex']
            subtitleindex = data['SubtitleStreamIndex']
            playTime = data['currentPosition']
            playMethod = data['playmethod']
            paused = data.get('paused', False)

            # Get playback volume
            volume_query = {
                "jsonrpc": "2.0",
                "id": 1,
                "method": "Application.GetProperties",
                "params": {
                    "properties": ["volume", "muted"]
                }
            }
            result = xbmc.executeJSONRPC(json.dumps(volume_query))
            result = json.loads(result)
            result = result.get('result')

            volume = result.get('volume')
            muted = result.get('muted')

            # Postdata for the websocketclient report
            postdata = {
                'QueueableMediaTypes': "Video",
                'CanSeek': True,
                'ItemId': itemId,
                'MediaSourceId': itemId,
                'PlayMethod': playMethod,
                'PositionTicks': int(playTime * 10000000),
                'IsPaused': paused,
                'VolumeLevel': volume,
                'IsMuted': muted
            }

            if playMethod == "Transcode":
                # Track can't be changed, keep reporting the same index
                postdata['AudioStreamIndex'] = audioindex
                postdata['AudioStreamIndex'] = subtitleindex

            else:
                # Get current audio and subtitles track
                tracks_query = {
                    "jsonrpc": "2.0",
                    "id": 1,
                    "method": "Player.GetProperties",
                    "params": {
                        "playerid":
                        1,
                        "properties": [
                            "currentsubtitle", "currentaudiostream",
                            "subtitleenabled"
                        ]
                    }
                }
                result = xbmc.executeJSONRPC(json.dumps(tracks_query))
                result = json.loads(result)
                result = result.get('result')

                try:  # Audio tracks
                    indexAudio = result['currentaudiostream']['index']
                except (KeyError, TypeError):
                    indexAudio = 0

                try:  # Subtitles tracks
                    indexSubs = result['currentsubtitle']['index']
                except (KeyError, TypeError):
                    indexSubs = 0

                try:  # If subtitles are enabled
                    subsEnabled = result['subtitleenabled']
                except (KeyError, TypeError):
                    subsEnabled = ""

                # Postdata for the audio
                data['AudioStreamIndex'], postdata['AudioStreamIndex'] = [
                    indexAudio + 1
                ] * 2

                # Postdata for the subtitles
                if subsEnabled and len(
                        xbmc.Player().getAvailableSubtitleStreams()) > 0:

                    # Number of audiotracks to help get Emby Index
                    audioTracks = len(xbmc.Player().getAvailableAudioStreams())
                    mapping = window("emby_%s.indexMapping" % currentFile)

                    if mapping:  # Set in PlaybackUtils.py

                        log.debug("Mapping for external subtitles index: %s" %
                                  mapping)
                        externalIndex = json.loads(mapping)

                        if externalIndex.get(str(indexSubs)):
                            # If the current subtitle is in the mapping
                            subindex = [externalIndex[str(indexSubs)]] * 2
                            data['SubtitleStreamIndex'], postdata[
                                'SubtitleStreamIndex'] = subindex
                        else:
                            # Internal subtitle currently selected
                            subindex = [
                                indexSubs - len(externalIndex) + audioTracks +
                                1
                            ] * 2
                            data['SubtitleStreamIndex'], postdata[
                                'SubtitleStreamIndex'] = subindex

                    else:  # Direct paths enabled scenario or no external subtitles set
                        subindex = [indexSubs + audioTracks + 1] * 2
                        data['SubtitleStreamIndex'], postdata[
                            'SubtitleStreamIndex'] = subindex
                else:
                    data['SubtitleStreamIndex'], postdata[
                        'SubtitleStreamIndex'] = [""] * 2

            # Report progress via websocketclient
            postdata = json.dumps(postdata)
            log.debug("Report: %s" % postdata)
            self.ws.send_progress_update(postdata)
Example #26
0
    url = urllib.unquote_plus(params["url"])
except:
    url = None

try:
    sch_ch_id = urllib.unquote_plus(params["sch_ch_id"])
except:
    sch_ch_id = None

addon_log(mode)
if mode == None:  #list categories
    CAT_LIST()
elif mode == 1:  #list channels
    CHANNEL_LIST(name, cat_id)
elif mode == 2:  #play stream
    if xbmc.Player(xbmc.PLAYER_CORE_AUTO).isPlaying():
        stop_spsc()

        xbmc.Player(xbmc.PLAYER_CORE_AUTO).stop()
        try:
            xbmc.executebuiltin("Dialog.Close(all,true)")
        except:
            pass

        xbmc.executebuiltin("ActivateWindow(busydialog)")
        xbmc.sleep(800)
        if cat_id == "200":
            url = grab_vk_stream(name, url)
        if cat_id == "201" or cat_id == "202":
            url = grab_fu_stream(name, url)
        STREAM(name, iconimage, url, sch_ch_id)
Example #27
0
        COUNT = 0
    else:
        COUNT += 1

        log('MP3 Service Checking Kodi is still trying to play %d' % COUNT)

        if COUNT > RETRIES:
            clear()


if __name__ == '__main__':
    log('********** XBMC STARTED **********')
    clear()
    while (not xbmc.abortRequested):  
        if not STARTED:
            STARTED = xbmc.Player().isPlaying()
        else:
            check()    
        xbmc.sleep(1000)

    log('********** XBMC ABORTED **********')
    clear()


############################### END OF SERVICE ###############################


import xbmc
import xbmcaddon
import xbmcgui
import xbmcplugin
Example #28
0
def note(n_time, status=False):
    if not xbmc.Player().isPlaying():
        n_time = datetime.datetime.now()
        notification.check_news2("t", override_service=status)
    return n_time
Example #29
0
import xbmc
import glob

# USBドライブは/media以下にマウントされる
# ワイルドカードで/mediaにあるすべてのmp4の動画のパスを取得する

videoFiles = []
for videoFile in glob.iglob("/media/*/*.mp4")
    videoFiles.append(videoFile)

# プレイリストのオブジェクトを作る
playList = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
playList.clear()

# プレイリストに追加する
for videoFile in videoFiles:
    playList.add(url=videoFile)

# 再生する
xbmc.Player().play(playList)
Example #30
0
 def onClick(self, controlID):
     if controlID == 6012:
         xbmc.Player().seekTime(self.skip_to)
         self.close()