All pastes #1378 Raw Edit

Anonymous

public ruby v1 · immutable
#1378 ·published 2004-10-11 13:21 UTC
rendered paste body
	def update(mpd)		@songs = []		@songs << Song.new(nil)		mpd.send_command("playlistinfo").each { |info|			#@list.append[0] = song[song.index(":")+1..-1]			if info[0..info.index(":")-1] == "file"				if @songs[-1].file != info[info.index(":")+2..-1]					@songs << Song.new(info[info.index(":")+2..-1])				end			end			if info[0..info.index(":")-1] == "Artist"				@songs[-1].artist = info[info.index(":")+2..-1]			end			if info[0..info.index(":")-1] == "Album"				@songs[-1].album = info[info.index(":")+2..-1]			end			if info[0..info.index(":")-1] == "Track"				@songs[-1].track = info[info.index(":")+2..-1]			end			if info[0..info.index(":")-1] == "Title"				@songs[-1].title = info[info.index(":")+2..-1]			end			if info[0..info.index(":")-1] == "Time"				@songs[-1].time = info[info.index(":")+2..-1]			end			if info[0..info.index(":")-1] == "Pos"				@songs[-1].pos = info[info.index(":")+2..-1]			end			if info[0..info.index(":")-1] == "Id"				@songs[-1].id = info[info.index(":")+2..-1]			end		}		@songs.each { |song|			iter = @list.append			#p(song.title)			iter[0] = song.title			iter[1] = song.artist			iter[2] = song.album		}	end