3.4.2 Archive tab updates

This commit is contained in:
Trevor Squillario 2014-05-05 18:50:17 -04:00
parent 1f8c286a13
commit e5318f395b
8 changed files with 183 additions and 112 deletions

View file

@ -1,5 +1,5 @@
JamStash.controller('ArchiveCtrl', JamStash.controller('ArchiveCtrl',
function ArchiveCtrl($scope, $rootScope, $location, $routeParams, $http, utils, globals, model, notifications, player, archive, json) { function ArchiveCtrl($scope, $rootScope, $location, $routeParams, $http, $timeout, utils, globals, model, notifications, player, archive, json) {
$scope.settings = globals.settings; $scope.settings = globals.settings;
$scope.itemType = 'archive'; $scope.itemType = 'archive';
$rootScope.song = []; $rootScope.song = [];
@ -35,6 +35,8 @@ function ArchiveCtrl($scope, $rootScope, $location, $routeParams, $http, utils,
if ($scope.SavedCollections.indexOf(newValue) == -1) { if ($scope.SavedCollections.indexOf(newValue) == -1) {
$scope.SavedCollections.push(newValue); $scope.SavedCollections.push(newValue);
$scope.writeSavedCollection(); $scope.writeSavedCollection();
var index = $scope.AllArtists.indexOf(newValue);
$scope.AllArtists.splice(index, 1);
} }
}; };
$scope.deleteSavedCollection = function (index) { $scope.deleteSavedCollection = function (index) {
@ -79,7 +81,7 @@ function ArchiveCtrl($scope, $rootScope, $location, $routeParams, $http, utils,
} else { } else {
utils.setValue('AlbumSort', null, true); utils.setValue('AlbumSort', null, true);
} }
$scope.getAlbums(''); $scope.getAlbums($scope.selectedArtist);
} }
}); });
$scope.getYears = function (startYear) { $scope.getYears = function (startYear) {
@ -98,7 +100,7 @@ function ArchiveCtrl($scope, $rootScope, $location, $routeParams, $http, utils,
}; };
$scope.filterSave = function () { $scope.filterSave = function () {
if ($scope.selectedArtist) { if ($scope.selectedArtist) {
$scope.getAlbums('', ''); $scope.getAlbums($scope.selectedArtist, $scope.filter);
} }
}; };
/* End Filter */ /* End Filter */
@ -118,14 +120,23 @@ function ArchiveCtrl($scope, $rootScope, $location, $routeParams, $http, utils,
$scope.song = data.song; $scope.song = data.song;
$scope.album = data.album; $scope.album = data.album;
$scope.selectedArtist = data.selectedArtist; $scope.selectedArtist = data.selectedArtist;
$scope.BreadCrumbs = data.breadcrumb;
}); });
}; };
$scope.getSongs = function (id, action) { $scope.getSongs = function (id, action) {
archive.getSongs(id, action).then(function (data) { archive.getSongs(id, action).then(function (data) {
$scope.song = data.song;
$scope.album = data.album; $scope.album = data.album;
$scope.song = data.song;
$scope.selectedAlbum = data.selectedAlbum; $scope.selectedAlbum = data.selectedAlbum;
$scope.BreadCrumbs = data.breadcrumb;
//$rootScope.showSongs();
//alert($("#songs").html())
//utils.safeApply();
$timeout(
function () {
$.fancybox.update();
}
);
}); });
}; };
$scope.scrollToTop = function () { $scope.scrollToTop = function () {
@ -149,13 +160,13 @@ function ArchiveCtrl($scope, $rootScope, $location, $routeParams, $http, utils,
/* Launch on Startup */ /* Launch on Startup */
//$scope.getArtists(); //$scope.getArtists();
//$scope.getCollections(); $scope.getAlbums();
if ($routeParams.artist) { if ($routeParams.artist) {
if ($routeParams.album) { if ($routeParams.album) {
//collection:(GreenskyBluegrass) AND format:(MP3) AND identifier:(gsbg2013-09-20.flac16) //collection:(GreenskyBluegrass) AND format:(MP3) AND identifier:(gsbg2013-09-20.flac16)
$scope.getAlbums('', $routeParams.album); $scope.getSongs($routeParams.album);
} else { } else {
$scope.getAlbums($routeParams.artist, ''); $scope.getAlbums($routeParams.artist);
} }
$scope.addSavedCollection($routeParams.artist); $scope.addSavedCollection($routeParams.artist);
} }

View file

@ -391,6 +391,7 @@ function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, $htt
$scope.getGenres(); $scope.getGenres();
$scope.getPodcasts(); $scope.getPodcasts();
$scope.openDefaultSection(); $scope.openDefaultSection();
$scope.getMusicFolders();
if ($routeParams.artistId && $routeParams.albumId) { if ($routeParams.artistId && $routeParams.albumId) {
$scope.getAlbumByTag($routeParams.albumId); $scope.getAlbumByTag($routeParams.albumId);
} else if ($routeParams.artistId) { } else if ($routeParams.artistId) {

View file

@ -160,6 +160,38 @@ function AppCtrl($scope, $rootScope, $document, $window, $location, $cookieStore
title: null title: null
} }
}); });
/*
$('.showSongs').fancybox({
href: '#songs',
autoWidth: false,
width: '100%',
//margin: [50, 10, 50, 10], // top, right, bottom, left
openEffect: 'none',
closeEffect: 'none',
beforeLoad: function () {
if ($rootScope.queue == 0) {
//this.close();
}
},
helpers: {
title: null
}
});
$rootScope.showSongs = function () {
alert($("#songs").html())
$.fancybox({
type: 'inline',
content: $("#songs").html(),
autoWidth: false,
width: '100%',
transitionIn: 'elastic',
transitionOut: 'elastic',
helpers: {
title: null
}
});
}
*/
$('#audiocontainer .scrubber').mouseover(function (e) { $('#audiocontainer .scrubber').mouseover(function (e) {
$('.audiojs .scrubber').stop().animate({ height: '8px' }); $('.audiojs .scrubber').stop().animate({ height: '8px' });
@ -507,8 +539,7 @@ function AppCtrl($scope, $rootScope, $document, $window, $location, $cookieStore
$scope.loadSettings(); $scope.loadSettings();
utils.switchTheme(globals.settings.Theme); utils.switchTheme(globals.settings.Theme);
if ($scope.loggedIn()) { if ($scope.loggedIn()) {
$scope.ping(); //$scope.ping();
$scope.getMusicFolders();
if (globals.settings.SaveTrackPosition) { if (globals.settings.SaveTrackPosition) {
player.loadTrackPosition(); player.loadTrackPosition();
player.startSaveTrackPosition(); player.startSaveTrackPosition();

View file

@ -3,7 +3,7 @@
"date": "5/4/2014", "version": "3.4.1", "date": "5/4/2014", "version": "3.4.1",
"changes": [ "changes": [
{ "text": "- Tab state saved, consolidated Subsonic artists, playlist and podcasts" }, { "text": "- Tab state saved, consolidated Subsonic artists, playlist and podcasts" },
{ "text": "- Archive.org tab, expanded Collection search" } { "text": "- Archive.org tab, Collection search, added breadcrumb" }
] ]
}, },
{ {

View file

@ -28,7 +28,7 @@
</li> </li>
</ul> </ul>
<ul class="simplelist mainlist noselect"> <ul class="simplelist mainlist noselect">
<li class="item" ng-repeat="o in AllArtists" ng-click="getAlbums(o)" ng-class="{ 'selected': selectedArtist == o }"> <li class="item" ng-repeat="o in AllArtists" ng-click="getAlbums(o)">
<div class="infolink"> <div class="infolink">
<a href="" class="hover" title="Save Collection" ng-click="addSavedCollection(o)" stop-event="click"> <img src="images/pin_gl_12x12.png" /> </a> <a href="" class="hover" title="Save Collection" ng-click="addSavedCollection(o)" stop-event="click"> <img src="images/pin_gl_12x12.png" /> </a>
</div> </div>
@ -50,11 +50,17 @@
<input type="text" id="Description" name="Description" class="m" ng-model="filter.Description" placeholder="Description" title="Description" /> <input type="text" id="Description" name="Description" class="m" ng-model="filter.Description" placeholder="Description" title="Description" />
<a href="" class="button" ng-click="filterSave()"><img class="pad" src="images/magnifying_glass_alt_12x12.png" /></a>&nbsp; <a href="" class="button" ng-click="filterSave()"><img class="pad" src="images/magnifying_glass_alt_12x12.png" /></a>&nbsp;
</form> </form>
<div id="BreadCrumb">
<div id="BreadCrumbs" class="floatleft">
<div class="crumb" ng-repeat="o in BreadCrumbs | filter:{type:'artist'}"><a ng-click="getAlbums(o.name, filter)">{{o.name}}</a> &gt;</div>
<div class="crumb" ng-repeat="o in BreadCrumbs | filter:{type:'album'}"><a ng-click="getSongs(o.id, '')">{{o.name}}</a> &gt;</div>
</div>
</div>
</li> </li>
</ul> </ul>
<div class="clear"></div> <div class="clear"></div>
<ul class="simplelist songlist noselect"> <ul class="simplelist songlist noselect">
<li class="album" ng-repeat="o in album" ng-switch on="o.type" ng-class="{'selected': selectedAlbum == o.id}" ng-click="getSongs(o.id, '')"> <li class="album showSongs" ng-repeat="o in album" ng-switch on="o.type" ng-class="{'selected': selectedAlbum == o.id}" ng-click="getSongs(o.id, '')">
<div id="{{'AlbumInfo' + $index}}" class="infolink"> <div id="{{'AlbumInfo' + $index}}" class="infolink">
<a href="" class="hover" title="More Info..." ng-click="toggleSubmenu('#submenu_AlbumInfo' + $index, '#AlbumInfo' + $index, 'right', 10)" stop-event="click"><img src="images/info_gl_6x12.png" /></a> <a href="" class="hover" title="More Info..." ng-click="toggleSubmenu('#submenu_AlbumInfo' + $index, '#AlbumInfo' + $index, 'right', 10)" stop-event="click"><img src="images/info_gl_6x12.png" /></a>
</div> </div>
@ -75,7 +81,9 @@
<div class="description shadow" ng-bind-html="o.description"></div> <div class="description shadow" ng-bind-html="o.description"></div>
<div class="clear"></div> <div class="clear"></div>
</li> </li>
<div ng-if="song.length > 0" ng-include src="'js/partials/songs.html'"></div> <ul class="simplelist songlist noselect" ng-if="song.length > 0">
<div class="songs" ng-include src="'js/partials/songs.html'"></div>
</ul>
</ul> </ul>
</div> </div>
</div> </div>

View file

@ -1341,110 +1341,122 @@ JamStash.factory('archive', function ($rootScope, $http, $q, $sce, globals, mode
}, },
getAlbums: function (name, filter) { getAlbums: function (name, filter) {
var deferred = $q.defer(); var deferred = $q.defer();
var url = globals.archiveUrl + 'advancedsearch.php?q='; if (name) {
if (name !== '') { var url = globals.archiveUrl + 'advancedsearch.php?q=';
content.selectedArtist = name; if (name !== '') {
url += 'collection:(' + name + ') AND format:(MP3)'; content.selectedArtist = name;
} else if (content.selectedArtist) { url += 'collection:(' + name + ') AND format:(MP3)';
name = content.selectedArtist; } else if (content.selectedArtist) {
url += 'collection:(' + content.selectedArtist + ') AND format:(MP3)'; name = content.selectedArtist;
} else { url += 'collection:(' + content.selectedArtist + ') AND format:(MP3)';
url += 'collection:(' + name + ')'; } else {
} url += 'collection:(' + name + ')';
if (filter.Source) {
url += ' AND source:(' + filter.Source + ')';
}
if (filter.Year) {
if (parseInt(filter.Year)) {
url += ' AND year:(' + filter.Year + ')';
} }
} content.breadcrumb = [];
if (filter.Description) { content.breadcrumb.push({ 'type': 'artist', 'id': name, 'name': name });
url += ' AND description:(' + filter.Description + ')';
} if (filter.Source) {
if (content.selectedArtist) { url += ' AND source:(' + filter.Source + ')';
url += '&sort[]=' + globals.settings.DefaultArchiveAlbumSort; }
} if (filter.Year) {
url += '&fl[]=avg_rating,collection,date,description,downloads,headerImage,identifier,publisher,publicdate,source,subject,title,year'; if (parseInt(filter.Year)) {
url += '&rows=50&page=1&output=json'; url += ' AND year:(' + filter.Year + ')';
$.ajax({
url: url,
method: 'GET',
dataType: globals.settings.Protocol,
timeout: globals.settings.Timeout,
success: function (data) {
var items = [];
if (data.response.docs.length > 0) {
items = data.response.docs;
//alert(JSON.stringify(data["response"]));
content.album = [];
content.song = [];
angular.forEach(items, function (item, key) {
content.album.push(mapAlbum(item));
});
notifications.updateMessage(content.album.length, true);
} else {
notifications.updateMessage("Sorry :(", true);
} }
deferred.resolve(content);
},
error: function () {
notifications.updateMessage('Archive.org service down :(');
} }
}); if (filter.Description) {
url += ' AND description:(' + filter.Description + ')';
}
if (content.selectedArtist) {
url += '&sort[]=' + globals.settings.DefaultArchiveAlbumSort;
}
url += '&fl[]=avg_rating,collection,date,description,downloads,headerImage,identifier,publisher,publicdate,source,subject,title,year';
url += '&rows=50&page=1&output=json';
$.ajax({
url: url,
method: 'GET',
dataType: globals.settings.Protocol,
timeout: globals.settings.Timeout,
success: function (data) {
var items = [];
if (data.response.docs.length > 0) {
items = data.response.docs;
//alert(JSON.stringify(data["response"]));
content.album = [];
content.song = [];
angular.forEach(items, function (item, key) {
content.album.push(mapAlbum(item));
});
notifications.updateMessage(content.album.length, true);
} else {
notifications.updateMessage("Sorry :(", true);
}
deferred.resolve(content);
},
error: function () {
notifications.updateMessage('Archive.org service down :(');
}
});
} else {
deferred.resolve(content);
}
return deferred.promise; return deferred.promise;
}, },
getSongs: function (id, action) { getSongs: function (id, action) {
var deferred = $q.defer(); var deferred = $q.defer();
content.selectedAlbum = id; if (id) {
var url = globals.archiveUrl + 'details/' + id + '?output=json'; content.selectedAlbum = id;
$.ajax({ if (content.breadcrumb.length > 0) { content.breadcrumb.splice(1, (content.breadcrumb.length - 1)); }
url: url, content.breadcrumb.push({ 'type': 'album', 'id': id, 'name': id });
method: 'GET', var url = globals.archiveUrl + 'details/' + id + '?output=json';
dataType: globals.settings.Protocol, $.ajax({
timeout: globals.settings.Timeout, url: url,
success: function (data) { method: 'GET',
var coverart = ''; dataType: globals.settings.Protocol,
var server = data.server; timeout: globals.settings.Timeout,
var dir = data.dir; success: function (data) {
var identifier = data.metadata.identifier[0]; var coverart = '';
if (typeof data.misc.image != 'undefined') { var server = data.server;
coverart = data.misc.image; var dir = data.dir;
var identifier = data.metadata.identifier[0];
if (typeof data.misc.image != 'undefined') {
coverart = data.misc.image;
}
var items = data.files;
if (action == 'add') {
angular.forEach(items, function (item, key) {
var song = mapSong(key, item, server, dir, identifier, coverart);
if (song) {
$rootScope.queue.push(song);
}
});
notifications.updateMessage(Object.keys(items).length + ' Song(s) Added to Queue', true);
} else if (action == 'play') {
$rootScope.queue = [];
angular.forEach(items, function (item, key) {
var song = mapSong(key, item, server, dir, identifier, coverart);
if (song) {
$rootScope.queue.push(song);
}
});
var next = $rootScope.queue[0];
$rootScope.playSong(false, next);
notifications.updateMessage(Object.keys(items).length + ' Song(s) Added to Queue', true);
} else {
content.album = [];
content.song = [];
angular.forEach(items, function (item, key) {
var song = mapSong(key, item, server, dir, identifier, coverart);
if (song) {
content.song.push(song);
}
});
}
deferred.resolve(content);
} }
var items = data.files; });
if (action == 'add') { } else {
angular.forEach(items, function (item, key) { deferred.resolve(content);
var song = mapSong(key, item, server, dir, identifier, coverart); }
if (song) {
$rootScope.queue.push(song);
}
});
notifications.updateMessage(Object.keys(items).length + ' Song(s) Added to Queue', true);
} else if (action == 'play') {
$rootScope.queue = [];
angular.forEach(items, function (item, key) {
var song = mapSong(key, item, server, dir, identifier, coverart);
if (song) {
$rootScope.queue.push(song);
}
});
var next = $rootScope.queue[0];
$rootScope.playSong(false, next);
notifications.updateMessage(Object.keys(items).length + ' Song(s) Added to Queue', true);
} else {
content.album = [];
content.song = [];
angular.forEach(items, function (item, key) {
var song = mapSong(key, item, server, dir, identifier, coverart);
if (song) {
content.song.push(song);
}
});
}
deferred.resolve(content);
}
});
return deferred.promise; return deferred.promise;
} }
}; };

View file

@ -1,6 +1,6 @@
JamStash.service('utils', function ($cookieStore, globals, model) { JamStash.service('utils', function ($rootScope, $cookieStore, globals, model) {
this.safeApply = function (fn) { this.safeApply = function (fn) {
var phase = this.$root.$$phase; var phase = $rootScope.$root.$$phase;
if (phase == '$apply' || phase == '$digest') { if (phase == '$apply' || phase == '$digest') {
if (fn && (typeof (fn) === 'function')) { if (fn && (typeof (fn) === 'function')) {
fn(); fn();

View file

@ -1175,6 +1175,14 @@ ul.songlist li:hover
position: fixed; position: fixed;
} }
#songs {
width: 1200px;
display: none;
}
#songs .songlist {
padding: 35px 0 0 0;
}
/* Player Style */ /* Player Style */
#player #player
{ {