jslinted
This commit is contained in:
parent
310c79f63c
commit
c46265340c
12 changed files with 282 additions and 397 deletions
|
@ -8,8 +8,8 @@ function ArchiveCtrl($scope, $rootScope, $location, $routeParams, $http, utils,
|
|||
$scope.Protocol = 'jsonp';
|
||||
$scope.artist = [];
|
||||
$scope.album = [];
|
||||
$scope.selectedArtist;
|
||||
$scope.selectedAlbum;
|
||||
$scope.selectedArtist = null;
|
||||
$scope.selectedAlbum = null;
|
||||
$scope.selectedSongs = [];
|
||||
$scope.SavedCollections = globals.SavedCollections;
|
||||
$scope.AllCollections = [];
|
||||
|
@ -25,18 +25,18 @@ function ArchiveCtrl($scope, $rootScope, $location, $routeParams, $http, utils,
|
|||
});
|
||||
*/
|
||||
globals.SavedCollections = $scope.SavedCollections;
|
||||
}
|
||||
};
|
||||
$scope.addSavedCollection = function (newValue) {
|
||||
if ($scope.SavedCollections.indexOf(newValue) == -1) {
|
||||
$scope.SavedCollections.push(newValue);
|
||||
$scope.writeSavedCollection();
|
||||
}
|
||||
}
|
||||
};
|
||||
$scope.deleteSavedCollection = function (index) {
|
||||
$scope.SavedCollections.splice(index, 1);
|
||||
$scope.writeSavedCollection();
|
||||
}
|
||||
$scope.selectedCollection;
|
||||
};
|
||||
$scope.selectedCollection = null;
|
||||
$scope.$watch("selectedCollection", function (newValue, oldValue) {
|
||||
if (newValue !== oldValue) {
|
||||
$scope.addSavedCollection(newValue);
|
||||
|
@ -49,7 +49,7 @@ function ArchiveCtrl($scope, $rootScope, $location, $routeParams, $http, utils,
|
|||
$scope.SavedCollections.push(item);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
$scope.archiveUrl = 'https://archive.org/';
|
||||
|
||||
/* Filter */
|
||||
|
@ -71,7 +71,7 @@ function ArchiveCtrl($scope, $rootScope, $location, $routeParams, $http, utils,
|
|||
'publicdate asc',
|
||||
'stars desc',
|
||||
'stars asc'
|
||||
],
|
||||
];
|
||||
$scope.$watch("selectedArchiveAlbumSort", function (newValue, oldValue) {
|
||||
if (utils.getValue('AlbumSort') != newValue) {
|
||||
if (typeof newValue != 'undefined') {
|
||||
|
@ -90,8 +90,8 @@ function ArchiveCtrl($scope, $rootScope, $location, $routeParams, $http, utils,
|
|||
years.push(startYear++);
|
||||
}
|
||||
return years;
|
||||
}
|
||||
$scope.Years = $scope.getYears(),
|
||||
};
|
||||
$scope.Years = $scope.getYears();
|
||||
$scope.filter = {
|
||||
Year: "",
|
||||
Source: "",
|
||||
|
@ -101,7 +101,7 @@ function ArchiveCtrl($scope, $rootScope, $location, $routeParams, $http, utils,
|
|||
if ($scope.selectedArtist) {
|
||||
$scope.getAlbums('', '');
|
||||
}
|
||||
}
|
||||
};
|
||||
/* End Filter */
|
||||
|
||||
/*
|
||||
|
@ -116,7 +116,7 @@ function ArchiveCtrl($scope, $rootScope, $location, $routeParams, $http, utils,
|
|||
*/
|
||||
$scope.getAlbums = function (name, identifier) {
|
||||
var url = $scope.archiveUrl + 'advancedsearch.php?q=';
|
||||
if (name != '') {
|
||||
if (name !== '') {
|
||||
$scope.selectedArtist = name;
|
||||
url += 'collection:(' + name + ') AND format:(MP3)';
|
||||
} else if ($scope.selectedArtist) {
|
||||
|
@ -138,7 +138,7 @@ function ArchiveCtrl($scope, $rootScope, $location, $routeParams, $http, utils,
|
|||
description += typeof song.avg_rating != 'undefined' ? '<b>Rating</b>: ' + song.avg_rating + '<br />' : '';
|
||||
description += typeof song.downloads != 'undefined' ? '<b>Downloads</b>: ' + song.downloads + '<br />' : '';
|
||||
return new model.Album(song.identifier, null, song.title, song.collection[0], '', coverartthumb, coverartfull, $.format.date(new Date(song.publicdate), "yyyy-MM-dd h:mm a"), starred, description, url);
|
||||
}
|
||||
};
|
||||
if ($scope.filter.Source) {
|
||||
url += ' AND source:(' + $scope.filter.Source + ')';
|
||||
}
|
||||
|
@ -162,8 +162,8 @@ function ArchiveCtrl($scope, $rootScope, $location, $routeParams, $http, utils,
|
|||
timeout: globals.settings.Timeout,
|
||||
success: function (data) {
|
||||
var items = [];
|
||||
if (data["response"].docs.length > 0) {
|
||||
items = data["response"].docs;
|
||||
if (data.response.docs.length > 0) {
|
||||
items = data.response.docs;
|
||||
//alert(JSON.stringify(data["response"]));
|
||||
$scope.album = [];
|
||||
$rootScope.song = [];
|
||||
|
@ -183,7 +183,7 @@ function ArchiveCtrl($scope, $rootScope, $location, $routeParams, $http, utils,
|
|||
};
|
||||
utils.mapSong = function (key, song, server, dir, identifier, coverart) {
|
||||
var url, time, track, title, rating, starred, contenttype, suffix;
|
||||
var specs = ''
|
||||
var specs = '';
|
||||
if (song.format == 'VBR MP3') {
|
||||
url = 'http://' + server + dir + key;
|
||||
if (typeof song.bitrate == 'undefined' || typeof song.format == 'undefined') { specs = ' '; } else { specs = song.bitrate + 'kbps, ' + song.format.toLowerCase(); }
|
||||
|
@ -217,7 +217,7 @@ function ArchiveCtrl($scope, $rootScope, $location, $routeParams, $http, utils,
|
|||
$rootScope.queue.push(song);
|
||||
}
|
||||
});
|
||||
$rootScope.showQueue();
|
||||
//$rootScope.showQueue();
|
||||
notifications.updateMessage(Object.keys(items).length + ' Song(s) Added to Queue', true);
|
||||
$scope.$apply();
|
||||
} else if (action == 'play') {
|
||||
|
@ -232,7 +232,7 @@ function ArchiveCtrl($scope, $rootScope, $location, $routeParams, $http, utils,
|
|||
$scope.$apply(function () {
|
||||
$rootScope.playSong(false, next);
|
||||
});
|
||||
$rootScope.showQueue();
|
||||
//$rootScope.showQueue();
|
||||
notifications.updateMessage(Object.keys(items).length + ' Song(s) Added to Queue', true);
|
||||
} else {
|
||||
$scope.album = [];
|
||||
|
@ -254,25 +254,25 @@ function ArchiveCtrl($scope, $rootScope, $location, $routeParams, $http, utils,
|
|||
$scope.queue.push(item);
|
||||
item.selected = false;
|
||||
});
|
||||
$rootScope.showQueue();
|
||||
//$rootScope.showQueue();
|
||||
notifications.updateMessage($scope.selectedSongs.length + ' Song(s) Added to Queue', true);
|
||||
}
|
||||
}
|
||||
};
|
||||
$scope.scrollToTop = function () {
|
||||
$('#Artists').stop().scrollTo('#auto', 400);
|
||||
}
|
||||
};
|
||||
$scope.selectAll = function () {
|
||||
angular.forEach($rootScope.song, function (item, key) {
|
||||
$scope.selectedSongs.push(item);
|
||||
item.selected = true;
|
||||
});
|
||||
}
|
||||
};
|
||||
$scope.selectNone = function () {
|
||||
angular.forEach($rootScope.song, function (item, key) {
|
||||
$scope.selectedSongs = [];
|
||||
item.selected = false;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/* Launch on Startup */
|
||||
if ($routeParams.artist) {
|
||||
|
|
|
@ -20,9 +20,9 @@ function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, util
|
|||
{ id: "frequent", name: "Most Played" },
|
||||
{ id: "recent", name: "Recently Played" }
|
||||
];
|
||||
$scope.selectedAutoAlbum;
|
||||
$scope.selectedArtist;
|
||||
$scope.selectedAlbum;
|
||||
$scope.selectedAutoAlbum = null;
|
||||
$scope.selectedArtist = null;
|
||||
$scope.selectedAlbum = null;
|
||||
$scope.SelectedAlbumSort = globals.settings.DefaultAlbumSort;
|
||||
$scope.AlbumSort = globals.AlbumSorts;
|
||||
$scope.BreadCrumbs = [];
|
||||
|
@ -36,7 +36,7 @@ function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, util
|
|||
if (obj.id == newValue) {
|
||||
return index;
|
||||
}
|
||||
})
|
||||
});
|
||||
globals.settings.DefaultAlbumSort = globals.AlbumSorts[indexes];
|
||||
}
|
||||
}
|
||||
|
@ -56,14 +56,14 @@ function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, util
|
|||
dataType: globals.settings.Protocol,
|
||||
timeout: globals.settings.Timeout,
|
||||
success: function (data) {
|
||||
if (data["subsonic-response"].user.adminRole == true) {
|
||||
if (data["subsonic-response"].user.adminRole === true) {
|
||||
$.get(globals.settings.Server + '/musicFolderSettings.view?scanNow');
|
||||
} else {
|
||||
alert('You are not logged in as an admin user!');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
$scope.mapArtist = function (data) {
|
||||
var name = '';
|
||||
var artist = data.artist;
|
||||
|
@ -78,18 +78,18 @@ function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, util
|
|||
});
|
||||
if (typeof data.name !== 'undefined') { name = data.name.toString(); }
|
||||
return new model.Index(name, artists);
|
||||
}
|
||||
};
|
||||
$scope.mapIndex = function (data) {
|
||||
var name, id = '';
|
||||
if (typeof data.id !== 'undefined') { id = data.id; }
|
||||
if (typeof data.name !== 'undefined') { name = data.name.toString(); }
|
||||
return new model.Artist(id, name);
|
||||
}
|
||||
};
|
||||
$scope.mapPlaylist = function (data) {
|
||||
return new model.Artist(data.id, data.name);
|
||||
}
|
||||
};
|
||||
$scope.getArtists = function (id) {
|
||||
var url, id;
|
||||
var url;
|
||||
if (utils.getValue('MusicFolders')) {
|
||||
var folder = angular.fromJson(utils.getValue('MusicFolders'));
|
||||
id = folder.id;
|
||||
|
@ -155,12 +155,12 @@ function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, util
|
|||
if (typeof album.title !== 'undefined') { title = album.title; } else { title = album.name; }
|
||||
var type;
|
||||
if (album.isDir) {
|
||||
type = 'byfolder';
|
||||
type = 'byfolder';
|
||||
} else {
|
||||
type = 'bytag';
|
||||
}
|
||||
return new model.Album(album.id, album.parent, title, album.artist, album.artistId, coverartthumb, coverartfull, $.format.date(new Date(album.created), "yyyy-MM-dd h:mm a"), starred, '', '', type);
|
||||
}
|
||||
};
|
||||
$scope.getAlbums = function (id, name) {
|
||||
$scope.selectedAutoAlbum = null;
|
||||
$scope.selectedArtist = id;
|
||||
|
@ -340,7 +340,7 @@ function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, util
|
|||
$rootScope.queue.push(utils.mapSong(item));
|
||||
});
|
||||
$scope.$apply();
|
||||
$rootScope.showQueue();
|
||||
//$rootScope.showQueue();
|
||||
notifications.updateMessage(items.length + ' Song(s) Added to Queue', true);
|
||||
} else if (action == 'play') {
|
||||
$rootScope.queue = [];
|
||||
|
@ -351,7 +351,7 @@ function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, util
|
|||
$scope.$apply(function () {
|
||||
$rootScope.playSong(false, next);
|
||||
});
|
||||
$rootScope.showQueue();
|
||||
//$rootScope.showQueue();
|
||||
notifications.updateMessage(items.length + ' Song(s) Added to Queue', true);
|
||||
} else if (action == 'preview') {
|
||||
$scope.songpreview = [];
|
||||
|
@ -365,7 +365,7 @@ function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, util
|
|||
if (typeof data["subsonic-response"].directory.id != 'undefined') {
|
||||
var albumId = data["subsonic-response"].directory.id;
|
||||
var albumName = data["subsonic-response"].directory.name;
|
||||
if ($scope.BreadCrumbs.length > 0) { $scope.BreadCrumbs.splice(1, ($scope.BreadCrumbs.length - 1)) };
|
||||
if ($scope.BreadCrumbs.length > 0) { $scope.BreadCrumbs.splice(1, ($scope.BreadCrumbs.length - 1)); }
|
||||
$scope.BreadCrumbs.push({ 'type': 'album', 'id': albumId, 'name': albumName });
|
||||
}
|
||||
$rootScope.song = [];
|
||||
|
@ -394,7 +394,7 @@ function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, util
|
|||
};
|
||||
$scope.search = function () {
|
||||
var query = $('#Search').val();
|
||||
if (query != '') {
|
||||
if (query !== '') {
|
||||
var type = $('#SearchType').val();
|
||||
$.ajax({
|
||||
url: globals.BaseURL() + '/search2.view?' + globals.BaseParams() + '&query=' + query,
|
||||
|
@ -455,10 +455,10 @@ function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, util
|
|||
});
|
||||
//$('#Search').val("");
|
||||
}
|
||||
}
|
||||
};
|
||||
$scope.toggleAZ = function (event) {
|
||||
$scope.toggleSubmenu('#submenu_AZIndex', '#AZIndex', 'right', 44);
|
||||
}
|
||||
};
|
||||
$scope.loadPlaylistsForMenu = function (data, event) {
|
||||
$.ajax({
|
||||
url: globals.BaseURL() + '/getPlaylists.view?' + globals.BaseParams(),
|
||||
|
@ -494,7 +494,7 @@ function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, util
|
|||
*/
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
$scope.addToPlaylist = function (id) {
|
||||
var songs = [];
|
||||
if ($scope.selectedSongs.length !== 0) {
|
||||
|
@ -518,7 +518,7 @@ function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, util
|
|||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
$scope.sortDateFunction = function (a, b) {
|
||||
return a.date < b.date ? 1 : -1;
|
||||
};
|
||||
|
|
|
@ -3,24 +3,27 @@ function AppCtrl($scope, $rootScope, $document, $location, $cookieStore, utils,
|
|||
$rootScope.settings = globals.settings;
|
||||
$rootScope.song = [];
|
||||
$rootScope.queue = [];
|
||||
$rootScope.playingSong;
|
||||
$rootScope.playingSong = null;
|
||||
$rootScope.MusicFolders = [];
|
||||
$rootScope.Genres = [];
|
||||
$rootScope.selectedPlaylist = "";
|
||||
$rootScope.selectedAutoPlaylist = "";
|
||||
$rootScope.SelectedMusicFolder = "";
|
||||
$rootScope.unity;
|
||||
$rootScope.unity = null;
|
||||
$rootScope.loggedIn = function () {
|
||||
if (globals.settings.Server != '' && globals.settings.Username != '' && globals.settings.Password != '') {
|
||||
if (globals.settings.Server !== '' && globals.settings.Username !== '' && globals.settings.Password !== '') {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
$rootScope.totalDisplayed = 50;
|
||||
$rootScope.loadMore = function () {
|
||||
$scope.totalDisplayed += 50;
|
||||
};
|
||||
$rootScope.go = function (path) {
|
||||
$location.path(path);
|
||||
};
|
||||
/*
|
||||
$scope.playSong = function (loadonly, data) {
|
||||
$scope.$apply(function () {
|
||||
|
@ -46,7 +49,7 @@ function AppCtrl($scope, $rootScope, $document, $location, $cookieStore, utils,
|
|||
if (utils.getValue("SavedCollections")) { globals.SavedCollections = utils.getValue("SavedCollections").split(","); }
|
||||
if (utils.getValue("SavedGenres")) { globals.SavedGenres = utils.getValue("SavedGenres").split(","); }
|
||||
if (globals.settings.Debug) { console.log('Settings: ' + JSON.stringify(globals.settings, null, 2)); }
|
||||
}
|
||||
};
|
||||
$scope.toggleSetting = function (setting) {
|
||||
var id = setting;
|
||||
if (globals.settings[id]) {
|
||||
|
@ -55,7 +58,7 @@ function AppCtrl($scope, $rootScope, $document, $location, $cookieStore, utils,
|
|||
globals.settings[id] = true;
|
||||
}
|
||||
notifications.updateMessage(setting + ' : ' + globals.settings[id], true);
|
||||
}
|
||||
};
|
||||
|
||||
$.ajaxSetup({
|
||||
'beforeSend': function () {
|
||||
|
@ -111,19 +114,19 @@ function AppCtrl($scope, $rootScope, $document, $location, $cookieStore, utils,
|
|||
submenu.css({ "left": (off.left - margin) + "px", "top": (off.top) + "px" }).fadeIn(400);
|
||||
break;
|
||||
}
|
||||
setTimeout(function () { if (submenu_active == false) $('div.submenu').stop().fadeOut(); }, 10000);
|
||||
setTimeout(function () { if (submenu_active === false) $('div.submenu').stop().fadeOut(); }, 10000);
|
||||
}
|
||||
}
|
||||
};
|
||||
$rootScope.showQueue = function () {
|
||||
var submenu = $('#QueuePreview');
|
||||
submenu.fadeIn(400);
|
||||
var timeout = globals.settings.Timeout;
|
||||
setTimeout(function () { submenu.fadeOut(); }, timeout);
|
||||
}
|
||||
};
|
||||
$rootScope.hideQueue = function () {
|
||||
var submenu = $('#QueuePreview');
|
||||
submenu.fadeOut();
|
||||
}
|
||||
};
|
||||
$scope.toggleQueue = function () {
|
||||
var submenu = $('#QueuePreview');
|
||||
if (submenu.css('display') == 'none') {
|
||||
|
@ -131,7 +134,7 @@ function AppCtrl($scope, $rootScope, $document, $location, $cookieStore, utils,
|
|||
} else {
|
||||
$rootScope.hideQueue();
|
||||
}
|
||||
}
|
||||
};
|
||||
$("a.coverartfancy").fancybox({
|
||||
beforeShow: function () {
|
||||
//this.title = $('#songdetails_artist').html();
|
||||
|
@ -209,18 +212,18 @@ function AppCtrl($scope, $rootScope, $document, $location, $cookieStore, utils,
|
|||
return "You're about to end your session, are you sure?";
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$scope.dragStart = function (e, ui) {
|
||||
ui.item.data('start', ui.item.index());
|
||||
}
|
||||
};
|
||||
$scope.dragEnd = function (e, ui) {
|
||||
var start = ui.item.data('start'),
|
||||
end = ui.item.index();
|
||||
$rootScope.queue.splice(end, 0,
|
||||
$rootScope.queue.splice(start, 1)[0]);
|
||||
$scope.$apply();
|
||||
}
|
||||
};
|
||||
$document.keydown(function (e) {
|
||||
$scope.scrollToIndex(e);
|
||||
});
|
||||
|
@ -265,8 +268,8 @@ function AppCtrl($scope, $rootScope, $document, $location, $cookieStore, utils,
|
|||
}
|
||||
if (unicode == 189) { // dash - volume down
|
||||
var volume = utils.getValue('Volume') ? parseFloat(utils.getValue('Volume')) : 1;
|
||||
if (volume <= 1 && volume > 0 && source == '') {
|
||||
volume += -.1;
|
||||
if (volume <= 1 && volume > 0 && source === '') {
|
||||
volume += -0.1;
|
||||
$(player1).jPlayer({
|
||||
volume: volume
|
||||
});
|
||||
|
@ -276,8 +279,8 @@ function AppCtrl($scope, $rootScope, $document, $location, $cookieStore, utils,
|
|||
}
|
||||
if (unicode == 187) { // equals - volume up
|
||||
var volume = utils.getValue('Volume') ? parseFloat(utils.getValue('Volume')) : 1;
|
||||
if (volume < 1 && volume >= 0 && source == '') {
|
||||
volume += .1;
|
||||
if (volume < 1 && volume >= 0 && source ==- '') {
|
||||
volume += 0.1;
|
||||
$(player1).jPlayer({
|
||||
volume: volume
|
||||
});
|
||||
|
@ -296,37 +299,37 @@ function AppCtrl($scope, $rootScope, $document, $location, $cookieStore, utils,
|
|||
};
|
||||
$scope.scrollToTop = function () {
|
||||
$('#Artists').stop().scrollTo('#auto', 400);
|
||||
}
|
||||
};
|
||||
$scope.selectAll = function () {
|
||||
angular.forEach($rootScope.song, function (item, key) {
|
||||
$scope.selectedSongs.push(item);
|
||||
item.selected = true;
|
||||
});
|
||||
}
|
||||
};
|
||||
$scope.playAll = function () {
|
||||
$rootScope.queue = [];
|
||||
$scope.selectAll();
|
||||
$scope.addSongsToQueue();
|
||||
var next = $rootScope.queue[0];
|
||||
$rootScope.playSong(false, next);
|
||||
}
|
||||
};
|
||||
$scope.selectNone = function () {
|
||||
angular.forEach($rootScope.song, function (item, key) {
|
||||
$scope.selectedSongs = [];
|
||||
item.selected = false;
|
||||
});
|
||||
}
|
||||
};
|
||||
$scope.addSongsToQueue = function () {
|
||||
if ($scope.selectedSongs.length !== 0) {
|
||||
angular.forEach($scope.selectedSongs, function (item, key) {
|
||||
$scope.queue.push(item);
|
||||
item.selected = false;
|
||||
});
|
||||
$rootScope.showQueue();
|
||||
//$rootScope.showQueue();
|
||||
notifications.updateMessage($scope.selectedSongs.length + ' Song(s) Added to Queue', true);
|
||||
$scope.selectedSongs.length = 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
$scope.isActive = function (route) {
|
||||
return route === $location.path();
|
||||
};
|
||||
|
@ -345,6 +348,10 @@ function AppCtrl($scope, $rootScope, $document, $location, $cookieStore, utils,
|
|||
folders[0] = data["subsonic-response"].musicFolders.musicFolder;
|
||||
}
|
||||
|
||||
folders.unshift({
|
||||
"id": -1,
|
||||
"name": "All Folders"
|
||||
});
|
||||
$rootScope.MusicFolders = folders;
|
||||
if (utils.getValue('MusicFolders')) {
|
||||
var folder = angular.fromJson(utils.getValue('MusicFolders'));
|
||||
|
@ -356,12 +363,14 @@ function AppCtrl($scope, $rootScope, $document, $location, $cookieStore, utils,
|
|||
i++;
|
||||
});
|
||||
$rootScope.SelectedMusicFolder = $rootScope.MusicFolders[index];
|
||||
} else {
|
||||
$rootScope.SelectedMusicFolder = $rootScope.MusicFolders[0];
|
||||
}
|
||||
$scope.$apply();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
$scope.getGenres = function () {
|
||||
var genres = 'Acid Rock,Acoustic,Alt Country,Alt/Indie,Alternative & Punk,Alternative Metal,Alternative,AlternRock,Awesome,Bluegrass,Blues,Blues-Rock,Classic Hard Rock,Classic Rock,Comedy,Country,Country-Rock,Dance,Dance-Rock,Deep Funk,Easy Listening,Electronic,Electronica,Electronica/Dance,Folk,Folk/Rock,Funk,Grunge,Hard Rock,Heavy Metal,Holiday,House,Improg,Indie Rock,Indie,International,Irish,Jam Band,Jam,Jazz Fusion,Jazz,Latin,Live Albums,Metal,Music,Oldies,Other,Pop,Pop/Rock,Post Rock,Progressive Rock,Psychedelic Rock,Psychedelic,Punk,R&B,Rap & Hip-Hop,Reggae,Rock & Roll,Rock,Rock/Pop,Roots,Ska,Soft Rock,Soul,Southern Rock,Thrash Metal,Unknown,Vocal,World';
|
||||
$rootScope.Genres = genres.split(',');
|
||||
|
@ -386,7 +395,7 @@ function AppCtrl($scope, $rootScope, $document, $location, $cookieStore, utils,
|
|||
}
|
||||
});
|
||||
*/
|
||||
}
|
||||
};
|
||||
$scope.download = function (id) {
|
||||
$.ajax({
|
||||
url: globals.BaseURL() + '/getUser.view?' + globals.BaseParams() + '&username=' + globals.settings.Username,
|
||||
|
@ -395,9 +404,9 @@ function AppCtrl($scope, $rootScope, $document, $location, $cookieStore, utils,
|
|||
timeout: globals.settings.Timeout,
|
||||
success: function (data) {
|
||||
if (typeof data["subsonic-response"].error != 'undefined') {
|
||||
notifications.updateMessage('Error: ' + data["subsonic-response"].error.message, true);
|
||||
notifications.updateMessage('Error: ' + data["subsonic-response"].error.message, true);
|
||||
} else {
|
||||
if (data["subsonic-response"].user.downloadRole == true) {
|
||||
if (data["subsonic-response"].user.downloadRole === true) {
|
||||
$window.location.href = globals.BaseURL() + '/download.view?' + globals.BaseParams() + '&id=' + id;
|
||||
} else {
|
||||
notifications.updateMessage('You do not have permission to Download', true);
|
||||
|
@ -405,7 +414,7 @@ function AppCtrl($scope, $rootScope, $document, $location, $cookieStore, utils,
|
|||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
$scope.ping = function () {
|
||||
$.ajax({
|
||||
url: globals.BaseURL() + '/ping.view?' + globals.BaseParams(),
|
||||
|
@ -425,10 +434,10 @@ function AppCtrl($scope, $rootScope, $document, $location, $cookieStore, utils,
|
|||
notifications.updateMessage('Unable to connect to Subsonic server');
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
$scope.addSongToQueue = function (data) {
|
||||
$rootScope.queue.push(data);
|
||||
}
|
||||
};
|
||||
$scope.queueRemoveSelected = function (data, event) {
|
||||
angular.forEach($scope.selectedSongs, function (item, key) {
|
||||
var index = $rootScope.queue.indexOf(item);
|
||||
|
@ -436,11 +445,11 @@ function AppCtrl($scope, $rootScope, $document, $location, $cookieStore, utils,
|
|||
$rootScope.queue.splice(index, 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
$scope.queueEmpty = function () {
|
||||
//self.selectedSongs([]);
|
||||
$rootScope.queue = [];
|
||||
}
|
||||
};
|
||||
$scope.queueTotal = function () {
|
||||
var total = 0;
|
||||
ko.utils.arrayForEach(self.queue(), function (item) {
|
||||
|
@ -451,10 +460,10 @@ function AppCtrl($scope, $rootScope, $document, $location, $cookieStore, utils,
|
|||
} else {
|
||||
return '0 song(s), 00:00:00 total time';
|
||||
}
|
||||
}
|
||||
};
|
||||
$scope.queueShuffle = function () {
|
||||
$rootScope.queue.sort(function () { return 0.5 - Math.random() });
|
||||
}
|
||||
$rootScope.queue.sort(function () { return 0.5 - Math.random(); });
|
||||
};
|
||||
$scope.selectedSongs = [];
|
||||
$scope.selectSong = function (data) {
|
||||
var i = $scope.selectedSongs.indexOf(data);
|
||||
|
@ -466,24 +475,24 @@ function AppCtrl($scope, $rootScope, $document, $location, $cookieStore, utils,
|
|||
data.selected = true;
|
||||
}
|
||||
//$scope.$apply();
|
||||
}
|
||||
};
|
||||
$rootScope.getRandomSongs = function (action, genre, folder) {
|
||||
if (globals.settings.Debug) { console.log('action:' + action + ', genre:' + genre + ', folder:' + folder); }
|
||||
var size = globals.settings.AutoPlaylistSize;
|
||||
$rootScope.selectedPlaylist = null;
|
||||
if (typeof folder == 'number') {
|
||||
$rootScope.selectedAutoPlaylist = folder;
|
||||
} else if (genre != '') {
|
||||
} else if (genre !== '') {
|
||||
$rootScope.selectedAutoPlaylist = genre;
|
||||
} else {
|
||||
$rootScope.selectedAutoPlaylist = 'random';
|
||||
}
|
||||
var genreParams = '';
|
||||
if (genre != '' && genre != 'Random') {
|
||||
if (genre !== '' && genre != 'Random') {
|
||||
genreParams = '&genre=' + genre;
|
||||
}
|
||||
folderParams = '';
|
||||
if (typeof folder == 'number' && folder != '' && folder != 'all') {
|
||||
if (typeof folder == 'number' && folder !== '' && folder != 'all') {
|
||||
//alert(folder);
|
||||
folderParams = '&musicFolderId=' + folder;
|
||||
} else if (typeof $rootScope.SelectedMusicFolder.id != 'undefined') {
|
||||
|
@ -508,7 +517,7 @@ function AppCtrl($scope, $rootScope, $document, $location, $cookieStore, utils,
|
|||
$rootScope.queue.push(utils.mapSong(item));
|
||||
});
|
||||
$scope.$apply();
|
||||
$rootScope.showQueue();
|
||||
//$rootScope.showQueue();
|
||||
notifications.updateMessage(items.length + ' Song(s) Added to Queue', true);
|
||||
} else if (action == 'play') {
|
||||
$rootScope.queue = [];
|
||||
|
@ -519,7 +528,7 @@ function AppCtrl($scope, $rootScope, $document, $location, $cookieStore, utils,
|
|||
$scope.$apply(function () {
|
||||
$rootScope.playSong(false, next);
|
||||
});
|
||||
$rootScope.showQueue();
|
||||
//$rootScope.showQueue();
|
||||
notifications.updateMessage(items.length + ' Song(s) Added to Queue', true);
|
||||
} else {
|
||||
$rootScope.song = [];
|
||||
|
@ -531,7 +540,7 @@ function AppCtrl($scope, $rootScope, $document, $location, $cookieStore, utils,
|
|||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
$scope.updateFavorite = function (item) {
|
||||
var id = item.id;
|
||||
var starred = item.starred;
|
||||
|
@ -552,10 +561,10 @@ function AppCtrl($scope, $rootScope, $document, $location, $cookieStore, utils,
|
|||
notifications.updateMessage('Favorite Updated!', true);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
$scope.toTrusted = function (html) {
|
||||
return $sce.trustAsHtml(html);
|
||||
}
|
||||
};
|
||||
|
||||
/* Launch on Startup */
|
||||
$scope.loadSettings();
|
||||
|
|
|
@ -7,7 +7,7 @@ function PlaylistCtrl($scope, $rootScope, $location, utils, globals, model, noti
|
|||
$scope.playlists = [];
|
||||
$scope.playlistsPublic = [];
|
||||
$scope.playlistsGenre = globals.SavedGenres;
|
||||
$scope.selectedGenre;
|
||||
$scope.selectedGenre = null;
|
||||
$scope.$watch("selectedGenre", function (newValue, oldValue) {
|
||||
if (newValue !== oldValue) {
|
||||
globals.SavedGenres.push(newValue);
|
||||
|
@ -41,7 +41,7 @@ function PlaylistCtrl($scope, $rootScope, $location, utils, globals, model, noti
|
|||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
$scope.getPlaylist = function (id, action) {
|
||||
$rootScope.selectedAutoPlaylist = null;
|
||||
$rootScope.selectedPlaylist = id;
|
||||
|
@ -64,7 +64,7 @@ function PlaylistCtrl($scope, $rootScope, $location, utils, globals, model, noti
|
|||
$rootScope.queue.push(utils.mapSong(item));
|
||||
});
|
||||
$scope.$apply();
|
||||
$rootScope.showQueue();
|
||||
//$rootScope.showQueue();
|
||||
notifications.updateMessage(items.length + ' Song(s) Added to Queue', true);
|
||||
} else if (action == 'play') {
|
||||
$rootScope.queue = [];
|
||||
|
@ -75,7 +75,7 @@ function PlaylistCtrl($scope, $rootScope, $location, utils, globals, model, noti
|
|||
$scope.$apply(function () {
|
||||
$rootScope.playSong(false, next);
|
||||
});
|
||||
$rootScope.showQueue();
|
||||
//$rootScope.showQueue();
|
||||
notifications.updateMessage(items.length + ' Song(s) Added to Queue', true);
|
||||
} else {
|
||||
$scope.album = [];
|
||||
|
@ -90,7 +90,7 @@ function PlaylistCtrl($scope, $rootScope, $location, utils, globals, model, noti
|
|||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
$scope.getStarred = function (action, type) {
|
||||
var size = globals.settings.AutoPlaylistSize;
|
||||
$rootScope.selectedPlaylist = null;
|
||||
|
@ -134,7 +134,7 @@ function PlaylistCtrl($scope, $rootScope, $location, utils, globals, model, noti
|
|||
$rootScope.queue.push(utils.mapSong(item));
|
||||
});
|
||||
$scope.$apply();
|
||||
$rootScope.showQueue();
|
||||
//$rootScope.showQueue();
|
||||
notifications.updateMessage(items.length + ' Song(s) Added to Queue', true);
|
||||
} else if (action == 'play') {
|
||||
$rootScope.queue = [];
|
||||
|
@ -145,7 +145,7 @@ function PlaylistCtrl($scope, $rootScope, $location, utils, globals, model, noti
|
|||
$scope.$apply(function () {
|
||||
$rootScope.playSong(false, next);
|
||||
});
|
||||
$rootScope.showQueue();
|
||||
//$rootScope.showQueue();
|
||||
notifications.updateMessage(items.length + ' Song(s) Added to Queue', true);
|
||||
} else {
|
||||
$rootScope.song = [];
|
||||
|
@ -162,10 +162,10 @@ function PlaylistCtrl($scope, $rootScope, $location, utils, globals, model, noti
|
|||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
$scope.newPlaylist = function (data, event) {
|
||||
var reply = prompt("Choose a name for your new playlist.", "");
|
||||
if (reply != 'null' && reply != null && reply != '') {
|
||||
if (reply != 'null' && reply !== null && reply !== '') {
|
||||
$.ajax({
|
||||
url: globals.BaseURL() + '/createPlaylist.view?' + globals.BaseParams() + '&name=' + reply,
|
||||
method: 'GET',
|
||||
|
@ -176,9 +176,9 @@ function PlaylistCtrl($scope, $rootScope, $location, utils, globals, model, noti
|
|||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
$scope.deletePlaylist = function () {
|
||||
if ($rootScope.selectedPlaylist != null) {
|
||||
if ($rootScope.selectedPlaylist !== null) {
|
||||
var id = $rootScope.selectedPlaylist;
|
||||
if (utils.confirmDelete('Are you sure you want to delete the selected playlist?')) {
|
||||
$.ajax({
|
||||
|
@ -192,9 +192,9 @@ function PlaylistCtrl($scope, $rootScope, $location, utils, globals, model, noti
|
|||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
$scope.savePlaylist = function () {
|
||||
if ($rootScope.selectedPlaylist() != null) {
|
||||
if ($rootScope.selectedPlaylist() !== null) {
|
||||
var id = $rootScope.selectedPlaylist().id();
|
||||
var songs = [];
|
||||
ko.utils.arrayForEach($rootScope.song(), function (item) {
|
||||
|
@ -215,12 +215,12 @@ function PlaylistCtrl($scope, $rootScope, $location, utils, globals, model, noti
|
|||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
$scope.removeSelectedSongs = function (data, event) {
|
||||
ko.utils.arrayForEach($scope.selectedSongs(), function (item) {
|
||||
$rootScope.song.remove(item);
|
||||
});
|
||||
}
|
||||
};
|
||||
/* End Playlists */
|
||||
|
||||
/* Launch on Startup */
|
||||
|
|
|
@ -4,7 +4,7 @@ function PodcastCtrl($scope, $rootScope, $location, utils, globals, model, notif
|
|||
|
||||
$rootScope.song = [];
|
||||
$scope.podcasts = [];
|
||||
$scope.selectedPodcast;
|
||||
$scope.selectedPodcast = null;
|
||||
$scope.getPodcasts = function (refresh) {
|
||||
if (globals.settings.Debug) { console.log("LOAD PODCASTS"); }
|
||||
$.ajax({
|
||||
|
@ -25,7 +25,7 @@ function PodcastCtrl($scope, $rootScope, $location, utils, globals, model, notif
|
|||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
$scope.getPodcast = function (id, action) {
|
||||
$scope.selectedPodcast = id;
|
||||
var map = function (data) {
|
||||
|
@ -46,7 +46,7 @@ function PodcastCtrl($scope, $rootScope, $location, utils, globals, model, notif
|
|||
var salt = Math.floor(Math.random() * 100000);
|
||||
url = globals.BaseURL() + '/stream.view?' + globals.BaseParams() + '&id=' + song.streamId + '&salt=' + salt;
|
||||
return new model.Song(song.streamId, song.parent, track, song.title, song.artist, song.artistId, song.album, song.albumId, coverartthumb, coverartfull, song.duration, song.userRating, starred, suffix, specs, url, 0, description);
|
||||
}
|
||||
};
|
||||
$.ajax({
|
||||
url: globals.BaseURL() + '/getPodcasts.view?' + globals.BaseParams(),
|
||||
method: 'GET',
|
||||
|
@ -75,7 +75,7 @@ function PodcastCtrl($scope, $rootScope, $location, utils, globals, model, notif
|
|||
}
|
||||
});
|
||||
$scope.$apply();
|
||||
$rootScope.showQueue();
|
||||
//$rootScope.showQueue();
|
||||
notifications.updateMessage(items.length + ' Song(s) Added to Queue', true);
|
||||
} else if (action == 'play') {
|
||||
$rootScope.queue = [];
|
||||
|
@ -88,7 +88,7 @@ function PodcastCtrl($scope, $rootScope, $location, utils, globals, model, notif
|
|||
$scope.$apply(function () {
|
||||
$rootScope.playSong(false, next);
|
||||
});
|
||||
$rootScope.showQueue();
|
||||
//$rootScope.showQueue();
|
||||
notifications.updateMessage(items.length + ' Song(s) Added to Queue', true);
|
||||
} else {
|
||||
$scope.album = [];
|
||||
|
@ -104,7 +104,7 @@ function PodcastCtrl($scope, $rootScope, $location, utils, globals, model, notif
|
|||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/* Launch on Startup */
|
||||
$scope.getPodcasts();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue