2.0.7 Release

This commit is contained in:
Trevor Squillario 2012-09-29 15:15:00 -04:00
parent 2b5aae9c2f
commit e2099ee62a
8 changed files with 135 additions and 58 deletions

View file

@ -129,7 +129,7 @@
<div class="loading"></div> <div class="loading"></div>
<div id="Playlists" class="smsection floatleft noselect"> <div id="Playlists" class="smsection floatleft noselect">
<div class="padder"> <div class="padder">
<ul class="simplelist"><li class="index">Genre Playlists</li></ul> <ul class="simplelist"><li class="index">Auto Playlists</li></ul>
<ul id="AutoPlaylistContainer" class="simplelist mainlist"></ul> <ul id="AutoPlaylistContainer" class="simplelist mainlist"></ul>
<ul class="simplelist"><li class="index">Folder Playlists</li></ul> <ul class="simplelist"><li class="index">Folder Playlists</li></ul>
<ul id="FolderContainer" class="simplelist mainlist"></ul> <ul id="FolderContainer" class="simplelist mainlist"></ul>
@ -179,6 +179,7 @@
<input type="password" id="Password" name="Password" class="large"/><br /> <input type="password" id="Password" name="Password" class="large"/><br />
<label for="Server">Server <span class="red">*</span></label><br /> <label for="Server">Server <span class="red">*</span></label><br />
<input type="text" id="Server" name="Server" class="xlarge" title="Subsonic Server URL Ex: http://host:port/subsonic"/><br /> <input type="text" id="Server" name="Server" class="xlarge" title="Subsonic Server URL Ex: http://host:port/subsonic"/><br />
<label for="SubsonicVersion">Subsonic API: <span id="SubsonicVersion"></span></label><br />
</div> </div>
<div class="subsection floatleft"> <div class="subsection floatleft">
<h3 class="title">Keyboard Shortcuts</h3> <h3 class="title">Keyboard Shortcuts</h3>
@ -194,9 +195,9 @@
<div class="clear"></div> <div class="clear"></div>
<div class="subsection floatleft"> <div class="subsection floatleft">
<h3 class="title">Options</h3> <h3 class="title">Options</h3>
<label for="GenrePlaylists">Genres</label><br /> <label for="AutoPlaylists">Genres</label><br />
<select id="Genres" name="Genres" class="large"></select><br /> <select id="Genres" name="Genres" class="large"></select><br />
<input type="text" id="GenrePlaylists" name="GenrePlaylists" class="large" title="Comma separated list of genres for Auto Playlists"/><br /> <input type="text" id="AutoPlaylists" name="AutoPlaylists" class="large" title="Comma separated list of genres for Auto Playlists"/><br />
<label for="AutoAlbumSize">Auto Album Size (Default 15)</label><br /> <label for="AutoAlbumSize">Auto Album Size (Default 15)</label><br />
<input type="text" id="AutoAlbumSize" name="AutoAlbumSize" class="large" title="Number of Albums to Get on the Music Library tab"/><br /> <input type="text" id="AutoAlbumSize" name="AutoAlbumSize" class="large" title="Number of Albums to Get on the Music Library tab"/><br />
<label for="AutoPlaylistSize">Auto Playlist Size (Default 25)</label><br /> <label for="AutoPlaylistSize">Auto Playlist Size (Default 25)</label><br />
@ -254,8 +255,11 @@
<span class="changes"></span> <span class="changes"></span>
</li> </li>
--> -->
<li class="log"><span class="version">9/25/2012 - 2.0.7</span> <li class="log"><span class="version">9/29/2012 - 2.0.7</span>
<span class="changes">Updated to SoundManager2 v297a-20120916</span>
<span class="changes">Implemented <i>updatePlaylist</i> API method. Allows for larger playlists.</span>
<span class="changes">Added support for Podcasts (Thanks to <a href="https://github.com/nithinphilips/MiniSub" target="_blank">nithinphilips</a>)</span> <span class="changes">Added support for Podcasts (Thanks to <a href="https://github.com/nithinphilips/MiniSub" target="_blank">nithinphilips</a>)</span>
<span class="changes">Added Genre support for Auto Playlists (Thanks to <a href="https://github.com/Concept211/MiniSub" target="_blank">Concept211</a> & <a href="https://github.com/orangepeelbeef/MiniSub" target="_blank">orangepeelbeef</a>)</span>
</li> </li>
<li class="log"><span class="version">8/13/2012 - 2.0.6</span> <li class="log"><span class="version">8/13/2012 - 2.0.6</span>
<span class="changes">Minor bugfix</span> <span class="changes">Minor bugfix</span>
@ -375,8 +379,8 @@
<div id="songdetails"> <div id="songdetails">
<div id="coverart"><a id="coverartimage" href="images/albumdefault_120.jpg"><img src="images/albumdefault_56.jpg" alt=""/></a></div> <div id="coverart"><a id="coverartimage" href="images/albumdefault_120.jpg"><img src="images/albumdefault_56.jpg" alt=""/></a></div>
<ul> <ul>
<li id="songdetails_song" class="song"></li> <li id="songdetails_song" class="song" title=""></li>
<li id="songdetails_artist" class="album"></li> <li id="songdetails_artist" class="album" title=""></li>
</ul> </ul>
<div class="rate"><a id="songdetails_rate" class="rate" href="" title="Add To Favorites"></a></div> <div class="rate"><a id="songdetails_rate" class="rate" href="" title="Add To Favorites"></a></div>
<div class="vertshade"></div> <div class="vertshade"></div>

View file

@ -1,3 +1,17 @@
function ping() {
$.ajax({
url: baseURL + '/ping.view?u=' + username + '&p=' + password + '&v=1.6.0&c=' + applicationName + '&f=jsonp',
method: 'GET',
dataType: 'jsonp',
timeout: 10000,
success: function (data) {
if (data["subsonic-response"].status == 'ok') {
version = data["subsonic-response"].version;
$('#SubsonicVersion').html(version);
}
}
});
}
function loadArtists(id, refresh) { function loadArtists(id, refresh) {
if (debug) { console.log("LOAD ARTISTS"); } if (debug) { console.log("LOAD ARTISTS"); }
if (refresh) { if (refresh) {
@ -27,9 +41,6 @@ function loadArtists(id, refresh) {
if (data["subsonic-response"].status === 'ok') { if (data["subsonic-response"].status === 'ok') {
var indexlist, indexname; var indexlist, indexname;
if (data["subsonic-response"].version != '') {
version = data["subsonic-response"].version;
}
// There is a bug in the API that doesn't return a JSON array for one artist // There is a bug in the API that doesn't return a JSON array for one artist
var indexes = []; var indexes = [];
if (data["subsonic-response"].indexes.index !== undefined) { if (data["subsonic-response"].indexes.index !== undefined) {
@ -147,20 +158,23 @@ function loadGenres(refresh) {
} }
var content = $('#AutoPlaylistContainer').html(); var content = $('#AutoPlaylistContainer').html();
if (content === "") { if (content === "") {
var genres = $.cookie('GenrePlaylists'); var genres = $.cookie('AutoPlaylists');
var genresArr = [];
if (genres) { if (genres) {
var genresArr = genres.split(','); genresArr = genres.split(',');
//<li class="item" data-genre="Alternative"><span>Alternative</span><div class="floatright"><a class="play" title="Play" href="" data-genre="Alternative"></a></div><div class="floatright"><a class="add" title="Add To Current Playlist" href="" data-genre="Alternative"></a></div></li> genresArr.unshift('Random');
$.each(genresArr, function (i, genre) { } else {
var html = ""; genresArr.push('Random');
html += '<li class=\"item\" data-genre=\"' + genre + '\">';
html += '<span>' + genre + '</span>';
html += '<div class=\"floatright\"><a class=\"play\" href=\"\" data-genre=\"' + genre + '\" title=\"Play\"></a></div>';
html += '<div class=\"floatright\"><a class=\"add\" href=\"\" data-genre=\"' + genre + '\" title=\"Add To Current Playlist\"></a></div>';
html += '</li>';
$(html).appendTo("#AutoPlaylistContainer");
});
} }
$.each(genresArr, function (i, genre) {
var html = "";
html += '<li class=\"item\" data-genre=\"' + genre + '\">';
html += '<span>' + genre + '</span>';
html += '<div class=\"floatright\"><a class=\"play\" href=\"\" data-genre=\"' + genre + '\" title=\"Play\"></a></div>';
html += '<div class=\"floatright\"><a class=\"add\" href=\"\" data-genre=\"' + genre + '\" title=\"Add To Current Playlist\"></a></div>';
html += '</li>';
$(html).appendTo("#AutoPlaylistContainer");
});
} }
} }
function getAlbums(id, action, appendto) { function getAlbums(id, action, appendto) {
@ -263,7 +277,7 @@ function getAlbumListBy(id) {
}); });
} }
function getRandomSongList(action, appendto, genre, folder) { function getRandomSongList(action, appendto, genre, folder) {
var size,gstring; var size, gstring;
gstring = ''; gstring = '';
if ($.cookie('AutoPlaylistSize') === null) { if ($.cookie('AutoPlaylistSize') === null) {
size = 25; size = 25;
@ -271,14 +285,14 @@ function getRandomSongList(action, appendto, genre, folder) {
size = $.cookie('AutoPlaylistSize'); size = $.cookie('AutoPlaylistSize');
} }
if (genre !== undefined) { if (genre !== undefined) {
gstring = '&genre=' + genre; gstring = '&genre=' + genre;
} }
if (genre === 'Random') { if (genre === 'Random') {
gstring = ''; gstring = '';
} }
if (folder !== undefined) { if (folder !== undefined) {
gstring = '&musicFolderId=' + folder; gstring = '&musicFolderId=' + folder;
} }
$.ajax({ $.ajax({
url: baseURL + '/getRandomSongs.view?u=' + username + '&p=' + password + '&v=' + version + '&c=' + applicationName + '&f=jsonp&size=' + size + gstring, url: baseURL + '/getRandomSongs.view?u=' + username + '&p=' + password + '&v=' + version + '&c=' + applicationName + '&f=jsonp&size=' + size + gstring,
method: 'GET', method: 'GET',
@ -290,6 +304,7 @@ function getRandomSongList(action, appendto, genre, folder) {
$("#TrackContainer").empty(); $("#TrackContainer").empty();
} }
if (action === 'autoplay') { if (action === 'autoplay') {
$("#TrackContainer").empty();
$(appendto).empty(); $(appendto).empty();
} }
// There is a bug in the API that doesn't return a JSON array for one artist // There is a bug in the API that doesn't return a JSON array for one artist
@ -314,6 +329,9 @@ function getRandomSongList(action, appendto, genre, folder) {
html = generateSongHTML(rowcolor, item.id, item.parent, track, item.title, item.artist, item.album, item.coverArt, item.userRating, time['m'], time['s']); html = generateSongHTML(rowcolor, item.id, item.parent, track, item.title, item.artist, item.album, item.coverArt, item.userRating, time['m'], time['s']);
$(html).appendTo(appendto); $(html).appendTo(appendto);
}); });
if (appendto === '#TrackContainer') {
updateMessage(items.length + ' Song(s)');
}
if (appendto === '#CurrentPlaylistContainer') { if (appendto === '#CurrentPlaylistContainer') {
updateMessage(items.length + ' Song(s) Added'); updateMessage(items.length + ' Song(s) Added');
} }
@ -613,20 +631,39 @@ function addToPlaylist(playlistid, from) {
} }
}); });
if (count > 0) { if (count > 0) {
$.ajax({ var runningVersion = parseVersionString(version);
type: 'GET', var minimumVersion = parseVersionString('1.8.0');
url: baseURL + '/createPlaylist.view?u=' + username + '&p=' + password, if (checkVersion(runningVersion, minimumVersion)) {
dataType: 'jsonp', $.ajax({
timeout: 10000, type: 'GET',
data: { v: version, c: applicationName, f: "jsonp", playlistId: playlistid, songId: currentsongs }, url: baseURL + '/updatePlaylist.view?u=' + username + '&p=' + password,
success: function () { dataType: 'jsonp',
$('table.songlist tr.song').each(function () { timeout: 10000,
$(this).removeClass('selected'); data: { v: version, c: applicationName, f: "jsonp", playlistId: playlistid, songIdToAdd: selected },
}); success: function () {
updateMessage('Playlist Updated!'); $('table.songlist tr.song').each(function () {
}, $(this).removeClass('selected');
traditional: true // Fixes POST with an array in JQuery 1.4 });
}); updateMessage('Playlist Updated!');
},
traditional: true // Fixes POST with an array in JQuery 1.4
});
} else {
$.ajax({
type: 'GET',
url: baseURL + '/createPlaylist.view?u=' + username + '&p=' + password,
dataType: 'jsonp',
timeout: 10000,
data: { v: version, c: applicationName, f: "jsonp", playlistId: playlistid, songId: currentsongs },
success: function () {
$('table.songlist tr.song').each(function () {
$(this).removeClass('selected');
});
updateMessage('Playlist Updated!');
},
traditional: true // Fixes POST with an array in JQuery 1.4
});
}
} }
} }
}); });
@ -747,7 +784,7 @@ function getPlaylist(id, action, appendto) {
$(html).appendTo(appendto); $(html).appendTo(appendto);
}); });
if (appendto === '#TrackContainer tbody') { if (appendto === '#TrackContainer tbody') {
updateMessage(playlist.name + ': ' + count + ' Songs'); updateMessage(count + ' Song(s)');
} }
if (appendto === '#CurrentPlaylistContainer tbody') { if (appendto === '#CurrentPlaylistContainer tbody') {
updateMessage(children.length + ' Song(s) Added'); updateMessage(children.length + ' Song(s) Added');
@ -856,7 +893,7 @@ function getPodcast(id, action, appendto) {
count++; count++;
}); });
if (appendto === '#PodcastContainer tbody') { if (appendto === '#PodcastContainer tbody') {
updateMessage(channel.title + ': ' + count + ' Songs'); updateMessage(count + ' Song(s)');
} }
if (appendto === '#CurrentPlaylistContainer tbody') { if (appendto === '#CurrentPlaylistContainer tbody') {
updateMessage(count + ' Song(s) Added'); updateMessage(count + ' Song(s) Added');

View file

@ -68,7 +68,7 @@ function generateSongHTML(rowcolor, childid, parentid, track, title, artist, alb
} else { } else {
coverartSrc = baseURL + '/getCoverArt.view?v=' + version + '&c=' + applicationName + '&f=jsonp&size=25&id=' + coverart; coverartSrc = baseURL + '/getCoverArt.view?v=' + version + '&c=' + applicationName + '&f=jsonp&size=25&id=' + coverart;
} }
html += '<td class=\"album\"><a href="javascript:getAlbums(\'' + parentid + '\',\'\',\'#AlbumRows\')">' + album + '<img src=\"' + coverartSrc + '\" /></a></td>'; html += '<td class=\"album\"><a href="javascript:getAlbums(\'' + parentid + '\',\'\',\'#AlbumRows\')"><img src=\"' + coverartSrc + '\" />' + album + '</a></td>';
html += '<td class=\"time\">' + m + ':' + s + '</td>'; html += '<td class=\"time\">' + m + ':' + s + '</td>';
html += '</tr>'; html += '</tr>';
return html; return html;
@ -95,7 +95,7 @@ function generatePodcastHTML(rowcolor, childid, parentid, track, title, descript
} else { } else {
coverartSrc = baseURL + '/getCoverArt.view?v=' + version + '&c=' + applicationName + '&f=jsonp&size=25&id=' + coverart; coverartSrc = baseURL + '/getCoverArt.view?v=' + version + '&c=' + applicationName + '&f=jsonp&size=25&id=' + coverart;
} }
html += '<td class=\"album\"><a href="javascript:getAlbums(\'' + parentid + '\',\'\',\'#AlbumRows\')">' + album + '<img src=\"' + coverartSrc + '\" /></a></td>'; html += '<td class=\"album\"><a href="javascript:getAlbums(\'' + parentid + '\',\'\',\'#AlbumRows\')"><img src=\"' + coverartSrc + '\" />' + album + '</a></td>';
html += '<td class=\"time\">' + m + ':' + s + '</td>'; html += '<td class=\"time\">' + m + ':' + s + '</td>';
html += '</tr>'; html += '</tr>';
return html; return html;

View file

@ -33,9 +33,11 @@ function playSong(el, songid, albumid) {
$('#songdetails_rate').attr('class', 'rate'); $('#songdetails_rate').attr('class', 'rate');
} }
$('#songdetails_song').html(title); $('#songdetails_song').html(title);
$('#songdetails_song').attr('title', title);
$('#songdetails_song').attr('parentid', albumid); $('#songdetails_song').attr('parentid', albumid);
$('#songdetails_song').attr('childid', songid); $('#songdetails_song').attr('childid', songid);
$('#songdetails_artist').html(artist + ' - ' + album); $('#songdetails_artist').html(artist + ' - ' + album);
$('#songdetails_artist').attr('title', artist + ' - ' + album);
var coverartSrc, coverartFullSrc; var coverartSrc, coverartFullSrc;
if (coverart == undefined) { if (coverart == undefined) {
coverartSrc = 'images/albumdefault_50.jpg'; coverartSrc = 'images/albumdefault_50.jpg';

View file

@ -184,3 +184,31 @@ function closeAllNotifications() {
notifications[notification].cancel(); notifications[notification].cancel();
} }
} }
function parseVersionString(str) {
if (typeof (str) != 'string') { return false; }
var x = str.split('.');
// parse from string or default to 0 if can't parse
var maj = parseInt(x[0]) || 0;
var min = parseInt(x[1]) || 0;
var pat = parseInt(x[2]) || 0;
return {
major: maj,
minor: min,
patch: pat
}
}
function checkVersion(runningVersion, minimumVersion) {
if (runningVersion.major >= minimumVersion.major) {
if (runningVersion.minor >= minimumVersion.minor) {
if (runningVersion.patch >= minimumVersion.patch) {
return true;
} else {
return false;
}
} else {
return false;
}
} else {
return false;
}
}

View file

@ -62,8 +62,6 @@ function resizeSMSection(x) {
$('#BottomContainer').css({ 'width': (newsmwidth - 16) + 'px' }); $('#BottomContainer').css({ 'width': (newsmwidth - 16) + 'px' });
$.cookie('defaultsmwidth', newwidth, { expires: 365, path: '/' }); $.cookie('defaultsmwidth', newwidth, { expires: 365, path: '/' });
var ulwidth = newsmwidth + 6; var ulwidth = newsmwidth + 6;
$('#AlbumContainer').css({ 'margin-left': ulwidth + 'px' }); $('#AlbumContainer, #TrackContainer, #PodcastContainer').css({ 'margin-left': ulwidth + 'px' });
$('#TrackContainer').css({ 'margin-left': ulwidth + 'px' });
$('#PodcastContainer').css({ 'margin-left': ulwidth + 'px' });
} }
} }

View file

@ -2,7 +2,7 @@
//User config staff //User config staff
$('#Username').val($.cookie('username')); $('#Username').val($.cookie('username'));
//$('#Password').val($.cookie('passwordenc')); //$('#Password').val($.cookie('passwordenc'));
$('#GenrePlaylists').val($.cookie('GenrePlaylists')); $('#AutoPlaylists').val($.cookie('AutoPlaylists'));
$('#AutoAlbumSize').val($.cookie('AutoAlbumSize')); $('#AutoAlbumSize').val($.cookie('AutoAlbumSize'));
$('#AutoPlaylistSize').val($.cookie('AutoPlaylistSize')); $('#AutoPlaylistSize').val($.cookie('AutoPlaylistSize'));
$('#Server').val($.cookie('Server')); $('#Server').val($.cookie('Server'));
@ -73,6 +73,7 @@
if ($.cookie('Notification_NowPlaying')) { if ($.cookie('Notification_NowPlaying')) {
updateNowPlaying(true); updateNowPlaying(true);
} }
ping();
} }
// Tabs - Click Event // Tabs - Click Event
@ -391,9 +392,12 @@
} }
}); });
$('#action_CurrentSelectAll').click(function () { $('#action_CurrentSelectAll').click(function () {
var count = 0;
$('#CurrentPlaylist tr.song').each(function () { $('#CurrentPlaylist tr.song').each(function () {
$(this).addClass('selected'); $(this).addClass('selected');
count++;
}); });
updateMessage(count + ' Song(s) Selected');
return false; return false;
}); });
$('#action_CurrentSelectNone').click(function () { $('#action_CurrentSelectNone').click(function () {
@ -424,8 +428,7 @@
return false; return false;
}); });
$('#PlaylistContainer li.item').live('click', function () { $('#PlaylistContainer li.item').live('click', function () {
$('#AutoPlaylistContainer li').removeClass('selected'); $('#AutoPlaylistContainer li, #FolderContainer li, #PlaylistContainer li').removeClass('selected');
$('#PlaylistContainer li').removeClass('selected');
$(this).addClass('selected'); $(this).addClass('selected');
getPlaylist($(this).attr("id"), '', '#TrackContainer tbody'); getPlaylist($(this).attr("id"), '', '#TrackContainer tbody');
}); });
@ -579,12 +582,12 @@
if (password != "") { if (password != "") {
$.cookie('passwordenc', 'enc:' + HexEncode(password), { expires: 365 }); $.cookie('passwordenc', 'enc:' + HexEncode(password), { expires: 365 });
} }
var GenrePlaylists = $('#GenrePlaylists').val(); var AutoPlaylists = $('#AutoPlaylists').val();
if (GenrePlaylists != '') { $.cookie('GenrePlaylists', GenrePlaylists, { expires: 365 }); } $.cookie('AutoPlaylists', AutoPlaylists, { expires: 365 });
var AutoAlbumSize = $('#AutoAlbumSize').val(); var AutoAlbumSize = $('#AutoAlbumSize').val();
if (AutoAlbumSize != '') { $.cookie('AutoAlbumSize', AutoAlbumSize, { expires: 365 }); } $.cookie('AutoAlbumSize', AutoAlbumSize, { expires: 365 });
var AutoPlaylistSize = $('#AutoPlaylistSize').val(); var AutoPlaylistSize = $('#AutoPlaylistSize').val();
if (AutoPlaylistSize != '') { $.cookie('AutoPlaylistSize', AutoPlaylistSize, { expires: 365 }); } $.cookie('AutoPlaylistSize', AutoPlaylistSize, { expires: 365 });
var server = $('#Server').val(); var server = $('#Server').val();
if (server != "") { if (server != "") {
$.cookie('Server', server, { expires: 365 }); $.cookie('Server', server, { expires: 365 });
@ -597,14 +600,14 @@
}); });
$('#Genres').live('change', function () { $('#Genres').live('change', function () {
var genre = $(this).val(); var genre = $(this).val();
var currentGenres = $('#GenrePlaylists').val(); var currentGenres = $('#AutoPlaylists').val();
var newGenres; var newGenres;
if (currentGenres == '') { if (currentGenres == '') {
newGenres = genre; newGenres = genre;
} else { } else {
newGenres = currentGenres + ', ' + genre; newGenres = currentGenres + ', ' + genre;
} }
$('#GenrePlaylists').val(newGenres); $('#AutoPlaylists').val(newGenres);
}); });
$('#HideAZ').live('click', function () { $('#HideAZ').live('click', function () {
if ($('#HideAZ').is(':checked')) { if ($('#HideAZ').is(':checked')) {
@ -700,5 +703,5 @@
} }
}).disableSelection(); }).disableSelection();
}); // End document.ready }); // End document.ready

View file

@ -38,7 +38,7 @@ h3.title
#container { #container {
text-align: left; text-align: left;
min-height: 600px; /*min-height: 600px;*/
min-width: 810px; min-width: 810px;
} }
#nav #nav
@ -174,7 +174,7 @@ a#logo:hover
overflow: auto; overflow: auto;
background: #fff; background: #fff;
border: 1px solid #cbcbcb; border: 1px solid #cbcbcb;
margin-top: 5px; margin-top: 4px;
} }
.fullsection .fullsection
{ {
@ -488,6 +488,10 @@ table.songlist tr.song td.album a
{ {
color: #829FC0; color: #829FC0;
text-decoration: none; text-decoration: none;
float: left;
overflow: hidden;
white-space: nowrap;
font-size: 12px;
} }
table.songlist tr.song td.album a:hover table.songlist tr.song td.album a:hover
{ {
@ -675,6 +679,7 @@ background-color: #8dbdd8;
.subactions .subactions
{ {
height: 29px; height: 29px;
width: 620px;
margin: 4px 0 0 0; margin: 4px 0 0 0;
padding: 0 0 0 5px; padding: 0 0 0 5px;
} }