All pastes #267379 Raw Edit

Miscellany

public text v1 · immutable
·published 2006-12-04 20:43 UTC
rendered paste body
alias xmms {
	set output [exec cat /tmp/xmms-info]
	set track_title [string range [lindex [split $output \n] 12] 7 end]
	set track_length [string range [lindex [split $output \n] 8] 6 end]
	set track_complete [string range [lindex [split $output \n] 6] 10 end]
	set file_name [lindex [split $output \n] 13]
	set album_name [lindex [split $file_name /] end-1]
	/say ":: Now Playing : $track_title ($track_complete/$track_length) (Album : $album_name) ::"
	complete
}

on !queue enqueue_track {
	splitsrc
	set xmms_status [string range [lindex [split [exec cat /tmp/xmms-info] \n] 2] 8 end]
	set check_exists [exec slocate -d musicdb "$_rest"]
	if { [string compare $check_exists $_rest] == 0 } {
		print "$_nick just enqueued $_rest"
		print "$xmms_status"
		if { $xmms_status == "Stopped" } {
			exec xmms -p "$_rest"
		} else {
			exec xmms -e "$_rest"
		}
	} else {
	/raw notice $_nick :$_rest does not exist in musicdb. Type !search <search terms> to search musicdb.
	}
	complete
}

on !search search_music {
	splitsrc
	if { [channel] == "#sob" } {
	if { ![regexp {[?*]} $_rest] } {
		if { [string length $_rest] >= 5 } {
        		set search_results [split [exec slocate -i -d musicdb "$_rest*.mp3"] \n]
			if { [string length $search_results] > 1 } {
				foreach result $search_results {
					/raw notice $_nick :$result
				}
				/raw notice $_nick :To queue a track copy the entire line for the track from the search result then type '!queue' (without the quotes) and paste the line you copied from the search result.
			} else {
				/raw notice $_nick :Song not found in database.
			}
			unset search_results
		} else {
			/raw notice $_nick :You must provide a search term at least 5 characters in length.
		}
	} else {
		/raw notice $_nick :Wildcards not permitted in search strings.
	}
	}
        complete
}

alias jukebox {
	/say ":: Welcome to Paladine's Jukebox ::"
	/say ":: Use !search <string> to search the database. ::"
	/say ":: Use !queue <filepath> to add a song to the playlist. ::"
	/say ":: Tune in on http://radio.paladine.org.uk:10000/ ::"
}