• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python xbmc.executehttpapi函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中xbmc.executehttpapi函数的典型用法代码示例。如果您正苦于以下问题:Python executehttpapi函数的具体用法?Python executehttpapi怎么用?Python executehttpapi使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了executehttpapi函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: _build_playlist

def _build_playlist( movie_titles ):
    for movie in movie_titles:
        xbmc.log( "[script.cinema.experience] - Movie Title: %s" % movie, level=xbmc.LOGNOTICE )
        xbmc.executehttpapi( "SetResponseFormat()" )
        xbmc.executehttpapi( "SetResponseFormat(OpenField,)" )
        # select Movie path from movieview Limit 1
        sql = "SELECT movieview.idMovie, movieview.c00, movieview.strPath, movieview.strFileName, movieview.c08, movieview.c14 FROM movieview WHERE c00 LIKE '%s' LIMIT 1" % ( movie.replace( "'", "''", ), )
        xbmc.log( "[script.cinema.experience]  - SQL: %s" % ( sql, ), level=xbmc.LOGDEBUG )
        # query database for info dummy is needed as there are two </field> formatters
        try:
            movie_id, movie_title, movie_path, movie_filename, thumb, genre, dummy = xbmc.executehttpapi( "QueryVideoDatabase(%s)" % quote_plus( sql ), ).split( "</field>" )
            movie_id = int( movie_id )
        except:
            traceback.print_exc()
            xbmc.log( "[script.cinema.experience] - Unable to match movie", level=xbmc.LOGERROR )
            movie_id = 0
            movie_title = movie_path = movie_filename = thumb = genre = dummy = ""
        movie_full_path = os.path.join(movie_path, movie_filename).replace("\\\\" , "\\")
        xbmc.log( "[script.cinema.experience] - Movie Title: %s" % movie_title, level=xbmc.LOGNOTICE )
        xbmc.log( "[script.cinema.experience] - Movie Path: %s" % movie_path, level=xbmc.LOGNOTICE )
        xbmc.log( "[script.cinema.experience] - Movie Filename: %s" % movie_filename, level=xbmc.LOGNOTICE )
        xbmc.log( "[script.cinema.experience] - Full Movie Path: %s" % movie_full_path, level=xbmc.LOGNOTICE )
        if not movie_id == 0:
            json_command = '{"jsonrpc": "2.0", "method": "Playlist.Add", "params": {"playlistid": 1, "item": {"movieid": %d} }, "id": 1}' % movie_id
            json_response = xbmc.executeJSONRPC(json_command)
            xbmc.log( "[script.cinema.experience] - JSONRPC Response: \n%s" % movie_title, level=xbmc.LOGDEBUG )
            xbmc.sleep( 50 )
开发者ID:selrahc13,项目名称:script.cinema.experience,代码行数:27,代码来源:pre_eden_code.py


示例2: _finalize_download

 def _finalize_download(self, tmp_path):
     try:
         # copy the trailer
         pDialog.update(-1)
         # only copy if the trailer doesn't exist
         if not os.path.isfile(self.filepath):
             xbmc.executehttpapi("FileCopy(%s,%s)" % (tmp_path, urllib.quote_plus(self.filepath.encode("utf-8"))))
         # fetch the thumbnail
         thumbpath = os.path.splitext(self.filepath)[0] + ".tbn"
         # necessary for dialog to update
         if not os.path.isfile(thumbpath):
             xbmc.executehttpapi(
                 "FileCopy(%s,%s)" % (self.g_thumbnail, urllib.quote_plus(thumbpath.encode("utf-8")))
             )
         self.g_thumbnail = thumbpath
         # we succeeded
         return True
     except:
         print "ERROR: %s::%s (%d) - %s" % (
             self.__class__.__name__,
             sys.exc_info()[2].tb_frame.f_code.co_name,
             sys.exc_info()[2].tb_lineno,
             sys.exc_info()[1],
         )
         return False
开发者ID:nolenfelten,项目名称:xbmc-addons,代码行数:25,代码来源:xbmcplugin_download.py


示例3: _finalize_download

 def _finalize_download( self, tmp_path ):
     try:
         # copy the trailer
         msg1 = xbmc.getLocalizedString( 30503 ) % ( os.path.split( self.filepath )[ 1 ], )
         msg2 = xbmc.getLocalizedString( 30502 ) % ( os.path.split( self.filepath )[ 0 ], )
         pDialog.update( -1, msg1, msg2 )
         # necessary for dialog to update
         xbmc.sleep( 50 )
         xbmc.executehttpapi( "FileCopy(%s,%s)" % ( tmp_path, self.filepath.encode( "utf-8" ), ) )
         # create conf file for better MPlayer playback only when trailer saved on xbox and not progressive
         if ( not self.filepath.startswith( "smb://" ) and not g_movie_url.endswith( "p.mov" ) and not os.path.isfile( self.filepath + ".conf" ) and os.environ.get( "OS", "xbox" ) == "xbox" ):
             f = open( self.filepath + ".conf" , "w" )
             f.write( "nocache=1" )
             f.close()
         # copy the thumbnail
         thumbpath = os.path.splitext( self.filepath )[ 0 ] + ".tbn"
         msg1 = xbmc.getLocalizedString( 30503 ) % ( os.path.split( thumbpath )[ 1 ], )
         pDialog.update( -1, msg1, msg2 )
         # necessary for dialog to update
         xbmc.sleep( 50 )
         xbmc.executehttpapi( "FileCopy(%s,%s)" % ( g_thumbnail, thumbpath.encode( "utf-8" ), ) )
         # we succeeded
         return True
     except:
         print "ERROR: %s::%s (%d) - %s" % ( self.__class__.__name__, sys.exc_info()[ 2 ].tb_frame.f_code.co_name, sys.exc_info()[ 2 ].tb_lineno, sys.exc_info()[ 1 ], )
         return False
开发者ID:drrlramsey,项目名称:xbmc-addons,代码行数:26,代码来源:xbmcplugin_download.py


示例4: _run_rom

 def _run_rom(self, launcherName, romName):
     if (self.launchers.has_key(launcherName)):
         launcher = self.launchers[launcherName]
         if (launcher["roms"].has_key(romName)):
             rom = self.launchers[launcherName]["roms"][romName]
             if (os.environ.get( "OS", "xbox" ) == "xbox"):
                 f=open(SHORTCUT_FILE, "wb")
                 f.write("<shortcut>\n")
                 f.write("    <path>" + launcher["application"] + "</path>\n")
                 f.write("    <custom>\n")
                 f.write("       <game>" + rom["filename"] + "</game>\n")
                 f.write("    </custom>\n")
                 f.write("</shortcut>\n")
                 f.close()
                 xbmc.executebuiltin('XBMC.Runxbe(' + SHORTCUT_FILE + ')')
             else:
                 if (sys.platform == 'win32'):
                     if (launcher["wait"] == "true"):
                         cmd = "System.ExecWait"
                     else:
                         cmd = "System.Exec"
                     xbmc.executebuiltin("%s(\\\"%s\\\" %s \\\"%s\\\")" % (cmd, launcher["application"], launcher["args"], rom["filename"]))
                 elif (sys.platform.startswith('linux')):
                     #this minimizes xbmc some apps seems to need it
                     xbmc.executehttpapi("Action(199)")
                     os.system("\"%s\" %s \"%s\"" % (launcher["application"], launcher["args"], rom["filename"]))
                     #this brings xbmc back
                     xbmc.executehttpapi("Action(199)")
                 elif (sys.platform.startswith('darwin')):
                     os.system("\"%s\" %s \"%s\"" % (launcher["application"], launcher["args"], rom["filename"]))
                 else:
                     pass;
开发者ID:thmoviestr,项目名称:xbmc-launcher,代码行数:32,代码来源:launcher_plugin.py


示例5: showInfo

    def showInfo(self, timer):
        if self.hideShortItems:
            position = xbmc.PlayList(xbmc.PLAYLIST_MUSIC).getposition() + self.infoOffset

            if self.channels[self.currentChannel - 1].getItemDuration(xbmc.PlayList(xbmc.PLAYLIST_MUSIC).getposition()) < self.shortItemLength:
                return

        self.getControl(102).setVisible(True)
        self.showingInfo = True
        self.setShowInfo()

        if self.infoTimer.isAlive():
            self.infoTimer.cancel()

        self.infoTimer = threading.Timer(timer, self.hideInfo)
        self.infoTimer.name = "InfoTimer"

        if xbmc.getCondVisibility('Player.ShowInfo'):
            if USING_FRODO:
                json_query = '{"jsonrpc": "2.0", "method": "Input.Info", "id": 1}'
                self.ignoreInfoAction = True
                self.channelList.sendJSON(json_query);
            else:
                xbmc.executehttpapi("SendKey(0xF049)")
                self.ignoreInfoAction = True

        self.infoTimer.start()
开发者ID:ingolfius,项目名称:Retroplex-XBMC-1,代码行数:27,代码来源:Overlay.py


示例6: save_lyrics

 def save_lyrics( self, song ):
     try:
         # format lyrics with song info header
         song.lyrics = "[ti:%s]\n[ar:%s]\n[al:%s]\n[re:%s]\n[ve:%s]\n[we:%s]\n[offset:0]\n\n%s" % (
             song.title,
             song.artist,
             song.album,
             self.Addon.getAddonInfo( "Name" ),
             self.Addon.getAddonInfo( "Version" ),
             song.website,
             song.lyrics,
         )
         # use httpapi for smb:// paths if xbox
         if ( song.lyrics_path.startswith( "smb://" ) and os.environ.get( "OS", "n/a" ) == "xbox" ):
             # no way to create dirs for smb:// paths on xbox
             xbmc.executehttpapi( "FileUpload(%s,%s)" % ( song.lyrics_path, base64.standard_b64encode( BOM_UTF8 + song.lyrics.encode( "UTF-8", "replace" ) ), ) )
         else:
             # if the path to the source file does not exist create it
             self._makedirs( os.path.dirname( song.lyrics_path ) )
             # save lyrics
             open( song.lyrics_path, "w" ).write( BOM_UTF8 + song.lyrics.encode( "UTF-8", "replace" ) )
     except Exception, e:
         # log error
         xbmc.log( "Lyrics::save_lyrics (%s)" % ( e, ), xbmc.LOGERROR )
         # set error message
         song.message = self.Addon.getLocalizedString( 30852 ) % ( e, )
         song.status = False
开发者ID:nuka1195,项目名称:lyrics.xbmc_lyrics,代码行数:27,代码来源:lyrics-nostore.py


示例7: FullScreenXBMC

def FullScreenXBMC():
	#Logutil.log("Toggle to Full Screen mode", util.LOG_LEVEL_INFO)
	#this brings xbmc back
	try:
		xbmc.executehttpapi("Action(199)")
	except:
		xbmc.executeJSONRPC('{"jsonrpc":"2.0","method":"Input.ExecuteAction","params":{"action":"togglefullscreen"},"id":"1"}')
开发者ID:peteward44,项目名称:xbmc-romulator,代码行数:7,代码来源:Launcher.py


示例8: saving

 def saving(self):
     listIdGenres = []
     listStrGenres = []
     for e in self.genres:
         listIdGenres.append(e[0])
         listStrGenres.append(e[1])
     if self.mode == "movie":
         sql_data = 'DELETE FROM genrelinkmovie WHERE idMovie=\"%s\"' % (self.idfilm)
     else:
         sql_data = 'DELETE FROM genrelinktvshow WHERE idShow=\"%s\"' % (self.idfilm)
     xml_data = xbmc.executehttpapi( "ExecVideoDatabase(%s)" % urllib.quote_plus( sql_data ), )
     lg = []
     for g in self.movieGenres:
         lg.append(listStrGenres[listIdGenres.index(g)])
         if self.mode == "movie":
             sql_data = 'INSERT INTO genrelinkmovie ("idGenre","idMovie") VALUES (%s,%s)' % (g, self.idfilm)
         else:
             sql_data = 'INSERT INTO genrelinktvshow ("idGenre","idShow") VALUES (%s,%s)' % (g, self.idfilm)
         xml_data = xbmc.executehttpapi( "ExecVideoDatabase(%s)" % urllib.quote_plus( sql_data ), )
     self.strgenre = " / ".join(lg)
     if self.mode == "movie":
         sql_data = 'UPDATE movie SET c14=\"%s\" WHERE idMovie=%s' % (self.strgenre, self.idfilm)
     else:
         sql_data = 'UPDATE tvshow SET c08=\"%s\" WHERE idShow=%s' % (self.strgenre, self.idfilm)
     xml_data = xbmc.executehttpapi( "ExecVideoDatabase(%s)" % urllib.quote_plus( sql_data ), )
     self.ex = 1
     self.close()
开发者ID:Quihico,项目名称:passion-xbmc,代码行数:27,代码来源:default.py


示例9: installer

def installer(file="Z:\\savegame.zip"):
    if xbmcgui.Dialog().yesno("Install","Install Save Game?"):
        xbmc.executebuiltin('XBMC.Extract('+file+',' +"e:\\" + ')')
        xbmc.executehttpapi('FileDelete(e:\\gameid.ini)') # get rid of this file
        xbmcgui.Dialog().ok("Game Saves","Game Save Installed")
    else:
        xbmcgui.Dialog().ok("Game Saves","Game Save Not Installed")
开发者ID:amitca71,项目名称:xbmc-scripting,代码行数:7,代码来源:default.py


示例10: update_item_and_file_id

    def update_item_and_file_id(self, old_idItem, new_idItem, old_idFile, new_idFile):
        sql_dict = {'newItemId': new_idItem, 'newFileId': new_idFile, 'oldItemId': old_idItem, 'oldFileId': old_idFile}
        if self.library == MOVIES:
            update_sql = ["update movie set idMovie=%(newItemId)d, idFile=%(newFileId)d where idMovie=%(oldItemId)d;",
                          "update actorlinkmovie set idMovie=%(newItemId)d where idMovie=%(oldItemId)d;",
                          "update countrylinkmovie set idMovie=%(newItemId)d where idMovie=%(oldItemId)d;",
                          "update directorlinkmovie set idMovie=%(newItemId)d where idMovie=%(oldItemId)d;",
                          "update genrelinkmovie set idMovie=%(newItemId)d where idMovie=%(oldItemId)d;",
                          "update movielinktvshow set idMovie=%(newItemId)d where idMovie=%(oldItemId)d;",
                          "update setlinkmovie set idMovie=%(newItemId)d where idMovie=%(oldItemId)d;",
                          "update studiolinkmovie set idMovie=%(newItemId)d where idMovie=%(oldItemId)d;",
                          "update writerlinkmovie set idMovie=%(newItemId)d where idMovie=%(oldItemId)d;"]

        elif self.library == TV_EPISODES:
            update_sql = ["update episode set idEpisode=%(newItemId)d, idFile=%(newFileId)d where idEpisode=%(oldItemId)d;",
                          "update actorlinkepisode set idEpisode=%(newItemId)d where idEpisode=%(oldItemId)d;",
                          "update directorlinkepisode set idEpisode=%(newItemId)d where idEpisode=%(oldItemId)d;",
                          "update tvshowlinkepisode set idEpisode=%(newItemId)d where idEpisode=%(oldItemId)d;",
                          "update writerlinkepisode set idEpisode=%(newItemId)d where idEpisode=%(oldItemId)d;"]

        elif self.library == MUSIC_VIDEOS:
            update_sql = ["update musicvideo set idMVideo=%(newItemId)d, idFile=%(newFileId)d where idMVideo=%(oldItemId)d;",
                          "update actorlinkmusicvideo set idMVideo=%(newItemId)d where idMVideo=%(oldItemId)d;",
                          "update directorlinkmusicvideo set idMVideo=%(newItemId)d where idMVideo=%(oldItemId)d;",
                          "update genrelinkmusicvideo set idMVideo=%(newItemId)d where idMVideo=%(oldItemId)d;",
                          "update studiolinkmusicvideo set idMVideo=%(newItemId)d where idMVideo=%(oldItemId)d;"]

        if self.library in (MOVIES, TV_EPISODES, MUSIC_VIDEOS):
            update_sql += ["update files set idFile=%(newFileId)d where idFile=%(oldFileId)d;",
                          "update bookmark set idFile=%(newFileId)d where idFile=%(oldFileId)d;",
                          "update stacktimes set idFile=%(newFileId)d where idFile=%(oldFileId)d;",
                          "update streamdetails set idFile=%(newFileId)d where idFile=%(oldFileId)d;"]

            for q in update_sql:
                xbmc.executehttpapi( "ExecVideoDatabase(%s)" % quote_plus( q % sql_dict ), )
开发者ID:joemiller,项目名称:xbmc-script-sort-movies-by-file-date,代码行数:35,代码来源:sort.py


示例11: _set_thumb

    def _set_thumb(self, launcherName, romname, url):
        self.url = url
        # download thumb
        urllib.urlretrieve( url, None, self._report_hook )

        # copy it into thumbs path
        path = self.settings[ "thumbs_path" ]
        filepath = os.path.join(path, os.path.basename(url))

        pDialog.update( 100, __language__( 30032 ))
        xbmc.sleep( 50 )
        xbmc.executehttpapi( "FileCopy(%s,%s)" % (url, filepath, ) )

        launcher = self.launchers[launcherName]

        if (romname):
            rom = launcher["roms"][romname]
            rom["thumb"] = filepath
        else:
            launcher["thumb"] = filepath

        self.storage_backend._save_launchers(self.launchers)

        # returning back to the previous window
        if (romname):
            xbmc.executebuiltin("ReplaceWindow(Programs,%s?%s)" % (self._path, launcherName))
        else:
            xbmc.executebuiltin("ReplaceWindow(Programs,%s)" % (self._path))
开发者ID:thmoviestr,项目名称:xbmc-launcher,代码行数:28,代码来源:launcher_plugin.py


示例12: get_cached_thumb

 def get_cached_thumb( self, fpath ):
     # fixe me: xbmc not change/reload/refresh image if path is same
     fpath = xbmc.translatePath( fpath )
     filename = md5.new( open( fpath ).read( 250 ) ).hexdigest()
     temp = "special://temp/moviesets/%s.tbn" % filename
     if not os.path.exists( temp ): xbmc.executehttpapi( "FileCopy(%s,%s)" % ( fpath, temp ) ).replace( "<li>", "" )
     return ( fpath, temp )[ os.path.exists( temp ) ]
开发者ID:Quihico,项目名称:passion-xbmc,代码行数:7,代码来源:dialogs.py


示例13: _toogle_fullscreen

def _toogle_fullscreen():
    try:
        # Dharma / Eden compatible
        xbmc.executehttpapi("Action(199)")
    except:
        # Frodo & + compatible
        xbmc.executeJSONRPC('{"jsonrpc":"2.0","method":"Input.ExecuteAction","params":{"action":"togglefullscreen"},"id":"1"}')
开发者ID:finalmakerr,项目名称:featherence,代码行数:7,代码来源:launcher_plugin.py


示例14: _get_queued_video_info

def _get_queued_video_info( feature = 0 ):
    xbmc.log( "%s - _get_queued_video_info() Started" % log_message, level=xbmc.LOGDEBUG )
    equivalent_mpaa = "NR"
    try:
        # get movie name
        movie_title = xbmc.PlayList( xbmc.PLAYLIST_VIDEO )[ feature ].getdescription()
        # this is used to skip trailer for current movie selection
        movie = os.path.splitext( os.path.basename( xbmc.PlayList( xbmc.PLAYLIST_VIDEO )[ feature ].getfilename() ) )[ 0 ]
        # format our records start and end
        xbmc.executehttpapi( "SetResponseFormat()" )
        xbmc.executehttpapi( "SetResponseFormat(OpenField,)" )
        # TODO: verify the first is the best audio
        # setup the sql, we limit to 1 record as there can be multiple entries in streamdetails
        sql = "SELECT movie.c12, movie.c14, streamdetails.strAudioCodec FROM movie, streamdetails WHERE movie.idFile=streamdetails.idFile AND streamdetails.iStreamType=1 AND c00='%s' LIMIT 1" % ( movie_title.replace( "'", "''", ), )
        xbmc.log( "%s - SQL: %s" % ( log_message, sql, ), level=xbmc.LOGDEBUG )
        # query database for info dummy is needed as there are two </field> formatters
        mpaa, genre, audio, dummy = xbmc.executehttpapi( "QueryVideoDatabase(%s)" % quote_plus( sql ), ).split( "</field>" )
        # TODO: add a check and new sql for videos queued from files mode, or try an nfo
        # calculate rating
        if mpaa == "":
            mpaa = "NR"
        elif mpaa.startswith("Rated"):
            mpaa = mpaa.split( " " )[ 1 - ( len( mpaa.split( " " ) ) == 1 ) ]
            mpaa = ( mpaa, "NR", )[ mpaa not in ( "G", "PG", "PG-13", "R", "NC-17", "Unrated", ) ]
        elif mpaa.startswith("UK"):
            mpaa = mpaa.split( ":" )[ 1 - ( len( mpaa.split( ":" ) ) == 1 ) ]
            mpaa = ( mpaa, "NR", )[ mpaa not in ( "12", "12A", "PG", "15", "18", "R18", "MA", "U", ) ]
        else:
            mpaa = ( mpaa, "NR", )[ mpaa not in ( "12", "12A", "PG", "15", "18", "R18", "MA", "U", ) ]
        if mpaa not in ( "G", "PG", "PG-13", "R", "NC-17", "Unrated", "NR" ):
            if mpaa in ("12", "12A",):
                equivalent_mpaa = "PG-13"
            elif mpaa == "15":
                equivalent_mpaa = "R"
            elif mpaa == "U":
                equivalent_mpaa = "G"
            elif mpaa in ("18", "R18", "MA",):
                equivalent_mpaa = "NC-17"
        else:
            equivalent_mpaa = mpaa
    except:
        traceback.print_exc()
        movie_title = mpaa = audio = genre = movie = equivalent_mpaa = ""
    # spew queued video info to log
    xbmc.log( "%s - Queued Movie Information" % log_message, level=xbmc.LOGDEBUG )
    xbmc.log( "%s %s" % ( log_message,log_sep ), level=xbmc.LOGDEBUG )
    xbmc.log( "%s - Title: %s" % ( log_message, movie_title, ), level=xbmc.LOGDEBUG )
    xbmc.log( "%s - Path: %s" % ( log_message, movie, ), level=xbmc.LOGDEBUG )
    xbmc.log( "%s - Genre: %s" % ( log_message, genre, ), level=xbmc.LOGDEBUG )
    xbmc.log( "%s - MPAA: %s" % ( log_message, mpaa, ), level=xbmc.LOGDEBUG )
    xbmc.log( "%s - Audio: %s" % ( log_message, audio, ), level=xbmc.LOGDEBUG )
    if _S_( "audio_videos_folder" ):
        xbmc.log( "%s - Folder: %s" % ( log_message, ( xbmc.translatePath( _S_( "audio_videos_folder" ) ) + { "dca": "DTS", "ac3": "Dolby", "dtsma": "DTSHD-MA", "dtshd_ma": "DTSHD-MA", "a_truehd": "Dolby TrueHD", "truehd": "Dolby TrueHD" }.get( audio, "Other" ) + xbmc.translatePath( _S_( "audio_videos_folder" ) )[ -1 ], ) ), level=xbmc.LOGDEBUG )
    xbmc.log( "%s  %s" % ( log_message, log_sep ), level=xbmc.LOGDEBUG )
    # return results
    return mpaa, audio, genre, movie, equivalent_mpaa
开发者ID:nuka1195,项目名称:script.cinema_experience,代码行数:56,代码来源:ce_playlist.py


示例15: fetch_similarTracks

	def fetch_similarTracks( self, currentlyPlayingTitle, currentlyPlayingArtist ):
		apiMethod = "&method=track.getsimilar&limit=" + str(self.limitlastfmresult)

		# The url in which to use
		Base_URL = self.apiPath + apiMethod + "&artist=" + urllib.quote_plus(currentlyPlayingArtist) + "&track=" + urllib.quote_plus(currentlyPlayingTitle)
		#print Base_URL
		WebSock = urllib.urlopen(Base_URL)  # Opens a 'Socket' to URL
		WebHTML = WebSock.read()            # Reads Contents of URL and saves to Variable
		WebSock.close()                     # Closes connection to url

		xbmc.executehttpapi("setresponseformat(openRecordSet;<recordset>;closeRecordSet;</recordset>;openRecord;<record>;closeRecord;</record>;openField;<field>;closeField;</field>)");
		#print WebHTML
		similarTracks = re.findall("<track>.+?<name>(.+?)</name>.+?<match>(.+?)</match>.+?<artist>.+?<name>(.+?)</name>.+?</artist>.+?</track>", WebHTML, re.DOTALL )
		random.shuffle(similarTracks)
		foundArtists = []
		countTracks = len(similarTracks)
		print "Count: " + str(countTracks)
		for similarTrackName, matchValue, similarArtistName in similarTracks:
			#print "Looking for: " + similarTrackName + " - " + similarArtistName + " - " + matchValue
			similarTrackName = similarTrackName.replace("+"," ").replace("("," ").replace(")"," ").replace("&quot","'").replace("'","''").replace("&amp;","and")
			similarArtistName = similarArtistName.replace("+"," ").replace("("," ").replace(")"," ").replace("&quot","'").replace("'","''").replace("&amp;","and")
			sql_music = "select strTitle, strArtist, strAlbum, strPath, strFileName, strThumb, iDuration from songview where strTitle LIKE '%%" + similarTrackName + "%%' and strArtist LIKE '%%" + similarArtistName + "%%' order by random() limit 1"
			music_xml = xbmc.executehttpapi( "QueryMusicDatabase(%s)" % quote_plus( sql_music ), )
			# separate the records
			records = re.findall( "<record>(.+?)</record>", music_xml, re.DOTALL )
			for count, item in enumerate( records ):
				# separate individual fields
				fields = re.findall( "<field>(.*?)</field>", item, re.DOTALL )
				artist = fields[1]
				trackTitle = fields[0]
				album = fields[2]
				trackPath = fields[3] + fields[4]
				thumb = fields[5]
				duration = int(fields[6])
				print "Found: " + trackTitle + " by: " + artist
				if (self.allowtrackrepeat == "true" or (self.allowtrackrepeat == "false" and trackPath not in self.addedTracks)):
					if (self.preferdifferentartist == "false" or (self.preferdifferentartist == "true" and eval(matchValue) < 0.2 and similarArtistName not in foundArtists)):
						listitem = self.getListItem(trackTitle,artist,album,thumb,duration)
						xbmc.PlayList(0).add(url=trackPath, listitem=listitem)
						self.addedTracks += [trackPath]
						xbmc.executebuiltin("Container.Refresh")
						self.countFoundTracks += 1
						if (similarArtistName not in foundArtists):
							foundArtists += [similarArtistName]

			if (self.countFoundTracks >= self.numberoftrackstoadd):
				break
			
		if (self.countFoundTracks == 0):
			time.sleep(3)
			#self.firstRun = 1
			print "None found"
			xbmc.executebuiltin("Notification(" + self.SCRIPT_NAME+",No similar tracks were found)")
			return False
			
		xbmc.executebuiltin('SetCurrentPlaylist(0)')
开发者ID:mclog,项目名称:repository-mortstar-addons,代码行数:56,代码来源:pm.py


示例16: showChannelLabel

    def showChannelLabel(self, channel):
        self.log('showChannelLabel ' + str(channel))

        if self.channelLabelTimer.isAlive():
            self.channelLabelTimer.cancel()
            self.channelLabelTimer = threading.Timer(5.0, self.hideChannelLabel)

        tmp = self.inputChannel
        self.hideChannelLabel()
        self.inputChannel = tmp
        curlabel = 0

        if channel > 99:
            self.channelLabel[curlabel].setImage(IMAGES_LOC + 'label_' + str(channel // 100) + '.png')
            self.channelLabel[curlabel].setVisible(True)
            curlabel += 1

        if channel > 9:
            self.channelLabel[curlabel].setImage(IMAGES_LOC + 'label_' + str((channel % 100) // 10) + '.png')
            self.channelLabel[curlabel].setVisible(True)
            curlabel += 1

        self.channelLabel[curlabel].setImage(IMAGES_LOC + 'label_' + str(channel % 10) + '.png')
        self.channelLabel[curlabel].setVisible(True)

        ##ADDED BY SRANSHAFT: USED TO SHOW NEW INFO WINDOW WHEN CHANGING CHANNELS
        if self.inputChannel == -1 and self.infoOnChange == True:
            self.infoOffset = 0
            self.showInfo(5.0)

        if self.showChannelBug == True:
            try:
                self.getControl(103).setImage(self.channelLogos + ascii(self.channels[self.currentChannel - 1].name) + '.png')
            except:
                pass
        else:
            try:
                self.getControl(103).setImage('')
            except:
                pass
        ##

        if xbmc.getCondVisibility('Player.ShowInfo'):
            if USING_FRODO:
                json_query = '{"jsonrpc": "2.0", "method": "Input.Info", "id": 1}'
                self.ignoreInfoAction = True
                self.channelList.sendJSON(json_query);
            else:
                xbmc.executehttpapi("SendKey(0xF049)")
                self.ignoreInfoAction = True

        self.channelLabelTimer.name = "ChannelLabel"
        self.channelLabelTimer.start()
        self.startNotificationTimer(10.0)
        self.log('showChannelLabel return')
开发者ID:ingolfius,项目名称:Retroplex-XBMC-1,代码行数:55,代码来源:Overlay.py


示例17: GetMusicBrainzId

def GetMusicBrainzId(artist):
    xbmc.executehttpapi( "SetResponseFormat()" )
    xbmc.executehttpapi( "SetResponseFormat(OpenRecord,%s)" % ( "<record>", ) )
    xbmc.executehttpapi( "SetResponseFormat(CloseRecord,%s)" % ( "</record>", ) )
    xbmc.executehttpapi('')
    
    sqlQuery = "SELECT DISTINCT artist.strArtist, song.idArtist, song.strMusicBrainzArtistID FROM song JOIN artist ON artist.idArtist=song.idArtist WHERE artist.strArtist='%s'" %artist
    results = xbmc.executehttpapi( "QueryMusicDatabase(%s)" % urllib.quote_plus( sqlQuery ) )
    records = re.findall( "<record>(.+?)</record>", results, re.DOTALL )
    
    if len(records) == 1:
        fields = re.findall( "<field>(.+?)</field>", records[0], re.DOTALL)
        
        if len(fields) == 3:
            if fields[2] == 'not_there':
                log('We searched MusicBrainz before and not found - let\'s try again')
                return GetMusicBrainzIdFromNet(artist, int(fields[1]))
            else:
                log('MusicBrainz id is already stored in XBMC database')
                return fields[2]
        else:
            log('We didn\'t search MusicBrainz for this artist yet - let\'s try')
            return GetMusicBrainzIdFromNet(artist, int(fields[1]))
    
    
    return None
开发者ID:Black09,项目名称:pieh-xbmc-addons,代码行数:26,代码来源:MusicBrainz.py


示例18: _get_queued_video_info

 def _get_queued_video_info(self):
     try:
         xbmc.log("_get_queued_video_info()", xbmc.LOGNOTICE)
         # clear then queue the currently selected video
         xbmc.executebuiltin("Playlist.Clear")
         xbmc.executebuiltin("Action(Queue,%d)" % (xbmcgui.getCurrentWindowId() - 10000,))
         xbmc.log("Action(Queue,%d)" % (xbmcgui.getCurrentWindowId() - 10000,), xbmc.LOGNOTICE)
         # we need to sleep so the video gets queued properly
         xbmc.sleep(300)
         # create a video playlist
         self.playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
         # get movie name
         movie_title = self.playlist[0].getdescription()
         # this is used to skip trailer for current movie selection
         movie = os.path.splitext(os.path.basename(self.playlist[0].getfilename()))[0]
         # format our records start and end
         xbmc.executehttpapi("SetResponseFormat()")
         xbmc.executehttpapi("SetResponseFormat(OpenField,)")
         # TODO: verify the first is the best audio
         # setup the sql, we limit to 1 record as there can be multiple entries in streamdetails
         sql = (
             "SELECT movie.c12, movie.c14, streamdetails.strAudioCodec FROM movie, streamdetails WHERE movie.idFile=streamdetails.idFile AND streamdetails.iStreamType=1 AND c00='%s' LIMIT 1"
             % (movie_title.replace("'", "''"),)
         )
         xbmc.log("SQL: %s" % (sql,), xbmc.LOGNOTICE)
         # query database for info dummy is needed as there are two </field> formatters
         mpaa, genre, audio, dummy = xbmc.executehttpapi("QueryVideoDatabase(%s)" % quote_plus(sql)).split(
             "</field>"
         )
         # TODO: add a check and new sql for videos queued from files mode, or try an nfo
         # calculate rating
         mpaa = mpaa.split(" ")[1 - (len(mpaa.split(" ")) == 1)]
         mpaa = (mpaa, "NR")[mpaa not in ("G", "PG", "PG-13", "R", "NC-17", "Unrated")]
     except:
         movie_title = mpaa = audio = genre = movie = ""
     # spew queued video info to log
     xbmc.log("-" * 70, xbmc.LOGNOTICE)
     xbmc.log("Title: %s" % (movie_title,), xbmc.LOGNOTICE)
     xbmc.log("Path: %s" % (movie,), xbmc.LOGNOTICE)
     xbmc.log("Genre: %s" % (genre,), xbmc.LOGNOTICE)
     xbmc.log("MPAA: %s" % (mpaa,), xbmc.LOGNOTICE)
     xbmc.log("Audio: %s" % (audio,), xbmc.LOGNOTICE)
     if _S_("audio_videos_folder"):
         xbmc.log(
             "- Folder: %s"
             % (
                 xbmc.translatePath(_S_("audio_videos_folder"))
                 + {"dca": "DTS", "ac3": "Dolby"}.get(audio, "Other")
                 + xbmc.translatePath(_S_("audio_videos_folder"))[-1],
             ),
             xbmc.LOGNOTICE,
         )
     xbmc.log("-" * 70, xbmc.LOGNOTICE)
     # return results
     return mpaa, audio, genre, movie
开发者ID:ackbarr,项目名称:script.cinema.experience,代码行数:55,代码来源:xbmcscript_player.py


示例19: _get_movie_details

def _get_movie_details( movie_title="", thumbnail="", movie_full_path="" ):
    xbmc.log( "[script.cinema.experience] - [ce_playlist.py] - _get_movie_details started", level=xbmc.LOGNOTICE )
    # format our records start and end
    xbmc.executehttpapi( "SetResponseFormat()" )
    xbmc.executehttpapi( "SetResponseFormat(OpenField,)" )
    # retrive plot(c01), plotoutline(c02), runtime(c11), mpaa(c12), year(c07), studio(c18), genre(c14), writer(c06), director(c15), tagline(c03), votes(c04), imdbcode(c09), rating(c05), top250(c13) from database
    sql_query = "SELECT c01, c02, c11, c12, c07, c18, c14, c06, c15, c03, c04, c09, c05, c13 FROM movieview WHERE c00='%s' LIMIT 1" % ( movie_title.replace( "'", "''", ), )
    # the dummy string is to catch the extra </field>
    plot, plotoutline, runtime, mpaa, year, studio, genre, writer, director, tagline, votes, imdbcode, rating, top250, dummy = xbmc.executehttpapi( "QueryVideoDatabase(%s)" % quote_plus( sql_query ), ).split( "</field>" )
    return plot, plotoutline, runtime, mpaa, year, studio, genre, writer, director, tagline, votes, imdbcode, rating, votes, top250
    
开发者ID:nuka1195,项目名称:script.cinema_experience,代码行数:10,代码来源:dharma_code.py


示例20: __init__

 def __init__( self ):
     # parse argv for any preferences
     self._parse_argv()
     # clear properties
     self._clear_properties()
     # format our records start and end
     xbmc.executehttpapi( "SetResponseFormat(OpenRecord,%s)" % ( "<record>", ) )
     xbmc.executehttpapi( "SetResponseFormat(CloseRecord,%s)" % ( "</record>", ) )
     # fetch media info
     self._fetch_movie_info()
     self._fetch_tvshow_info()
开发者ID:xbs08,项目名称:MediaStream_Redux,代码行数:11,代码来源:RecentlyAdded.py



注:本文中的xbmc.executehttpapi函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python xbmc.getCacheThumbName函数代码示例发布时间:2022-05-26
下一篇:
Python xbmc.executebuiltin函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap