Giter VIP home page Giter VIP logo

so-nice's Introduction

So Nice ♫

Gem Version

“Everynight with my star friends, we eat caviar and drink champage”

A small Web interface to play, pause, change volume or skip the currently playing song in iTunes Mac, iTunes Windows, Spotify Mac, MPD, Rhythmbox, Amarok and XMMS2.

Screenshot

Install

Make sure you have Ruby > 1.9 and Rubygems installed. You can then type in a terminal:

$ gem install sonice

Launch it with:

$ sonice

Then visit http://localhost:3000

Configuration

You can launch sonice with these environment options:

  • SONICE_CONTROLS=0 to disable on-screen controls
  • SONICE_VOTING=0 to disable voting
  • SONICE_PORT=12345 to change port (default 3000)

Example:

$ SONICE_CONTROLS=0 SONICE_VOTING=0 sonice

If you don't want to type them all the time, add them to your .bashrc:

export SONICE_CONTROLS=0
export SONICE_VOTING=0

Players

Supports iTunes Mac, iTunes Windows, Spotify Mac, Rdio Mac, MPD, Rhythmbox, Amarok and XMMS2 thanks to anyplayer.

Development Setup

With bundler (gem install bundler) and git, get the code and get started:

$ git clone https://github.com/sunny/so-nice
$ cd so-nice
$ bundle install

Launch the binary with:

$ ruby -Ilib bin/sonice

Contribute

Feel free to help with the development by submitting issues and pull requests on github.

Licenced under the WTFPL, made by these awesome contributors.

so-nice's People

Contributors

caarlos0 avatar datagutt avatar dependabot-preview[bot] avatar dependabot[bot] avatar dmcneary avatar dpick avatar fixermark avatar gdiggs avatar nbc avatar sausyn avatar sunny avatar themimicodes avatar timjb avatar zenlor 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  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  avatar  avatar  avatar

so-nice's Issues

Cover art not showing up

Just pulled and everything is working but I am not seeing any album cover art. Is this only supposed to be coming from wikimedia/musicbrainz/lastfm or can I use my own cover art as embedded as metadata in my songs (or a JPEG in the album folder)?

Internal server error

Running iTunes 12.0.1.26
Windows 7
Ruby 1.9.3 with dev kit

installed sonice, and the first time it ran I got the webpage and controls, and some names of some songs came up and then it stopped working. Not sure if it ever managed to control iTunes at all.

On future attempts to get it to work I get the internal server error and nothing comes up.
Here is the output from the cmd line.

C:\Ruby193\devkit>sonice
== Sinatra/1.4.5 has taken the stage on 3000 for production with backup from Thi
n
Thin web server (v1.6.3 codename Protein Powder)
Maximum connections set to 1024
Listening on 0.0.0.0:3000, CTRL+C to stop
Looking for a player...
Connected to iTunes Windows
NoMethodError - undefined method name' for nil:NilClass: C:/Ruby193/lib/ruby/gems/1.9.1/gems/anyplayer-1.1.4/lib/anyplayer/player s/itunes_windows.rb:43:intrack'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sonice-2.1.2/lib/sonice/app.rb:44:in
block in <class:App>' C:/Ruby193/lib/ruby/gems/1.9.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:16 03:incall'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:16
03:in block in compile!' C:/Ruby193/lib/ruby/gems/1.9.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:96 6:in[]'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:96
6:in block (3 levels) in route!' C:/Ruby193/lib/ruby/gems/1.9.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:98 5:inroute_eval'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:96

Bad background layout on both desktop and mobile

A picture speaks louder than a thousand words, so here's two.

Mobile (Android 4.4.2, Google Chrome Stable)
Android

Desktop (Safari, Mac OS 10.10)
OSX

Also, I had to change the "play" glyph to ▶ because Google Chrome on Android would render the former glyph to a barred box.

WIN32OLERuntimeError - failed to create WIN32OLE object from 'iTunes.Application'

Hi guys,

Now that we resolved the anyplayer issue with Itunes Windows not connected with anyplayer, I started to resume trying out sonice.

When I ran sonice at the command prompt (under Windows obviously :) ). I encountered the following error logs written on screen. (see attached)
sonice-errors

Hope you can see the error message..

Basically it says it failed to instantiate WIN32OLE object from my Itunes.

But the odd thing about it is that I can still somewhat able to interact with my running Windows itunes using Sonice web interface ie can play/pause, move next/prev track.etc. Only the response is very slow for itunes to accept the web interface controls commands.

Hope this makes sense.

Let me know if you need further info from me.

dev setup misses anyplayer (ruby 1.8.7) ?

pi@raspberrypi ~ $ cd so-nice/
pi@raspberrypi ~/so-nice $ bundle install
Fetching gem metadata from http://rubygems.org/..........
Fetching gem metadata from http://rubygems.org/..
Resolving dependencies......
Using ruby-mpd (0.3.0) 
Using anyplayer (1.1.2) 
Using daemons (1.1.9) 
Using eventmachine (1.0.3) 
Using tilt (1.4.1) 
Installing haml (4.0.3) 
Using rack (1.5.2) 
Installing rack-protection (1.5.0) 
Installing sinatra (1.4.3) 
Installing thin (1.5.1) 
Using xml-simple (1.1.2) 
Using sonice (2.1.0) from source at . 
Using bundler (1.3.5) 
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
Post-install message from haml:

HEADS UP! Haml 4.0 has many improvements, but also has changes that may break
your application:

* Support for Ruby 1.8.6 dropped
* Support for Rails 2 dropped
* Sass filter now always outputs <style> tags
* Data attributes are now hyphenated, not underscored
* html2haml utility moved to the html2haml gem
* Textile and Maruku filters moved to the haml-contrib gem

For more info see:

http://rubydoc.info/github/haml/haml/file/CHANGELOG.md

pi@raspberrypi ~/so-nice $ ruby -v
ruby 1.8.7 (2012-02-08 patchlevel 358) [arm-linux-eabihf]
pi@raspberrypi ~/so-nice $ uname -a
Linux raspberrypi 3.6.11+ #538 PREEMPT Fri Aug 30 20:42:08 BST 2013 armv6l GNU/Linux
pi@raspberrypi ~/so-nice $ ruby -Ilib bin/sonice
./lib/sonice.rb:5:in `require': no such file to load -- anyplayer (LoadError)
    from ./lib/sonice.rb:5
    from ./lib/sonice/command_line.rb:1:in `require'
    from ./lib/sonice/command_line.rb:1
    from bin/sonice:2:in `require'
    from bin/sonice:2


pi@raspberrypi ~/so-nice $ git status
# On branch master
nothing to commit (working directory clean)

pi@raspberrypi ~/so-nice $ git log -1
commit 5e5cf6a1ed8abdd1a83f13636ad64c29147cb775
Author: Sunny Ripert <[email protected]>
Date:   Wed Dec 18 13:51:36 2013 +0100

    Gem badge

Display filename if no tags

I have many untagged flac files in my collection, and I would be so nice if I could display the filename, with some random background images (like chromecast or bing images).
Thank you for this well done project.

osascript errors

I assume this is just my environment, but between every event in my logs such as 127.0.0.1 - - [14/May/2012 22:04:19] "GET / HTTP/1.1" 200 67 0.2317 I also get a bunch of errors that look like this:

2012-05-14 22:04:19.212 osascript[18082:f07] Error loading /Library/ScriptingAdditions/24U Appearance OSAX.osax/Contents/MacOS/24U Appearance OSAX:  dlopen(/Library/ScriptingAdditions/24U Appearance OSAX.osax/Contents/MacOS/24U Appearance OSAX, 262): no suitable image found.  Did find:
/Library/ScriptingAdditions/24U Appearance OSAX.osax/Contents/MacOS/24U Appearance OSAX: mach-o, but wrong architecture
osascript: OpenScripting.framework - scripting addition "/Library/ScriptingAdditions/24U Appearance OSAX.osax" declares no loadable handlers.
2012-05-14 22:04:19.290 osascript[18083:f07] Error loading /Library/ScriptingAdditions/24U Appearance OSAX.osax/Contents/MacOS/24U Appearance OSAX:  dlopen(/Library/ScriptingAdditions/24U Appearance OSAX.osax/Contents/MacOS/24U Appearance OSAX, 262): no suitable image found.  Did find:
/Library/ScriptingAdditions/24U Appearance OSAX.osax/Contents/MacOS/24U Appearance OSAX: mach-o, but wrong architecture
osascript: OpenScripting.framework - scripting addition "/Library/ScriptingAdditions/24U Appearance OSAX.osax" declares no loadable handlers.
2012-05-14 22:04:19.366 osascript[18084:f07] Error loading /Library/ScriptingAdditions/24U Appearance OSAX.osax/Contents/MacOS/24U Appearance OSAX:  dlopen(/Library/ScriptingAdditions/24U Appearance OSAX.osax/Contents/MacOS/24U Appearance OSAX, 262): no suitable image found.  Did find:
/Library/ScriptingAdditions/24U Appearance OSAX.osax/Contents/MacOS/24U Appearance OSAX: mach-o, but wrong architecture
osascript: OpenScripting.framework - scripting addition "/Library/ScriptingAdditions/24U Appearance OSAX.osax" declares no loadable handlers.

This isn't the end of the world as everything functions as expected, but it certainly fills up the console fast.

sonice's executable "rake" conflicts with anyplayer

I get this message when installing on Ubuntu 20.10, Ruby 2.7

$ sudo gem install sonice
Fetching tilt-2.0.10.gem
Fetching ruby-mpd-0.3.3.gem
Fetching anyplayer-1.2.0.gem
Fetching rack-2.2.3.gem
Fetching sinatra-2.1.0.gem
Fetching rack-protection-2.1.0.gem
Fetching ruby2_keywords-0.0.2.gem
Fetching mustermann-1.1.1.gem
Fetching sonice-2.2.0.gem
Fetching xml-simple-1.1.7.gem
Successfully installed ruby-mpd-0.3.3
Successfully installed anyplayer-1.2.0
Successfully installed rack-2.2.3
Successfully installed tilt-2.0.10
Successfully installed rack-protection-2.1.0
Successfully installed ruby2_keywords-0.0.2
Successfully installed mustermann-1.1.1
Successfully installed sinatra-2.1.0
Successfully installed xml-simple-1.1.7
sonice's executable "rake" conflicts with anyplayer
Overwrite the executable? [yN]  

I chose "yes",
and then the installation is stalled :

Overwrite the executable? [yN]  y
Successfully installed sonice-2.2.0
Parsing documentation for ruby-mpd-0.3.3
Installing ri documentation for ruby-mpd-0.3.3
Parsing documentation for anyplayer-1.2.0
Installing ri documentation for anyplayer-1.2.0
Parsing documentation for rack-2.2.3
Installing ri documentation for rack-2.2.3
Parsing documentation for tilt-2.0.10
Installing ri documentation for tilt-2.0.10
Parsing documentation for rack-protection-2.1.0
Installing ri documentation for rack-protection-2.1.0
Parsing documentation for ruby2_keywords-0.0.2
Installing ri documentation for ruby2_keywords-0.0.2
Parsing documentation for mustermann-1.1.1
Installing ri documentation for mustermann-1.1.1
Parsing documentation for sinatra-2.1.0
Installing ri documentation for sinatra-2.1.0

Nevermind, I relaunched sudo gem install sonice and installation ends without error the 2nd time.
I still don't know if I should have allowed "rake" overwriting "anyplayer".

It works amazingly well, even if I don't understand the "voting system", and the artist picture is missing. Hope this fix ( #49 ) will be merged soon !

Would like to submit simple feature request? (Stop button)

for eg. I would like to add a stop button on the interface since I notice there isn't any.

Do you mind if I make the changes on my local dev machine, commit and push it for you to review it?

Let me know if that works for you. Cause this is my first time I actually want to actively participate in open-source projects.

Thanks.

Updating playing? variable

This isn't so much of an actual issue as something I'm trying to do. You probably remember me from committing to the anyplayer gem. Now I'm trying to incorporate that playing? boolean into so-nice, but I'm noticing that when I pause the music, my assigned variable @playing does not recognize that. How can I update the variable each time, just as the song info updates every time the song changes?

get '/' do
  @title = $player.track
  @artist = $player.artist
  @album = $player.album
  if $player.name == "iTunes" or $player.name == "Spotify Mac"
    @playing = $player.playing? # How can this be updated each time I pause/play the music? 
  end

missing dependency to json ? (using ruby 1.8.7)

pi@raspberrypi ~ $ gem install sonice
....
pi@raspberrypi ~ $ SONICE_VOTING=0 sonice
/var/lib/gems/1.8/gems/haml-4.0.4/lib/haml/parser.rb:86: warning: regexp has invalid interval
/usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require': no such file to load -- json (LoadError)
...

pi@raspberrypi ~/so-nice $ ruby -v
ruby 1.8.7 (2012-02-08 patchlevel 358) [arm-linux-eabihf]
pi@raspberrypi ~/so-nice $ uname -a
Linux raspberrypi 3.6.11+ #538 PREEMPT Fri Aug 30 20:42:08 BST 2013 armv6l GNU/Linux

Internal Server Error

~ ❯❯❯ sonice
== Sinatra/1.4.5 has taken the stage on 3000 for production with backup from Thin
Thin web server (v1.6.3 codename Protein Powder)
Maximum connections set to 1024
Listening on 0.0.0.0:3000, CTRL+C to stop
Looking for a player...
Connected to Spotify Mac
NoMethodError - undefined method `fetch' for nil:NilClass:
    /Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:832:in `compile_template'
    /Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:813:in `render'
    /Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:675:in `haml'
    /Library/Ruby/Gems/2.0.0/gems/sonice-2.1.1/lib/sonice/app.rb:50:in `block in <class:App>'
    /Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1603:in `call'
    /Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1603:in `block in compile!'
    /Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:966:in `[]'
    /Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:966:in `block (3 levels) in route!'
    /Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:985:in `route_eval'
    /Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:966:in `block (2 levels) in route!'
    /Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1006:in `block in process_route'
    /Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1004:in `catch'
    /Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1004:in `process_route'
    /Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:964:in `block in route!'
    /Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:963:in `each'
    /Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:963:in `route!'
    /Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1076:in `block in dispatch!'
    /Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `block in invoke'
    /Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `catch'
    /Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `invoke'
    /Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1073:in `dispatch!'
    /Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:898:in `block in call!'
    /Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `block in invoke'
    /Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `catch'
    /Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1058:in `invoke'
    /Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:898:in `call!'
    /Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:886:in `call'
    /Library/Ruby/Gems/2.0.0/gems/rack-protection-1.5.3/lib/rack/protection/xss_header.rb:18:in `call'
    /Library/Ruby/Gems/2.0.0/gems/rack-protection-1.5.3/lib/rack/protection/path_traversal.rb:16:in `call'
    /Library/Ruby/Gems/2.0.0/gems/rack-protection-1.5.3/lib/rack/protection/json_csrf.rb:18:in `call'
    /Library/Ruby/Gems/2.0.0/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
    /Library/Ruby/Gems/2.0.0/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
    /Library/Ruby/Gems/2.0.0/gems/rack-1.5.2/lib/rack/logger.rb:15:in `call'
    /Library/Ruby/Gems/2.0.0/gems/rack-1.5.2/lib/rack/commonlogger.rb:33:in `call'
    /Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:217:in `call'
    /Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:210:in `call'
    /Library/Ruby/Gems/2.0.0/gems/rack-1.5.2/lib/rack/head.rb:11:in `call'
    /Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:180:in `call'
    /Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:2014:in `call'
    /Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1478:in `block in call'
    /Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1788:in `synchronize'
    /Library/Ruby/Gems/2.0.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:1478:in `call'
    /Library/Ruby/Gems/2.0.0/gems/thin-1.6.3/lib/thin/connection.rb:86:in `block in pre_process'
    /Library/Ruby/Gems/2.0.0/gems/thin-1.6.3/lib/thin/connection.rb:84:in `catch'
    /Library/Ruby/Gems/2.0.0/gems/thin-1.6.3/lib/thin/connection.rb:84:in `pre_process'
    /Library/Ruby/Gems/2.0.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:1037:in `call'
    /Library/Ruby/Gems/2.0.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:1037:in `block in spawn_threadpool'
127.0.0.1 - - [02/Nov/2014 17:44:14] "GET / HTTP/1.1" 500 30 0.2419

Allow so-nice in iframe

To prevent sending the X-Frame-Options header you need to disable frame_options like this:

set :protection, :except => :frame_options

New favicon

On dark screens especially, the favicon is kinda messy.

image

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.