#!/usr/bin/env ruby ######################################################################## # get_playlist.rb - create an XML playlist from the XMMS playlist # # by Paul Duncan # ######################################################################## # load XMMS bindings require 'xmms' # create a new Xmms::Remote object r = Xmms::Remote.new # add String#xml_escape! (used below to escape values) class String def xml_escape! gsub '&', '&' gsub '<', '<' gsub '>', '>' end end # start the XML output puts '', '' # step through each element in the playlist and print it's information # in XML form r.playlist do |title, file, time| puts ' ', " #{title.xml_escape!}", " #{file.xml_escape!}", " #{time}", ' ', end # close the XML output puts ''