Coder Social home page Coder Social logo

sunny / anyplayer Goto Github PK

View Code? Open in Web Editor NEW
50.0 5.0 12.0 91 KB

Interact with the currently running music player. Supports iTunes Mac, iTunes Windows, Spotify Mac, Rdio Mac, MPD, Rhythmbox, Amarok and XMMS2.

License: MIT License

Ruby 100.00%
music-console xmms2 amarok rhythmbox mpd music-player music ruby spotify-mac itunes-windows

anyplayer's Introduction

Anyplayer

Gem Version Build Status

Interacts with the currently running music player. Supports iTunes Mac, iTunes Windows, Spotify Mac, Rdio Mac, MPD, Rhythmbox, Amarok and XMMS2.

Install

$ gem install anyplayer

Use it in your terminal

$ anyplayer artist     # artist of the current track
New Order
$ anyplayer track      # name of the current track
Blue Monday
$ anyplayer album
Power, Corruption & Lies
$ anyplayer next       # changes track forward
$ anyplayer prev       #               backward
$ anyplayer playpause  # pauses if it is playing, plays if it's paused
$ anyplayer play
$ anyplayer pause
$ anyplayer voldown    # put the volume somewhat up
$ anyplayer volup      #                         down
$ anyplayer volume     # prints the volume percentage
100
$ anyplayer vote       # votes to go to next song (default number of votes is 5)
$ anyplayer name
iTunes
$ anyplayer launched && echo "a player is running" || echo "nothing running"
a player is running

Or in Ruby

In your Gemfile:

# Interact with the current music player
gem "anyplayer"

In your code:

require "anyplayer"
player = Anyplayer::Selector.new.player

player.launched? # => true
player.name # => Rythmbox
player.artist # => "The Avalanches"
player.track # => "Frontier Psychiatrist"
# …

Or in a browser

With the So Nice Web interface:

So Nice Screenshot

Contribute!

All contributions are welcome! Head to the Github issues to report bugs, questions or code. Also, check out CONTRIBUTING.md.

Here a few useful commands while developping:

$ ruby -Ilib bin/anyplayer  # Use the anyplayer command-line from source
$ bin/rake test             # Launch tests
$ bin/rake install          # Install from source
$ bin/rake console          # Launch console

License

MIT

anyplayer's People

Contributors

dependabot-preview[bot] avatar earthrid avatar gdiggs avatar irosenb avatar nkoehring avatar sunny avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

anyplayer's Issues

System could not find the specified path when starting out

I did the 'gem install anyplayer'

But I tried to play around with it, I keeps throwing the errors when I did the following at the Ruby console.

irb(main):006:0>require 'anyplayer'
=>true
irb(main):007:0> players = Anyplayer::Selector.new.player
The system cannot find the path specified
The system cannot find the path specified
=>"#<Anyplayer::Amarok:0x2f2fe00 @votes=0>"

Then I ran this on the terminal using the following
C:\Users\Andy Wong>anyplayer -v
anyplayer v1.1.3
Loaded rhythmbox
Rhythmbox launched?
The system cannot find the path specified.
Loaded mpd
Mpd launched?
Loaded xmms2
Xmms2 launched?
The system cannot find the path specified.
Loaded amarok
Amarok launched?
Usage: anyplayer [-v] [command]

Where command is one of: playpause, play, pause, next, prev, voldown, volup,
volume, track, artist, album, vote, name, launched.

Player connected: Amarok.

But when I digged your code further under anyplayer/players folder, I see that itunes_window is one of the valid array values that i should be using since I'm using Itunes on Windows.

Why did it miss it?

I'm running on Windows 64-bit - just FYI.

Thanks,

You should state that linux is barely supported.

The README should clearly mention that fact that half the sources you list aren't supported on LInux. This will help the next person not waste time reading to source to work why nothing works.

Only says player connected "Amarok" (I don't have amarok installed, but spotify and itunes are running)

~ ➤ gem install anyplayer
Fetching: ruby-mpd-0.3.2.gem (100%)
Successfully installed ruby-mpd-0.3.2
Fetching: anyplayer-1.1.4.gem (100%)
Successfully installed anyplayer-1.1.4
2 gems installed
~ ➤ anyplayer
sh: line 1: 23309 Trace/BPT trap: 5 qdbus org.kde.amarok 2>&1
Usage: anyplayer [-v] [command]

Where command is one of: playpause, play, pause, next, prev, voldown, volup, volume, track, artist, album, vote, name, launched, paused, playing.

Player connected: Amarok.
~ ➤ anyplayer
sh: line 1: 23323 Trace/BPT trap: 5 qdbus org.kde.amarok 2>&1
Usage: anyplayer [-v] [command]

Where command is one of: playpause, play, pause, next, prev, voldown, volup, volume, track, artist, album, vote, name, launched, paused, playing.

Player connected: Amarok.
~ ➤ anyplayer pause
sh: line 1: 23330 Trace/BPT trap: 5 qdbus org.kde.amarok 2>&1
dyld: Library not loaded: QtCore.framework/Versions/4/QtCore
Referenced from: /usr/bin/qdbus
Reason: image not found

~ ➤ anyplayer launched
sh: line 1: 23381 Trace/BPT trap: 5 qdbus org.kde.amarok 2>&1
sh: line 1: 23384 Trace/BPT trap: 5 qdbus org.kde.amarok 2>&1
~ ➤ ruby -v
ruby 2.0.0p195 (2013-05-14 revision 40734) [x86_64-darwin12.2.0]
~ ➤

Do I need to install a different version of Qt or something? Seems strange...

xmms2 detection fails (timeout)

pi@raspberrypi ~ $ xmms2 current
Playing: FIP - : 212:21 of 00:00


pi@raspberrypi ~ $ anyplayer -v
anyplayer v1.1.2
Loaded rhythmbox
Rhythmbox launched?
Loaded mpd
Mpd launched?
Loaded xmms2
Xmms2 launched?
Timed out after 5 seconds
Loaded amarok
Amarok launched?
Usage: anyplayer [-v] [command]

Where command is one of: playpause, play, pause, next, prev, voldown, volup,
volume, track, artist, album, vote, name, launched.

Player connected: Amarok.
pi@raspberrypi ~ $ 

problems on Mac OS X

Hey, I wanted to check out So Nice and got this error, installed from rubygems. I looked at your source and it seems like this is fixed in newer commits on Anyplayer. So when fetching Anyplayer git master branch So Nice works great!

$ anyplayer
=>
/Users/jon/.rvm/gems/ruby-1.9.3-p327/gems/anyplayer-0.0.2/lib/anyplayer/players/itunes.rb:2:in require': cannot load such file -- appscript (LoadError) from /Users/jon/.rvm/gems/ruby-1.9.3-p327/gems/anyplayer-0.0.2/lib/anyplayer/players/itunes.rb:2:in<top (required)>'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.