2.3.5 last.fm fix, volume shortcuts

This commit is contained in:
Trevor Squillario 2012-12-03 18:19:21 -05:00
parent c12537e061
commit 8643f01647
13 changed files with 223 additions and 97 deletions

View file

@ -4,6 +4,9 @@ Imagine you can stream all your music from home, to any device, where ever you a
MiniSub is an HTML5 Web Player for the Subsonic streaming server.
***Please submit all bug reports & feature requests via the GitHub page***
https://github.com/tsquillario/MiniSub/issues
Features
* HTML5 Audio with Flash fallback (provided by the SoundManager2 library)
* Flexible Layout (will scale to whatever size your browser window is)

Binary file not shown.

After

Width:  |  Height:  |  Size: 268 B

View file

@ -217,6 +217,7 @@
<li><em>Spacebar</em> Play/Pause</li>
<li><em>&rarr;</em> Next Track</li>
<li><em>&larr;</em> Previous Track</li>
<li><em>-/_</em> Volume Down <em>=/+</em> Volume Up</li>
<li><span></span></li>
</ul>
</div>
@ -271,7 +272,7 @@
<span>Local Storage</span><br />
<div class="clear"></div>
<div class="inputwrap"><input type="checkbox" id="SaveTrackPosition" name="SaveTrackPosition" value="1" title="Saves Play Queue & Track Position Periodically (Uses HTML5: localStorage)"/></div>
<label for="SaveTrackPosition">Save Current Position</label>
<label for="SaveTrackPosition">Save Progress</label>
</fieldset>
</div>
</div>
@ -295,6 +296,11 @@
<span class="changes">- </span>
</li>
-->
<li class="log"><span class="version">12/3/2012 - 2.3.5</span>
<span class="changes">- Added keyboard volume controls back. Use the plus (=/+) and minus (-/_) keys</span>
<span class="changes">- Change Save Current Position to Save Progress, added an indicator next to volume</span>
<span class="changes">- Fixed Last.fm scrobble feature, this works again!</span>
</li>
<li class="log"><span class="version">11/27/2012 - 2.3.4</span>
<span class="changes">- Basic Breadcrumb navigation implemented</span>
</li>
@ -474,6 +480,7 @@
<a href="#" id="action_Mute" class="mute first" title="Mute"></a>
<a href="#" id="action_UnMute" class="unmute first" title="Unmute" style="display: none;"></a>
<div class="jp-volume-bar"><div class="jp-volume-bar-value"></div></div><a href="#" id="action_VolumeMax" class="volume" title="Max Volume"></a>
<a href="#" id="action_SaveProgress" class="lock" title="Progress Saved" style="display: none;"></a>
</li>
</ul>
<div class="rate"><a id="songdetails_rate" class="rate" href="" title="Add To Favorites"></a></div>

View file

@ -9,7 +9,7 @@ var password;
var passwordenc;
var server;
var smwidth;
var currentVersion = '2.3.4';
var currentVersion = '2.3.5';
function getCookie(value) {
if ($.cookie(value)) {
@ -83,11 +83,11 @@ if (getCookie('passwordenc')) {
password = 'enc:' + HexEncode(getCookie('password'));
}
}
var auth = makeBaseAuth(username, password);
if (getCookie('password')) {
setCookie('passwordenc', 'enc:' + HexEncode(getCookie('password')));
setCookie('password', null);
}
var auth = makeBaseAuth(username, password.substring(4, password.length).hexDecode());
var apiVersion = '1.6.0';
function loadTabContent(tab) {

View file

@ -1,6 +1,15 @@
/* Ajax Global Setup */
// Inject Basic Auth
$.ajaxSetup({
beforeSend: function (req) {
req.setRequestHeader('Authorization', auth);
}
//headers: { "Authorization": "Basic " + auth }
});
function ping() {
$.ajax({
url: baseURL + '/ping.view?u=' + username + '&p=' + password + '&v=1.6.0&c=' + applicationName + '&f=json',
url: baseURL + '/ping.view?v=1.6.0&c=' + applicationName + '&f=json',
method: 'GET',
dataType: 'json',
timeout: 10000,
@ -26,11 +35,11 @@ function loadArtists(id, refresh) {
}
var url;
if (id == "all") {
url = baseURL + '/getIndexes.view?u=' + username + '&p=' + password + '&v=' + apiVersion + '&c=' + applicationName + '&f=json';
url = baseURL + '/getIndexes.view?v=' + apiVersion + '&c=' + applicationName + '&f=json';
} else if (id) {
url = baseURL + '/getIndexes.view?u=' + username + '&p=' + password + '&v=' + apiVersion + '&c=' + applicationName + '&f=json&musicFolderId=' + id;
url = baseURL + '/getIndexes.view?v=' + apiVersion + '&c=' + applicationName + '&f=json&musicFolderId=' + id;
} else {
url = baseURL + '/getIndexes.view?u=' + username + '&p=' + password + '&v=' + apiVersion + '&c=' + applicationName + '&f=json';
url = baseURL + '/getIndexes.view?v=' + apiVersion + '&c=' + applicationName + '&f=json';
}
if (debug) { console.log(url); }
var content = $('#ArtistContainer').html();
@ -139,7 +148,7 @@ function loadArtists(id, refresh) {
}
function getMusicFolders() {
$.ajax({
url: baseURL + '/getMusicFolders.view?u=' + username + '&p=' + password + '&v=' + apiVersion + '&c=' + applicationName + '&f=json',
url: baseURL + '/getMusicFolders.view?v=' + apiVersion + '&c=' + applicationName + '&f=json',
method: 'GET',
dataType: 'json',
timeout: 10000,
@ -210,7 +219,7 @@ function loadAutoPlaylists(refresh) {
}
function getAlbums(id, action, appendto) {
$.ajax({
url: baseURL + '/getMusicDirectory.view?u=' + username + '&p=' + password + '&v=' + apiVersion + '&c=' + applicationName + '&f=json&id=' + id,
url: baseURL + '/getMusicDirectory.view?v=' + apiVersion + '&c=' + applicationName + '&f=json&id=' + id,
method: 'GET',
dataType: 'json',
timeout: 10000,
@ -248,7 +257,7 @@ function getAlbums(id, action, appendto) {
});
toggleAlbumListNextPrev('#status_Library', false, '', '');
if (appendto == '#CurrentPlaylistContainer') {
updateMessage(children.length + ' Song(s) Added');
updateMessage(children.length + ' Song(s) Added', true);
}
if (appendto == '#AlbumContainer tbody' && isDir == true) {
header = generateAlbumHeaderHTML();
@ -266,6 +275,55 @@ function getAlbums(id, action, appendto) {
}
});
}
/* Currently not being used */
function getArtist(id, action, appendto) {
$.ajax({
url: baseURL + '/getArtist.view?v=' + apiVersion + '&c=' + applicationName + '&f=json&id=' + id,
method: 'GET',
dataType: 'json',
timeout: 10000,
success: function (data) {
if (action == '') {
$('#AlbumContainer tbody').empty();
}
if (action === 'autoplay') {
$('#CurrentPlaylistContainer tbody').empty();
}
if (action == 'link') {
$('#AlbumContainer tbody').empty();
$('#action_tabLibrary').trigger('click');
}
if (data["subsonic-response"].artist !== undefined) {
// There is a bug in the API that doesn't return a JSON array for one artist
var children = [];
if (data["subsonic-response"].artist.album.length > 0) {
children = data["subsonic-response"].artist.album;
} else {
children[0] = data["subsonic-response"].artist.album;
}
var rowcolor;
var header;
$.each(children, function (i, child) {
var html = generateRowHTML(child, appendto);
$(html).appendTo(appendto).hide().fadeIn('fast');
});
toggleAlbumListNextPrev('#status_Library', false, '', '');
if (appendto == '#CurrentPlaylistContainer') {
updateMessage(children.length + ' Song(s) Added', true);
}
if (appendto == '#AlbumContainer tbody') {
header = generateAlbumHeaderHTML();
$('#songActions a.button').addClass('disabled');
}
$("#AlbumContainer thead").html(header);
if (action == 'autoplay') {
autoPlay();
}
}
}
});
}
function getAlbumListBy(id, offset) {
var size, url;
if (getCookie('AutoAlbumSize')) {
@ -274,9 +332,9 @@ function getAlbumListBy(id, offset) {
size = 15;
}
if (offset > 0) {
url = baseURL + '/getAlbumList.view?u=' + username + '&p=' + password + '&v=' + apiVersion + '&c=' + applicationName + '&f=json&size=' + size + '&type=' + id + '&offset=' + offset
url = baseURL + '/getAlbumList.view?v=' + apiVersion + '&c=' + applicationName + '&f=json&size=' + size + '&type=' + id + '&offset=' + offset
} else {
url = baseURL + '/getAlbumList.view?u=' + username + '&p=' + password + '&v=' + apiVersion + '&c=' + applicationName + '&f=json&size=' + size + '&type=' + id
url = baseURL + '/getAlbumList.view?v=' + apiVersion + '&c=' + applicationName + '&f=json&size=' + size + '&type=' + id
}
$.ajax({
url: url,
@ -312,7 +370,7 @@ function getAlbumListBy(id, offset) {
$('#songActions a.button').addClass('disabled');
toggleAlbumListNextPrev('#status_Library', true, id, offset);
} else {
updateMessage('Albums failed to load, no music :(');
updateMessage('Albums failed to load, no music :(', true);
$('#AlbumContainer tbody').empty();
}
}
@ -359,7 +417,7 @@ function getRandomSongList(action, appendto, genre, folder) {
getStarred(action, appendto, 'song');
} else {
$.ajax({
url: baseURL + '/getRandomSongs.view?u=' + username + '&p=' + password + '&v=' + apiVersion + '&c=' + applicationName + '&f=json&size=' + size + genreParams + folderParams,
url: baseURL + '/getRandomSongs.view?v=' + apiVersion + '&c=' + applicationName + '&f=json&size=' + size + genreParams + folderParams,
method: 'GET',
dataType: 'json',
timeout: 10000,
@ -396,7 +454,7 @@ function getRandomSongList(action, appendto, genre, folder) {
updateStatus('#status_Playlists', countCurrentPlaylist('#TrackContainer'));
}
if (appendto === '#CurrentPlaylistContainer tbody') {
updateMessage(items.length + ' Song(s) Added');
updateMessage(items.length + ' Song(s) Added', true);
updateStatus('#status_Current', countCurrentPlaylist('#CurrentPlaylistContainer'));
}
if (action == 'autoplay' || action == 'autoplayappend') {
@ -418,7 +476,7 @@ function getStarred(action, appendto, type) {
size = 25;
}
$.ajax({
url: baseURL + '/getStarred.view?u=' + username + '&p=' + password + '&v=' + apiVersion + '&c=' + applicationName + '&f=json&size=' + size,
url: baseURL + '/getStarred.view?v=' + apiVersion + '&c=' + applicationName + '&f=json&size=' + size,
method: 'GET',
dataType: 'json',
timeout: 10000,
@ -492,7 +550,7 @@ function getStarred(action, appendto, type) {
updateStatus('#status_Playlists', countCurrentPlaylist('#TrackContainer'));
}
if (appendto == '#CurrentPlaylistContainer tbody') {
updateMessage(items.length + ' Song(s) Added');
updateMessage(items.length + ' Song(s) Added', true);
}
if (action == 'autoplay') {
autoPlay();
@ -509,7 +567,7 @@ function updateNowPlaying(showPopup) {
updaterNowPlaying = $.periodic({ period: 4000, decay: 1.5, max_period: 30000 }, function () {
$.ajax({
periodic: this,
url: baseURL + '/getNowPlaying.view?u=' + username + '&p=' + password + '&v=' + apiVersion + '&c=' + applicationName + '&f=json',
url: baseURL + '/getNowPlaying.view?v=' + apiVersion + '&c=' + applicationName + '&f=json',
method: 'GET',
dataType: 'json',
timeout: 10000,
@ -546,7 +604,7 @@ function updateNowPlaying(showPopup) {
if (msg.coverArt === undefined) {
coverartSrc = 'images/albumdefault_50.jpg';
} else {
coverartSrc = baseURL + '/getCoverArt.view?u=' + username + '&p=' + password + '&v=' + apiVersion + '&c=' + applicationName + '&f=json&size=50&id=' + msg.coverArt;
coverartSrc = baseURL + '/getCoverArt.view?v=' + apiVersion + '&c=' + applicationName + '&f=json&size=50&id=' + msg.coverArt;
}
if (getCookie('Notification_NowPlaying')) {
var sid = msg.username + '-' + msg.id;
@ -567,7 +625,7 @@ function stopUpdateNowPlaying() {
function search(type, query) {
$.ajax({
url: baseURL + '/search2.view?u=' + username + '&p=' + password + '&v=' + apiVersion + '&c=' + applicationName + '&f=json&query=' + query,
url: baseURL + '/search2.view?v=' + apiVersion + '&c=' + applicationName + '&f=json&query=' + query,
method: 'GET',
dataType: 'json',
timeout: 10000,
@ -627,7 +685,7 @@ function loadFolders(refresh) {
if (content === "") {
// Load Folders
$.ajax({
url: baseURL + '/getMusicFolders.view?u=' + username + '&p=' + password + '&v=' + apiVersion + '&c=' + applicationName + '&f=json',
url: baseURL + '/getMusicFolders.view?v=' + apiVersion + '&c=' + applicationName + '&f=json',
method: 'GET',
dataType: 'json',
timeout: 10000,
@ -660,7 +718,7 @@ function loadPlaylists(refresh) {
if (content === "") {
// Load Playlists
$.ajax({
url: baseURL + '/getPlaylists.view?u=' + username + '&p=' + password + '&v=' + apiVersion + '&c=' + applicationName + '&f=json',
url: baseURL + '/getPlaylists.view?v=' + apiVersion + '&c=' + applicationName + '&f=json',
method: 'GET',
dataType: 'json',
timeout: 10000,
@ -698,13 +756,13 @@ function savePlaylist(playlistid) {
if (songs.length > 0) {
$.ajax({
type: 'GET',
url: baseURL + '/createPlaylist.view?u=' + username + '&p=' + password,
url: baseURL + '/createPlaylist.view',
dataType: 'json',
timeout: 10000,
data: { v: apiVersion, c: applicationName, f: "json", playlistId: playlistid, songId: songs },
success: function () {
getPlaylist(playlistid);
updateMessage('Playlist Updated!');
updateMessage('Playlist Updated!', true);
},
traditional: true // Fixes POST with an array in JQuery 1.4
});
@ -712,7 +770,7 @@ function savePlaylist(playlistid) {
}
function getPlaylist(id, action, appendto) {
$.ajax({
url: baseURL + '/getPlaylist.view?u=' + username + '&p=' + password + '&v=' + apiVersion + '&c=' + applicationName + '&f=json&id=' + id,
url: baseURL + '/getPlaylist.view?v=' + apiVersion + '&c=' + applicationName + '&f=json&id=' + id,
method: 'GET',
dataType: 'json',
timeout: 10000,
@ -750,7 +808,7 @@ function getPlaylist(id, action, appendto) {
updateStatus('#status_Playlists', countCurrentPlaylist('#TrackContainer'));
}
if (appendto === '#CurrentPlaylistContainer tbody') {
updateMessage(children.length + ' Song(s) Added');
updateMessage(children.length + ' Song(s) Added', true);
}
if (action === 'autoplay') {
autoPlay();
@ -767,7 +825,7 @@ function getPlaylist(id, action, appendto) {
function loadPlaylistsForMenu(menu) {
$('#' + menu).empty();
$.ajax({
url: baseURL + '/getPlaylists.view?u=' + username + '&p=' + password + '&v=' + apiVersion + '&c=' + applicationName + '&f=json',
url: baseURL + '/getPlaylists.view?v=' + apiVersion + '&c=' + applicationName + '&f=json',
method: 'GET',
dataType: 'json',
timeout: 10000,
@ -791,7 +849,7 @@ function newPlaylist() {
var reply = prompt("Choose a name for your new playlist.", "");
if (reply != 'null' && reply != null && reply != '') {
$.ajax({
url: baseURL + '/createPlaylist.view?u=' + username + '&p=' + password + '&v=' + apiVersion + '&c=' + applicationName + '&f=json&name=' + reply,
url: baseURL + '/createPlaylist.view?v=' + apiVersion + '&c=' + applicationName + '&f=json&name=' + reply,
method: 'GET',
dataType: 'json',
timeout: 10000,
@ -803,7 +861,7 @@ function newPlaylist() {
}
function deletePlaylist(id) {
$.ajax({
url: baseURL + '/deletePlaylist.view?u=' + username + '&p=' + password + '&v=' + apiVersion + '&c=' + applicationName + '&f=json&id=' + id,
url: baseURL + '/deletePlaylist.view?v=' + apiVersion + '&c=' + applicationName + '&f=json&id=' + id,
method: 'GET',
dataType: 'json',
timeout: 10000,
@ -829,7 +887,7 @@ function addToPlaylist(playlistid, from) {
// Get songs from playlist
var currentsongs = [];
$.ajax({
url: baseURL + '/getPlaylist.view?u=' + username + '&p=' + password + '&v=' + apiVersion + '&c=' + applicationName + '&f=json&id=' + playlistid,
url: baseURL + '/getPlaylist.view?v=' + apiVersion + '&c=' + applicationName + '&f=json&id=' + playlistid,
method: 'GET',
dataType: 'json',
timeout: 10000,
@ -860,22 +918,24 @@ function addToPlaylist(playlistid, from) {
if (checkVersion(runningVersion, minimumVersion)) { // is 1.8.0 or newer
$.ajax({
type: 'GET',
url: baseURL + '/updatePlaylist.view?u=' + username + '&p=' + password,
url: baseURL + '/updatePlaylist.view',
dataType: 'json',
timeout: 10000,
data: { v: apiVersion, c: applicationName, f: "json", playlistId: playlistid, songIdToAdd: selected },
success: function () {
success: function (data) {
// Add logic to show an error if the playlist update fails
// if (data["subsonic-response"].playlist.entry !== undefined) {
$('table.songlist tr.song').each(function () {
$(this).removeClass('selected');
});
updateMessage('Playlist Updated!');
updateMessage(count + ' Song(s) Added to Playlist', true);
},
traditional: true // Fixes POST with an array in JQuery 1.4
});
} else {
$.ajax({ // Depreciated: 11/5/2012
type: 'GET',
url: baseURL + '/createPlaylist.view?u=' + username + '&p=' + password,
url: baseURL + '/createPlaylist.view',
dataType: 'json',
timeout: 10000,
data: { v: apiVersion, c: applicationName, f: "json", playlistId: playlistid, songId: currentsongs },
@ -883,7 +943,7 @@ function addToPlaylist(playlistid, from) {
$('table.songlist tr.song').each(function () {
$(this).removeClass('selected');
});
updateMessage('Playlist Updated!');
updateMessage(count + ' Song(s) Added to Playlist', true);
},
traditional: true // Fixes POST with an array in JQuery 1.4
});
@ -896,7 +956,7 @@ function addToPlaylist(playlistid, from) {
if (reply) {
$.ajax({
type: 'GET',
url: baseURL + '/createPlaylist.view?u=' + username + '&p=' + password,
url: baseURL + '/createPlaylist.view',
dataType: 'json',
timeout: 10000,
data: { v: apiVersion, c: applicationName, f: "json", name: "" + reply + "", songId: selected },
@ -904,7 +964,7 @@ function addToPlaylist(playlistid, from) {
$('table.songlist tr.song').each(function () {
$(this).removeClass('selected');
});
updateMessage('Playlist Created!');
updateMessage('Playlist Created!', true);
},
traditional: true // Fixes POST with an array in JQuery 1.4
});
@ -931,7 +991,7 @@ function addToCurrent(addAll) {
});
}
$('#CurrentPlaylistContainer tbody tr.song').removeClass('selected');
updateMessage(count + ' Song(s) Added');
updateMessage(count + ' Song(s) Added', true);
}
}
function countCurrentPlaylist(container) {
@ -999,6 +1059,7 @@ function saveTrackPosition() {
albumid: albumid,
position: position
};
$('#action_SaveProgress').show();
setCookie('CurrentSong', JSON.stringify(currentSong));
saveCurrentPlaylist();
}
@ -1014,7 +1075,7 @@ function downloadItem(id, type) {
reqDownload = 'playlistUtf8Hex=' + id;
}
if (reqDownload) {
url = baseURL + '/download.view?u=' + username + '&p=' + password + '&v=' + apiVersion + '&c=' + applicationName + '&f=json&' + reqDownload;
url = baseURL + '/download.view?v=' + apiVersion + '&c=' + applicationName + '&f=json&' + reqDownload;
window.location = url;
}
}
@ -1029,7 +1090,7 @@ function loadPodcasts(refresh) {
if (content === "") {
// Load Podcasts
$.ajax({
url: baseURL + '/getPodcasts.view?u=' + username + '&p=' + password + '&v=' + apiVersion + '&c=' + applicationName + '&f=json',
url: baseURL + '/getPodcasts.view?v=' + apiVersion + '&c=' + applicationName + '&f=json',
method: 'GET',
dataType: 'json',
timeout: 10000,
@ -1063,7 +1124,7 @@ function loadPodcasts(refresh) {
}
function getPodcast(id, action, appendto) {
$.ajax({
url: baseURL + '/getPodcasts.view?u=' + username + '&p=' + password + '&v=' + apiVersion + '&c=' + applicationName + '&f=json',
url: baseURL + '/getPodcasts.view?v=' + apiVersion + '&c=' + applicationName + '&f=json',
method: 'GET',
dataType: 'json',
timeout: 10000,
@ -1114,7 +1175,7 @@ function getPodcast(id, action, appendto) {
updateStatus('#status_Podcasts', countCurrentPlaylist('#PodcastContainer'));
}
if (appendto === '#CurrentPlaylistContainer tbody') {
updateMessage(count + ' Song(s) Added');
updateMessage(count + ' Song(s) Added', true);
}
if (action === 'autoplay') {
autoPlay();
@ -1136,7 +1197,7 @@ function loadVideos(refresh) {
if (content == "") {
// Load Videos
$.ajax({
url: baseURL + '/getVideos.view?u=' + username + '&p=' + password + '&v=' + apiVersion + '&c=' + applicationName + '&f=json',
url: baseURL + '/getVideos.view?v=' + apiVersion + '&c=' + applicationName + '&f=json',
method: 'GET',
dataType: 'json',
timeout: 10000,
@ -1156,7 +1217,7 @@ function loadVideos(refresh) {
} else {
rowcolor = 'odd';
}
var videoURL = baseURL + '/stream.view?u=' + username + '&p=' + password + '&v=' + apiVersion + '&c=' + applicationName + '&id=' + video.id;
var videoURL = baseURL + '/stream.view?v=' + apiVersion + '&c=' + applicationName + '&id=' + video.id;
html = '<tr class=\"row video\" childid=\"' + video.id + '\" parentid=\"' + video.parent + '\" bitrate=\"' + video.bitRate + '\" userrating=\"\">';
html += '<td class=\"itemactions\">';
//html += '<a class=\"add\" href=\"\" title=\"Add To Play Queue\"></a>';
@ -1171,7 +1232,7 @@ function loadVideos(refresh) {
if (video.coverArt === undefined) {
coverartSrc = 'images/albumdefault_25.jpg';
} else {
coverartSrc = baseURL + '/getCoverArt.view?u=' + username + '&p=' + password + '&v=' + apiVersion + '&c=' + applicationName + '&f=json&size=25&id=' + video.coverArt;
coverartSrc = baseURL + '/getCoverArt.view?v=' + apiVersion + '&c=' + applicationName + '&f=json&size=25&id=' + video.coverArt;
}
var time = secondsToTime(video.duration);
html += '<td class=\"album\"><img src=\"' + coverartSrc + '\" />' + video.album + '</td>';

View file

@ -4,7 +4,7 @@ function updateChatMessages() {
updater = $.periodic({ period: 1000, decay: 1.5, max_period: 1800000 }, function () {
$.ajax({
periodic: this,
url: baseURL + '/getChatMessages.view?u=' + username + '&p=' + password + '&v=' + apiVersion + '&c=' + applicationName + '&f=json&since=' + starttime,
url: baseURL + '/getChatMessages.view?v=' + apiVersion + '&c=' + applicationName + '&f=json&since=' + starttime,
method: 'GET',
dataType: 'json',
timeout: 10000,
@ -49,7 +49,7 @@ function stopUpdateChatMessages() {
function addChatMessage(msg) {
$.ajax({
type: 'GET',
url: baseURL + '/addChatMessage.view?u=' + username + '&p=' + password,
url: baseURL + '/addChatMessage.view',
dataType: 'json',
timeout: 10000,
data: { v: apiVersion, c: applicationName, f: "json", message: msg },

View file

@ -1,5 +1,5 @@
function generateRowHTML(child, appendto) {
var html, isDir, starred, duration, artist, i;
var html, isDir, starred, duration, artist, artistId, i;
isDir = child.isDir;
if (child.starred !== undefined) { starred = true; } else { starred = false; }
if (child.duration !== undefined) { duration = child.duration; } else { duration = ''; }
@ -33,7 +33,7 @@ function generateAlbumHTML(childid, parentid, coverart, title, artist, rating, s
if (coverart == undefined) {
html += '<td class=\"albumart\"><img src=\"images/albumdefault_50.jpg\" /></td>';
} else {
html += '<td class=\"albumart\"><img src=\"' + baseURL + '/getCoverArt.view?u=' + username + '&p=' + password + '&v=' + apiVersion + '&c=' + applicationName + '&f=json&size=50&id=' + coverart + '\" /></td>';
html += '<td class=\"albumart\"><img src=\"' + baseURL + '/getCoverArt.view?v=' + apiVersion + '&c=' + applicationName + '&f=json&size=50&id=' + coverart + '\" /></td>';
}
html += '<td class=\"album\">' + title + '</td>';
html += '<td class=\"artist\">' + artist + '</td>';
@ -72,13 +72,14 @@ function generateSongHTML(childid, parentid, track, title, description, artist,
html += '<td class=\"title\">' + title + '</td>';
}
html += '<td class=\"artist\">' + artist + '</td>';
//html += '<td class=\"artist\"><a href="#">' + artist + '</a></td>';
var coverartSrc;
if (coverart == undefined) {
coverartSrc = 'images/albumdefault_25.jpg';
} else {
coverartSrc = baseURL + '/getCoverArt.view?u=' + username + '&p=' + password + '&v=' + apiVersion + '&c=' + applicationName + '&f=json&size=25&id=' + coverart;
coverartSrc = baseURL + '/getCoverArt.view?v=' + apiVersion + '&c=' + applicationName + '&f=json&size=25&id=' + coverart;
}
html += '<td class=\"album\" data-order-by=\"' + album + '\"><a href="#" class=\"albumlink\"><img src=\"' + coverartSrc + '\" />' + album + '</a></td>';
html += '<td class=\"album\" data-order-by=\"' + album + '\"><a href="#"><img src=\"' + coverartSrc + '\" />' + album + '</a></td>';
html += '<td class=\"time\">' + time + '</td>';
html += '</tr>';
return html;

View file

@ -5,10 +5,10 @@ function getSongData(el, songid, albumid, position, loadonly) {
var minimumVersion = parseVersionString('1.8.0');
if (checkVersion(runningVersion, minimumVersion)) {
if (debug) { console.log('apiVersion at or above 1.8.0 using getSong.view'); }
ajaxUrl = baseURL + '/getSong.view?u=' + username + '&p=' + password + '&v=' + apiVersion + '&c=' + applicationName + '&f=json&id=' + songid;
ajaxUrl = baseURL + '/getSong.view?v=' + apiVersion + '&c=' + applicationName + '&f=json&id=' + songid;
} else {
if (debug) { console.log('apiVersion below 1.8.0 using getMusicDirectory.view'); }
ajaxUrl = baseURL + '/getMusicDirectory.view?u=' + username + '&p=' + password + '&v=' + apiVersion + '&c=' + applicationName + '&f=json&id=' + albumid; // Deprecated: apiVersion 1.8.0
ajaxUrl = baseURL + '/getMusicDirectory.view?v=' + apiVersion + '&c=' + applicationName + '&f=json&id=' + albumid; // Deprecated: apiVersion 1.8.0
}
if (debug) { console.log(ajaxUrl) }
$.ajax({
@ -87,8 +87,8 @@ function playSong(el, songid, albumid, title, artist, album, coverart, rating, s
coverartSrc = 'images/albumdefault_60.jpg';
coverartFullSrc = '';
} else {
coverartSrc = baseURL + '/getCoverArt.view?u=' + username + '&p=' + password + '&v=' + apiVersion + '&c=' + applicationName + '&f=json&size=60&id=' + coverart;
coverartFullSrc = baseURL + '/getCoverArt.view?u=' + username + '&p=' + password + '&v=' + apiVersion + '&c=' + applicationName + '&f=json&id=' + coverart;
coverartSrc = baseURL + '/getCoverArt.view?v=' + apiVersion + '&c=' + applicationName + '&f=json&size=60&id=' + coverart;
coverartFullSrc = baseURL + '/getCoverArt.view?v=' + apiVersion + '&c=' + applicationName + '&f=json&id=' + coverart;
}
$('#coverartimage').attr('href', coverartFullSrc);
$('#coverartimage img').attr('src', coverartSrc);
@ -101,6 +101,7 @@ function playSong(el, songid, albumid, title, artist, album, coverart, rating, s
audioSolution = "flash,html";
}
$("#playdeck").jPlayer("destroy");
$.jPlayer.timeFormat.showHour = true;
$("#playdeck").jPlayer({
swfPath: "js/jplayer",
wmode: "window",
@ -124,11 +125,11 @@ function playSong(el, songid, albumid, title, artist, album, coverart, rating, s
ready: function () {
if (suffix == 'oga') {
$(this).jPlayer("setMedia", {
oga: baseURL + '/stream.view?u=' + username + '&p=' + password + '&v=' + apiVersion + '&c=' + applicationName + '&id=' + songid + '&salt=' + salt,
oga: baseURL + '/stream.view?v=' + apiVersion + '&c=' + applicationName + '&id=' + songid + '&salt=' + salt,
});
} else if (suffix == 'mp3') {
$(this).jPlayer("setMedia", {
mp3: baseURL + '/stream.view?u=' + username + '&p=' + password + '&v=' + apiVersion + '&c=' + applicationName + '&id=' + songid + '&salt=' + salt,
mp3: baseURL + '/stream.view?v=' + apiVersion + '&c=' + applicationName + '&id=' + songid + '&salt=' + salt,
});
}
if (!loadonly) {
@ -138,10 +139,18 @@ function playSong(el, songid, albumid, title, artist, album, coverart, rating, s
$(this).jPlayer("pause", position);
}
},
volumechange: function(event) { // The $.jPlayer.event.ended event
timeupdate: function(event) {
// Scrobble song once percentage is reached
var p = event.jPlayer.status.currentPercentAbsolute;
if (!scrobbled && p > 30) {
if (debug) { console.log('LAST.FM SCROBBLE - Percent Played: ' + p); }
scrobbleSong(true);
}
},
volumechange: function(event) {
setCookie('Volume', event.jPlayer.options.volume);
},
ended: function() { // The $.jPlayer.event.ended event
ended: function() {
var next = $('#CurrentPlaylistContainer tr.playing').next();
if (!changeTrack(next)) {
if (getCookie('AutoPilot')) {
@ -173,7 +182,7 @@ function playSong(el, songid, albumid, title, artist, album, coverart, rating, s
var solution = data.solutions[i];
if (data[solution].used) {
spechtml += "<strong>" + solution + "</strong> is";
spechtml += " being used with<strong>";
spechtml += " currently being used with<strong>";
for (format in data[solution].support) {
if (data[solution].support[format]) {
spechtml += " " + format;
@ -233,7 +242,7 @@ function playVideo(id, bitrate) {
function scrobbleSong(submission) {
var songid = $('#songdetails_song').attr('childid');
$.ajax({
url: baseURL + '/scrobble.view?u=' + username + '&p=' + password + '&v=' + apiVersion + '&c=' + applicationName + '&f=json&id=' + songid + "&submission=" + submission,
url: baseURL + '/scrobble.view?v=' + apiVersion + '&c=' + applicationName + '&f=json&id=' + songid + "&submission=" + submission,
method: 'GET',
dataType: 'json',
timeout: 10000,
@ -246,12 +255,12 @@ function scrobbleSong(submission) {
}
function rateSong(songid, rating) {
$.ajax({
url: baseURL + '/setRating.view?u=' + username + '&p=' + password + '&v=' + apiVersion + '&c=' + applicationName + '&f=json&id=' + songid + "&rating=" + rating,
url: baseURL + '/setRating.view?v=' + apiVersion + '&c=' + applicationName + '&f=json&id=' + songid + "&rating=" + rating,
method: 'GET',
dataType: 'json',
timeout: 10000,
success: function () {
updateMessage('Rating Updated!');
updateMessage('Rating Updated!', true);
}
});
}
@ -259,9 +268,9 @@ function starItem(itemid, starred) {
var url;
if (itemid !== undefined) {
if (starred) {
url = baseURL + '/star.view?u=' + username + '&p=' + password + '&v=' + apiVersion + '&c=' + applicationName + '&f=json&id=' + itemid;
url = baseURL + '/star.view?v=' + apiVersion + '&c=' + applicationName + '&f=json&id=' + itemid;
} else {
url = baseURL + '/unstar.view?u=' + username + '&p=' + password + '&v=' + apiVersion + '&c=' + applicationName + '&f=json&id=' + itemid;
url = baseURL + '/unstar.view?v=' + apiVersion + '&c=' + applicationName + '&f=json&id=' + itemid;
}
$.ajax({
url: url,
@ -269,7 +278,7 @@ function starItem(itemid, starred) {
dataType: 'json',
timeout: 10000,
success: function () {
updateMessage('Favorite Updated!');
updateMessage('Favorite Updated!', true);
}
});
}

View file

@ -120,16 +120,22 @@ function secondsToTime(secs) {
return time;
}
var msgIndex = 1;
function updateMessage(msg) {
function updateMessage(msg, autohide) {
if (msg != '') {
var id = msgIndex;
$('#messages').append('<span id=\"msg_' + id + '\" class="message">' + msg + '</span>');
$('#messages').fadeIn();
setTimeout(function () {
var el = '#msg_' + id;
$(el).fadeOut( function() { $(this).remove(); });
},
5000);
if (autohide) {
setTimeout(function () {
$(el).fadeOut(function () { $(this).remove(); });
}, 10000);
} else {
$(el).click(function () {
$(el).fadeOut(function () { $(this).remove(); });
return false;
});
}
msgIndex++;
}
}

View file

@ -12,6 +12,11 @@
if (getCookie('HideAZ')) {
$('#BottomContainer').hide();
}
if (getCookie('SaveTrackPosition')) {
$('#SaveTrackPosition').attr('checked', true);
} else {
$('#SaveTrackPosition').attr('checked', false);
}
$('ul#ChangeLog li.log').each(function (i, el) {
if (i > 3) {
$(el).hide();

View file

@ -45,18 +45,13 @@
} else {
$('#ForceFlash').attr('checked', false);
}
if (getCookie('SaveTrackPosition')) {
$('#SaveTrackPosition').attr('checked', true);
} else {
$('#SaveTrackPosition').attr('checked', false);
}
if (getCookie('AutoPilot')) {
setCookie('AutoPilot', null)
}
// Version check
if (getCookie('CurrentVersion')) {
if (checkVersionNewer(parseVersionString(getCookie('CurrentVersion')), parseVersionString(currentVersion))) {
updateMessage('MiniSub updated to v' + currentVersion);
updateMessage('MiniSub updated to v' + currentVersion, false);
setCookie('CurrentVersion', currentVersion);
}
} else {
@ -106,7 +101,7 @@
return false;
});
// Ajax Loading Screen
// Show/Hide Loading
$("#toploading").ajaxStart(function () {
$(this).show();
});
@ -119,8 +114,7 @@
var source = e.target.id;
if (source != 'Search' && source != 'ChatMsg' && source != 'AutoPlaylists') {
var unicode = e.charCode ? e.charCode : e.keyCode;
// a-z
if (unicode >= 65 && unicode <= 90 && $('#tabLibrary').is(':visible')) {
if (unicode >= 65 && unicode <= 90 && $('#tabLibrary').is(':visible')) { // a-z
var key = findKeyForCode(unicode);
if (key == 'x' || key == 'y' || key == 'z') {
key = 'x-z';
@ -129,23 +123,42 @@
if ($(el).length > 0) {
$('#Artists').stop().scrollTo(el, 400);
}
// right arrow
} else if (unicode == 39 || unicode == 176) {
} else if (unicode == 39 || unicode == 176) { // right arrow
var next = $('#CurrentPlaylistContainer tr.playing').next();
if (!next.length) next = $('#CurrentPlaylistContainer li').first();
changeTrack(next);
// back arrow
} else if (unicode == 37 || unicode == 177) {
} else if (unicode == 37 || unicode == 177) { // back arrow
var prev = $('#CurrentPlaylistContainer tr.playing').prev();
if (!prev.length) prev = $('#CurrentPlaylistContainer tr').last();
changeTrack(prev);
// spacebar
} else if (unicode == 32 || unicode == 179 || unicode == 0179) {
} else if (unicode == 32 || unicode == 179 || unicode == 0179) { // spacebar
playPauseSong();
return false;
} else if (unicode == 36 && $('#tabLibrary').is(':visible')) {
} else if (unicode == 36 && $('#tabLibrary').is(':visible')) { // home
$('#Artists').stop().scrollTo('#MusicFolders', 400);
}
if (unicode == 189) { // dash - volume down
var volume = getCookie('Volume') ? parseFloat(getCookie('Volume')) : 1;
if (volume <= 1 && volume > 0 && source == '') {
volume += -.1;
$("#playdeck").jPlayer({
volume: volume
});
setCookie('Volume', volume);
//updateMessage('Volume: ' + Math.round(volume * 100) + '%');
}
}
if (unicode == 187) { // equals - volume up
var volume = getCookie('Volume') ? parseFloat(getCookie('Volume')) : 1;
if (volume < 1 && volume >= 0 && source == '') {
volume += .1;
$("#playdeck").jPlayer({
volume: volume
});
setCookie('Volume', volume);
//updateMessage('Volume: ' + Math.round(volume * 100) + '%');
}
}
}
});
@ -288,7 +301,7 @@
$(track).clone().appendTo('#CurrentPlaylistContainer');
count++;
}
updateMessage(count + ' Song(s) Added');
updateMessage(count + ' Song(s) Added', true);
var firstsong = $('#CurrentPlaylistContainer tr.song:first');
songid = $(firstsong).attr('childid');
albumid = $(firstsong).attr('parentid');
@ -329,7 +342,7 @@
$(this).addClass('rate');
return false;
});
$('table.songlist tr.song a.albumlink').live('click', function (event) {
$('table.songlist tr.song td.album a').live('click', function (event) {
var parentid = $(this).parent().parent().attr('parentid');
if (parentid != '' && parentid !== undefined) {
$('#AutoAlbumContainer li').removeClass('selected');
@ -338,6 +351,17 @@
}
return false;
});
/*
$('table.songlist tr.song td.artist a').live('click', function (event) {
var artistid = $(this).parent().parent().attr('artistid');
if (artistid != '' && artistid !== undefined) {
$('#AutoAlbumContainer li').removeClass('selected');
$('#ArtistContainer li').removeClass('selected');
getArtist(artistid, 'link', '#AlbumContainer tbody');
}
return false;
});
*/
$('li.index').live('click', function (e) {
$('#Artists').stop().scrollTo('#auto', 400);
return false;
@ -596,7 +620,7 @@
$(this).addClass('selected');
count++;
});
updateMessage(count + ' Song(s) Selected');
updateMessage(count + ' Song(s) Selected', true);
}
return false;
});
@ -633,7 +657,7 @@
}
}
$(this).attr("title", msg);
updateMessage(msg);
updateMessage(msg, true);
return false;
});

View file

@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "MiniSub",
"description": "MiniSub - HTML5 Mini Player for Subsonic",
"version": "2.3.4",
"version": "2.3.5",
"app": {
"launch": {
"local_path": "index.html"

View file

@ -253,6 +253,7 @@ a#logo:hover
border-radius: 4px 4px 4px 4px;
box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
opacity: 0.8;
cursor: pointer;
}
.status
{
@ -595,7 +596,7 @@ table.songlist tr.row td.album
padding: 0;
line-height: 31px;
}
table.songlist tr.row td.album a
table.songlist tr.row a
{
color: #829FC0;
text-decoration: none;
@ -604,7 +605,7 @@ table.songlist tr.row td.album a
white-space: nowrap;
font-size: 12px;
}
table.songlist tr.row td.album a:hover
table.songlist tr.row a:hover
{
text-decoration: underline;
}
@ -1125,6 +1126,15 @@ table.songlist tr.selected td.album a
{
background: url('../images/loop_alt4_gl_16x12.png') 0 center no-repeat;
}
#songdetails a.lock
{
float: left;
margin: 2px;
height: 12px;
width: 9px;
display: block;
background: url('../images/lock_stroke_gl_9x12.png') 0 center no-repeat;
}
#songdetails a.first
{
margin: 2px 2px 2px 0;