The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Web-based Xmms control program

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Vincent Foley

Posts: 512
Nickname: gnuvince
Registered: Apr, 2005

Vincent Foley is a hobbyist Rubyist.
Web-based Xmms control program Posted: Jul 15, 2005 10:30 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Vincent Foley.
Original Post: Web-based Xmms control program
Feed Title: Vincent Foley-Bourgon
Feed URL: http://www.livejournal.com/~gnuvince/data/rss
Feed Description: Vincent Foley-Bourgon - LiveJournal.com
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Vincent Foley
Latest Posts From Vincent Foley-Bourgon

Advertisement
I wrote a small program to control Xmms remotely. The program uses
Ruby and the web framework Wee. Here it is:

require "rubygems"
require "xmms"

class Main < Wee::Component

  def initialize
    super()
    # Put your own initialization code below...
    @xmms = Xmms::Remote.new
  end

  # --------------------------------------------
  # Rendering
  # --------------------------------------------

  def render
    song = @xmms.get_playlist_title
    songs = @xmms.playlist.map { |s| s.first }
    id = (songs.index(song)).to_s
    ids = (0...songs.size).collect { |i| i.to_s }

    r.h1("Xmms remote control")
    r.text(song)
    r.paragraph

    r.form do
      r.select_list(ids).multiple.labels(songs).selected(id.to_s).callback { |s|
        @xmms.playlist_pos = s[0].to_i
      }
      r.submit_button.value("Goto")

      r.paragraph

      [:prev, :pause, :stop, :play, :next].each { |sym|
        r.anchor.callback { @xmms.send(sym) }.with { r.text(sym.to_s.capitalize) }
        r.space
      }
    end
  end

end


That's the thing I like about Ruby, it's easy to build a little
something for your own usage.

Read: Web-based Xmms control program

Topic: Rails tip: Functional testing ajax calls Previous Topic   Next Topic Topic: Weird weight gains and losses

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use