sync develop with local dev

This commit is contained in:
Trevor Squillario 2014-04-05 11:53:30 -04:00
parent 09ac96526e
commit 149688b8ca
23 changed files with 496 additions and 157 deletions

View file

@ -181,7 +181,7 @@ function ArchiveCtrl($scope, $rootScope, $location, $routeParams, $http, utils,
}
});
};
utils.mapSong = function (key, song, server, dir, identifier, coverart) {
$scope.mapSong = function (key, song, server, dir, identifier, coverart) {
var url, time, track, title, rating, starred, contenttype, suffix;
var specs = '';
if (song.format == 'VBR MP3') {
@ -212,7 +212,7 @@ function ArchiveCtrl($scope, $rootScope, $location, $routeParams, $http, utils,
var items = data.files;
if (action == 'add') {
angular.forEach(items, function (item, key) {
var song = utils.mapSong(key, item, server, dir, identifier, coverart);
var song = $scope.mapSong(key, item, server, dir, identifier, coverart);
if (song) {
$rootScope.queue.push(song);
}
@ -223,7 +223,7 @@ function ArchiveCtrl($scope, $rootScope, $location, $routeParams, $http, utils,
} else if (action == 'play') {
$rootScope.queue = [];
angular.forEach(items, function (item, key) {
var song = utils.mapSong(key, item, server, dir, identifier, coverart);
var song = $scope.mapSong(key, item, server, dir, identifier, coverart);
if (song) {
$rootScope.queue.push(song);
}
@ -238,7 +238,7 @@ function ArchiveCtrl($scope, $rootScope, $location, $routeParams, $http, utils,
$scope.album = [];
$rootScope.song = [];
angular.forEach(items, function (item, key) {
var song = utils.mapSong(key, item, server, dir, identifier, coverart);
var song = $scope.mapSong(key, item, server, dir, identifier, coverart);
if (song) {
$rootScope.song.push(song);
}

View file

@ -159,7 +159,7 @@ function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, util
} 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);
return new model.Album(album.id, album.parent, title, album.artist.toString(), 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;
@ -255,7 +255,7 @@ function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, util
$scope.album = [];
$rootScope.song = [];
$scope.album.push($scope.mapAlbum(data["subsonic-response"].album));
//$scope.album.push($scope.mapAlbum(data["subsonic-response"].album));
var items = [];
if (data["subsonic-response"].album.song.length > 0) {
@ -412,6 +412,7 @@ function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, util
} else {
items[0] = data["subsonic-response"].searchResult2.song;
}
$scope.album = [];
$rootScope.song = [];
angular.forEach(items, function (item, key) {
$rootScope.song.push(utils.mapSong(item));
@ -427,6 +428,7 @@ function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, util
items[0] = data["subsonic-response"].searchResult2.album;
}
$scope.album = [];
$rootScope.song = [];
angular.forEach(items, function (item, key) {
if (item.isDir) {
$scope.album.push($scope.mapAlbum(item));

View file

@ -118,14 +118,10 @@ function AppCtrl($scope, $rootScope, $document, $window, $location, $cookieStore
}
};
$rootScope.showQueue = function () {
var submenu = $('#QueuePreview');
submenu.fadeIn(400);
var timeout = globals.settings.Timeout;
setTimeout(function () { submenu.fadeOut(); }, timeout);
$.fancybox.open();
};
$rootScope.hideQueue = function () {
var submenu = $('#QueuePreview');
submenu.fadeOut();
$.fancybox.close();
};
$scope.toggleQueue = function () {
var submenu = $('#QueuePreview');
@ -149,9 +145,18 @@ function AppCtrl($scope, $rootScope, $document, $window, $location, $cookieStore
closeEffect: 'none'
});
$('#action_Welcome').fancybox({
$('.showQueue').fancybox({
href: '#showqueue',
autoWidth: false,
width: '100%',
//margin: [50, 10, 50, 10], // top, right, bottom, left
openEffect: 'none',
closeEffect: 'none'
closeEffect: 'none',
beforeLoad: function () {
if ($rootScope.queue == 0) {
this.close();
}
}
});
$('#audiocontainer .scrubber').mouseover(function (e) {
@ -232,21 +237,19 @@ function AppCtrl($scope, $rootScope, $document, $window, $location, $cookieStore
if (source != 'Search' && source != 'Source' && source != 'Description' && source != 'ChatMsg' && source != 'AutoPlaylists') {
var unicode = e.charCode ? e.charCode : e.keyCode;
if (globals.settings.Debug) { console.log('Keycode Triggered: ' + unicode); }
/*
if (unicode == 49) {
utils.changeTab('tabQueue');
if (unicode == 49) { // 1
$('#action_Queue').click();
} else if (unicode == 50) {
utils.changeTab('tabLibrary');
$('#action_Library').click();
} else if (unicode == 51) {
utils.changeTab('tabArchive');
$('#action_Playlists').click();
} else if (unicode == 52) {
utils.changeTab('tabPlaylists');
$('#action_Podcasts').click();
} else if (unicode == 53) {
utils.changeTab('tabPodcasts');
} else if (unicode == 54) {
utils.changeTab('tabSettings');
$('#action_Archive').click();
} else if (unicode == 54) { // 6
$('#action_Settings').click();
}
*/
if (unicode >= 65 && unicode <= 90 && $('#tabLibrary').is(':visible')) { // a-z
var key = utils.findKeyForCode(unicode);
if (key == 'x' || key == 'y' || key == 'z') {
@ -270,22 +273,22 @@ function AppCtrl($scope, $rootScope, $document, $window, $location, $cookieStore
var volume = utils.getValue('Volume') ? parseFloat(utils.getValue('Volume')) : 1;
if (volume <= 1 && volume > 0 && source === '') {
volume += -0.1;
$(player1).jPlayer({
$(globals.Player1).jPlayer({
volume: volume
});
utils.setValue('Volume', volume, true);
//updateMessage('Volume: ' + Math.round(volume * 100) + '%');
if (globals.settings.Debug) { console.log('Volume: ' + Math.round(volume * 100) + '%'); }
}
}
if (unicode == 187) { // equals - volume up
var volume = utils.getValue('Volume') ? parseFloat(utils.getValue('Volume')) : 1;
if (volume < 1 && volume >= 0 && source ==- '') {
volume += 0.1;
$(player1).jPlayer({
$(globals.Player1).jPlayer({
volume: volume
});
utils.setValue('Volume', volume, true);
//updateMessage('Volume: ' + Math.round(volume * 100) + '%');
if (globals.settings.Debug) { console.log('Volume: ' + Math.round(volume * 100) + '%'); }
}
}
}
@ -464,6 +467,7 @@ function AppCtrl($scope, $rootScope, $document, $window, $location, $cookieStore
$scope.queueEmpty = function () {
//self.selectedSongs([]);
$rootScope.queue = [];
$.fancybox.close();
};
$scope.queueTotal = function () {
var total = 0;
@ -510,7 +514,7 @@ function AppCtrl($scope, $rootScope, $document, $window, $location, $cookieStore
if (typeof folder == 'number' && folder !== '' && folder != 'all') {
//alert(folder);
folderParams = '&musicFolderId=' + folder;
} else if (typeof $rootScope.SelectedMusicFolder.id != 'undefined') {
} else if (typeof $rootScope.SelectedMusicFolder.id != 'undefined' && $rootScope.SelectedMusicFolder.id >= 0) {
//alert($rootScope.SelectedMusicFolder.id);
folderParams = '&musicFolderId=' + $rootScope.SelectedMusicFolder.id;
}

View file

@ -1,8 +1,7 @@
JamStash.controller('QueueCtrl',
function QueueCtrl($scope, $rootScope, $routeParams, $location, utils, globals, json, notifications) {
$scope.settings = globals.settings;
//$scope.song = $rootScope.queue;
//angular.copy($rootScope.queue, $scope.song);
$scope.song = $rootScope.queue;
//angular.copy($rootScope.queue, $scope.song);
$scope.itemType = 'pl';
});

View file

@ -1,5 +1,5 @@
JamStash.controller('SettingsCtrl',
function SettingsCtrl($scope, $routeParams, $location, utils, globals, json, notifications, player) {
function SettingsCtrl($rootScope, $scope, $routeParams, $location, utils, globals, json, notifications, player) {
$scope.settings = globals.settings;
$scope.Timeouts = [
{ id: 10000, name: 10 },
@ -26,9 +26,9 @@ function SettingsCtrl($scope, $routeParams, $location, utils, globals, json, not
$scope.reset = function () {
utils.setValue('Settings', null, true);
$scope.loadSettings();
}
};
$scope.save = function () {
if ($scope.settings.Password != '' && globals.settings.Password.substring(0, 4) != 'enc:') { $scope.settings.Password = 'enc:' + utils.HexEncode($scope.settings.Password); }
if ($scope.settings.Password !== '' && globals.settings.Password.substring(0, 4) != 'enc:') { $scope.settings.Password = 'enc:' + utils.HexEncode($scope.settings.Password); }
if ($scope.settings.NotificationSong) {
notifications.requestPermissionIfRequired();
if (!notifications.hasNotificationPermission()) {
@ -52,7 +52,7 @@ function SettingsCtrl($scope, $routeParams, $location, utils, globals, json, not
utils.setValue('Settings', $scope.settings, true);
notifications.updateMessage('Settings Updated!', true);
$scope.loadSettings();
if (globals.settings.Server != '' && globals.settings.Username != '' && globals.settings.Password != '') {
if (globals.settings.Server !== '' && globals.settings.Username !== '' && globals.settings.Password !== '') {
$scope.ping();
}
};
@ -64,7 +64,7 @@ function SettingsCtrl($scope, $routeParams, $location, utils, globals, json, not
json.getChangeLog(function (data) {
$scope.changeLog = data;
});
}
};
$scope.setupDemo = function () {
var Username = "android-guest";
var Password = "guest";
@ -77,8 +77,17 @@ function SettingsCtrl($scope, $routeParams, $location, utils, globals, json, not
//$scope.save();
$location.url('/library');
}
}
};
/* Load on Startup */
// https://tsquillario.dyndns.org:8443/Jamstash/beta/#/settings?url=https://tsquillario.dyndns.org:8443/subsonic&u=tsquillario
if (typeof $location.search()['url'] != 'undefined' && $scope.settings.Server === '') {
if (globals.settings.Debug) { console.log("Setting Provided: " + $location.search()['url']); }
$scope.settings.Server = $location.search()['url'];
}
if (typeof $location.search()['u'] != 'undefined' && $scope.settings.Username === '') {
if (globals.settings.Debug) { console.log("Setting Provided: " + $location.search()['u']); }
$scope.settings.Username = $location.search()['u'];
}
/* End Startup */
});