当前位置: 首页>>代码示例>>Python>>正文


Python MPDClient.listallinfo方法代码示例

本文整理汇总了Python中mpd.MPDClient.listallinfo方法的典型用法代码示例。如果您正苦于以下问题:Python MPDClient.listallinfo方法的具体用法?Python MPDClient.listallinfo怎么用?Python MPDClient.listallinfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mpd.MPDClient的用法示例。


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

示例1: init

# 需要导入模块: from mpd import MPDClient [as 别名]
# 或者: from mpd.MPDClient import listallinfo [as 别名]
def init():
  global CLIENT, PLAYLIST, LIBRARY
  ## MPD object instance
  CLIENT = MPDClient()
  if mpdConnect(CLIENT, CON_ID):
    logging.info('Connected to MPD server')
    CLIENT.setvol(95)
    PLAYLIST = CLIENT.playlistinfo()
    LIBRARY  = CLIENT.listallinfo()
    
    repeat(True) # Repeat all tracks
  else:
    logging.critical('Failed to connect to MPD server')
    logging.critical("Sleeping 1 second and retrying")
    time.sleep(1)
    init()
开发者ID:Unoqueva,项目名称:pyBus,代码行数:18,代码来源:pyBus_module_audio.py

示例2: MPDClient

# 需要导入模块: from mpd import MPDClient [as 别名]
# 或者: from mpd.MPDClient import listallinfo [as 别名]
cursor.execute( "SELECT ROWID, title FROM albums" )

for album in cursor:
    db_albums[album[1]] = album[0]

cursor.execute( "SELECT artists.name, albums.title FROM artists, albums, contributions WHERE contributions.artist = artists.ROWID AND contributions.album = albums.ROWID" )

for contribution in cursor:
    db_catalog.add( contribution )

# Next get the current database from MPD.

player = MPDClient()
player.connect( 'guanaco', 6600 )

songs = player.listallinfo()

for song in songs:
    artist = 'unknown'
    album = 'unknown'
    if 'artist' in song:
        if type( song['artist'] ) is list:
            artist = ' - '.join( song['artist'] )
        else:
            artist = song['artist']
    if 'album' in song:
        if type( song['album'] ) is list:
            album = ' - '.join( song['album'] )
        else:
            album = song['album']
    if artist not in db_artists:
开发者ID:allenbarnett5,项目名称:mpddisplay,代码行数:33,代码来源:update_database.py

示例3: MPDClient

# 需要导入模块: from mpd import MPDClient [as 别名]
# 或者: from mpd.MPDClient import listallinfo [as 别名]
	args = parser.parse_args()

	skip_tagged = args.skip_tagged

	client = MPDClient()
	client.timeout = 10
	client.idletimeout = None
	client.connect(MPD_HOST, MPD_PORT)

	libdir = get_mpd_library_dir(MPD_CONF)

	total_files_updated = 0
	total_files_skipped = 0
	total_image_size    = 0

	for song in client.listallinfo(''):
		if not 'file' in song:
			continue

		file_rel = song['file']

		if skip_tagged:
			# Awful, I know. But the sticker_find() function did not do much.
			try:
				client.sticker_get('song', file_rel, 'image-nchunks')
				# Track has art, skip it.
				total_files_skipped += 1
				continue
			except:
				# Track has no art.
				pass
开发者ID:polyfloyd,项目名称:trollibox,代码行数:33,代码来源:mpd-artwork.py

示例4: MPDClient

# 需要导入模块: from mpd import MPDClient [as 别名]
# 或者: from mpd.MPDClient import listallinfo [as 别名]
from mpd import MPDClient
client = MPDClient()               # create client object
client.timeout = 10                # network timeout in seconds (floats allowed), default: None
client.idletimeout = None          # timeout for fetching the result of the idle command is handled seperately, default: None
client.connect("localhost", 6600)  # connect to localhost:6600
print(client.mpd_version)          # print the MPD version
print(client.listallinfo()) # print result of the command "find any house"
client.close()                     # send the close command
client.disconnect()     
开发者ID:danseagrave,项目名称:dans-xmas-lights,代码行数:11,代码来源:mpd-test.py

示例5: play

# 需要导入模块: from mpd import MPDClient [as 别名]
# 或者: from mpd.MPDClient import listallinfo [as 别名]
@route('/do/<command>/')
def play(command):
    status = request.mpd.status().get( 'state', '')
    if command == 'play':
        request.mpd.pause() if status == 'play' else request.mpd.play()
    elif command == 'next':
        request.mpd.next()
    elif command == 'prev':
        request.mpd.previous()
    elif command == 'stop':
        request.mpd.stop()
    return redirect('/')
    
@route('/static/<filename:path>')
def send_static(filename):
    return static_file(filename, root=os.path.join(BASE_DIR, 'static'))

if __name__ == '__main__':
    Song.initialize()
    c = MPDClient()
    c.connect("localhost", 6600)
    for s in c.listallinfo():
        try:
            song = Song(**s)
        except Exception as e:
            print(e, s)
        else:
            song.save() 
    
    run(host='localhost', port=8080, reloader=True, debug=True)
开发者ID:TallerTechnologies,项目名称:dishey,代码行数:32,代码来源:app.py


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