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 is a music sharing service allowing you to easily share tracks and albums regardless of any music platforms.
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.
Three main actions are done server-side :
- Reverse searching the query, when the user searches for a permalink (see below : supported permalinks)
- Querying music APIs and platforms for results
- Sharing a specific result
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"
}
}
}
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
}
]
}
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.
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 is done client-side, in two steps :
cleaning
Cleaning the title, artist, name of a track or albumhashing
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.
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
The following permalinks are supported when searching on tuneefy :
- Deezer song link : http://www.deezer.com/listen-10236179
- Deezer artist link : http://www.deezer.com/fr/music/radiohead
- Deezer album link : http://www.deezer.com/fr/music/rjd2/deadringer-144183
- Spotify song link : http://open.spotify.com/track/5jhJur5n4fasblLSCOcrTp or spotify:track:5jhJur5n4fasblLSCOcrTp
- Spotify artist link : http://open.spotify.com/artist/6UUrUCIZtQeOf8tC0WuzRy or spotify:artist:6UUrUCIZtQeOf8tC0WuzRy
- Spotify album link : http://open.spotify.com/album/2bRcCP8NYDgO7gtRbkcqdk or spotify:album:2bRcCP8NYDgO7gtRbkcqdk
- Last.fm song link : http://www.last.fm/music/The+Clash/London+Calling/London+Calling
- Last.fm album link : http://www.last.fm/music/The+Clash/London+Calling
- Last.fm artist link : http://www.lastfm.fr/music/Sex+Pistols
- Grooveshark verbose song link : http://grooveshark.com/s/Sweet+Sweet+Heartkiller/2GVBvD?src=5
- Grooveshark album link : http://grooveshark.com/album/Impeccable+Blahs/1529354
- Grooveshark artist link : http://grooveshark.com/artist/Say+Hi+To+Your+Mom/401373
- Soundcloud simple song link : http://soundcloud.com/fuckmylife/radiohead-codex-deadmau5-cover
- Hypemachine track link : http://hypem.com/item/1g079/
- Youtube music link : http://www.youtube.com/watch?v=_FOyHhU0i7k
- Rdio link : http://www.rdio.com/#/artist/Crash_Test_Dummies
- Qobuz track link : http://player.qobuz.com/#!/track/5280111
- Xbox track link : http://music.xbox.com/Track/7D4AB500-0100-11DB-89CA-0019B92A3933
- Xbox album link : http://music.xbox.com/Album/C954F807-0100-11DB-89CA-0019B92A3933
- Beats Music track link : http://on.beatsmusic.com/albums/al8992411/tracks/tr8992441
- Beats Music album link : http://on.beatsmusic.com/albums/al6960443
- Beats Music artist link : http://on.beatsmusic.com/artists/ar27304
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)
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
- http://www.extremr.com/
- http://livingdancing.tumblr.com/
- http://next.liberation.fr
- http://lebidule.org/
- LaRockArmy (https://www.youtube.com/channel/UCgxUpKe_69MqeCgLHGm5V2Q)
- http://elx-art.com/wp-content/uploads/2014/05/Spotify-Innovation.pdf
Do not hesitate to drop me a line at tchap(@)tuneefy.com, or to fork this repo and make pull requests.