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

Python xbmc.getSupportedMedia函数代码示例

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

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



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

示例1: build_music_playlist

def build_music_playlist():
    log( "Building Music Playlist", xbmc.LOGNOTICE )
    xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "AudioPlaylist.Clear", "id": 1}')
    music_playlist = xbmc.PlayList( xbmc.PLAYLIST_MUSIC )
    track_location = []
    # check to see if playlist or music file is selected
    if trivia_settings[ "trivia_music" ] == 1:
        if trivia_settings[ "trivia_music_file" ].endswith(".m3u"):
            log( "Music Playlist: %s" % trivia_settings[ "trivia_music_file" ] )
            playlist_file = xbmcvfs.File( trivia_settings[ "trivia_music_file" ], 'rb')
            saved_playlist = playlist_file.read().splitlines()
            playlist_file.close()
            log( "Finished Reading Music Playlist" )
            track_info, track_location = parse_playlist( saved_playlist, xbmc.getSupportedMedia('music') )
        elif os.path.splitext( trivia_settings[ "trivia_music_file" ] )[1] in xbmc.getSupportedMedia('music'):
            for track in range(100):
                track_location.append( trivia_settings[ "trivia_music_file" ] )
    # otherwise
    else:
        if trivia_settings[ "trivia_music_folder" ]:
            # search given folder and subfolders for files
            track_location = dirEntries( trivia_settings[ "trivia_music_folder" ], "music", "TRUE" )
    # shuffle playlist
    shuffle( track_location )
    for track in track_location:
        music_playlist.add( track,  )
开发者ID:h0tw1r3,项目名称:script.cinema.experience,代码行数:26,代码来源:ce_playlist.py


示例2: build_music_playlist

def build_music_playlist():
    xbmc.log( "%s - Building Music Playlist" % log_message, level=xbmc.LOGNOTICE)
    xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "AudioPlaylist.Clear", "id": 1}')
    music_playlist = xbmc.PlayList( xbmc.PLAYLIST_MUSIC )
    track_location = []
    # check to see if playlist or music file is selected
    if int( _S_( "trivia_music" ) ) == 1:
        if _S_( "trivia_music_file" ).endswith(".m3u"):
            xbmc.log( "%s - Music Playlist: %s" % ( log_message, _S_( "trivia_music_file" ) ), level=xbmc.LOGDEBUG)
            playlist_file = open( _S_( "trivia_music_file" ), 'rb')
            saved_playlist = playlist_file.readlines()
            xbmc.log( "%s - Finished Reading Music Playlist" % log_message, level=xbmc.LOGDEBUG)
            track_info, track_location = parse_playlist( saved_playlist, xbmc.getSupportedMedia('music') )
        elif os.path.splitext( _S_( "trivia_music_file" ) )[1] in xbmc.getSupportedMedia('music'):
            for track in range(100):
                track_location.append( _S_( "trivia_music_file" ) )
    # otherwise
    else:
        if _S_( "trivia_music_folder" ):
            # search given folder and subfolders for files
            track_location = dirEntries( _S_( "trivia_music_folder" ), "music", "TRUE" )
    # shuffle playlist
    count = 0
    while count <6:
        shuffle( track_location, random )
        count+=1
    for track in track_location:
        music_playlist.add( track,  )
开发者ID:nuka1195,项目名称:script.cinema_experience,代码行数:28,代码来源:ce_playlist.py


示例3: _validateExtension

def _validateExtension(ext,info):
    #use Kodi's supported media to check for valid extension or return default
    if info.get('media_type') == 'video':
        if not ext in xbmc.getSupportedMedia('video'): return 'mp4'
    elif info.get('media_type') == 'audio':
        if not ext in xbmc.getSupportedMedia('music'): return 'mp3'
    elif info.get('media_type') == 'image':
        if not ext in xbmc.getSupportedMedia('picture'): return 'jpg'
    return ext
开发者ID:AMOboxTV,项目名称:AMOBox.LegoBuild,代码行数:9,代码来源:YDStreamExtractor.py


示例4: _isValidMediaExtension

def _isValidMediaExtension(ext):
    # use Kodi's supported media to check for valid extension
    if (
        ext in xbmc.getSupportedMedia("video")
        or ext in xbmc.getSupportedMedia("music")
        or ext in xbmc.getSupportedMedia("picture")
    ):
        return True
    return False
开发者ID:EPiC-APOC,项目名称:repository.xvbmc,代码行数:9,代码来源:YDStreamExtractor.py


示例5: getTypeFromExt

def getTypeFromExt(ext):
	ext = ext.lower()
	video = xbmc.getSupportedMedia('video').replace('.','').split('|')
	audio = xbmc.getSupportedMedia('music').replace('.','').split('|')
	image = xbmc.getSupportedMedia('picture').replace('.','').split('|')
	if ext in video:
		return 'videofile'
	elif ext in audio:
		return 'audiofile'
	elif ext in image:
		return 'imagefile'
	return None
开发者ID:ruuk,项目名称:script.module.sharesocial,代码行数:12,代码来源:share.py


示例6: _validateExtension

def _validateExtension(ext, info):
    # use Kodi's supported media to check for valid extension or return default
    if info.get("media_type") == "video":
        if ext not in xbmc.getSupportedMedia("video"):
            return "mp4"
    elif info.get("media_type") == "audio":
        if ext not in xbmc.getSupportedMedia("music"):
            return "mp3"
    elif info.get("media_type") == "image":
        if ext not in xbmc.getSupportedMedia("picture"):
            return "jpg"
    return ext
开发者ID:EPiC-APOC,项目名称:repository.xvbmc,代码行数:12,代码来源:YDStreamExtractor.py


示例7: getURLMediaType

def getURLMediaType(url):
    if url.startswith("http"):
        videoTypes = xbmc.getSupportedMedia("video")
        musicTypes = xbmc.getSupportedMedia("music")
        imageTypes = xbmc.getSupportedMedia("picture")
        ext = url.rsplit(".", 1)[-1]
        if ext in videoTypes:
            return "video"
        elif ext in musicTypes:
            return "audio"
        elif ext in imageTypes:
            return "image"
    return protocolMediaType(url)
开发者ID:rjof,项目名称:xbmc.service.pushbullet,代码行数:13,代码来源:pushhandler.py


示例8: getURLMediaType

def getURLMediaType(url):
    if url.startswith('http'):
        videoTypes = xbmc.getSupportedMedia('video')
        musicTypes = xbmc.getSupportedMedia('music')
        imageTypes = xbmc.getSupportedMedia('picture')
        ext = url.rsplit('.',1)[-1]
        if ext in videoTypes:
            return 'video'
        elif ext in musicTypes:
            return 'audio'
        elif ext in imageTypes:
            return 'image'
    return protocolMediaType(url)
开发者ID:ruuk,项目名称:xbmc.service.pushbullet,代码行数:13,代码来源:pushhandler.py


示例9: _get_slides

def _get_slides( paths, movie_mpaa ):
    # reset folders list
    tmp_slides = []
    folders = []
    # mpaa ratings
    mpaa_ratings = { "G": 0, "PG": 1, "PG-13": 2, "R": 3, "NC-17": 4, "--": 5, "": 6 }
    # enumerate thru paths and fetch slides recursively
    for path in paths:
        # get the directory listing
        entries = dirEntries( path, media_type="files", recursive="FALSE" )
        # sort in case
        entries.sort()
        # get a slides.xml if it exists
        slidesxml_exists, mpaa, question_format, clue_format, answer_format, still_format = _get_slides_xml( path )
        # check if rating is ok
        log( "Movie MPAA: %s" % movie_mpaa )
        log( "Slide MPAA: %s" % mpaa )
        if ( slidesxml_exists and mpaa_ratings.get( movie_mpaa, -1 ) < mpaa_ratings.get( mpaa, -1 ) ):
            log( "Slide Rating above movie rating - skipping whole folder", xbmc.LOGNOTICE )
            continue
        # initialize these to True so we add a new list item to start
        question = clue = answer = still = True
        # enumerate through our entries list and combine question, clue, answer
        for entry in entries:
            # if folder add to our folder list to recursively fetch slides
            if ( entry.endswith( "/" ) or entry.endswith( "\\" ) ):
                folders += [ entry ]
            # sliders.xml was included, so check it
            elif ( slidesxml_exists ):
                # question
                if ( question_format and re.search( question_format, os.path.basename( entry ), re.IGNORECASE ) ):
                    if ( question ):
                        tmp_slides += [ [ "", "", "" ] ]
                        clue = answer = still = False
                    tmp_slides[ -1 ][ 0 ] = "__question__" + entry
                    # clue
                elif ( clue_format and re.search( clue_format, os.path.basename( entry ), re.IGNORECASE ) ):
                    if ( clue ):
                        tmp_slides += [ [ "", "", "" ] ]
                        question = answer = still = False
                    tmp_slides[ -1 ][ 1 ] = "__clue__" + entry
                # answer
                elif ( answer_format and re.search( answer_format, os.path.basename( entry ), re.IGNORECASE ) ):
                    if ( answer ):
                        tmp_slides += [ [ "", "", "" ] ]
                        question = clue = still = False
                    tmp_slides[ -1 ][ 2 ] = "__answer__" + entry
                    # still
                elif ( still_format and re.search( still_format, os.path.basename( entry ), re.IGNORECASE ) ):
                    if ( still ):
                        tmp_slides += [ [ "", "", "" ] ]
                        clue = answer = question = False
                    tmp_slides[ -1 ][ 0 ] = "__still__" + entry
            # add the file as a question TODO: maybe check for valid picture format?
            elif ( entry and os.path.splitext( entry )[ 1 ].lower() in xbmc.getSupportedMedia( "picture" ) ):
                tmp_slides += [ [ "", "", "__still__" + entry ] ] 
    # if there are folders call again (we want recursive)
    if ( folders ):
        tmp_slides.extend( _get_slides( folders, movie_mpaa ) )
    return tmp_slides
开发者ID:h0tw1r3,项目名称:script.cinema.experience,代码行数:60,代码来源:slides.py


示例10: build_music_playlist

def build_music_playlist():
    utils.log( "Building Music Playlist", xbmc.LOGNOTICE )
    xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "AudioPlaylist.Clear", "id": 1}')
    music_playlist = xbmc.PlayList( xbmc.PLAYLIST_MUSIC )
    track_location = []
    # check to see if playlist or music file is selected
    if trivia_settings[ "trivia_music" ] == 1:
        if ( os.path.splitext( trivia_settings[ "trivia_music_file" ] )[ 1 ] ).lower() in ( "m3u", "pls", "asf", "ram" ):
            utils.log( "Music Playlist: %s" % trivia_settings[ "trivia_music_file" ] )
            if trivia_settings[ "trivia_music_file" ].endswith(".m3u"):
                track_location = parser.parse_m3u( trivia_settings[ "trivia_music_file" ], xbmc.getSupportedMedia('music') )
            elif trivia_settings[ "trivia_music_file" ].endswith(".pls"):
                track_location = parser.parse_pls( trivia_settings[ "trivia_music_file" ], xbmc.getSupportedMedia('music') )
            elif trivia_settings[ "trivia_music_file" ].endswith(".asf"):
                track_location = parser.parse_asf( trivia_settings[ "trivia_music_file" ], xbmc.getSupportedMedia('music') )
            elif trivia_settings[ "trivia_music_file" ].endswith(".ram"):
                track_location = parser.parse_ram( trivia_settings[ "trivia_music_file" ], xbmc.getSupportedMedia('music') )
        elif os.path.splitext( trivia_settings[ "trivia_music_file" ] )[1] in xbmc.getSupportedMedia('music'):
            for track in range(100):
                track_location.append( trivia_settings[ "trivia_music_file" ] )
    # otherwise
    else:
        if trivia_settings[ "trivia_music_folder" ]:
            # search given folder and subfolders for files
            track_location = absolute_listdir( trivia_settings[ "trivia_music_folder" ], media_type = "music", recursive = True )
    # shuffle playlist
    shuffle( track_location )
    for track in track_location:
        music_playlist.add( track,  )
开发者ID:hoa2014,项目名称:script.cinema.experience,代码行数:29,代码来源:ce_playlist.py


示例11: _get_items

 def _get_items(self, paths, media_type):
     # reset folders list
     folders = []
     # enumerate thru paths and fetch videos/pictures recursively
     for path in paths:
         # get the directory listing
         entries = xbmc.executehttpapi("GetDirectory(%s)" % (path,)).split("\n")
         # enumerate through our entries list and check for valid media type
         for entry in entries:
             # remove <li> from item
             entry = entry.replace("<li>", "")
             # if folder add to our folder list to recursively fetch videos/pictures
             if entry.endswith("/") or entry.endswith("\\"):
                 folders += [entry]
             # is this a valid video/picture file
             elif entry and (
                 (media_type.startswith("video") and os.path.splitext(entry)[1] in xbmc.getSupportedMedia("video"))
                 or (
                     media_type.endswith("picture")
                     and os.path.splitext(entry)[1] in xbmc.getSupportedMedia("picture")
                 )
             ):
                 # add our entry
                 self.tmp_paths += [entry]
     # if there are folders call again (we want recursive)
     if folders:
         self._get_items(folders, media_type)
开发者ID:ackbarr,项目名称:script.cinema.experience,代码行数:27,代码来源:xbmcscript_player.py


示例12: absolute_listdir

def absolute_listdir( path, media_type = "files", recursive = False, contains = "" ):
    absolute_files = []
    absolute_folders = []
    path = utils.smart_unicode( path )
    folders, files = xbmcvfs.listdir( path )
    for f in files:
        f = utils.smart_unicode( f )
        if media_type == "files":
            if not contains or ( contains and ( contains in f ) ):
                try:
                    absolute_files.append( os.path.join( path, f ).replace("\\\\","\\") )
                except UnicodeError:
                    utils.log( "Problem with path, skipping" )
                    utils.log( "Path: %s" % repr( path ) )
                    utils.log( "Filename: %s" % repr( path ) )
                except:
                    utils.log( "Problem with path, skipping" )
                    traceback.print_exc()
        else:
            if ( os.path.splitext( f )[ 1 ] ).lower() in ( xbmc.getSupportedMedia( media_type ) ).lower():
                if not contains or ( contains and ( contains in f ) ):
                    absolute_files.append( os.path.join( path, f ).replace("\\\\","\\") )
    if folders:
        absolute_folders = absolute_folder_paths( folders, path )
        if recursive:
            for folder in absolute_folders:
                absolute_files.extend( absolute_listdir( folder, media_type = media_type, recursive = recursive, contains = contains ) )
    return absolute_files
开发者ID:SaveScum,项目名称:script.cinema.experience,代码行数:28,代码来源:folder.py


示例13: get_user_input

 def get_user_input(self, itype, header, *args):
     """Get user input of type defined by 'itype'."""
     if itype == 'string':
         v = self.__get_from_keyboard(header)
     elif itype == 'directory':
         #v = os.getcwd()
         dialog = xbmcgui.Dialog()
         v = dialog.browse(3, header, 'files')
     elif itype == 'picture':
         mask = xbmc.getSupportedMedia('picture')
         mltp = False
         if len(args):
             mltp = args[0]
         dialog = xbmcgui.Dialog()
         # first testing if multiple selection patch is applied to FileBrowser,
         # otherwise fall back to old method call, but return tuple anyway.
         # required patch: http://trac.xbmc.org/ticket/10894
         # available since git commit dcad8dbd
         try:
             v = dialog.browse(2, header, "pictures", mask, False, False, mltp)
         except TypeError:
             v = dialog.browse(2, header, "pictures", mask)
             v = (v,)
     elif itype == 'select':
         dialog = xbmcgui.Dialog()
         v = dialog.select(header, *args)
     elif itype == 'number':
         v = xbmcgui.Dialog().numeric(0, header)
     else:
         v = None
     
     return v
开发者ID:cClaude,项目名称:xppr,代码行数:32,代码来源:plugin.py


示例14: _get_slides

def _get_slides( paths, movie_mpaa ):
    # reset folders list
    tmp_slides = []
    folders = []
    # mpaa ratings
    mpaa_ratings = { "G": 0, "PG": 1, "PG-13": 2, "R": 3, "NC-17": 4, "--": 5, "": 6 }
    # enumerate thru paths and fetch slides recursively
    for path in paths:
        # get the directory listing
        entries = xbmc.executehttpapi( "GetDirectory(%s)" % ( path, ) ).split( "\n" )
        # sort in case
        entries.sort()
        # get a slides.xml if it exists
        slidesxml_exists, mpaa, question_format, clue_format, answer_format = _get_slides_xml( path )
        # check if rating is ok
        xbmc.log( "[script.cinema.experience] - Movie MPAA: %s" % movie_mpaa, level=xbmc.LOGDEBUG )
        xbmc.log( "[script.cinema.experience] - Slide MPAA: %s" % mpaa, level=xbmc.LOGDEBUG )
        if ( slidesxml_exists and mpaa_ratings.get( movie_mpaa, -1 ) < mpaa_ratings.get( mpaa, -1 ) ):
            xbmc.log( "[script.cinema.experience] - Slide Rating above movie rating - skipping whole folder", level=xbmc.LOGNOTICE)
            continue
        # initialize these to True so we add a new list item to start
        question = clue = answer = True
        # enumerate through our entries list and combine question, clue, answer
        for entry in entries:
            # remove <li> from item
            entry = entry.replace( "<li>", "" )
            # if folder add to our folder list to recursively fetch slides
            if ( entry.endswith( "/" ) or entry.endswith( "\\" ) ):
                folders += [ entry.replace( "<li>", "" ) ]
            # sliders.xml was included, so check it
            elif ( slidesxml_exists ):
                # question
                if ( question_format and re.search( question_format, os.path.basename( entry ), re.IGNORECASE ) ):
                    if ( question ):
                        tmp_slides += [ [ "", "", "" ] ]
                        clue = answer = False
                    tmp_slides[ -1 ][ 0 ] = entry
                # clue
                elif ( clue_format and re.search( clue_format, os.path.basename( entry ), re.IGNORECASE ) ):
                    if ( clue ):
                        tmp_slides += [ [ "", "", "" ] ]
                        question = answer = False
                    tmp_slides[ -1 ][ 1 ] = entry
                # answer
                elif ( answer_format and re.search( answer_format, os.path.basename( entry ), re.IGNORECASE ) ):
                    if ( answer ):
                        tmp_slides += [ [ "", "", "" ] ]
                        question = clue = False
                    tmp_slides[ -1 ][ 2 ] = entry
            # add the file as a question TODO: maybe check for valid picture format?
            elif ( entry and os.path.splitext( entry )[ 1 ].lower() in xbmc.getSupportedMedia( "picture" ) ):
                tmp_slides += [ [ "", "", entry ] ]
    # if there are folders call again (we want recursive)
    if ( folders ):
        tmp_slides.extend( _get_slides( folders, movie_mpaa ) )
    return tmp_slides
开发者ID:nuka1195,项目名称:script.cinema_experience,代码行数:56,代码来源:slides.py


示例15: showRarVideos

def showRarVideos( url ):
    VIDEO_EXTENTIONS = xbmc.getSupportedMedia('video').split('|')
    # remove some archive extensions
    VIDEO_EXTENTIONS.remove(".rar")
    VIDEO_EXTENTIONS.remove(".001")
    VIDEO_EXTENTIONS.remove(".url")

    found_video_file = False

    dp = xbmcgui.DialogProgress()
    dp.create("Finding video files in rar. Be Patient!")

    def info_callback(raritem):
        try:
            currently_reading_rar_volume_file = raritem.volume_file.split('/')[-1]
            completed = (raritem.volume+1 * 100) / 15
            dp.update(completed, 'Reading rar data for the following rar file...', currently_reading_rar_volume_file, 'VOLUME #%s' % raritem.volume)
            doLog("%s\n%s\n%s" % (raritem.file_offset, raritem.volume_file.split('/')[-1], raritem.type))
        except:
            pass

    rar_file = rarfile.RarFile( url, crc_check=False, info_callback=info_callback )
    if rar_file.needs_password():
        errorNotice = 'XBMC.Notification("RAR IS PASSWORD PROTECTED!","Cannot handle a password protected archive.", 5000)'
        xbmc.executebuiltin( errorNotice )
        dp.close()
        return False

    for filename in rar_file.namelist():
        file_info = rar_file.getinfo(filename)
        doLog( "\tRAR INFO needs_password: %s - volume: %s - volume_file: %s - compress_type: %s" % (file_info.needs_password(), file_info.volume, file_info.volume_file, file_info.compress_type))

        filename = filename.replace('\\','/')
        dp.update(0, filename)
        doLog( "FILENAME FOUND: %s" % filename )

        # test for an extension otherwise skip
        try:
            file_ext_lower = "." + filename.lower().split('.')[-1]
            doLog( "Checking Extension: %s" % file_ext_lower )
            if file_ext_lower in (".rar",".001"):
                errorNotice = 'XBMC.Notification("Archive within archive detected!","Cannot handle double packed archives.", 2000)'
                xbmc.executebuiltin( errorNotice )
            if file_ext_lower in VIDEO_EXTENTIONS:
                # use the rar volume_file which holds the actual url to where this video file starts in the set.
                # otherwise videos further in the set won't play. SWEET!
                video_url = urllib.quote( file_info.volume_file ).replace("-", "%2d").replace(".", "%2e").replace("/", "%2f")
                video_url = "rar://" + video_url + "/" + filename
                found_video_file = True
                doLog( "addLink( name=%s, url=%s)" % (filename, video_url))
                addLink( name=filename, url=video_url)
        except:
            pass
    dp.close()
    return found_video_file
开发者ID:vdeku,项目名称:daledewd-xbmc-repo,代码行数:55,代码来源:default.py


示例16: _get_slides

 def _get_slides( self, paths ):
     # reset folders list
     folders = []
     # mpaa ratings
     mpaa_ratings = { "G": 0, "PG": 1, "PG-13": 2, "R": 3, "NC-17": 4, "--": 5, "": 6 }
     # enumerate thru paths and fetch slides recursively
     for path in paths:
         # get the directory listing
         entries = xbmc.executehttpapi( "GetDirectory(%s)" % ( path, ) ).split( "\n" )
         # sort in case
         entries.sort()
         # get a slides.xml if it exists
         slidesxml_exists, mpaa, question_format, clue_format, answer_format = self._get_slides_xml( path )
         # check if rating is ok
         if ( slidesxml_exists and mpaa_ratings.get( self.mpaa, -1 ) < mpaa_ratings.get( mpaa, -1 ) ):
             print "skipping whole folder", path
             continue
         # initialize these to True so we add a new list item to start
         question = clue = answer = True
         # enumerate through our entries list and combine question, clue, answer
         for entry in entries:
             # remove <li> from item
             entry = entry.replace( "<li>", "" )
             # if folder add to our folder list to recursively fetch slides
             if ( entry.endswith( "/" ) or entry.endswith( "\\" ) ):
                 folders += [ entry.replace( "<li>", "" ) ]
             # sliders.xml was included, so check it
             elif ( slidesxml_exists ):
                 # question
                 if ( re.search( question_format, os.path.basename( entry ), re.IGNORECASE ) ):
                     if ( question ):
                         self.tmp_slides += [ [ "", "", "" ] ]
                         clue = answer = False
                     self.tmp_slides[ -1 ][ 0 ] = entry
                 # clue
                 elif ( re.search( clue_format, os.path.basename( entry ), re.IGNORECASE ) ):
                     if ( clue ):
                         self.tmp_slides += [ [ "", "", "" ] ]
                         question = answer = False
                     self.tmp_slides[ -1 ][ 1 ] = entry
                 # answer
                 elif ( re.search( answer_format, os.path.basename( entry ), re.IGNORECASE ) ):
                     if ( answer ):
                         self.tmp_slides += [ [ "", "", "" ] ]
                         question = clue = False
                     self.tmp_slides[ -1 ][ 2 ] = entry
             # add the file as a question
             elif ( entry and os.path.splitext( entry )[ 1 ].lower() in xbmc.getSupportedMedia( "picture" ) ):
                 self.tmp_slides += [ [ "", "", entry ] ]
     # if there are folders call again (we want recursive)
     if ( folders ):
         self._get_slides( folders )
开发者ID:nuka1195,项目名称:script.cinema_experience,代码行数:52,代码来源:xbmcscript_trivia.py


示例17: get_video_extensions

def get_video_extensions():
    '''Get the video extensions supported by xbmc.

    @return: a lowercase list of media extensions that xbmc claims to support (extensions only, no dots).
    @rtype: [str]
    '''
    try:
        return get_video_extensions._supported
    except AttributeError:
        get_video_extensions._supported = [ext.lstrip('.').lower()
                                           for ext in xbmc.getSupportedMedia('video').split('|')]
        logger.debug('supported video extensions are: ' + repr(get_video_extensions._supported))
        return get_video_extensions._supported
开发者ID:TerrorKeed,项目名称:xbmc-addon-tvtumbler,代码行数:13,代码来源:utils.py


示例18: _get_slides

 def _get_slides( self, paths, media_type ):
     # reset folders list
     folders = []
     # enumerate thru paths and fetch slides recursively
     for path in paths:
         # get the directory listing
         entries = xbmc.executehttpapi( "GetDirectory(%s)" % ( path, ) ).splitlines()
         # sort in case
         entries.sort()
         # get a slides.xml if it exists
         slidesxml_exists, mpaa, theme, question_format, clue_format, answer_format = self._get_slides_xml( path )
         # check if rating is ok
         if ( slidesxml_exists and self.mpaa_ratings.get( self.mpaa, self.unrated_rating_index ) < self.mpaa_ratings.get( mpaa, self.unrated_rating_index ) ):
             xbmc.log( "Skipping whole folder: %s" % ( path, ), xbmc.LOGNOTICE )
             xbmc.log( "     Movie MPAA: %s - Folder MPAA: %s" % ( self.mpaa, mpaa, ), xbmc.LOGNOTICE )
             continue
         # initialize these to True so we add a new list item to start
         question = clue = answer = True
         # enumerate through our entries list and combine question, clue, answer
         for entry in entries:
             # remove <li> from item
             entry = entry.replace( "<li>", "" )
             # if folder add to our folder list to recursively fetch slides
             if ( entry.endswith( "/" ) or entry.endswith( "\\" ) ):
                 folders += [ entry.replace( "<li>", "" ) ]
             # sliders.xml was included, so check it
             elif ( slidesxml_exists ):
                 # question
                 if ( re.search( question_format, os.path.basename( entry ), re.IGNORECASE ) ):
                     if ( question ):
                         self.tmp_slides += [ [ "", "", "" ] ]
                         clue = answer = False
                     self.tmp_slides[ -1 ][ 0 ] = entry
                 # clue
                 elif ( re.search( clue_format, os.path.basename( entry ), re.IGNORECASE ) ):
                     if ( clue ):
                         self.tmp_slides += [ [ "", "", "" ] ]
                         question = answer = False
                     self.tmp_slides[ -1 ][ 1 ] = entry
                 # answer
                 elif ( re.search( answer_format, os.path.basename( entry ), re.IGNORECASE ) ):
                     if ( answer ):
                         self.tmp_slides += [ [ "", "", "" ] ]
                         question = clue = False
                     self.tmp_slides[ -1 ][ 2 ] = entry
             # add the file as a question
             elif ( entry and os.path.splitext( entry )[ 1 ].lower() in xbmc.getSupportedMedia( "picture" ) ):
                 self.tmp_slides += [ [ "", "", entry ] ]
     # if there are folders call again (we want recursive)
     if ( folders ):
         self._get_slides( folders )
开发者ID:nuka1195,项目名称:script.cinema_experience,代码行数:51,代码来源:main.py


示例19: _get_special_items

 def _get_special_items( self, **kwargs ):
     # return if no items
     if ( not kwargs[ "items" ] ): return
     # if path is a file check if file exists
     if ( not kwargs[ "isfolder" ] and not kwargs[ "path" ].startswith( "http://" ) and not os.path.isfile( kwargs[ "path" ] ) ): return
     # set default paths list and temp playlist
     self.tmp_paths = [ kwargs[ "path" ] ]
     tmp_playlist = []
     # if path is a folder fetch # videos/images
     if ( kwargs[ "isfolder" ] ):
         # initialize our lists
         self.tmp_paths = []
         # get items
         self._get_items( [ kwargs[ "path" ] ] )
         # shuffle items
         shuffle( self.tmp_paths )
     ## here we divide functions to work like shuffle_slides
     # initialize our listitem
     listitem = None
     # enumerate thru and add our videos/images
     for count in range( kwargs[ "items" ] ):
         # no listitem for images
         if ( os.path.splitext( self.tmp_paths[ count ] )[ 1 ] in xbmc.getSupportedMedia( "video" ) ):
             # create the listitem and fill the infolabels
             listitem = self._get_listitem(
                 title = kwargs.get( "title", os.path.splitext( os.path.basename( self.tmp_paths[ count ] ) )[ 0 ] ),
                 url = self.tmp_paths[ count ],
                 thumbnail = kwargs.get( "thumbnail", None ),
                 plot = kwargs.get( "plot", "" ),
                 duration = kwargs.get( "duration", "" ),
                 mpaa = kwargs.get( "mpaa", "" ),
                 release_date = kwargs.get( "release_date", "0 0 0" ),
                 studio = kwargs.get( "studio", self.Addon.getAddonInfo( "Name" ) ),
                 genre = kwargs.get( "genre", self.Addon.getAddonInfo( "Name" ) ),
                 writer = kwargs.get( "writer", "" ),
                 director = kwargs.get( "director", "" )
             )
         # add our video/image to the temp playlist
         tmp_playlist += [ ( self.tmp_paths[ count ], listitem, ) ]
     # add reults to our experience
     if ( tmp_playlist ):
         kwargs[ "experience" ] += [ { 
             "type": kwargs[ "type" ],
             "playlist": tmp_playlist,
             "slideshow_duration": kwargs.get( "slideshow_duration", -1 ), #FIXME: probably is always -1 unless we combine slideshow
             "image_duration": kwargs.get( "image_duration", -1 ),
             "play_music": False,
         } ]
开发者ID:nuka1195,项目名称:script.cinema_experience,代码行数:48,代码来源:experience-working.py


示例20: is_playable_media

def is_playable_media( filename, media="picture" ):
    """
    getSupportedMedia(media) -- Returns the supported file types for the specific media as a string.
    media          : string - media type
    *Note, media type can be (video, music, picture).
           The return value is a pipe separated string of filetypes (eg. '.mov|.avi').
           You can use the above as keywords for arguments and skip certain optional arguments.
           Once you use a keyword, all following arguments require the keyword.
    example:
      - mTypes = xbmc.getSupportedMedia('video')
    """
    media_types = xbmc.getSupportedMedia( media ).split( "|" )
    try:
        return os.path.splitext( filename )[ 1 ].lower() in media_types
    except:
        print_exc()
开发者ID:Quihico,项目名称:passion-xbmc,代码行数:16,代码来源:utilities.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python xbmc.log函数代码示例发布时间:2022-05-26
下一篇:
Python xbmc.getSkinDir函数代码示例发布时间: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