We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit de4766bc authored by elleo's avatar elleo

Add support for recommended radio for remote users

parent 66784d1b
......@@ -22,6 +22,7 @@ require_once('../database.php');
require_once('../templating.php');
require_once('../data/Track.php');
require_once('../data/Server.php');
require_once('../data/RemoteUser.php');
require_once('../utils/resolve-external.php');
function radio_title_from_url($url) {
......@@ -123,7 +124,11 @@ function make_playlist($session, $old_format = false, $format='xml') {
$res = get_loved_tracks(array($requser->uniqueid));
} else if (preg_match('@l(ast|ibre)fm://user/(.*)/recommended@', $url, $regs)) {
try {
$requser = new User($regs[2]);
if(strstr($regs[2], '@')) {
$requser = new RemoteUser($regs[2]);
} else {
$requser = new User($regs[2]);
}
} catch (Exception $e) {
die("FAILED\n"); // this should return a blank dummy playlist instead
}
......
......@@ -2,10 +2,14 @@
<center>
<h4>
{if $type != 'loved'}<a href='{$me->getURL('station')}'>{/if}{t name=$me->name|capitalize}%1's Loved Radio{/t}{if $type != 'loved'}</a>{/if} |
{if $type != 'recommended'}<a href='{$me->getURL('station', 'type=recommended')}'>{/if}{t name=$me->name|capitalize}%1's Recommended Radio{/t}{if $type != 'recommended'}</a>{/if} |
{if $type != 'mix'}<a href='{$me->getURL('station', 'type=mix')}'>{/if}{t name=$me->name|capitalize}%1's Mix Radio{/t}{if $type != 'mix'}</a>{/if} |
{if $type != 'neighbours'}<a href='{$me->getURL('station', 'type=neighbours')}'>{/if}{t name=$me->name|capitalize}%1's Neighbourhood Radio{/t}{if $type != 'neighbours'}</a>{/if}
{if !$remote}
{if $type != 'loved'}<a href='{$me->getURL('station')}'>{/if}{t name=$me->name|capitalize}%1's Loved Radio{/t}{if $type != 'loved'}</a>{/if} |
{/if}
{if $type != 'recommended'}<a href='{$me->getURL('station', 'type=recommended')}'>{/if}{t name=$me->name|capitalize}%1's Recommended Radio{/t}{if $type != 'recommended'}</a>{/if}
{if !$remote}
| {if $type != 'mix'}<a href='{$me->getURL('station', 'type=mix')}'>{/if}{t name=$me->name|capitalize}%1's Mix Radio{/t}{if $type != 'mix'}</a>{/if} |
{if $type != 'neighbours'}<a href='{$me->getURL('station', 'type=neighbours')}'>{/if}{t name=$me->name|capitalize}%1's Neighbourhood Radio{/t}{if $type != 'neighbours'}</a>{/if}
{/if}
</h4>
<div id='player-container' style='float: none; text-align: center;'>
......
......@@ -37,8 +37,10 @@ if (!isset($_GET['user']) && $logged_in == false) {
try {
if(strstr($_GET['user'], '@')) {
$user = new RemoteUser($_GET['user']);
$remote = true;
} else {
$user = new User($_GET['user']);
$remote = false;
}
} catch (Exception $e) {
$error = 'User not found';
......@@ -47,6 +49,8 @@ try {
if (isset($user->name)) {
if (isset($_GET['type'])) {
$type = $_GET['type'];
} elseif($remote) {
$type = 'recommended';
} else {
$type = 'loved';
}
......@@ -65,6 +69,7 @@ if (isset($user->name)) {
$smarty->assign('submenu', $submenu);
$smarty->assign('type', $type);
$smarty->assign('headerfile', 'maxiprofile.tpl');
$smarty->assign('remote', $remote);
$smarty->display('user-station.tpl');
} 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