diff --git a/app/app.js b/app/app.js index 5e166db..66085f1 100755 --- a/app/app.js +++ b/app/app.js @@ -1,7 +1,7 @@ /* Declare app level module */ angular.module('JamStash', ['ngCookies', 'ngRoute', 'ngSanitize', - 'jamstash.subsonic.ctrl']) + 'jamstash.subsonic.ctrl', 'jamstash.archive.ctrl']) .config(['$routeProvider',function($routeProvider) { 'use strict'; diff --git a/app/archive/archive-service.js b/app/archive/archive-service.js index 3975fe0..3d982e6 100644 --- a/app/archive/archive-service.js +++ b/app/archive/archive-service.js @@ -1,4 +1,11 @@ -angular.module('JamStash').factory('archive', ['$rootScope, $http, $q, $sce, globals, model, utils, map, notifications', +/** +* jamstash.archive.service Module +* +* Access Archive.org +*/ +angular.module('jamstash.archive.service', ['jamstash.settings', 'jamstash.model', 'jamstash.notifications']) + +.factory('archive', ['$rootScope', '$http', '$q', '$sce', 'globals', 'model', 'utils', 'map', 'notifications', function($rootScope, $http, $q, $sce, globals, model, utils, map, notifications) { 'use strict'; @@ -17,7 +24,7 @@ angular.module('JamStash').factory('archive', ['$rootScope, $http, $q, $sce, glo var mapAlbum = function (data) { var song = data; - var coverartthumb, coverartfull, starred, title, album, publisher, avg_rating, downloads, identifier; + var coverartthumb, coverartfull, starred, title, album, publisher, avg_rating, downloads, identifier, source, date; var url = globals.archiveUrl + 'details/' + song.identifier; coverartthumb = 'images/albumdefault_50.jpg'; coverartfull = 'images/albumdefault_160.jpg'; @@ -71,7 +78,7 @@ angular.module('JamStash').factory('archive', ['$rootScope, $http, $q, $sce, glo timeout: globals.settings.Timeout, success: function (data) { if (data.response.docs.length > 0) { - items = data.response.docs; + var items = data.response.docs; //alert(JSON.stringify(data["response"])); content.artist = []; angular.forEach(items, function (item, key) { diff --git a/app/archive/archive.js b/app/archive/archive.js index 059c064..fd6592b 100644 --- a/app/archive/archive.js +++ b/app/archive/archive.js @@ -1,5 +1,11 @@ -angular.module('JamStash') -.controller('ArchiveCtrl', ['$scope, $rootScope, $location, $routeParams, $http, $timeout, utils, globals, model, notifications, player, archive, json', +/** +* jamstash.archive.ctrl Module +* +* Access Archive.org +*/ +angular.module('jamstash.archive.ctrl', ['jamstash.archive.service']) + +.controller('ArchiveCtrl', ['$scope', '$rootScope', '$location', '$routeParams', '$http', '$timeout', 'utils', 'globals', 'model', 'notifications', 'player', 'archive', 'json', function($scope, $rootScope, $location, $routeParams, $http, $timeout, utils, globals, model, notifications, player, archive, json){ 'use strict'; diff --git a/app/common/main-controller.js b/app/common/main-controller.js index a204a71..3226c57 100644 --- a/app/common/main-controller.js +++ b/app/common/main-controller.js @@ -92,8 +92,8 @@ } else { var el = $(pl); var off = el.offset(); - width = el.width(); - height = el.height(); + var width = el.width(); + var height = el.height(); switch (pos) { case 'right': //show the menu to the right of placeholder @@ -391,56 +391,18 @@ $rootScope.queue.push(data); }; $rootScope.removeSong = function (item, songs) { - var index = songs.indexOf(item) + var index = songs.indexOf(item); songs.splice(index, 1); }; $scope.removeSongFromQueue = function (item) { var index = $rootScope.queue.indexOf(item) $rootScope.queue.splice(index, 1); - } + }; $scope.isActive = function (route) { return route === $location.path(); }; $rootScope.getSplitPosition = function (scope, elm) { - alert(elm.getBoundingClientRect().left); - }; - $scope.getMusicFolders = function () { - $.ajax({ - url: globals.BaseURL() + '/getMusicFolders.view?' + globals.BaseParams(), - method: 'GET', - dataType: globals.settings.Protocol, - timeout: globals.settings.Timeout, - success: function (data) { - if (data["subsonic-response"].musicFolders.musicFolder !== undefined) { - var folders = []; - if (data["subsonic-response"].musicFolders.musicFolder.length > 0) { - folders = data["subsonic-response"].musicFolders.musicFolder; - } else { - 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')); - var i = 0, index = ""; - angular.forEach($rootScope.MusicFolders, function (item, key) { - if (item.id == folder.id) { - index = i; - } - i++; - }); - $rootScope.SelectedMusicFolder = $rootScope.MusicFolders[index]; - } else { - $rootScope.SelectedMusicFolder = $rootScope.MusicFolders[0]; - } - $scope.$apply(); - } - } - }); + window.alert(elm.getBoundingClientRect().left); }; $scope.download = function (id) { $.ajax({ diff --git a/app/images/pin_gl_12x12.png b/app/images/pin_gl_12x12.png new file mode 100644 index 0000000..9a0ecfc Binary files /dev/null and b/app/images/pin_gl_12x12.png differ diff --git a/app/subsonic/subsonic.js b/app/subsonic/subsonic.js index e9440e2..18c30d1 100644 --- a/app/subsonic/subsonic.js +++ b/app/subsonic/subsonic.js @@ -300,7 +300,7 @@ angular.module('jamstash.subsonic.ctrl', ['jamstash.subsonic.service']) notifications.updateMessage(errorNotif, true); }); }; - $scope.getRandomSongs = function (action, genre, folder) { + $rootScope.getRandomSongs = function (action, genre, folder) { subsonic.getRandomSongs(action, genre, folder).then(function (data) { $scope.album = data.album; $scope.song = data.song; @@ -396,6 +396,44 @@ angular.module('jamstash.subsonic.ctrl', ['jamstash.subsonic.service']) $scope.selectedPodcast = data.selectedPodcast; }); }; + $scope.getMusicFolders = function () { + $.ajax({ + url: globals.BaseURL() + '/getMusicFolders.view?' + globals.BaseParams(), + method: 'GET', + dataType: globals.settings.Protocol, + timeout: globals.settings.Timeout, + success: function (data) { + if (data["subsonic-response"].musicFolders.musicFolder !== undefined) { + var folders = []; + if (data["subsonic-response"].musicFolders.musicFolder.length > 0) { + folders = data["subsonic-response"].musicFolders.musicFolder; + } else { + 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')); + var i = 0, index = ""; + angular.forEach($rootScope.MusicFolders, function (item, key) { + if (item.id == folder.id) { + index = i; + } + i++; + }); + $rootScope.SelectedMusicFolder = $rootScope.MusicFolders[index]; + } else { + $rootScope.SelectedMusicFolder = $rootScope.MusicFolders[0]; + } + $scope.$apply(); + } + } + }); + }; /* Launch on Startup */ $scope.getArtists();