All Projects → tchapi → Tuneefy

tchapi / Tuneefy

Licence: other
[DEPRECATED] tuneefy is a unified way to share music with your friends, over various online music services

Hello stranger ! A new version of tuneefy is now live and developed at github.com/tchapi/tuneefy2 if you want to contribute ...

If you wanna dive into the legacy source code, please read this wiki page first ...



tuneefy

tuneefy is a music sharing service allowing you to easily share tracks and albums regardless of any music platforms.

http://tuneefy.com


In a nutshell, tuneefy is a server-side proxy that will aggregate results from different music APIs, and display the consolidated result as a tracks list or albums list. Each item can then be shared.

Server-side

Three main actions are done server-side :

  1. Reverse searching the query, when the user searches for a permalink (see below : supported permalinks)
  2. Querying music APIs and platforms for results
  3. Sharing a specific result

Reverse search

The proxy performs a reverse-search on the query to retrieve the real title, artist and name behind a permalink

Example for the query "http://open.spotify.com/track/5jhJur5n4fasblLSCOcrTp" :

    {
        data: {
            lookedUpPlatform: 1,
            query: "Kasabian+Test+Transmission",
            lookedUpItem: {
                name: "Test Transmission",
                artist: "Kasabian",
                album: "Kasabian",
                picture: null,
                link: "http://open.spotify.com/track/5jhJur5n4fasblLSCOcrTp"
            }
        }
    }

Fecthing data

The server-side proxy retrieves tracks and albums listing from the different APIs and returns them in a common format.

Example (returning data when proxying results from Deezer for the search "Jackson") :

    {
        data: [
            {
                title: "Billie Jean",
                artist: "Michael Jackson",
                album: "HIStory - PAST, PRESENT AND FUTURE - Book I",
                picture: "http://api.deezer.com/2.0/album/71623/image",
                link: "http://www.deezer.com/track/540980",
                score: 1
            },
            {
                title: "Beat It",
                artist: "Michael Jackson",
                album: "HIStory - PAST, PRESENT AND FUTURE - Book I",
                picture: "http://api.deezer.com/2.0/album/71623/image",
                link: "http://www.deezer.com/track/541002",
                score: 0.910
            },
           
              ...

            {
                title: "Beat It",
                artist: "Michael Jackson",
                album: "Bad 25th Anniversary (Deluxe)",
                picture: "http://api.deezer.com/2.0/album/5814021/image",
                link: "http://www.deezer.com/track/59510131",
                score: 0.0899
            }
        ]
    }

Sharing

The server creates a permanent share link (e.g. http://tuneefy.com/t/8r2h9 or http://tuneefy.com/a/3zlp9) upon request by the client.

Client-side

The main thing happening client-side is the aggregation of the proxied results to get a comprehensive list of results for the user.

The client calls the proxy for each platform the user wants to search on. This allows for :

  • No cross-platform restriction on the APIs (all is done server-side)
  • Results are being updated real-time when each call returns (no need to way until all calls are finished)
  • Effective Caching

Unfortunately, as a side-effect, rate-limited APIs limit the number of calls the proxy can make.

Aggregation method

Aggregation is done client-side, in two steps :

  1. cleaning Cleaning the title, artist, name of a track or album
  2. hashing Creating a hash of these info for comparison

Cleaning includes trimming of course, and finding common patterns in the strings, such as :

  • (album version)
  • (featuring ...)
  • etc ...

The following javascript regexp are used to find these patterns:

    var regex_feat_p = /^(.*)(\(|\[)(\s*)(feat\s|feat\.|featuring\s|ft.|ft\s)([^\)^\]]*)(\)|\])(.*)$/gi;
    var regex_album_version = /^(.*)(\(|\[)(\s*)(album\sversion|version\salbum)([^\)^\]]*)(\)|\])(.*)$/gi;

The hash is currently a concatenation of the lowercased cleaned title, artist and name when available. All accented / non alphanumeric characters are replaced by their equivalent.

A word on patterns

To cut a long story short, I used :

  • A facade patterns, with templates, to display the different pages
  • A proxy pattern for the data handling from the different platforms
  • An event pooling pattern in a (light) MVC pattern to display the results and aggregate them for the user

Supported Permalinks

The following permalinks are supported when searching on tuneefy :

tuneefy bookmarklet

The tuneefy bookmarklet is a quick and convenient way to share tuneefy links directly from the page you're listening music in.

The standard production bookmarklet code is :

    javascript:(function(){tuneefy_bkmrklt=document.createElement('SCRIPT');tuneefy_bkmrklt.type='text/javascript';
    tuneefy_bkmrklt.src='http://tuneefy.com/widget/share.js.php?x='+(Math.random());
    document.getElementsByTagName('head')[0].appendChild(tuneefy_bkmrklt);})();

The bookmarklet recognizes what you're listening to on the following platforms / websites :

  • Deezer
  • Jiwa
  • Grooveshark
  • Radionomy
  • Stereomood
  • Musicmaze
  • Qobuz Player
  • Xbox Music
  • Rdio
  • Youtube (only for tracks available on iTunes via Youtube)
  • Myspace (music player and artist page - first track only)
  • Spotify (in a web browser only)

License

I give access to the tuneefy code under the Creative Commons Attribution-NonCommercial 3.0 Unported License (http://creativecommons.org/licenses/by-nc/3.0/legalcode).

In a nutshell, you are free to modify and distribute the code, as long as you don't make a commercial use of it, or sublicense it. You must include the following copyright notice and you cannot hold me liable if your server explodes while running this code (ahah).

Copyright (c) (CC BY-NC) 2012-2013 Cyril Chapellier

Sites that use tuneefy

Contact me

Do not hesitate to drop me a line at tchap(@)tuneefy.com, or to fork this repo and make pull requests.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].