diff --git a/README b/README index 7d3babb..5c00128 100644 --- a/README +++ b/README @@ -12,6 +12,7 @@ External Subsonic Music Player 10/1/2011 .010 fix for subdirectory custom installs 10/2/2011 .011 added play button from album list 10/13/2011 .012 added Current Playlist, fixed some bugs +10/14/2011 .013 moved auto playlists, album display tweaks TO DO: (In no particular order...) - Jukebox Control diff --git a/index.html b/index.html index 3f96914..5d6bf32 100644 --- a/index.html +++ b/index.html @@ -105,9 +105,9 @@ getAlbums(albumid, artistid, 'add', '#CurrentPlaylistContainer'); return false; }); - $('li.album a.title').live('click', function (e) { - var albumid = $(this).parent().attr('childid'); - var artistid = $(this).parent().attr('parentid'); + $('li.album').live('click', function (e) { + var albumid = $(this).attr('childid'); + var artistid = $(this).attr('parentid'); getAlbums(albumid, artistid, '', '#AlbumContainer'); return false; }); @@ -438,6 +438,14 @@
  • + @@ -467,14 +475,6 @@
    -
    diff --git a/js/app.js b/js/app.js index fa57af5..0989061 100644 --- a/js/app.js +++ b/js/app.js @@ -15,6 +15,7 @@ function loadTabContent(tab) { loadArtists(); // Load Albums Click Event $('ul#ArtistContainer li.item').live('click', function () { + $('ul#AutoAlbumContainer li').removeClass('selected'); $('ul#ArtistContainer li').removeClass('selected'); $(this).addClass('selected'); getAlbums($(this).attr("id"), '', '', '#AlbumContainer'); @@ -24,6 +25,12 @@ function loadTabContent(tab) { $('#Artists').stop().scrollTo(el); return false; }); + $('ul#AutoAlbumContainer li.item').live('click', function () { + $('ul#AutoAlbumContainer li').removeClass('selected'); + $('ul#ArtistContainer li').removeClass('selected'); + $(this).addClass('selected'); + getAlbumListBy($(this).attr("id")); + }); break; case '#tabPlaylists': loadPlaylists(); @@ -41,11 +48,6 @@ function loadTabContent(tab) { getPlaylist($(this).parent().parent().attr("id"), '', '#CurrentPlaylistContainer'); return false; }); - $('ul#AutoPlaylistContainer li.item').live('click', function () { - $('ul#AutoPlaylistContainer li').removeClass('selected'); - $(this).addClass('selected'); - getAlbumListBy($(this).attr("id")); - }); break; case '#tabPreferences': //loadPreferences(); @@ -122,14 +124,8 @@ function getAlbums(id, artistid, action, appendto) { } else { rowcolor = 'odd'; } - if (child.isDir == true) { - albumhtml = '
  • '; - albumhtml += '
    '; - albumhtml += '
    '; - albumhtml += '
    '; - albumhtml += '' + child.title + ''; - albumhtml += '
  • '; + albumhtml = generateAlbumHTML(rowcolor, child.id, child.parent, child.coverArt, child.title, child.artist); $(albumhtml).appendTo("#AlbumContainer"); } else { var track; @@ -138,7 +134,7 @@ function getAlbums(id, artistid, action, appendto) { albumhtml = generateSongHTML(rowcolor, child.id, child.parent, track, child.title, child.album, time['m'], time['s']); if (appendto == '#AlbumContainer') { if (i == 0) { - var backhtml = '
  • « Back
  • '; + var backhtml = '
  • « Back to ' + child.artist + '
  • '; $(backhtml).appendTo("#AlbumContainer"); } } @@ -152,6 +148,53 @@ function getAlbums(id, artistid, action, appendto) { } }); } +function getAlbumListBy(id) { + $.ajax({ + url: baseURL + '/getAlbumList.view?v=1.6.0&c=subweb&f=json&size=10&type=' + id, + method: 'GET', + dataType: 'json', + beforeSend: function (req) { + req.setRequestHeader('Authorization', auth); + }, + success: function (data) { + if (data["subsonic-response"].albumList.album != undefined) { + $("#AlbumContainer").empty(); + // There is a bug in the API that doesn't return a JSON array for one artist + var albums = []; + if (data["subsonic-response"].albumList.album.length > 0) { + albums = data["subsonic-response"].albumList.album; + } else { + albums[0] = data["subsonic-response"].albumList.album; + } + + var rowcolor; + var html; + $.each(albums, function (i, album) { + if (i % 2 == 0) { + rowcolor = 'even'; + } else { + rowcolor = 'odd'; + } + albumhtml = generateAlbumHTML(rowcolor, album.id, album.parent, album.coverArt, album.title, album.artist); + $(albumhtml).appendTo("#AlbumContainer") + }); + } else { + $('#AlbumContainer').empty(); + } + } + }); +} +function generateAlbumHTML(rowcolor, childid, parentid, coverart, title, artist) { + var html; + html = '
  • '; + html += '
    '; + html += '
    '; + html += '
    '; + html += '' + title + ''; + html += '' + artist + ''; + html += '
  • '; + return html; +} function generateSongHTML(rowcolor, childid, parentid, track, title, album, m, s) { var html; html = '
  • '; @@ -645,67 +688,6 @@ function getPlaylist(id, action, appendto) { } }); } -function getAlbumListBy(id) { - $.ajax({ - url: baseURL + '/getAlbumList.view?v=1.6.0&c=subweb&f=json&type=' + id, - method: 'GET', - dataType: 'json', - beforeSend: function (req) { - req.setRequestHeader('Authorization', auth); - }, - success: function (data) { - if (data["subsonic-response"].albumList.album != undefined) { - $("#TrackContainer").empty(); - // There is a bug in the API that doesn't return a JSON array for one artist - var albums = []; - if (data["subsonic-response"].albumList.album.length > 0) { - albums = data["subsonic-response"].albumList.album; - } else { - albums[0] = data["subsonic-response"].albumList.album; - } - - var rowcolor; - var html; - $.each(albums, function (i, album) { - $.ajax({ - url: baseURL + '/getMusicDirectory.view?v=1.6.0&c=subweb&f=json&size=5&id=' + album.id, - method: 'GET', - dataType: 'json', - beforeSend: function (req) { - req.setRequestHeader('Authorization', auth); - }, - success: function (data) { - var children = []; - if (data["subsonic-response"].directory.child.length > 0) { - children = data["subsonic-response"].directory.child; - } else { - children[0] = data["subsonic-response"].directory.child; - } - $.each(children, function (i, child) { - if (i % 2 == 0) { - rowcolor = 'even'; - } else { - rowcolor = 'odd'; - } - var track; - if (child.track === undefined) { track = " "; } else { track = child.track; } - var time = secondsToTime(child.duration); - html = '
  • '; - html += '' + track + ' '; - html += child.title; - html += ' ' + time['m'] + ':' + time['s'] + ''; - html += '
  • '; - $(html).appendTo("#TrackContainer"); - }); - } - }); - }); - } else { - $('ul#TrackContainer').empty(); - } - } - }); -} /* Reusable Functions */ function confirmDelete() { diff --git a/style/Style.css b/style/Style.css index 014257d..1e90635 100644 --- a/style/Style.css +++ b/style/Style.css @@ -289,7 +289,14 @@ ul.songlist li.album ul.songlist li.album a.title { display: block; - padding: 16px 115px; + padding: 9px 115px 0px; + margin-bottom: -3px; +} +ul.songlist li.album span.artist +{ + font-size: 11px; + color: #78B0EC; + padding-left: 15px; } ul.songlist .albumart { @@ -402,7 +409,7 @@ ul.songlist li.selected background-color: #4B95E5; border-bottom: 1px solid #73ABE7; } -#ArtistContainer +#ArtistContainer, #AutoAlbumContainer { margin: 0 30px 0 0; }