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 id="Playlists" class="smsection floatleft noselect">
<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 class="simplelist"><li class="index">Folder Playlists</li></ul>
<ul id="FolderContainer" class="simplelist mainlist"></ul>
@ -179,6 +179,7 @@
<input type="password" id="Password" name="Password" class="large"/><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 />
<label for="SubsonicVersion">Subsonic API: <span id="SubsonicVersion"></span></label><br />
</div>
<div class="subsection floatleft">
<h3 class="title">Keyboard Shortcuts</h3>
@ -194,9 +195,9 @@
<div class="clear"></div>
<div class="subsection floatleft">
<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 />
<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 />
<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 />
@ -254,8 +255,11 @@
<span class="changes"></span>
</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 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 class="log"><span class="version">8/13/2012 - 2.0.6</span>
<span class="changes">Minor bugfix</span>
@ -375,8 +379,8 @@
<div id="songdetails">
<div id="coverart"><a id="coverartimage" href="images/albumdefault_120.jpg"><img src="images/albumdefault_56.jpg" alt=""/></a></div>
<ul>
<li id="songdetails_song" class="song"></li>
<li id="songdetails_artist" class="album"></li>
<li id="songdetails_song" class="song" title=""></li>
<li id="songdetails_artist" class="album" title=""></li>
</ul>
<div class="rate"><a id="songdetails_rate" class="rate" href="" title="Add To Favorites"></a></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) {
if (debug) { console.log("LOAD ARTISTS"); }
if (refresh) {
@ -27,9 +41,6 @@ function loadArtists(id, refresh) {
if (data["subsonic-response"].status === 'ok') {
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
var indexes = [];
if (data["subsonic-response"].indexes.index !== undefined) {
@ -147,10 +158,14 @@ function loadGenres(refresh) {
}
var content = $('#AutoPlaylistContainer').html();
if (content === "") {
var genres = $.cookie('GenrePlaylists');
var genres = $.cookie('AutoPlaylists');
var genresArr = [];
if (genres) {
var 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 = genres.split(',');
genresArr.unshift('Random');
} else {
genresArr.push('Random');
}
$.each(genresArr, function (i, genre) {
var html = "";
html += '<li class=\"item\" data-genre=\"' + genre + '\">';
@ -161,7 +176,6 @@ function loadGenres(refresh) {
$(html).appendTo("#AutoPlaylistContainer");
});
}
}
}
function getAlbums(id, action, appendto) {
$('.first').trigger('click');
@ -263,7 +277,7 @@ function getAlbumListBy(id) {
});
}
function getRandomSongList(action, appendto, genre, folder) {
var size,gstring;
var size, gstring;
gstring = '';
if ($.cookie('AutoPlaylistSize') === null) {
size = 25;
@ -290,6 +304,7 @@ function getRandomSongList(action, appendto, genre, folder) {
$("#TrackContainer").empty();
}
if (action === 'autoplay') {
$("#TrackContainer").empty();
$(appendto).empty();
}
// 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).appendTo(appendto);
});
if (appendto === '#TrackContainer') {
updateMessage(items.length + ' Song(s)');
}
if (appendto === '#CurrentPlaylistContainer') {
updateMessage(items.length + ' Song(s) Added');
}
@ -613,6 +631,24 @@ function addToPlaylist(playlistid, from) {
}
});
if (count > 0) {
var runningVersion = parseVersionString(version);
var minimumVersion = parseVersionString('1.8.0');
if (checkVersion(runningVersion, minimumVersion)) {
$.ajax({
type: 'GET',
url: baseURL + '/updatePlaylist.view?u=' + username + '&p=' + password,
dataType: 'jsonp',
timeout: 10000,
data: { v: version, c: applicationName, f: "jsonp", playlistId: playlistid, songIdToAdd: selected },
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
});
} else {
$.ajax({
type: 'GET',
url: baseURL + '/createPlaylist.view?u=' + username + '&p=' + password,
@ -629,6 +665,7 @@ function addToPlaylist(playlistid, from) {
});
}
}
}
});
} else {
var reply = prompt("Choose a name for your new playlist.", "");
@ -747,7 +784,7 @@ function getPlaylist(id, action, appendto) {
$(html).appendTo(appendto);
});
if (appendto === '#TrackContainer tbody') {
updateMessage(playlist.name + ': ' + count + ' Songs');
updateMessage(count + ' Song(s)');
}
if (appendto === '#CurrentPlaylistContainer tbody') {
updateMessage(children.length + ' Song(s) Added');
@ -856,7 +893,7 @@ function getPodcast(id, action, appendto) {
count++;
});
if (appendto === '#PodcastContainer tbody') {
updateMessage(channel.title + ': ' + count + ' Songs');
updateMessage(count + ' Song(s)');
}
if (appendto === '#CurrentPlaylistContainer tbody') {
updateMessage(count + ' Song(s) Added');

View file

@ -68,7 +68,7 @@ function generateSongHTML(rowcolor, childid, parentid, track, title, artist, alb
} else {
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 += '</tr>';
return html;
@ -95,7 +95,7 @@ function generatePodcastHTML(rowcolor, childid, parentid, track, title, descript
} else {
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 += '</tr>';
return html;

View file

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

View file

@ -184,3 +184,31 @@ function closeAllNotifications() {
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' });
$.cookie('defaultsmwidth', newwidth, { expires: 365, path: '/' });
var ulwidth = newsmwidth + 6;
$('#AlbumContainer').css({ 'margin-left': ulwidth + 'px' });
$('#TrackContainer').css({ 'margin-left': ulwidth + 'px' });
$('#PodcastContainer').css({ 'margin-left': ulwidth + 'px' });
$('#AlbumContainer, #TrackContainer, #PodcastContainer').css({ 'margin-left': ulwidth + 'px' });
}
}

View file

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

View file

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