sunny / so-nice Goto Github PK
View Code? Open in Web Editor NEWSmall Web interface to control iTunes, Spotify, Rdio, MPD, Rhythmbox, Amarok and XMMS2. ♫
Home Page: http://sunny.github.io/so-nice/
Small Web interface to control iTunes, Spotify, Rdio, MPD, Rhythmbox, Amarok and XMMS2. ♫
Home Page: http://sunny.github.io/so-nice/
~ ❯❯❯ 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
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:in
track'
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:in
call'
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:in
route_eval'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:96
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)
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.
where do I edit to get it working with a custom port mpd?
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
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
To launch it:
$ ./so_nice.rb
Change to:
To launch it:
$ ./sonice.rb
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 !
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
To prevent sending the X-Frame-Options header you need to disable frame_options like this:
set :protection, :except => :frame_options
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.
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.
Remove if !request.xhr? to get it working via curl, wget.
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.
Possibly add pianobar control, it has the ability to be controlled by fifo.
where can i set my mpd socket or port? also password required to connect to mpd?
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)?
Since a LastFM API change, all images now all return a blank image:
A new source of images would be nice to have as a background.
Other sources to consider:
It used to be the case with Last.fm's api before they closed it. An alternative could be using Echonest's API. See #13.
Message from the API: "The artist.getImages method has been deprecated".
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.