3.4.2 Archive tab updates
This commit is contained in:
parent
1f8c286a13
commit
e5318f395b
8 changed files with 183 additions and 112 deletions
|
@ -1,5 +1,5 @@
|
|||
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.itemType = 'archive';
|
||||
$rootScope.song = [];
|
||||
|
@ -35,6 +35,8 @@ function ArchiveCtrl($scope, $rootScope, $location, $routeParams, $http, utils,
|
|||
if ($scope.SavedCollections.indexOf(newValue) == -1) {
|
||||
$scope.SavedCollections.push(newValue);
|
||||
$scope.writeSavedCollection();
|
||||
var index = $scope.AllArtists.indexOf(newValue);
|
||||
$scope.AllArtists.splice(index, 1);
|
||||
}
|
||||
};
|
||||
$scope.deleteSavedCollection = function (index) {
|
||||
|
@ -79,7 +81,7 @@ function ArchiveCtrl($scope, $rootScope, $location, $routeParams, $http, utils,
|
|||
} else {
|
||||
utils.setValue('AlbumSort', null, true);
|
||||
}
|
||||
$scope.getAlbums('');
|
||||
$scope.getAlbums($scope.selectedArtist);
|
||||
}
|
||||
});
|
||||
$scope.getYears = function (startYear) {
|
||||
|
@ -98,7 +100,7 @@ function ArchiveCtrl($scope, $rootScope, $location, $routeParams, $http, utils,
|
|||
};
|
||||
$scope.filterSave = function () {
|
||||
if ($scope.selectedArtist) {
|
||||
$scope.getAlbums('', '');
|
||||
$scope.getAlbums($scope.selectedArtist, $scope.filter);
|
||||
}
|
||||
};
|
||||
/* End Filter */
|
||||
|
@ -118,14 +120,23 @@ function ArchiveCtrl($scope, $rootScope, $location, $routeParams, $http, utils,
|
|||
$scope.song = data.song;
|
||||
$scope.album = data.album;
|
||||
$scope.selectedArtist = data.selectedArtist;
|
||||
$scope.BreadCrumbs = data.breadcrumb;
|
||||
});
|
||||
};
|
||||
|
||||
$scope.getSongs = function (id, action) {
|
||||
archive.getSongs(id, action).then(function (data) {
|
||||
$scope.song = data.song;
|
||||
$scope.album = data.album;
|
||||
$scope.song = data.song;
|
||||
$scope.selectedAlbum = data.selectedAlbum;
|
||||
$scope.BreadCrumbs = data.breadcrumb;
|
||||
//$rootScope.showSongs();
|
||||
//alert($("#songs").html())
|
||||
//utils.safeApply();
|
||||
$timeout(
|
||||
function () {
|
||||
$.fancybox.update();
|
||||
}
|
||||
);
|
||||
});
|
||||
};
|
||||
$scope.scrollToTop = function () {
|
||||
|
@ -149,13 +160,13 @@ function ArchiveCtrl($scope, $rootScope, $location, $routeParams, $http, utils,
|
|||
|
||||
/* Launch on Startup */
|
||||
//$scope.getArtists();
|
||||
//$scope.getCollections();
|
||||
$scope.getAlbums();
|
||||
if ($routeParams.artist) {
|
||||
if ($routeParams.album) {
|
||||
//collection:(GreenskyBluegrass) AND format:(MP3) AND identifier:(gsbg2013-09-20.flac16)
|
||||
$scope.getAlbums('', $routeParams.album);
|
||||
$scope.getSongs($routeParams.album);
|
||||
} else {
|
||||
$scope.getAlbums($routeParams.artist, '');
|
||||
$scope.getAlbums($routeParams.artist);
|
||||
}
|
||||
$scope.addSavedCollection($routeParams.artist);
|
||||
}
|
||||
|
|
|
@ -391,6 +391,7 @@ function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, $htt
|
|||
$scope.getGenres();
|
||||
$scope.getPodcasts();
|
||||
$scope.openDefaultSection();
|
||||
$scope.getMusicFolders();
|
||||
if ($routeParams.artistId && $routeParams.albumId) {
|
||||
$scope.getAlbumByTag($routeParams.albumId);
|
||||
} else if ($routeParams.artistId) {
|
||||
|
|
|
@ -160,6 +160,38 @@ function AppCtrl($scope, $rootScope, $document, $window, $location, $cookieStore
|
|||
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) {
|
||||
$('.audiojs .scrubber').stop().animate({ height: '8px' });
|
||||
|
@ -507,8 +539,7 @@ function AppCtrl($scope, $rootScope, $document, $window, $location, $cookieStore
|
|||
$scope.loadSettings();
|
||||
utils.switchTheme(globals.settings.Theme);
|
||||
if ($scope.loggedIn()) {
|
||||
$scope.ping();
|
||||
$scope.getMusicFolders();
|
||||
//$scope.ping();
|
||||
if (globals.settings.SaveTrackPosition) {
|
||||
player.loadTrackPosition();
|
||||
player.startSaveTrackPosition();
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"date": "5/4/2014", "version": "3.4.1",
|
||||
"changes": [
|
||||
{ "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" }
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
</li>
|
||||
</ul>
|
||||
<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">
|
||||
<a href="" class="hover" title="Save Collection" ng-click="addSavedCollection(o)" stop-event="click"> <img src="images/pin_gl_12x12.png" /> </a>
|
||||
</div>
|
||||
|
@ -50,11 +50,17 @@
|
|||
<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>
|
||||
</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> ></div>
|
||||
<div class="crumb" ng-repeat="o in BreadCrumbs | filter:{type:'album'}"><a ng-click="getSongs(o.id, '')">{{o.name}}</a> ></div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="clear"></div>
|
||||
<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">
|
||||
<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>
|
||||
|
@ -75,7 +81,9 @@
|
|||
<div class="description shadow" ng-bind-html="o.description"></div>
|
||||
<div class="clear"></div>
|
||||
</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>
|
||||
</div>
|
||||
</div>
|
||||
|
|
204
js/service.js
204
js/service.js
|
@ -1341,110 +1341,122 @@ JamStash.factory('archive', function ($rootScope, $http, $q, $sce, globals, mode
|
|||
},
|
||||
getAlbums: function (name, filter) {
|
||||
var deferred = $q.defer();
|
||||
var url = globals.archiveUrl + 'advancedsearch.php?q=';
|
||||
if (name !== '') {
|
||||
content.selectedArtist = name;
|
||||
url += 'collection:(' + name + ') AND format:(MP3)';
|
||||
} else if (content.selectedArtist) {
|
||||
name = content.selectedArtist;
|
||||
url += 'collection:(' + content.selectedArtist + ') AND format:(MP3)';
|
||||
} else {
|
||||
url += 'collection:(' + name + ')';
|
||||
}
|
||||
|
||||
if (filter.Source) {
|
||||
url += ' AND source:(' + filter.Source + ')';
|
||||
}
|
||||
if (filter.Year) {
|
||||
if (parseInt(filter.Year)) {
|
||||
url += ' AND year:(' + filter.Year + ')';
|
||||
if (name) {
|
||||
var url = globals.archiveUrl + 'advancedsearch.php?q=';
|
||||
if (name !== '') {
|
||||
content.selectedArtist = name;
|
||||
url += 'collection:(' + name + ') AND format:(MP3)';
|
||||
} else if (content.selectedArtist) {
|
||||
name = content.selectedArtist;
|
||||
url += 'collection:(' + content.selectedArtist + ') AND format:(MP3)';
|
||||
} else {
|
||||
url += 'collection:(' + name + ')';
|
||||
}
|
||||
}
|
||||
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);
|
||||
content.breadcrumb = [];
|
||||
content.breadcrumb.push({ 'type': 'artist', 'id': name, 'name': name });
|
||||
|
||||
if (filter.Source) {
|
||||
url += ' AND source:(' + filter.Source + ')';
|
||||
}
|
||||
if (filter.Year) {
|
||||
if (parseInt(filter.Year)) {
|
||||
url += ' AND year:(' + filter.Year + ')';
|
||||
}
|
||||
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;
|
||||
},
|
||||
getSongs: function (id, action) {
|
||||
var deferred = $q.defer();
|
||||
content.selectedAlbum = id;
|
||||
var url = globals.archiveUrl + 'details/' + id + '?output=json';
|
||||
$.ajax({
|
||||
url: url,
|
||||
method: 'GET',
|
||||
dataType: globals.settings.Protocol,
|
||||
timeout: globals.settings.Timeout,
|
||||
success: function (data) {
|
||||
var coverart = '';
|
||||
var server = data.server;
|
||||
var dir = data.dir;
|
||||
var identifier = data.metadata.identifier[0];
|
||||
if (typeof data.misc.image != 'undefined') {
|
||||
coverart = data.misc.image;
|
||||
if (id) {
|
||||
content.selectedAlbum = id;
|
||||
if (content.breadcrumb.length > 0) { content.breadcrumb.splice(1, (content.breadcrumb.length - 1)); }
|
||||
content.breadcrumb.push({ 'type': 'album', 'id': id, 'name': id });
|
||||
var url = globals.archiveUrl + 'details/' + id + '?output=json';
|
||||
$.ajax({
|
||||
url: url,
|
||||
method: 'GET',
|
||||
dataType: globals.settings.Protocol,
|
||||
timeout: globals.settings.Timeout,
|
||||
success: function (data) {
|
||||
var coverart = '';
|
||||
var server = data.server;
|
||||
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') {
|
||||
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);
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
deferred.resolve(content);
|
||||
}
|
||||
return deferred.promise;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
JamStash.service('utils', function ($cookieStore, globals, model) {
|
||||
JamStash.service('utils', function ($rootScope, $cookieStore, globals, model) {
|
||||
this.safeApply = function (fn) {
|
||||
var phase = this.$root.$$phase;
|
||||
var phase = $rootScope.$root.$$phase;
|
||||
if (phase == '$apply' || phase == '$digest') {
|
||||
if (fn && (typeof (fn) === 'function')) {
|
||||
fn();
|
||||
|
|
|
@ -1175,6 +1175,14 @@ ul.songlist li:hover
|
|||
position: fixed;
|
||||
}
|
||||
|
||||
#songs {
|
||||
width: 1200px;
|
||||
display: none;
|
||||
}
|
||||
#songs .songlist {
|
||||
padding: 35px 0 0 0;
|
||||
}
|
||||
|
||||
/* Player Style */
|
||||
#player
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue