Coder Social home page Coder Social logo

websinger's Introduction

Websinger

This is a weekend project of mine from a while ago. As such, the code quality is not great; test coverage is minimal to none; and I didn't bother to do things like "write down dependencies so that other people could use it". In other words, caveat emptor and all that.

I do mean to come back to this and make it nicer in the future, especially if it's useful for people other than me. In the meantime, pull requests are more than welcome!

What is it?

Websinger turns that Linux server where you back up all of your music into a jukebox.

When I was first thinking about this, I found a number of applications online that let you play music from the server through your browser. However, my need was unique in that it was the server that had the speakers: I wanted to be able to index all of the backed-up media, search it nicely, and allow everyone in the house to collaboratively edit a single playlist of what would play over the speakers.

Installation

Websinger currently runs on my Ubuntu server. It might run on yours, too! I run with Ruby 1.9.2 provided by a system-wide rvm installation. If you don't, the Rakefile in particular will probably not work for you.

First, install these non-Ruby prerequisities:

sudo apt-get install apache2 mpg123 libmagic-dev

Clone the Github repository wherever you wish, and resolve the Ruby dependencies with Bundler:

sudo gem install bundler

mkdir -p /var/rails
cd /var/rails
git clone git://github.com/smashwilson/websinger.git
cd websinger
bundle install

Deploy the Rails app however you wish. I use Apache and Passenger.

Next, use the included Rake task to create the websinger user and register the player daemon with upstart:

# You probably want to read lib/tasks/install.rake first!
sudo rake install

Finally, you'll need to start the player daemon:

sudo start websinger-player

Now your server is running, but it has no music yet.

Adding Music

Websinger provides a Rake task for scanning a directory tree to add mp3 files to its database. I have a script that invokes it as follows:

#!/bin/bash

export RAILS_ENV=production
cd /var/rails/websinger
rake websinger:scan[/home/smash/music,true,/home/smash/import-errors.log] --trace

This will import all .mp3 files found under /home/smash/music, reporting verbose progress and logging error messages to import-errors.log. Currently, things that give the scan task trouble include blank IDv3 titles and non-UTF-8 characters within track paths.

websinger's People

Contributors

smashwilson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

websinger's Issues

Mobile support

Provide a mobile stylesheet so that we can drive it with our phones!

Actually register the websinger-player daemon to launch on boot

Firing off of the networking event doesn't work: I still need to manually launch the player daemon on every boot. It's annoying. Research upstart a little more and actually get the service to launch correctly. Improve the rake install task to match.

Library audit service

Create a task to audit the integrity and collect metrics on the current contents of the music library. Some interesting things to count:

  • Total number of tracks and total combined playtime.
  • Count (or list) tracks that are lacking each important ID3 field: title, artist, album, track number, and album art.
  • Incomplete albums, as identified by skips in track number.

Upgrade to Rails 4

There have been a bunch of Rails (and Ruby!) releases since the last time I touched this code, most recently Rails 4. Do the upgrade in concert with #14 so I get coverage as I flush out compatibility issues.

Implement separate player clients for test, dev, and production

The existing client.rb will become the production one, which communicates with a real websinger player process via ActiveRecord and the status.yaml file. For development, create a client that launches a background thread to simulate playing progress without actually creating sound, at a realtime rate (advance through the current track at one second per second). For testing, create a client that skips through tracks on demand, i.e. a finish_track method that simulates playing a track to completion.

Refactor player daemon

The player daemon is a confusing mash of odd loops and parts that do and don't use ActiveRecord. There seem to be some race issues left, too. Hit it with the refactoring hammer to make its operation more clear and more correct.

Improve import task

The music import task is not very intelligent: it always replaces an existing track with the same title and artist with a new track. Some possible improvements:

  • Include a checksum on the file contents as part of the uniqueness criteria.
  • Take into account the completeness of each track. Prefer tracks with more complete ID3 tags, considering the ones that contribute to organization and display most heavily.
  • Improve the handling of non-UTF-8 encoded paths, titles, and artists. Check against a list of possible encodings before giving up.

Empty search should return page_size random results

This would more easily support the use case of paging around through the library without a particular destination in mind, and it would keep the default music library view from being the least-filled out tracks.

Testing

I've been remiss in writing unit tests for this project, mainly due to not wanting to commit mp3s into a public git repository (for test fixtures). Track down a public-domain mp3 and get some half-decent test coverage.

Album art search should prefer folder or cover image

It's easier to control and fix album art issues when you can place the file manually, rather than embedding.

Also, I'd like to remove the dependency on libmagic so that I can actually develop on my Windows box; this would make it less important.

Rework the player controls

Functionality:

  • Add a "next" control to drop the current track and increment to the next.
  • Volume control.
  • Display the current track's album art.

Visual design:

  • Smaller, less blocky controls.
  • Less visual focus on the track's progress, more on the track's title, artist, and album art.

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.