Project

mplayer.rb

0.0
No commit activity in last 3 years
No release in over 3 years
Just create a new MPlayer-object with something like mp=MPlayer.new. An mplayer-instance and a fifo-file, which controlls it will be created. Now you can run mplayer-commands simply by running their names as methods of this object or you can call the run-method. For forther description see http://github.com/chaosprinz/mplayer.rb
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies
 Project Readme

mplayer.rb

With this library its possible to controll the great mplayer with ruby. This is done by using its slave-protocol.

##Usage

Every command, mplayer responds to is avaiable as an instance-method. This is possible through rubys method_missing-magic.

A list of commands can be found at http://www.mplayerhq.hu/DOCS/tech/slave.txt

require 'mplayer'

#instanciate an object
player # MPlayer.new

#sending commands to mplayer are simple method-calls
#start a song
player.loadfile '/path/to/song.mp3'
#break playback
player.pause

How i told, we just use mplayer slave-protocol. The communication goes through a named pipe (fifo-file). The creation of this fifo and the startup of mplayer is handled when a MPlayer-Instance is created.

There is also some kind of logfile, which is nothing more than a file where all the stdout and stderr of the mplayer is piped in.

You can controll the path to the this files (the fifo and the logfile) by passing options when you instanciate the MPlayer-Object:

require 'mplayer'

#create an object using options
player # MPlayer.new fifo: "/tmp/mysuperfifo",logfile: "/home/me/mysuperlogfile"

##TODO

  • command-methods should return the correspondending mplayer-response
  • methods for commands that need args should always take args
  • modulize it
  • create some examples

##Contribute

  • Fork the project
  • Create a feature-branch
  • Make your additions and fixes
  • Add tests for it
  • Send a pull request
  • Dont be angry for waiting-time, i'll take a look and work on it, as soon as my time allows

##Copyright

This software is licensed with an MIT-License Copyright (c) 2014 Siegfried Dünkel. See LICENSE for more details.