Skip to content

Commit

Permalink
Fix URL encoding for radio station logos
Browse files Browse the repository at this point in the history
  • Loading branch information
moodeaudio committed Nov 13, 2021
1 parent 4f7f1c0 commit 0f05c91
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions www/inc/playerlib.php
Expand Up @@ -505,7 +505,7 @@ function genFlatList($sock) {
}
else {
$flat[$item]['Genre'] = array($value);
}
}
}
// NOTE: Uncomment this if Composer is included in output of GenLibrary()
$flat[$item][$element] = $value;
Expand Down Expand Up @@ -3422,11 +3422,11 @@ function enhanceMetadata($current, $sock, $caller = '') {
// DEPRECATE $current['station_name'] = $_SESSION[$song['file']]['name'];
if ($_SESSION[$song['file']]['logo'] == 'local') {
// Local logo image
$current['coverurl'] = LOGO_ROOT_DIR . $_SESSION[$song['file']]['name'] . ".jpg";
$current['coverurl'] = rawurlencode(LOGO_ROOT_DIR . $_SESSION[$song['file']]['name'] . '.jpg');
}
else {
// URL logo image
$current['coverurl'] = $_SESSION[$song['file']]['logo'];
$current['coverurl'] = rawurlencode($_SESSION[$song['file']]['logo']);
}
# NOTE: Hardcode displayed bitrate for BBC 320K stations since MPD does not seem to pick up the rate since 0.20.10
if (strpos($_SESSION[$song['file']]['name'], 'BBC') !== false && strpos($_SESSION[$song['file']]['name'], '320K') !== false) {
Expand Down
4 changes: 2 additions & 2 deletions www/js/playerlib.js
Expand Up @@ -750,7 +750,7 @@ function renderUI() {
// Thumbnail cover for Playbar
if (MPD.json['file'] && MPD.json['coverurl'].indexOf('wimpmusic') == -1 && MPD.json['coverurl']) {
var image_url = MPD.json['artist'] == 'Radio station' ?
encodeURIComponent(MPD.json['coverurl'].replace('imagesw/radio-logos', 'imagesw/radio-logos/thumbs')) :
MPD.json['coverurl'].replace('imagesw/radio-logos', 'imagesw/radio-logos/thumbs') :
'/imagesw/thmcache/' + encodeURIComponent($.md5(MPD.json['file'].substring(0,MPD.json['file'].lastIndexOf('/')))) + '.jpg'
$('#playbar-cover').html('<img src="' + image_url + '">');
}
Expand Down Expand Up @@ -1710,7 +1710,7 @@ function renderRadioView() {
// Construct station entries
var imgUrl = data[i].logo == 'local' ? 'imagesw/radio-logos/thumbs/' + data[i].name + '.jpg' : data[i].logo;
output += '<li id="ra-' + (i + 1) + '" data-path="' + 'RADIO/' + data[i].name + '.pls';
output += '"><div class="db-icon db-song db-browse db-action">' + radioViewLazy + imgUrl + '"></div><div class="cover-menu" data-toggle="context" data-target="#context-menu-radio-item"></div></div><div class="db-entry db-song db-browse"></div>';
output += '"><div class="db-icon db-song db-browse db-action">' + radioViewLazy + encodeURIComponent(imgUrl) + '"></div><div class="cover-menu" data-toggle="context" data-target="#context-menu-radio-item"></div></div><div class="db-entry db-song db-browse"></div>';
output += radioViewHdDiv;
output += radioViewBgDiv;
output += '<span class="station-name">' + data[i].name + '</span>';
Expand Down

0 comments on commit 0f05c91

Please sign in to comment.