All pastes #64030 Raw Edit

ves

public python v1 · immutable
#64030 ·published 2006-06-11 01:16 UTC
rendered paste body
import mpdclient2, timing, timesearch_list = list()# ?!?! http://www.faqs.org/docs/diveintopython/regression_filter.html# <mpdclient2.dictobj object at 0x405a50bc ..#  {#    album: Stray Blues - A Collection Of,#    title: Lemonade,#    track: 05,#    artist: Beck,#    pos: 537,#    file: Beck - Stray Blues/beck - 05 - lemonade.mp3,#    time: 144,#    type: file,#    id: 537#  }>def get(obj, type, data):	if hasattr(obj, type):		if getattr(obj, type) == data:			search_list.append(obj)timing.start()mpd = mpdclient2.connect();info = mpd.playlistinfo()for i in range (0, len(info)):	get(info[i], "artist", "Beck")#	get(info[i], "title", "Hotwax")#	get(info[i], "album", "Odelay")timing.finish()print "There are: %d items! (%d seconds)" % (len(search_list), timing.seconds())# There are: 272 items! (3 seconds)