Added push for extra Defaults, Added Artist Search
This commit is contained in:
parent
0db50559e7
commit
ff10d7779c
7 changed files with 79 additions and 69 deletions
|
@ -23,44 +23,32 @@ function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, util
|
|||
$scope.selectedAutoAlbum;
|
||||
$scope.selectedArtist;
|
||||
$scope.selectedAlbum;
|
||||
$scope.selectedSubsonicAlbumSort = 'default';
|
||||
$scope.SubsonicSort = [];
|
||||
$scope.SubsonicAlbumSort = [
|
||||
{ id: "default", name: "Default Sort" },
|
||||
{ id: "artist", name: "Artist" },
|
||||
{ id: "album", name: "Album" },
|
||||
{ id: "createdate desc", name: "Date Added" },
|
||||
];
|
||||
$scope.SubsonicSongSort = [
|
||||
{ id: "default", name: "Default Sort" },
|
||||
{ id: "track", name: "Track" },
|
||||
{ id: "artist", name: "Artist" },
|
||||
{ id: "album", name: "Album" },
|
||||
{ id: "createdate desc", name: "Date Added" },
|
||||
];
|
||||
$scope.SelectedAlbumSort = globals.settings.DefaultAlbumSort;
|
||||
$scope.AlbumSort = globals.AlbumSorts;
|
||||
$scope.BreadCrumbs = [];
|
||||
$scope.$watch("selectedSubsonicAlbumSort", function (newValue, oldValue) {
|
||||
$scope.$watch("SelectedAlbumSort.id", function (newValue, oldValue) {
|
||||
if (newValue !== oldValue) {
|
||||
if ($rootScope.song.length > 0) {
|
||||
$scope.sortSubsonicSongs(newValue);
|
||||
} else if ($scope.album.length > 0) {
|
||||
$scope.sortSubsonicAlbums(newValue);
|
||||
indexes = $.map(globals.AlbumSorts, function (obj, index) {
|
||||
if (obj.id == newValue) {
|
||||
return index;
|
||||
}
|
||||
})
|
||||
globals.settings.DefaultAlbumSort = globals.AlbumSorts[indexes];
|
||||
}
|
||||
}
|
||||
});
|
||||
$rootScope.$watch("selectedMusicFolder", function (newValue, oldValue) {
|
||||
$rootScope.$watch("SelectedMusicFolder", function (newValue, oldValue) {
|
||||
if (newValue !== oldValue) {
|
||||
utils.setValue('MusicFolders', angular.toJson(newValue), true);
|
||||
$scope.getArtists(newValue.id);
|
||||
}
|
||||
});
|
||||
$scope.selectedLayout = globals.settings.DefaultLibraryLayout;
|
||||
//not sure how to just grab the layouts hash from the settings controller
|
||||
$scope.Layouts = [
|
||||
{ id: "list", name: "List" },
|
||||
{ id: "grid", name: "Grid" },
|
||||
];
|
||||
|
||||
$scope.SearchType = globals.settings.DefaultSearchType;
|
||||
$scope.SearchTypes = globals.SearchTypes;
|
||||
$scope.rescanLibrary = function (data, event) {
|
||||
$.ajax({
|
||||
url: globals.BaseURL() + '/getUser.view?' + globals.BaseParams() + '&username=' + globals.settings.Username,
|
||||
|
@ -121,12 +109,16 @@ function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, util
|
|||
}
|
||||
// TODO: AZIndex, build letters here. Make it a click button somewhere then a larger popup with letters finger friendly size
|
||||
$scope.shortcut = [];
|
||||
var items = [];
|
||||
if (typeof data["subsonic-response"].indexes.shortcut != 'undefined') {
|
||||
if (data["subsonic-response"].indexes.shortcut.length > 0) {
|
||||
$scope.shortcut = data["subsonic-response"].indexes.shortcut;
|
||||
items = data["subsonic-response"].indexes.shortcut;
|
||||
} else {
|
||||
$scope.shortcut[0] = data["subsonic-response"].indexes.shortcut;
|
||||
items[0] = data["subsonic-response"].indexes.shortcut;
|
||||
}
|
||||
angular.forEach(items, function (item, key) {
|
||||
$scope.shortcut.push(item);
|
||||
});
|
||||
}
|
||||
$scope.index = [];
|
||||
angular.forEach(indexes, function (item, key) {
|
||||
|
@ -187,10 +179,9 @@ function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, util
|
|||
$rootScope.song.push(utils.mapSong(item));
|
||||
}
|
||||
});
|
||||
if ($scope.selectedSubsonicAlbumSort != "default") {
|
||||
$scope.sortSubsonicAlbums($scope.selectedSubsonicAlbumSort);
|
||||
if ($scope.SelectedAlbumSort.id != "default") {
|
||||
$scope.sortSubsonicAlbums($scope.SelectedAlbumSort.id);
|
||||
}
|
||||
$scope.SubsonicSort = $scope.SubsonicAlbumSort;
|
||||
$scope.$apply();
|
||||
} else {
|
||||
notifications.updateMessage('No Albums Returned :(', true);
|
||||
|
@ -307,7 +298,9 @@ function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, util
|
|||
$rootScope.song.push($scope.mapAlbum(item));
|
||||
}
|
||||
});
|
||||
$scope.SubsonicSort = $scope.SubsonicAlbumSort;
|
||||
if ($scope.SelectedAlbumSort.id != "default") {
|
||||
$scope.sortSubsonicAlbums($scope.SelectedAlbumSort.id);
|
||||
}
|
||||
$scope.$apply();
|
||||
} else {
|
||||
notifications.updateMessage('No Albums Returned :(', true);
|
||||
|
@ -376,8 +369,10 @@ function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, util
|
|||
});
|
||||
if (albums.length > 0) {
|
||||
$scope.album = albums;
|
||||
if ($scope.SelectedAlbumSort.id != "default") {
|
||||
$scope.sortSubsonicAlbums($scope.SelectedAlbumSort.id);
|
||||
}
|
||||
}
|
||||
$scope.SubsonicSort = $scope.SubsonicSongSort;
|
||||
$scope.$apply();
|
||||
}
|
||||
} else {
|
||||
|
@ -399,7 +394,7 @@ function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, util
|
|||
if (data["subsonic-response"].searchResult2 !== "") {
|
||||
var header;
|
||||
var items = [];
|
||||
if (type === 'song') {
|
||||
if (type === '0') {
|
||||
if (data["subsonic-response"].searchResult2.song !== undefined) {
|
||||
if (data["subsonic-response"].searchResult2.song.length > 0) {
|
||||
items = data["subsonic-response"].searchResult2.song;
|
||||
|
@ -413,7 +408,7 @@ function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, util
|
|||
$scope.$apply();
|
||||
}
|
||||
}
|
||||
if (type === 'album') {
|
||||
if (type === '1') {
|
||||
if (data["subsonic-response"].searchResult2.album !== undefined) {
|
||||
if (data["subsonic-response"].searchResult2.album.length > 0) {
|
||||
items = data["subsonic-response"].searchResult2.album;
|
||||
|
@ -431,6 +426,19 @@ function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, util
|
|||
$scope.$apply();
|
||||
}
|
||||
}
|
||||
if (type === '2') {
|
||||
if (data["subsonic-response"].searchResult2.artist !== undefined) {
|
||||
if (data["subsonic-response"].searchResult2.artist.length > 0) {
|
||||
items = data["subsonic-response"].searchResult2.artist;
|
||||
} else {
|
||||
items[0] = data["subsonic-response"].searchResult2.artist;
|
||||
}
|
||||
angular.forEach(items, function (item, key) {
|
||||
$scope.shortcut.push(item);
|
||||
});
|
||||
$scope.$apply();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -8,7 +8,7 @@ function AppCtrl($scope, $rootScope, $document, $location, utils, globals, model
|
|||
$rootScope.Genres = [];
|
||||
$rootScope.selectedPlaylist = "";
|
||||
$rootScope.selectedAutoPlaylist = "";
|
||||
$rootScope.selectedMusicFolder = "";
|
||||
$rootScope.SelectedMusicFolder = "";
|
||||
$rootScope.unity;
|
||||
$rootScope.loggedIn = function () {
|
||||
if (globals.settings.Server != '' && globals.settings.Username != '' && globals.settings.Password != '') {
|
||||
|
@ -351,7 +351,7 @@ function AppCtrl($scope, $rootScope, $document, $location, utils, globals, model
|
|||
}
|
||||
i++;
|
||||
});
|
||||
$rootScope.selectedMusicFolder = $rootScope.MusicFolders[index];
|
||||
$rootScope.SelectedMusicFolder = $rootScope.MusicFolders[index];
|
||||
}
|
||||
$scope.$apply();
|
||||
}
|
||||
|
@ -482,9 +482,9 @@ function AppCtrl($scope, $rootScope, $document, $location, utils, globals, model
|
|||
if (typeof folder == 'number' && folder != '' && folder != 'all') {
|
||||
//alert(folder);
|
||||
folderParams = '&musicFolderId=' + folder;
|
||||
} else if (typeof $rootScope.selectedMusicFolder.id != 'undefined') {
|
||||
//alert($rootScope.selectedMusicFolder.id);
|
||||
folderParams = '&musicFolderId=' + $rootScope.selectedMusicFolder.id;
|
||||
} else if (typeof $rootScope.SelectedMusicFolder.id != 'undefined') {
|
||||
//alert($rootScope.SelectedMusicFolder.id);
|
||||
folderParams = '&musicFolderId=' + $rootScope.SelectedMusicFolder.id;
|
||||
}
|
||||
$.ajax({
|
||||
url: globals.BaseURL() + '/getRandomSongs.view?' + globals.BaseParams() + '&size=' + size + genreParams + folderParams,
|
||||
|
|
|
@ -13,11 +13,9 @@ function SettingsCtrl($scope, $routeParams, $location, utils, globals, json, not
|
|||
];
|
||||
$scope.Protocols = ["json", "jsonp"];
|
||||
$scope.Themes = ["Default", "Dark"];
|
||||
$scope.LibraryLayouts = [
|
||||
{ id: "list", name: "List" },
|
||||
{ id: "grid", name: "Grid" },
|
||||
];
|
||||
$scope.DefaultLibraryLayout = 'grid';
|
||||
$scope.SearchTypes = globals.SearchTypes;
|
||||
$scope.Layouts = globals.Layouts;
|
||||
|
||||
$scope.$watch('settings.HideAZ', function () {
|
||||
if (globals.settings.HideAZ) {
|
||||
$('#AZIndex').hide();
|
||||
|
|
|
@ -7,10 +7,7 @@
|
|||
</div>
|
||||
<div id="search">
|
||||
<input type="text" id="Search" class="medium" title="Wildcards (*) supported" placeholder="Search..." ng-enter="search()"/>
|
||||
<select id="SearchType" name="SearchType">
|
||||
<option value="song">Song</option>
|
||||
<option value="album">Album</option>
|
||||
</select>
|
||||
<select id="SearchType" name="SearchType" ng-model="SearchType.id" ng-options="o.id as o.name for o in SearchTypes"></select>
|
||||
<a href="" class="button" id="action_Search" title="Search" ng-click="search()"><img class="pad" src="images/magnifying_glass_alt_12x12.png" /></a>
|
||||
</div>
|
||||
<div class="subactions">
|
||||
|
@ -30,7 +27,7 @@
|
|||
<div id="AZIndex" ng-show="!settings.HideAZ" class="subactionsfixed">
|
||||
<a href="" ng-click="toggleAZ()" stop-event="click">A-Z</a>
|
||||
</div>
|
||||
<select id="MusicFolders" class="folders" ng-model="$root.selectedMusicFolder" ng-options="o as o.name for o in MusicFolders">
|
||||
<select id="MusicFolders" class="folders" ng-model="$root.SelectedMusicFolder" ng-options="o as o.name for o in MusicFolders">
|
||||
<option value="">All Folders</option>
|
||||
</select>
|
||||
<ul id="AutoAlbumContainer" class="simplelist mainlist noselect">
|
||||
|
@ -64,11 +61,9 @@
|
|||
<ul class="actionlist">
|
||||
<li>
|
||||
<form class="form">
|
||||
<select id="selectedSubsonicAlbumSort" ng-model="selectedSubsonicAlbumSort" ng-show="SubsonicSort.length" ng-options="o.id as o.name for o in SubsonicSort"></select>
|
||||
<!--<select id="selectedLayout" ng-model="selectedLayout" ng-options="o.id as o.name for o in Layouts"></select>-->
|
||||
<select id="SelectedAlbumSort" ng-model="SelectedAlbumSort.id" ng-show="AlbumSort.length" ng-options="o.id as o.name for o in AlbumSort"></select>
|
||||
</form>
|
||||
<div id="BreadCrumb">
|
||||
<a href="#" id="BreadHome"><img src="images/home_gl_12x12.png"></a>
|
||||
<div id="BreadCrumbs" class="floatleft">
|
||||
<div class="crumb" ng-repeat="o in BreadCrumbs | filter:{type:'artist'}"><a ng-click="getAlbums(o.id, o.name)">{{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>
|
||||
|
@ -79,7 +74,7 @@
|
|||
<div class="clear"></div>
|
||||
<ul class="simplelist songlist noselect">
|
||||
<div class="" ng-repeat="o in album" ng-switch on="o.type">
|
||||
<li class="album" ng-switch-when="byfolder" id="{{o.id}}" ng-class="{'selected': selectedAlbum == o.id, 'albumgrid': selectedLayout == 'grid'}" ng-click="getSongs(o.id, '')" parentid="{{o.parentid}}">
|
||||
<li class="album" ng-switch-when="byfolder" id="{{o.id}}" ng-class="{'selected': selectedAlbum == o.id, 'albumgrid': settings.DefaultLibraryLayout.id == 'grid'}" ng-click="getSongs(o.id, '')" parentid="{{o.parentid}}">
|
||||
<div class="itemactions">
|
||||
<a class="add" href="" title="Add To Play Queue" ng-click="getSongs(o.id, 'add')" stop-event="click"></a>
|
||||
<a class="play" href="" title="Play" ng-click="getSongs(o.id, 'play')" stop-event="click"></a>
|
||||
|
@ -94,7 +89,7 @@
|
|||
</div>
|
||||
<div class="clear"></div>
|
||||
</li>
|
||||
<li class="album" ng-switch-when="bytag" id="{{o.id}}" ng-class="{'selected': selectedAlbum == o.id, 'albumgrid': selectedLayout == 'grid'}" ng-click="getAlbumByTag(o.id)">
|
||||
<li class="album" ng-switch-when="bytag" id="{{o.id}}" ng-class="{'selected': selectedAlbum == o.id, 'albumgrid': settings.DefaultLibraryLayout.id == 'grid'}" ng-click="getAlbumByTag(o.id)">
|
||||
<div class="albumart"><img ng-src="{{o.coverartthumb}}" src="images/albumdefault_160.jpg"></div>
|
||||
<div class="albuminfo">
|
||||
<div class="title" title="{{o.name}}" ng-bind-html-unsafe="o.name"></div>
|
||||
|
|
|
@ -48,15 +48,11 @@
|
|||
<div class="clear"></div>
|
||||
<label for="DefaultLibraryLayout">Default Library Layout</label>
|
||||
<div class="clear"></div>
|
||||
<select id="DefaultLibraryLayout" name="DefaultLibraryLayout" class="" ng-model="settings.DefaultLibraryLayout" ng-options="o.id as o.name for o in LibraryLayouts" title="AJAX Request Library Layout"></select>
|
||||
<select id="DefaultLibraryLayout" name="DefaultLibraryLayout" class="" ng-model="settings.DefaultLibraryLayout.id" ng-options="o.id as o.name for o in Layouts" title="Library Layout"></select>
|
||||
<div class="clear"></div>
|
||||
<label for="DefaultSubsonicAlbumSort">Default Album Sort Order</label>
|
||||
<div class="clear"></div>
|
||||
<select id="DefaultSubsonicAlbumSort" name="DefaultSubsonicAlbumSort" class="" ng-model="settings.DefaultSubsonicAlbumSort" ng-options="o.id as o.name for o in SubsonicAlbumSort" title="Subsonic Album Layout"></select>
|
||||
<div class="clear"></div>
|
||||
<label for="DefaultSearchType">Default Search Type</label>
|
||||
<div class="clear"></div>
|
||||
<select id="DefaultSearchType" name="DefaultSearchType" class="" ng-model="settings.DefaultSearchType" ng-options="o.id as o.name for o in SearchTypeLayout" title="Subsonic Album Layout"></select>
|
||||
<select id="DefaultSearchType" name="DefaultSearchType" class="" ng-model="settings.DefaultSearchType.id" ng-options="o.id as o.name for o in SearchTypes" title="Subsonic Album Layout"></select>
|
||||
<div class="clear"></div>
|
||||
</fieldset>
|
||||
<div class="clear"></div>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
JamStash.service('model', function () {
|
||||
// Figure out how to move this, circular dependency with utils
|
||||
secondsToTime = function (secs) {
|
||||
// secs = 4729
|
||||
var times = new Array(3600, 60, 1);
|
||||
|
@ -75,6 +76,22 @@
|
|||
});
|
||||
|
||||
JamStash.service('globals', function () {
|
||||
this.SearchTypes = [
|
||||
{ id: "song", name: "Song" },
|
||||
{ id: "album", name: "Album" },
|
||||
{ id: "artist", name: "Artist" },
|
||||
];
|
||||
this.Layouts = [
|
||||
{ id: "grid", name: "Grid" },
|
||||
{ id: "list", name: "List" }
|
||||
];
|
||||
this.AlbumSorts = [
|
||||
{ id: "default", name: "Default Sort" },
|
||||
{ id: "artist", name: "Artist" },
|
||||
{ id: "album", name: "Album" },
|
||||
{ id: "track", name: "Track" },
|
||||
{ id: "createdate desc", name: "Date Added" },
|
||||
];
|
||||
this.settings = {
|
||||
// Subsonic
|
||||
/* Demo Server
|
||||
|
@ -102,7 +119,9 @@ JamStash.service('globals', function () {
|
|||
SaveTrackPosition: false,
|
||||
ForceFlash: false,
|
||||
Theme: "Default",
|
||||
DefaultLibraryLayout: "grid",
|
||||
DefaultLibraryLayout: this.Layouts[0],
|
||||
DefaultSearchType: this.SearchTypes[0],
|
||||
DefaultAlbumSort: this.AlbumSorts[0],
|
||||
AutoPlay: false,
|
||||
LoopQueue: false,
|
||||
Repeat: false,
|
||||
|
@ -110,10 +129,10 @@ JamStash.service('globals', function () {
|
|||
};
|
||||
this.SavedCollections = [];
|
||||
this.SavedGenres = [];
|
||||
|
||||
this.BaseURL = function () { return this.settings.Server + '/rest'; };
|
||||
this.BaseParams = function () { return 'u=' + this.settings.Username + '&p=' + this.settings.Password + '&f=' + this.settings.Protocol + '&v=' + this.settings.ApiVersion + '&c=' + this.settings.ApplicationName; };
|
||||
});
|
||||
|
||||
// Directives
|
||||
JamStash.directive('layout', function () {
|
||||
return {
|
||||
|
|
|
@ -508,10 +508,9 @@ ul.mainlist li.item a.add:hover
|
|||
#BreadCrumb
|
||||
{
|
||||
float: left;
|
||||
margin: 13px 0 0 0;
|
||||
padding: 2px 8px;
|
||||
margin: 14px 0 0 0;
|
||||
padding: 2px 0;
|
||||
color: #AEAEA7;
|
||||
background: #f6f6f6;
|
||||
border-radius: .4em;
|
||||
}
|
||||
#BreadCrumb img
|
||||
|
@ -537,11 +536,6 @@ ul.mainlist li.item a.add:hover
|
|||
{
|
||||
float: left;
|
||||
}
|
||||
#BreadHome a
|
||||
{
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#TrackContainer, #PodcastContainer
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue