Commit 1f749a6f authored by Mike Sheldon's avatar Mike Sheldon

Add mix radio station

parent 158c5b3a
......@@ -47,6 +47,10 @@ function radio_title_from_url($url) {
$user = $regs[2];
return 'Libre.fm ' . ucwords($user) . '\'s Recommended Radio';
}
if(ereg('l(ast|ibre)fm://user/(.*)/mix', $url, $regs)) {
$user = $regs[2];
return 'Libre.fm ' . ucwords($user) . '\'s Mix Radio';
}
if(ereg('l(ast|ibre)fm://community/loved', $url, $regs)) {
return 'Libre.fm Community\'s Loved Radio';
}
......@@ -84,13 +88,18 @@ function make_playlist($session, $old_format=false) {
} elseif(ereg('l(ast|ibre)fm://artist/(.*)', $url, $regs)) {
$artist = $regs[2];
$res = $adodb->Execute('SELECT name, artist_name, album_name, duration, streamurl FROM Track WHERE streamable=1 AND lower(artist_name) = ' . $adodb->qstr(mb_strtolower($artist, 'UTF-8')));
} elseif(ereg('l(ast|ibre)fm://user/(.*)/(loved|library)', $url, $regs)) {
} elseif(ereg('l(ast|ibre)fm://user/(.*)/(loved|library|mix)', $url, $regs)) {
$requser = new User($regs[2]);
$res = $adodb->Execute('SELECT Track.name, Track.artist_name, Track.album_name, Track.duration, Track.streamurl FROM Track INNER JOIN Loved_Tracks ON Track.artist_name=Loved_Tracks.artist AND Track.name=Loved_Tracks.track WHERE Loved_Tracks.userid=' . $requser->uniqueid . ' AND Track.streamable=1');
} elseif(ereg('l(ast|ibre)fm://user/(.*)/recommended', $url, $regs)) {
} elseif(ereg('l(ast|ibre)fm://user/(.*)/recommended', $url, $regs) || ereg('l(ast|ibre)fm://user/(.*)/mix', $url, $regs)) {
$requser = new User($regs[2]);
$recommendedArtists = $requser->getRecommended(8, true);
$res = get_artist_selection($recommendedArtists);
if($res) {
// If we already have some results then we're adding these to the loved tracks for mix radio
$res += get_artist_selection($recommendedArtists);
} else {
$res = get_artist_selection($recommendedArtists);
}
} elseif(ereg('l(ast|ibre)fm://community/loved', $url, $regs)) {
$res = $adodb->Execute('SELECT Track.name, Track.artist_name, Track.album_name, Track.duration, Track.streamurl FROM Track INNER JOIN Loved_Tracks ON Track.artist_name=Loved_Tracks.artist AND Track.name=Loved_Tracks.track WHERE Track.streamable=1');
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment