3.4 consolidated subsonic actions
This commit is contained in:
parent
b0c3d9e9ab
commit
fb989567cc
18 changed files with 1303 additions and 1077 deletions
25
index.html
25
index.html
|
@ -20,10 +20,7 @@
|
||||||
<script src="js/plugins/angular-cookies.min.js" type="text/javascript"></script>
|
<script src="js/plugins/angular-cookies.min.js" type="text/javascript"></script>
|
||||||
<script src="js/plugins/angular-resource.min.js" type="text/javascript"></script>
|
<script src="js/plugins/angular-resource.min.js" type="text/javascript"></script>
|
||||||
<!--
|
<!--
|
||||||
<script src="../js/plugins/angular.min.js"></script>
|
<script src="js/plugins/angular-ui-router.min.js"></script>
|
||||||
<script src="../js/plugins/angular-cookies.min.js"></script>
|
|
||||||
<script src="../js/plugins/angular-resource.min.js"></script>
|
|
||||||
<script src="../js/plugins/angular-route.min.js"></script>
|
|
||||||
-->
|
-->
|
||||||
<script src="js/plugins/jquery-ui-1.10.3.custom.min.js" type="text/javascript"></script>
|
<script src="js/plugins/jquery-ui-1.10.3.custom.min.js" type="text/javascript"></script>
|
||||||
<script src="js/plugins/jquery-split-pane.js"></script>
|
<script src="js/plugins/jquery-split-pane.js"></script>
|
||||||
|
@ -39,14 +36,11 @@
|
||||||
<script src="js/utils.js" type="text/javascript"></script>
|
<script src="js/utils.js" type="text/javascript"></script>
|
||||||
<script src="js/controllers/main.js" type="text/javascript"></script>
|
<script src="js/controllers/main.js" type="text/javascript"></script>
|
||||||
<script src="js/controllers/settings.js" type="text/javascript"></script>
|
<script src="js/controllers/settings.js" type="text/javascript"></script>
|
||||||
<script src="js/controllers/playlists.js" type="text/javascript"></script>
|
|
||||||
<script src="js/controllers/podcasts.js" type="text/javascript"></script>
|
|
||||||
<script src="js/controllers/library.js" type="text/javascript"></script>
|
<script src="js/controllers/library.js" type="text/javascript"></script>
|
||||||
<script src="js/controllers/archive.js" type="text/javascript"></script>
|
<script src="js/controllers/archive.js" type="text/javascript"></script>
|
||||||
<script src="js/controllers/queue.js"></script>
|
<script src="js/controllers/queue.js"></script>
|
||||||
<script src="js/player.js" type="text/javascript"></script>
|
<script src="js/player.js" type="text/javascript"></script>
|
||||||
</head>
|
</head>
|
||||||
<!--<body ng-controller="AppCtrl" layout state="bodyState" ng-init="bodyState = 1">-->
|
|
||||||
<body ng-controller="AppCtrl">
|
<body ng-controller="AppCtrl">
|
||||||
<div id="container">
|
<div id="container">
|
||||||
<div id="header">
|
<div id="header">
|
||||||
|
@ -61,8 +55,8 @@
|
||||||
<ul class="tabs">
|
<ul class="tabs">
|
||||||
<li><a href="" class="first showQueue" id="action_Queue" title="Queue" class="active" ng-class="{'active': isActive('/queue')}"><img src="images/play_alt_gd_16x16.png"></a></li>
|
<li><a href="" class="first showQueue" id="action_Queue" title="Queue" class="active" ng-class="{'active': isActive('/queue')}"><img src="images/play_alt_gd_16x16.png"></a></li>
|
||||||
<li><a href="#/library" id="action_Library" title="Library" ng-class="{'active': isActive('/library')}"><img src="images/headphones_gd_16x14.png" /></a></li>
|
<li><a href="#/library" id="action_Library" title="Library" ng-class="{'active': isActive('/library')}"><img src="images/headphones_gd_16x14.png" /></a></li>
|
||||||
<li><a href="#/playlists" id="action_Playlists" title="Playlists" ng-class="{'active': isActive('/playlists')}"><img src="images/list_gd_16x14.png" /></a></li>
|
<!--<li><a href="#/playlists" id="action_Playlists" title="Playlists" ng-class="{'active': isActive('/playlists')}"><img src="images/list_gd_16x14.png" /></a></li>-->
|
||||||
<li><a href="#/podcasts" id="action_Podcasts" title="Podcasts" ng-class="{'active': isActive('/podcasts')}"><img src="images/rss_16x16.png" /></a></li>
|
<!--<li><a href="#/podcasts" id="action_Podcasts" title="Podcasts" ng-class="{'active': isActive('/podcasts')}"><img src="images/rss_16x16.png" /></a></li>-->
|
||||||
<li><a href="#/archive" id="action_Archive" class="" title="Archive.org - Live Music Archive" ng-class="{'active': isActive('/archive')}"><img src="images/archive_gd_16x16.png" /></a></li>
|
<li><a href="#/archive" id="action_Archive" class="" title="Archive.org - Live Music Archive" ng-class="{'active': isActive('/archive')}"><img src="images/archive_gd_16x16.png" /></a></li>
|
||||||
<li><a href="#/settings" id="action_Settings" class="last" title="Settings" ng-class="{'active': isActive('/settings')}"><img src="images/cog_16x16.png" /></a></li>
|
<li><a href="#/settings" id="action_Settings" class="last" title="Settings" ng-class="{'active': isActive('/settings')}"><img src="images/cog_16x16.png" /></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -89,15 +83,6 @@
|
||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
</div><!-- end #content -->
|
</div><!-- end #content -->
|
||||||
<!-- Player -->
|
<!-- Player -->
|
||||||
<ul id="QueuePreview" class="shadow" class="songlist noselect" sortable>
|
|
||||||
<li class="row song" ng-repeat="o in queue track by $index" ng-class="{'playing': o.playing, 'selected': o.selected}" ng-click="selectSong(o)" ng-dblclick="playSong(false, o)" id="{{o.id}}" parentid="{{o.parentid}}">
|
|
||||||
<div class="albumart"><a class="coverartfancy" href="{{o.coverartfull}}"><img class="" ng-src="{{o.coverartthumb}}" src="images/albumdefault_60.jpg" /></a></div>
|
|
||||||
<div class="clear"></div>
|
|
||||||
<div class="title" title="{{ o.track + ' - ' + o.name + ' - ' + o.time }}" ng-bind-html="o.name"></div>
|
|
||||||
<div class="albumtext" title="{{o.album}}" ng-bind-html="o.album"></div>
|
|
||||||
<div class="albumtext" title="{{o.artist}}" ng-bind-html="o.artist"></div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<div id="player">
|
<div id="player">
|
||||||
<div id="playercontainer">
|
<div id="playercontainer">
|
||||||
<div id="playerleft" class="floatleft">
|
<div id="playerleft" class="floatleft">
|
||||||
|
@ -157,10 +142,10 @@
|
||||||
<a class="button" id="NextTrack" title="Next Track" ng-click="nextTrack()"><img src="images/last_12x12.png" /></a>
|
<a class="button" id="NextTrack" title="Next Track" ng-click="nextTrack()"><img src="images/last_12x12.png" /></a>
|
||||||
<a class="button" title="Shuffle Queue" ng-click="queueShuffle()">Shuffle</a>
|
<a class="button" title="Shuffle Queue" ng-click="queueShuffle()">Shuffle</a>
|
||||||
<a class="button" id="action_Empty" title="Delete Queue" ng-click="queueEmpty()">Empty</a>
|
<a class="button" id="action_Empty" title="Delete Queue" ng-click="queueEmpty()">Empty</a>
|
||||||
<a class="button" id="action_DeleteSelected" title="Remove Selected From Queue" ng-click="queueRemoveSelected()">Remove</a>
|
<a class="button" id="action_DeleteSelected" title="Remove Selected From Queue" ng-click="queueRemoveSelected()">Remove Song(s)</a>
|
||||||
</div>
|
</div>
|
||||||
<ul class="simplelist songlist noselect" style="width: 1200px;" ng-if="queue.length > 0">
|
<ul class="simplelist songlist noselect" style="width: 1200px;" ng-if="queue.length > 0">
|
||||||
<div ng-repeat="song in [queue]" class="songs" ng-include src="'js/partials/songs.html'" sortable></div>
|
<div ng-repeat="song in [queue] track by $index" class="songs" ng-include src="'js/partials/songs.html'" sortable></div>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<a href="" class="button" id="action_NewPlaylist" title="New Playlist" ng-click="newPlaylist()">+ New</a>
|
<a href="" class="button" id="action_NewPlaylist" title="New Playlist" ng-click="newPlaylist()">+ New</a>
|
||||||
<a href="" class="button" id="action_DeletePlaylist" title="Delete Selected Playlist" ng-click="deletePlaylist()">Delete</a>
|
<a href="" class="button" id="action_DeletePlaylist" title="Delete Selected Playlist" ng-click="deletePlaylist()">Delete</a>
|
||||||
<a href="" class="button" id="action_SavePlaylist" title="Save Playlist" ng-click="savePlaylist()">Save</a>
|
<a href="" class="button" id="action_SavePlaylist" title="Save Playlist" ng-click="savePlaylist()">Save</a>
|
||||||
<a href="" class="button" id="action_RemoveSongs" title="Remove selected song(s) from playlist" ng-click="removeSelectedSongs()">Remove Song(s)</a>
|
<a href="" class="button" id="action_RemoveSongs" title="Remove selected song(s) from playlist" ng-click="songsRemoveSelected()">Remove Song(s)</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
<div id="LayoutContainer" class="section lgsection split-pane fixed-left" split>
|
<div id="LayoutContainer" class="section lgsection split-pane fixed-left" split>
|
24
js/_saved/playlists.js
Normal file
24
js/_saved/playlists.js
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
JamStash.controller('PlaylistCtrl',
|
||||||
|
function PlaylistCtrl($scope, $rootScope, $location, utils, globals, model, notifications) {
|
||||||
|
$rootScope.song = [];
|
||||||
|
$scope.itemType = 'pl';
|
||||||
|
$scope.playlists = [];
|
||||||
|
$scope.playlistsPublic = [];
|
||||||
|
$scope.playlistsGenre = globals.SavedGenres;
|
||||||
|
$scope.selectedGenre = null;
|
||||||
|
$scope.$watch("selectedGenre", function (newValue, oldValue) {
|
||||||
|
if (newValue !== oldValue) {
|
||||||
|
globals.SavedGenres.push(newValue);
|
||||||
|
//$scope.playlistsGenre.push();
|
||||||
|
utils.setValue('SavedGenres', globals.SavedGenres.join(), false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Launch on Startup */
|
||||||
|
$scope.getPlaylists();
|
||||||
|
//$scope.getMusicFolders();
|
||||||
|
$scope.getGenres();
|
||||||
|
/* End Startup */
|
||||||
|
});
|
41
js/app.js
41
js/app.js
|
@ -52,6 +52,47 @@ JamStash.config(function ($sceDelegateProvider) {
|
||||||
// Then
|
// Then
|
||||||
$routeParams ==> {chapterId:1, sectionId:2, search:'moby'}
|
$routeParams ==> {chapterId:1, sectionId:2, search:'moby'}
|
||||||
*/
|
*/
|
||||||
|
/*
|
||||||
|
JamStash.config(function ($stateProvider) {
|
||||||
|
$stateProvider
|
||||||
|
.state('root', {
|
||||||
|
url: '',
|
||||||
|
views: {
|
||||||
|
'settings': {
|
||||||
|
url: '/settings',
|
||||||
|
templateUrl: 'js/partials/settings.html',
|
||||||
|
controller: 'SettingsCtrl'
|
||||||
|
},
|
||||||
|
'library': {
|
||||||
|
url: '/library',
|
||||||
|
templateUrl: 'js/partials/library.html',
|
||||||
|
controller: 'SubsonicCtrl'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
JamStash.config(function ($stateProvider) {
|
||||||
|
$stateProvider
|
||||||
|
.state('root', {
|
||||||
|
url: '/',
|
||||||
|
templateUrl: 'js/partials/library.html',
|
||||||
|
controller: 'SubsonicCtrl'
|
||||||
|
})
|
||||||
|
.state('settings', {
|
||||||
|
url: '/settings',
|
||||||
|
templateUrl: 'js/partials/settings.html',
|
||||||
|
controller: 'SettingsCtrl'
|
||||||
|
})
|
||||||
|
.state('library', {
|
||||||
|
url: '/library',
|
||||||
|
templateUrl: 'js/partials/library.html',
|
||||||
|
controller: 'SubsonicCtrl'
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
JamStash.config(function ($routeProvider) {
|
JamStash.config(function ($routeProvider) {
|
||||||
$routeProvider
|
$routeProvider
|
||||||
.when('/index', { redirectTo: '/library' })
|
.when('/index', { redirectTo: '/library' })
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
JamStash.controller('ArchiveCtrl',
|
JamStash.controller('ArchiveCtrl',
|
||||||
function ArchiveCtrl($scope, $rootScope, $location, $routeParams, $http, utils, globals, model, notifications, player, json) {
|
function ArchiveCtrl($scope, $rootScope, $location, $routeParams, $http, utils, globals, model, notifications, player, json) {
|
||||||
//$("#left-component").layout($scope.layoutThreeCol);
|
|
||||||
|
|
||||||
$scope.settings = globals.settings;
|
$scope.settings = globals.settings;
|
||||||
$scope.itemType = 'archive';
|
$scope.itemType = 'archive';
|
||||||
$rootScope.song = [];
|
$rootScope.song = [];
|
||||||
|
@ -20,10 +18,6 @@ function ArchiveCtrl($scope, $rootScope, $location, $routeParams, $http, utils,
|
||||||
});
|
});
|
||||||
$scope.writeSavedCollection = function () {
|
$scope.writeSavedCollection = function () {
|
||||||
utils.setValue('SavedCollections', $scope.SavedCollections.join(), false);
|
utils.setValue('SavedCollections', $scope.SavedCollections.join(), false);
|
||||||
/*
|
|
||||||
$scope.$apply(function () {
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
globals.SavedCollections = $scope.SavedCollections;
|
globals.SavedCollections = $scope.SavedCollections;
|
||||||
};
|
};
|
||||||
$scope.addSavedCollection = function (newValue) {
|
$scope.addSavedCollection = function (newValue) {
|
||||||
|
|
|
@ -1,15 +1,12 @@
|
||||||
JamStash.controller('SubsonicCtrl',
|
JamStash.controller('SubsonicCtrl',
|
||||||
function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, utils, globals, model, notifications, player) {
|
function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, utils, globals, model, map, subsonic, notifications, player) {
|
||||||
//$("#SubsonicAlbums").layout($scope.layoutThreeCol);
|
//$("#SubsonicAlbums").layout($scope.layoutThreeCol);
|
||||||
|
|
||||||
$rootScope.song = [];
|
//subsonic.song = [];
|
||||||
//$scope.artistId = $routeParams.artistId;
|
//$scope.artistId = $routeParams.artistId;
|
||||||
//$scope.albumId = $routeParams.albumId;
|
//$scope.albumId = $routeParams.albumId;
|
||||||
$scope.settings = globals.settings;
|
$scope.settings = globals.settings;
|
||||||
$scope.itemType = 'ss';
|
$scope.itemType = 'ss';
|
||||||
$scope.index = [];
|
|
||||||
$scope.shortcut = [];
|
|
||||||
$scope.album = [];
|
|
||||||
$scope.Server = globals.settings.Server;
|
$scope.Server = globals.settings.Server;
|
||||||
$scope.playlistMenu = [];
|
$scope.playlistMenu = [];
|
||||||
$scope.AutoAlbums = [
|
$scope.AutoAlbums = [
|
||||||
|
@ -20,18 +17,75 @@ function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, util
|
||||||
{ id: "frequent", name: "Most Played" },
|
{ id: "frequent", name: "Most Played" },
|
||||||
{ id: "recent", name: "Recently Played" }
|
{ id: "recent", name: "Recently Played" }
|
||||||
];
|
];
|
||||||
$scope.selectedAutoAlbum = null;
|
|
||||||
$scope.selectedArtist = null;
|
|
||||||
$scope.selectedAlbum = null;
|
|
||||||
$scope.SelectedAlbumSort = globals.settings.DefaultAlbumSort;
|
$scope.SelectedAlbumSort = globals.settings.DefaultAlbumSort;
|
||||||
$scope.AlbumSort = globals.AlbumSorts;
|
$scope.AlbumSort = globals.AlbumSorts;
|
||||||
$scope.BreadCrumbs = [];
|
$scope.showIndex = subsonic.showIndex;
|
||||||
|
$scope.$watch("showIndex", function (newValue, oldValue) {
|
||||||
|
if (newValue !== oldValue) {
|
||||||
|
subsonic.showIndex = $scope.showIndex;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$scope.toggleIndex = function () {
|
||||||
|
if ($scope.showIndex) {
|
||||||
|
$scope.showIndex = false;
|
||||||
|
} else {
|
||||||
|
$scope.showIndex = true;
|
||||||
|
}
|
||||||
|
$scope.saveDefaultSection('index');
|
||||||
|
};
|
||||||
|
$scope.showPlaylist = subsonic.showPlaylist;
|
||||||
|
$scope.$watch("showPlaylist", function (newValue, oldValue) {
|
||||||
|
if (newValue !== oldValue) {
|
||||||
|
subsonic.showPlaylist = $scope.showPlaylist;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$scope.togglePlaylist = function () {
|
||||||
|
if ($scope.showPlaylist) {
|
||||||
|
$scope.showPlaylist = false;
|
||||||
|
} else {
|
||||||
|
$scope.showPlaylist = true;
|
||||||
|
}
|
||||||
|
$scope.saveDefaultSection('playlist');
|
||||||
|
};
|
||||||
|
$scope.showPodcast = subsonic.showPodcast;
|
||||||
|
$scope.$watch("showPodcast", function (newValue, oldValue) {
|
||||||
|
if (newValue !== oldValue) {
|
||||||
|
subsonic.showPodcast = $scope.showPodcast;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$scope.togglePodcast = function () {
|
||||||
|
if ($scope.showPodcast) {
|
||||||
|
$scope.showPodcast = false;
|
||||||
|
} else {
|
||||||
|
$scope.showPodcast = true;
|
||||||
|
}
|
||||||
|
$scope.saveDefaultSection('podcast');
|
||||||
|
};
|
||||||
|
$scope.saveDefaultSection = function (val) {
|
||||||
|
utils.setValue('DefaultSection', val, false);
|
||||||
|
}
|
||||||
|
$scope.openDefaultSection = function (val) {
|
||||||
|
var section = utils.getValue('DefaultSection');
|
||||||
|
switch (section) {
|
||||||
|
case 'index':
|
||||||
|
$scope.showIndex = true;
|
||||||
|
break;
|
||||||
|
case 'playlist':
|
||||||
|
$scope.showPlaylist = true;
|
||||||
|
break;
|
||||||
|
case 'podcast':
|
||||||
|
$scope.showPodcast = true;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
$scope.$watch("SelectedAlbumSort.id", function (newValue, oldValue) {
|
$scope.$watch("SelectedAlbumSort.id", function (newValue, oldValue) {
|
||||||
if (newValue !== oldValue) {
|
if (newValue !== oldValue) {
|
||||||
if ($rootScope.song.length > 0) {
|
if (subsonic.song.length > 0) {
|
||||||
$scope.sortSubsonicSongs(newValue);
|
subsonic.sortSubsonicSongs(newValue);
|
||||||
} else if ($scope.album.length > 0) {
|
} else if (subsonic.content.album.length > 0) {
|
||||||
$scope.sortSubsonicAlbums(newValue);
|
subsonic.sortSubsonicAlbums(newValue);
|
||||||
indexes = $.map(globals.AlbumSorts, function (obj, index) {
|
indexes = $.map(globals.AlbumSorts, function (obj, index) {
|
||||||
if (obj.id == newValue) {
|
if (obj.id == newValue) {
|
||||||
return index;
|
return index;
|
||||||
|
@ -44,11 +98,18 @@ function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, util
|
||||||
$rootScope.$watch("SelectedMusicFolder", function (newValue, oldValue) {
|
$rootScope.$watch("SelectedMusicFolder", function (newValue, oldValue) {
|
||||||
if (newValue !== oldValue) {
|
if (newValue !== oldValue) {
|
||||||
utils.setValue('MusicFolders', angular.toJson(newValue), true);
|
utils.setValue('MusicFolders', angular.toJson(newValue), true);
|
||||||
$scope.getArtists(newValue.id);
|
$scope.getArtists(newValue.id, true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$scope.SearchType = globals.settings.DefaultSearchType;
|
$scope.SearchType = globals.settings.DefaultSearchType;
|
||||||
$scope.SearchTypes = globals.SearchTypes;
|
$scope.SearchTypes = globals.SearchTypes;
|
||||||
|
$scope.playlistsGenre = globals.SavedGenres;
|
||||||
|
$scope.$watch("selectedGenre", function (newValue, oldValue) {
|
||||||
|
if (newValue !== oldValue) {
|
||||||
|
globals.SavedGenres.push(newValue);
|
||||||
|
utils.setValue('SavedGenres', globals.SavedGenres.join(), false);
|
||||||
|
}
|
||||||
|
});
|
||||||
$scope.rescanLibrary = function (data, event) {
|
$scope.rescanLibrary = function (data, event) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: globals.BaseURL() + '/getUser.view?' + globals.BaseParams() + '&username=' + globals.settings.Username,
|
url: globals.BaseURL() + '/getUser.view?' + globals.BaseParams() + '&username=' + globals.settings.Username,
|
||||||
|
@ -64,140 +125,63 @@ function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, util
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
$scope.mapArtist = function (data) {
|
$scope.selectAll = function () {
|
||||||
var name = '';
|
$rootScope.selectAll($scope.song);
|
||||||
var artist = data.artist;
|
|
||||||
var artists = [];
|
|
||||||
if (artist.length > 0) {
|
|
||||||
artists = artist;
|
|
||||||
} else {
|
|
||||||
artists[0] = artist;
|
|
||||||
}
|
|
||||||
angular.forEach(artists, function (item, key) {
|
|
||||||
if (typeof item.name !== 'undefined') { item.name = item.name.toString(); }
|
|
||||||
});
|
|
||||||
if (typeof data.name !== 'undefined') { name = data.name.toString(); }
|
|
||||||
return new model.Index(name, artists);
|
|
||||||
};
|
};
|
||||||
$scope.mapIndex = function (data) {
|
$scope.selectNone = function () {
|
||||||
var name, id = '';
|
$rootScope.selectNone($scope.song);
|
||||||
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) {
|
$scope.playAll = function () {
|
||||||
return new model.Artist(data.id, data.name);
|
$rootScope.playAll($scope.song);
|
||||||
};
|
};
|
||||||
$scope.getArtists = function (id) {
|
$scope.playFrom = function (index) {
|
||||||
var url;
|
$rootScope.playFrom(index, $scope.song);
|
||||||
if (utils.getValue('MusicFolders')) {
|
};
|
||||||
var folder = angular.fromJson(utils.getValue('MusicFolders'));
|
$scope.removeSong = function (item) {
|
||||||
id = folder.id;
|
$rootScope.removeSong(item, $scope.song);
|
||||||
}
|
};
|
||||||
if (id) {
|
$scope.songsRemoveSelected = function () {
|
||||||
url = globals.BaseURL() + '/getIndexes.view?' + globals.BaseParams() + '&musicFolderId=' + id;
|
subsonic.songsRemoveSelected($scope.selectedSongs).then(function (data) {
|
||||||
} else {
|
$scope.album = data.album;
|
||||||
url = globals.BaseURL() + '/getIndexes.view?' + globals.BaseParams();
|
$scope.song = data.song;
|
||||||
}
|
|
||||||
$.ajax({
|
|
||||||
url: url,
|
|
||||||
method: 'GET',
|
|
||||||
dataType: globals.settings.Protocol,
|
|
||||||
timeout: globals.settings.Timeout,
|
|
||||||
done: function () { if (globals.settings.Debug) { console.log("DONE!"); } },
|
|
||||||
error: function () { if (globals.settings.Debug) { console.log("ERROR!"); } },
|
|
||||||
success: function (data) {
|
|
||||||
var indexes = [];
|
|
||||||
if (typeof data["subsonic-response"].indexes.index != 'undefined') {
|
|
||||||
if (data["subsonic-response"].indexes.index.length > 0) {
|
|
||||||
//angular.forEach(items, function(item, key) {
|
|
||||||
//});
|
|
||||||
//$.makeArray(obj)
|
|
||||||
indexes = data["subsonic-response"].indexes.index;
|
|
||||||
} else {
|
|
||||||
indexes[0] = data["subsonic-response"].indexes.index;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 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) {
|
|
||||||
items = data["subsonic-response"].indexes.shortcut;
|
|
||||||
} else {
|
|
||||||
items[0] = data["subsonic-response"].indexes.shortcut;
|
|
||||||
}
|
|
||||||
angular.forEach(items, function (item, key) {
|
|
||||||
$scope.shortcut.push($scope.mapIndex(item));
|
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
$scope.index = [];
|
$scope.getArtists = function (id, refresh) {
|
||||||
angular.forEach(indexes, function (item, key) {
|
subsonic.getArtists(id, refresh).then(function (data) {
|
||||||
$scope.index.push($scope.mapArtist(item));
|
$scope.index = data.artists;
|
||||||
});
|
$scope.shortcut = data.shortcuts;
|
||||||
$scope.$apply();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
$scope.refreshArtists = function (id) {
|
$scope.refreshArtists = function (id) {
|
||||||
utils.setValue('MusicFolders', null, true);
|
utils.setValue('MusicFolders', null, true);
|
||||||
$scope.getArtists();
|
$scope.getArtists(0, true);
|
||||||
};
|
$scope.getPlaylists(true);
|
||||||
|
|
||||||
$scope.mapAlbum = function (data) {
|
|
||||||
var album = data;
|
|
||||||
var title, coverartthumb, coverartfull, starred;
|
|
||||||
if (typeof album.coverArt != 'undefined') {
|
|
||||||
coverartthumb = globals.BaseURL() + '/getCoverArt.view?' + globals.BaseParams() + '&size=160&id=' + album.coverArt;
|
|
||||||
coverartfull = globals.BaseURL() + '/getCoverArt.view?' + globals.BaseParams() + '&id=' + album.coverArt;
|
|
||||||
}
|
|
||||||
if (typeof album.starred !== 'undefined') { starred = true; } else { starred = false; }
|
|
||||||
if (typeof album.title !== 'undefined') { title = album.title; } else { title = album.name; }
|
|
||||||
var type;
|
|
||||||
if (album.isDir) {
|
|
||||||
type = 'byfolder';
|
|
||||||
} else {
|
|
||||||
type = 'bytag';
|
|
||||||
}
|
|
||||||
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.getAlbums = function (id, name) {
|
||||||
$scope.selectedAutoAlbum = null;
|
subsonic.getAlbums(id, name).then(function (data) {
|
||||||
$scope.selectedArtist = id;
|
$scope.album = data.album;
|
||||||
$scope.BreadCrumbs = [];
|
$scope.song = data.song;
|
||||||
$scope.BreadCrumbs.push({ 'type': 'artist', 'id': id, 'name': name });
|
$scope.BreadCrumbs = data.breadcrumb;
|
||||||
var url = globals.BaseURL() + '/getMusicDirectory.view?' + globals.BaseParams() + '&id=' + id;
|
$scope.selectedAutoAlbum = data.selectedAutoAlbum;
|
||||||
$.ajax({
|
$scope.selectedArtist = data.selectedArtist;
|
||||||
url: url,
|
$scope.selectedAlbum = data.selectedAlbum;
|
||||||
method: 'GET',
|
$scope.selectedPlaylist = data.selectedPlaylist;
|
||||||
dataType: globals.settings.Protocol,
|
|
||||||
timeout: globals.settings.Timeout,
|
|
||||||
success: function (data) {
|
|
||||||
var items = [];
|
|
||||||
if (typeof data["subsonic-response"].directory.child != 'undefined') {
|
|
||||||
if (data["subsonic-response"].directory.child.length > 0) {
|
|
||||||
items = data["subsonic-response"].directory.child;
|
|
||||||
} else {
|
|
||||||
items[0] = data["subsonic-response"].directory.child;
|
|
||||||
}
|
|
||||||
$scope.album = [];
|
|
||||||
$rootScope.song = [];
|
|
||||||
|
|
||||||
angular.forEach(items, function (item, key) {
|
|
||||||
if (item.isDir) {
|
|
||||||
$scope.album.push($scope.mapAlbum(item));
|
|
||||||
} else {
|
|
||||||
$rootScope.song.push(utils.mapSong(item));
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
if ($scope.SelectedAlbumSort.id != "default") {
|
};
|
||||||
$scope.sortSubsonicAlbums($scope.SelectedAlbumSort.id);
|
$scope.getAlbumListBy = function (id, off) {
|
||||||
}
|
subsonic.getAlbumListBy(id, off).then(function (data) {
|
||||||
$scope.$apply();
|
$scope.album = data.album;
|
||||||
} else {
|
$scope.song = data.song;
|
||||||
notifications.updateMessage('No Albums Returned :(', true);
|
$scope.BreadCrumbs = data.breadcrumb;
|
||||||
}
|
$scope.selectedAutoAlbum = data.selectedAutoAlbum;
|
||||||
}
|
$scope.selectedArtist = data.selectedArtist;
|
||||||
|
$scope.selectedPlaylist = data.selectedPlaylist;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
$scope.getSongs = function (id, action) {
|
||||||
|
subsonic.getSongs(id, action).then(function (data) {
|
||||||
|
$scope.album = data.album;
|
||||||
|
$scope.song = data.song;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
$scope.getArtistByTag = function (id) { // Gets Artist by ID3 tag
|
$scope.getArtistByTag = function (id) { // Gets Artist by ID3 tag
|
||||||
|
@ -231,11 +215,11 @@ function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, util
|
||||||
} else {
|
} else {
|
||||||
items[0] = data["subsonic-response"].artist.album;
|
items[0] = data["subsonic-response"].artist.album;
|
||||||
}
|
}
|
||||||
$scope.album = [];
|
subsonic.content.album = [];
|
||||||
$rootScope.song = [];
|
subsonic.song = [];
|
||||||
|
|
||||||
angular.forEach(items, function (item, key) {
|
angular.forEach(items, function (item, key) {
|
||||||
$scope.album.push($scope.mapAlbum(item));
|
subsonic.content.album.push(map.mapAlbum(item));
|
||||||
});
|
});
|
||||||
$scope.$apply();
|
$scope.$apply();
|
||||||
} else {
|
} else {
|
||||||
|
@ -252,10 +236,10 @@ function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, util
|
||||||
timeout: globals.settings.Timeout,
|
timeout: globals.settings.Timeout,
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
if (typeof data["subsonic-response"].album != 'undefined') {
|
if (typeof data["subsonic-response"].album != 'undefined') {
|
||||||
$scope.album = [];
|
subsonic.content.album = [];
|
||||||
$rootScope.song = [];
|
subsonic.song = [];
|
||||||
|
|
||||||
//$scope.album.push($scope.mapAlbum(data["subsonic-response"].album));
|
//subsonic.content.album.push(map.mapAlbum(data["subsonic-response"].album));
|
||||||
|
|
||||||
var items = [];
|
var items = [];
|
||||||
if (data["subsonic-response"].album.song.length > 0) {
|
if (data["subsonic-response"].album.song.length > 0) {
|
||||||
|
@ -264,203 +248,74 @@ function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, util
|
||||||
items[0] = data["subsonic-response"].album.song;
|
items[0] = data["subsonic-response"].album.song;
|
||||||
}
|
}
|
||||||
angular.forEach(items, function (item, key) {
|
angular.forEach(items, function (item, key) {
|
||||||
$rootScope.song.push(utils.mapSong(item));
|
subsonic.song.push(map.mapSong(item));
|
||||||
});
|
});
|
||||||
$scope.$apply();
|
$scope.$apply();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
$scope.offset = 0;
|
|
||||||
$scope.getAlbumListBy = function (id, offset) {
|
|
||||||
var size, url;
|
|
||||||
$scope.selectedArtist = null;
|
|
||||||
$scope.selectedAutoAlbum = id;
|
|
||||||
$scope.BreadCrumbs = [];
|
|
||||||
if (offset == 'next') {
|
|
||||||
$scope.offset = $scope.offset + globals.settings.AutoAlbumSize;
|
|
||||||
} else if (offset == 'prev') {
|
|
||||||
$scope.offset = $scope.offset - globals.settings.AutoAlbumSize;
|
|
||||||
}
|
|
||||||
if ($scope.offset > 0) {
|
|
||||||
url = globals.BaseURL() + '/getAlbumList.view?' + globals.BaseParams() + '&size=' + globals.settings.AutoAlbumSize.toString() + '&type=' + id + '&offset=' + $scope.offset;
|
|
||||||
} else {
|
|
||||||
url = globals.BaseURL() + '/getAlbumList.view?' + globals.BaseParams() + '&size=' + globals.settings.AutoAlbumSize.toString() + '&type=' + id;
|
|
||||||
}
|
|
||||||
$.ajax({
|
|
||||||
url: url,
|
|
||||||
method: 'GET',
|
|
||||||
dataType: globals.settings.Protocol,
|
|
||||||
timeout: globals.settings.Timeout,
|
|
||||||
success: function (data) {
|
|
||||||
var items = [];
|
|
||||||
if (typeof data["subsonic-response"].albumList.album != 'undefined') {
|
|
||||||
if (data["subsonic-response"].albumList.album.length > 0) {
|
|
||||||
items = data["subsonic-response"].albumList.album;
|
|
||||||
} else {
|
|
||||||
items[0] = data["subsonic-response"].albumList.album;
|
|
||||||
}
|
|
||||||
$scope.album = [];
|
|
||||||
$rootScope.song = [];
|
|
||||||
angular.forEach(items, function (item, key) {
|
|
||||||
if (item.isDir) {
|
|
||||||
$scope.album.push($scope.mapAlbum(item));
|
|
||||||
} else {
|
|
||||||
$rootScope.song.push($scope.mapAlbum(item));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if ($scope.SelectedAlbumSort.id != "default") {
|
|
||||||
$scope.sortSubsonicAlbums($scope.SelectedAlbumSort.id);
|
|
||||||
}
|
|
||||||
$scope.$apply();
|
|
||||||
} else {
|
|
||||||
notifications.updateMessage('No Albums Returned :(', true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
$scope.getSongs = function (id, action) {
|
|
||||||
$scope.selectedAlbum = id;
|
|
||||||
var url = globals.BaseURL() + '/getMusicDirectory.view?' + globals.BaseParams() + '&id=' + id;
|
|
||||||
$.ajax({
|
|
||||||
url: url,
|
|
||||||
method: 'GET',
|
|
||||||
dataType: globals.settings.Protocol,
|
|
||||||
timeout: globals.settings.Timeout,
|
|
||||||
success: function (data) {
|
|
||||||
var items = [];
|
|
||||||
if (typeof data["subsonic-response"].directory.child != 'undefined') {
|
|
||||||
if (data["subsonic-response"].directory.child.length > 0) {
|
|
||||||
items = data["subsonic-response"].directory.child;
|
|
||||||
} else {
|
|
||||||
items[0] = data["subsonic-response"].directory.child;
|
|
||||||
}
|
|
||||||
if (action == 'add') {
|
|
||||||
angular.forEach(items, function (item, key) {
|
|
||||||
$rootScope.queue.push(utils.mapSong(item));
|
|
||||||
});
|
|
||||||
$scope.$apply();
|
|
||||||
//$rootScope.showQueue();
|
|
||||||
notifications.updateMessage(items.length + ' Song(s) Added to Queue', true);
|
|
||||||
} else if (action == 'play') {
|
|
||||||
$rootScope.queue = [];
|
|
||||||
angular.forEach(items, function (item, key) {
|
|
||||||
$rootScope.queue.push(utils.mapSong(item));
|
|
||||||
});
|
|
||||||
var next = $rootScope.queue[0];
|
|
||||||
$scope.$apply(function () {
|
|
||||||
$rootScope.playSong(false, next);
|
|
||||||
});
|
|
||||||
//$rootScope.showQueue();
|
|
||||||
notifications.updateMessage(items.length + ' Song(s) Added to Queue', true);
|
|
||||||
} else if (action == 'preview') {
|
|
||||||
$scope.songpreview = [];
|
|
||||||
angular.forEach(items, function (item, key) {
|
|
||||||
if (!item.isDir) {
|
|
||||||
$rootScope.songpreview.push(utils.mapSong(item));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$scope.$apply();
|
|
||||||
} else {
|
|
||||||
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)); }
|
|
||||||
$scope.BreadCrumbs.push({ 'type': 'album', 'id': albumId, 'name': albumName });
|
|
||||||
}
|
|
||||||
$rootScope.song = [];
|
|
||||||
$scope.album = [];
|
|
||||||
var albums = [];
|
|
||||||
angular.forEach(items, function (item, key) {
|
|
||||||
if (item.isDir) {
|
|
||||||
albums.push($scope.mapAlbum(item));
|
|
||||||
} else {
|
|
||||||
$rootScope.song.push(utils.mapSong(item));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (albums.length > 0) {
|
|
||||||
$scope.album = albums;
|
|
||||||
if ($scope.SelectedAlbumSort.id != "default") {
|
|
||||||
$scope.sortSubsonicAlbums($scope.SelectedAlbumSort.id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$scope.$apply();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
notifications.updateMessage('No Songs Returned :(', true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
$scope.search = function () {
|
$scope.search = function () {
|
||||||
var query = $('#Search').val();
|
var query = $('#Search').val();
|
||||||
if (query !== '') {
|
|
||||||
var type = $('#SearchType').val();
|
var type = $('#SearchType').val();
|
||||||
$.ajax({
|
subsonic.search(query, type).then(function (data) {
|
||||||
url: globals.BaseURL() + '/search2.view?' + globals.BaseParams() + '&query=' + query,
|
//$scope.shortcut = data.shortcuts;
|
||||||
method: 'GET',
|
$scope.album = data.album;
|
||||||
dataType: globals.settings.Protocol,
|
$scope.song = data.song;
|
||||||
timeout: globals.settings.Timeout,
|
|
||||||
success: function (data) {
|
|
||||||
if (data["subsonic-response"].searchResult2 !== "") {
|
|
||||||
var header;
|
|
||||||
var items = [];
|
|
||||||
if (type === '0') {
|
|
||||||
if (data["subsonic-response"].searchResult2.song !== undefined) {
|
|
||||||
if (data["subsonic-response"].searchResult2.song.length > 0) {
|
|
||||||
items = data["subsonic-response"].searchResult2.song;
|
|
||||||
} else {
|
|
||||||
items[0] = data["subsonic-response"].searchResult2.song;
|
|
||||||
}
|
|
||||||
$scope.album = [];
|
|
||||||
$rootScope.song = [];
|
|
||||||
angular.forEach(items, function (item, key) {
|
|
||||||
$rootScope.song.push(utils.mapSong(item));
|
|
||||||
});
|
});
|
||||||
$scope.$apply();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (type === '1') {
|
|
||||||
if (data["subsonic-response"].searchResult2.album !== undefined) {
|
|
||||||
if (data["subsonic-response"].searchResult2.album.length > 0) {
|
|
||||||
items = data["subsonic-response"].searchResult2.album;
|
|
||||||
} else {
|
|
||||||
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));
|
|
||||||
} else {
|
|
||||||
$rootScope.song.push($scope.mapAlbum(item));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
//$('#Search').val("");
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
$scope.toggleAZ = function (event) {
|
$scope.toggleAZ = function (event) {
|
||||||
$scope.toggleSubmenu('#submenu_AZIndex', '#AZIndex', 'right', 44);
|
$scope.toggleSubmenu('#submenu_AZIndex', '#AZIndex', 'right', 44);
|
||||||
};
|
};
|
||||||
|
$scope.getPlaylists = function (refresh) {
|
||||||
|
subsonic.getPlaylists(refresh).then(function (data) {
|
||||||
|
$scope.playlists = data.playlists;
|
||||||
|
$scope.playlistsPublic = data.playlistsPublic;
|
||||||
|
$scope.selectedAutoPlaylist = data.selectedAutoPlaylist;
|
||||||
|
$scope.selectedPlaylist = data.selectedPlaylist;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
$scope.getPlaylist = function (id, action) {
|
||||||
|
subsonic.getPlaylist(id, action).then(function (data) {
|
||||||
|
$scope.album = data.album;
|
||||||
|
$scope.song = data.song;
|
||||||
|
$scope.selectedAutoPlaylist = data.selectedAutoPlaylist;
|
||||||
|
$scope.selectedPlaylist = data.selectedPlaylist;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
$scope.getStarred = function (action, type) {
|
||||||
|
subsonic.getStarred(action, type).then(function (data) {
|
||||||
|
$scope.album = data.album;
|
||||||
|
$scope.song = data.song;
|
||||||
|
$scope.selectedAutoPlaylist = data.selectedAutoPlaylist;
|
||||||
|
$scope.selectedPlaylist = data.selectedPlaylist;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
$scope.getRandomSongs = function (action, genre, folder) {
|
||||||
|
subsonic.getRandomSongs(action, genre, folder).then(function (data) {
|
||||||
|
$scope.album = data.album;
|
||||||
|
$scope.song = data.song;
|
||||||
|
$scope.selectedAutoPlaylist = data.selectedAutoPlaylist;
|
||||||
|
$scope.selectedPlaylist = data.selectedPlaylist;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
$scope.newPlaylist = function (data, event) {
|
||||||
|
subsonic.newPlaylist(data, event).then(function (data) {
|
||||||
|
$scope.getPlaylists(true);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
$scope.deletePlaylist = function () {
|
||||||
|
subsonic.deletePlaylist().then(function (data) {
|
||||||
|
$scope.getPlaylists(true);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
$scope.savePlaylist = function () {
|
||||||
|
var id = $scope.selectedPlaylist;
|
||||||
|
subsonic.savePlaylist().then(function (data) {
|
||||||
|
$scope.getPlaylist(id, '');
|
||||||
|
notifications.updateMessage('Playlist Updated!', true);
|
||||||
|
});
|
||||||
|
};
|
||||||
$scope.loadPlaylistsForMenu = function (data, event) {
|
$scope.loadPlaylistsForMenu = function (data, event) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: globals.BaseURL() + '/getPlaylists.view?' + globals.BaseParams(),
|
url: globals.BaseURL() + '/getPlaylists.view?' + globals.BaseParams(),
|
||||||
|
@ -478,7 +333,7 @@ function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, util
|
||||||
}
|
}
|
||||||
angular.forEach(playlists, function (item, key) {
|
angular.forEach(playlists, function (item, key) {
|
||||||
if (item.owner == globals.settings.Username) {
|
if (item.owner == globals.settings.Username) {
|
||||||
$scope.playlistMenu.push($scope.mapPlaylist(item));
|
$scope.playlistMenu.push(map.mapPlaylist(item));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if ($scope.playlistMenu.length > 0) {
|
if ($scope.playlistMenu.length > 0) {
|
||||||
|
@ -521,56 +376,32 @@ function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, util
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
$scope.sortDateFunction = function (a, b) {
|
$scope.getGenres = function () {
|
||||||
return a.date < b.date ? 1 : -1;
|
subsonic.getGenres().then(function (data) {
|
||||||
|
$scope.Genres = data;
|
||||||
|
});
|
||||||
};
|
};
|
||||||
$scope.sortArtistFunction = function (a, b) {
|
$scope.getPodcasts = function (refresh) {
|
||||||
return a.artist.toLowerCase() < b.artist.toLowerCase() ? -1 : 1;
|
subsonic.getPodcasts(refresh).then(function (data) {
|
||||||
|
$scope.podcasts = data;
|
||||||
|
});
|
||||||
};
|
};
|
||||||
$scope.sortAlbumFunction = function (a, b) {
|
$scope.getPodcast = function (id, action) {
|
||||||
return a.name.toLowerCase() < b.name.toLowerCase() ? -1 : 1;
|
subsonic.getPodcast(id, action).then(function (data) {
|
||||||
};
|
$scope.album = data.album;
|
||||||
$scope.sortTrackFunction = function (a, b) {
|
$scope.song = data.song;
|
||||||
return parseInt(a.track) > parseInt(b.track) ? -1 : 1;
|
$scope.selectedPodcast = data.selectedPodcast;
|
||||||
};
|
});
|
||||||
$scope.sortSubsonicAlbums = function (newValue) {
|
|
||||||
if (typeof newValue != 'undefined') {
|
|
||||||
//alert(newValue);
|
|
||||||
switch (newValue) {
|
|
||||||
case 'createdate desc':
|
|
||||||
$scope.album.sort($scope.sortDateFunction);
|
|
||||||
break;
|
|
||||||
case 'artist':
|
|
||||||
$scope.album.sort($scope.sortArtistFunction);
|
|
||||||
break;
|
|
||||||
case 'album':
|
|
||||||
$scope.album.sort($scope.sortAlbumFunction);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
$scope.sortSubsonicSongs = function (newValue) {
|
|
||||||
if (typeof newValue != 'undefined') {
|
|
||||||
//alert(newValue);
|
|
||||||
switch (newValue) {
|
|
||||||
case 'createdate desc':
|
|
||||||
$rootScope.song.sort($scope.sortDateFunction);
|
|
||||||
break;
|
|
||||||
case 'artist':
|
|
||||||
$rootScope.song.sort($scope.sortArtistFunction);
|
|
||||||
break;
|
|
||||||
case 'album':
|
|
||||||
$rootScope.song.sort($scope.sortAlbumFunction);
|
|
||||||
break;
|
|
||||||
case 'track':
|
|
||||||
$rootScope.song.sort($scope.sortTrackFunction);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* Launch on Startup */
|
/* Launch on Startup */
|
||||||
$scope.getArtists();
|
$scope.getArtists();
|
||||||
|
$scope.getAlbums();
|
||||||
|
$scope.getPlaylists();
|
||||||
|
$scope.getGenres();
|
||||||
|
$scope.getPodcasts();
|
||||||
|
$scope.openDefaultSection();
|
||||||
if ($routeParams.artistId && $routeParams.albumId) {
|
if ($routeParams.artistId && $routeParams.albumId) {
|
||||||
$scope.getAlbumByTag($routeParams.albumId);
|
$scope.getAlbumByTag($routeParams.albumId);
|
||||||
} else if ($routeParams.artistId) {
|
} else if ($routeParams.artistId) {
|
||||||
|
|
|
@ -6,8 +6,7 @@ function AppCtrl($scope, $rootScope, $document, $window, $location, $cookieStore
|
||||||
$rootScope.playingSong = null;
|
$rootScope.playingSong = null;
|
||||||
$rootScope.MusicFolders = [];
|
$rootScope.MusicFolders = [];
|
||||||
$rootScope.Genres = [];
|
$rootScope.Genres = [];
|
||||||
$rootScope.selectedPlaylist = "";
|
|
||||||
$rootScope.selectedAutoPlaylist = "";
|
|
||||||
$rootScope.SelectedMusicFolder = "";
|
$rootScope.SelectedMusicFolder = "";
|
||||||
$rootScope.unity = null;
|
$rootScope.unity = null;
|
||||||
$rootScope.loggedIn = function () {
|
$rootScope.loggedIn = function () {
|
||||||
|
@ -244,13 +243,11 @@ function AppCtrl($scope, $rootScope, $document, $window, $location, $cookieStore
|
||||||
} else if (unicode == 50) {
|
} else if (unicode == 50) {
|
||||||
$('#action_Library').click();
|
$('#action_Library').click();
|
||||||
} else if (unicode == 51) {
|
} else if (unicode == 51) {
|
||||||
$('#action_Playlists').click();
|
|
||||||
} else if (unicode == 52) {
|
|
||||||
$('#action_Podcasts').click();
|
|
||||||
} else if (unicode == 53) {
|
|
||||||
$('#action_Archive').click();
|
$('#action_Archive').click();
|
||||||
} else if (unicode == 54) { // 6
|
} else if (unicode == 52) {
|
||||||
$('#action_Settings').click();
|
$('#action_Settings').click();
|
||||||
|
} else if (unicode == 53) {
|
||||||
|
} else if (unicode == 54) { // 6
|
||||||
}
|
}
|
||||||
if (unicode >= 65 && unicode <= 90 && $('#tabLibrary').is(':visible')) { // a-z
|
if (unicode >= 65 && unicode <= 90 && $('#tabLibrary').is(':visible')) { // a-z
|
||||||
var key = utils.findKeyForCode(unicode);
|
var key = utils.findKeyForCode(unicode);
|
||||||
|
@ -305,21 +302,27 @@ function AppCtrl($scope, $rootScope, $document, $window, $location, $cookieStore
|
||||||
$scope.scrollToTop = function () {
|
$scope.scrollToTop = function () {
|
||||||
$('#Artists').stop().scrollTo('#auto', 400);
|
$('#Artists').stop().scrollTo('#auto', 400);
|
||||||
};
|
};
|
||||||
$scope.selectAll = function () {
|
$rootScope.selectAll = function (songs) {
|
||||||
angular.forEach($rootScope.song, function (item, key) {
|
angular.forEach(songs, function (item, key) {
|
||||||
$scope.selectedSongs.push(item);
|
$scope.selectedSongs.push(item);
|
||||||
item.selected = true;
|
item.selected = true;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
$scope.playAll = function () {
|
$rootScope.selectNone = function (songs) {
|
||||||
|
angular.forEach(songs, function (item, key) {
|
||||||
|
$scope.selectedSongs = [];
|
||||||
|
item.selected = false;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
$rootScope.playAll = function (songs) {
|
||||||
$rootScope.queue = [];
|
$rootScope.queue = [];
|
||||||
$scope.selectAll();
|
$rootScope.selectAll(songs);
|
||||||
$scope.addSongsToQueue();
|
$rootScope.addSongsToQueue();
|
||||||
var next = $rootScope.queue[0];
|
var next = $rootScope.queue[0];
|
||||||
$rootScope.playSong(false, next);
|
$rootScope.playSong(false, next);
|
||||||
};
|
};
|
||||||
$scope.playFrom = function (index) {
|
$rootScope.playFrom = function (index, songs) {
|
||||||
var from = $rootScope.song.slice(index,$rootScope.song.length);
|
var from = songs.slice(index,songs.length);
|
||||||
$scope.selectedSongs = [];
|
$scope.selectedSongs = [];
|
||||||
angular.forEach(from, function (item, key) {
|
angular.forEach(from, function (item, key) {
|
||||||
$scope.selectedSongs.push(item);
|
$scope.selectedSongs.push(item);
|
||||||
|
@ -327,36 +330,29 @@ function AppCtrl($scope, $rootScope, $document, $window, $location, $cookieStore
|
||||||
});
|
});
|
||||||
if ($scope.selectedSongs.length > 0) {
|
if ($scope.selectedSongs.length > 0) {
|
||||||
$rootScope.queue = [];
|
$rootScope.queue = [];
|
||||||
$scope.addSongsToQueue();
|
$rootScope.addSongsToQueue();
|
||||||
var next = $rootScope.queue[0];
|
var next = $rootScope.queue[0];
|
||||||
$rootScope.playSong(false, next);
|
$rootScope.playSong(false, next);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
$scope.selectNone = function () {
|
$rootScope.addSongsToQueue = function () {
|
||||||
angular.forEach($rootScope.song, function (item, key) {
|
|
||||||
$scope.selectedSongs = [];
|
|
||||||
item.selected = false;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
$scope.addSongsToQueue = function () {
|
|
||||||
if ($scope.selectedSongs.length !== 0) {
|
if ($scope.selectedSongs.length !== 0) {
|
||||||
angular.forEach($scope.selectedSongs, function (item, key) {
|
angular.forEach($scope.selectedSongs, function (item, key) {
|
||||||
$rootScope.queue.push(item);
|
$rootScope.queue.push(item);
|
||||||
item.selected = false;
|
item.selected = false;
|
||||||
});
|
});
|
||||||
//$rootScope.showQueue();
|
|
||||||
notifications.updateMessage($scope.selectedSongs.length + ' Song(s) Added to Queue', true);
|
notifications.updateMessage($scope.selectedSongs.length + ' Song(s) Added to Queue', true);
|
||||||
$scope.selectedSongs.length = 0;
|
$scope.selectedSongs.length = 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
$rootScope.removeSong = function (item, songs) {
|
||||||
|
var index = songs.indexOf(item)
|
||||||
|
songs.splice(index, 1);
|
||||||
|
};
|
||||||
$scope.removeSongFromQueue = function (item) {
|
$scope.removeSongFromQueue = function (item) {
|
||||||
var index = $rootScope.queue.indexOf(item)
|
var index = $rootScope.queue.indexOf(item)
|
||||||
$rootScope.queue.splice(index, 1);
|
$rootScope.queue.splice(index, 1);
|
||||||
}
|
}
|
||||||
$scope.removeSong = function (item) {
|
|
||||||
var index = $rootScope.song.indexOf(item)
|
|
||||||
$rootScope.song.splice(index, 1);
|
|
||||||
};
|
|
||||||
$scope.isActive = function (route) {
|
$scope.isActive = function (route) {
|
||||||
return route === $location.path();
|
return route === $location.path();
|
||||||
};
|
};
|
||||||
|
@ -398,31 +394,6 @@ function AppCtrl($scope, $rootScope, $document, $window, $location, $cookieStore
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
$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(',');
|
|
||||||
/* This is broken in version 4.8, unable to convert XML to JSON
|
|
||||||
$.ajax({
|
|
||||||
url: globals.BaseURL() + '/getGenres.view?' + globals.BaseParams(),
|
|
||||||
method: 'GET',
|
|
||||||
dataType: globals.settings.Protocol,
|
|
||||||
timeout: globals.settings.Timeout,
|
|
||||||
success: function (data) {
|
|
||||||
if (typeof data["subsonic-response"].genres != 'undefined') {
|
|
||||||
var items = [];
|
|
||||||
if (data["subsonic-response"].genres.length > 0) {
|
|
||||||
items = data["subsonic-response"].genres;
|
|
||||||
} else {
|
|
||||||
items[0] = data["subsonic-response"].genres;
|
|
||||||
}
|
|
||||||
|
|
||||||
$rootScope.Genres = items;
|
|
||||||
$scope.$apply();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
};
|
|
||||||
$scope.download = function (id) {
|
$scope.download = function (id) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: globals.BaseURL() + '/getUser.view?' + globals.BaseParams() + '&username=' + globals.settings.Username,
|
url: globals.BaseURL() + '/getUser.view?' + globals.BaseParams() + '&username=' + globals.settings.Username,
|
||||||
|
@ -502,72 +473,6 @@ function AppCtrl($scope, $rootScope, $document, $window, $location, $cookieStore
|
||||||
$scope.selectedSongs.push(data);
|
$scope.selectedSongs.push(data);
|
||||||
data.selected = true;
|
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 !== '') {
|
|
||||||
$rootScope.selectedAutoPlaylist = genre;
|
|
||||||
} else {
|
|
||||||
$rootScope.selectedAutoPlaylist = 'random';
|
|
||||||
}
|
|
||||||
var genreParams = '';
|
|
||||||
if (genre !== '' && genre != 'Random') {
|
|
||||||
genreParams = '&genre=' + genre;
|
|
||||||
}
|
|
||||||
folderParams = '';
|
|
||||||
if (typeof folder == 'number' && folder !== '' && folder != 'all') {
|
|
||||||
//alert(folder);
|
|
||||||
folderParams = '&musicFolderId=' + folder;
|
|
||||||
} else if (typeof $rootScope.SelectedMusicFolder.id != 'undefined' && $rootScope.SelectedMusicFolder.id >= 0) {
|
|
||||||
//alert($rootScope.SelectedMusicFolder.id);
|
|
||||||
folderParams = '&musicFolderId=' + $rootScope.SelectedMusicFolder.id;
|
|
||||||
}
|
|
||||||
$.ajax({
|
|
||||||
url: globals.BaseURL() + '/getRandomSongs.view?' + globals.BaseParams() + '&size=' + size + genreParams + folderParams,
|
|
||||||
method: 'GET',
|
|
||||||
dataType: globals.settings.Protocol,
|
|
||||||
timeout: globals.settings.Timeout,
|
|
||||||
success: function (data) {
|
|
||||||
if (typeof data["subsonic-response"].randomSongs.song != 'undefined') {
|
|
||||||
var items = [];
|
|
||||||
if (data["subsonic-response"].randomSongs.song.length > 0) {
|
|
||||||
items = data["subsonic-response"].randomSongs.song;
|
|
||||||
} else {
|
|
||||||
items[0] = data["subsonic-response"].randomSongs.song;
|
|
||||||
}
|
|
||||||
if (action == 'add') {
|
|
||||||
angular.forEach(items, function (item, key) {
|
|
||||||
$rootScope.queue.push(utils.mapSong(item));
|
|
||||||
});
|
|
||||||
$scope.$apply();
|
|
||||||
//$rootScope.showQueue();
|
|
||||||
notifications.updateMessage(items.length + ' Song(s) Added to Queue', true);
|
|
||||||
} else if (action == 'play') {
|
|
||||||
$rootScope.queue = [];
|
|
||||||
angular.forEach(items, function (item, key) {
|
|
||||||
$rootScope.queue.push(utils.mapSong(item));
|
|
||||||
});
|
|
||||||
var next = $rootScope.queue[0];
|
|
||||||
$scope.$apply(function () {
|
|
||||||
$rootScope.playSong(false, next);
|
|
||||||
});
|
|
||||||
//$rootScope.showQueue();
|
|
||||||
notifications.updateMessage(items.length + ' Song(s) Added to Queue', true);
|
|
||||||
} else {
|
|
||||||
$rootScope.song = [];
|
|
||||||
angular.forEach(items, function (item, key) {
|
|
||||||
$rootScope.song.push(utils.mapSong(item));
|
|
||||||
});
|
|
||||||
$scope.$apply();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
$scope.updateFavorite = function (item) {
|
$scope.updateFavorite = function (item) {
|
||||||
var id = item.id;
|
var id = item.id;
|
||||||
|
|
|
@ -1,231 +0,0 @@
|
||||||
JamStash.controller('PlaylistCtrl',
|
|
||||||
function PlaylistCtrl($scope, $rootScope, $location, utils, globals, model, notifications) {
|
|
||||||
//$("#left-component").layout($scope.layoutTwoCol);
|
|
||||||
|
|
||||||
$rootScope.song = [];
|
|
||||||
$scope.itemType = 'pl';
|
|
||||||
$scope.playlists = [];
|
|
||||||
$scope.playlistsPublic = [];
|
|
||||||
$scope.playlistsGenre = globals.SavedGenres;
|
|
||||||
$scope.selectedGenre = null;
|
|
||||||
$scope.$watch("selectedGenre", function (newValue, oldValue) {
|
|
||||||
if (newValue !== oldValue) {
|
|
||||||
globals.SavedGenres.push(newValue);
|
|
||||||
//$scope.playlistsGenre.push();
|
|
||||||
utils.setValue('SavedGenres', globals.SavedGenres.join(), false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$scope.getPlaylists = function (refresh) {
|
|
||||||
if (globals.settings.Debug) { console.log("LOAD PLAYLISTS"); }
|
|
||||||
$.ajax({
|
|
||||||
url: globals.BaseURL() + '/getPlaylists.view?' + globals.BaseParams(),
|
|
||||||
method: 'GET',
|
|
||||||
dataType: globals.settings.Protocol,
|
|
||||||
timeout: globals.settings.Timeout,
|
|
||||||
success: function (data) {
|
|
||||||
if (data["subsonic-response"].playlists.playlist !== undefined) {
|
|
||||||
var items = [];
|
|
||||||
if (data["subsonic-response"].playlists.playlist.length > 0) {
|
|
||||||
items = data["subsonic-response"].playlists.playlist;
|
|
||||||
} else {
|
|
||||||
items[0] = data["subsonic-response"].playlists.playlist;
|
|
||||||
}
|
|
||||||
angular.forEach(items, function (item, key) {
|
|
||||||
if (item.owner == globals.settings.Username) {
|
|
||||||
$scope.playlists.push(item);
|
|
||||||
} else if (item.public) {
|
|
||||||
$scope.playlistsPublic.push(item);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$scope.$apply();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
$scope.getPlaylist = function (id, action) {
|
|
||||||
$rootScope.selectedAutoPlaylist = null;
|
|
||||||
$rootScope.selectedPlaylist = id;
|
|
||||||
$.ajax({
|
|
||||||
url: globals.BaseURL() + '/getPlaylist.view?' + globals.BaseParams() + '&id=' + id,
|
|
||||||
method: 'GET',
|
|
||||||
dataType: globals.settings.Protocol,
|
|
||||||
timeout: globals.settings.Timeout,
|
|
||||||
success: function (data) {
|
|
||||||
if (typeof data["subsonic-response"].playlist.entry != 'undefined') {
|
|
||||||
var items = [];
|
|
||||||
var playlist = data["subsonic-response"].playlist;
|
|
||||||
if (playlist.entry.length > 0) {
|
|
||||||
items = playlist.entry;
|
|
||||||
} else {
|
|
||||||
items[0] = playlist.entry;
|
|
||||||
}
|
|
||||||
if (action == 'add') {
|
|
||||||
angular.forEach(items, function (item, key) {
|
|
||||||
$rootScope.queue.push(utils.mapSong(item));
|
|
||||||
});
|
|
||||||
$scope.$apply();
|
|
||||||
//$rootScope.showQueue();
|
|
||||||
notifications.updateMessage(items.length + ' Song(s) Added to Queue', true);
|
|
||||||
} else if (action == 'play') {
|
|
||||||
$rootScope.queue = [];
|
|
||||||
angular.forEach(items, function (item, key) {
|
|
||||||
$rootScope.queue.push(utils.mapSong(item));
|
|
||||||
});
|
|
||||||
var next = $rootScope.queue[0];
|
|
||||||
$scope.$apply(function () {
|
|
||||||
$rootScope.playSong(false, next);
|
|
||||||
});
|
|
||||||
//$rootScope.showQueue();
|
|
||||||
notifications.updateMessage(items.length + ' Song(s) Added to Queue', true);
|
|
||||||
} else {
|
|
||||||
$scope.album = [];
|
|
||||||
$rootScope.song = [];
|
|
||||||
angular.forEach(items, function (item, key) {
|
|
||||||
$rootScope.song.push(utils.mapSong(item));
|
|
||||||
});
|
|
||||||
$scope.$apply();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$rootScope.song = [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
$scope.getStarred = function (action, type) {
|
|
||||||
var size = globals.settings.AutoPlaylistSize;
|
|
||||||
$rootScope.selectedPlaylist = null;
|
|
||||||
$rootScope.selectedAutoPlaylist = 'starred';
|
|
||||||
$.ajax({
|
|
||||||
url: globals.BaseURL() + '/getStarred.view?' + globals.BaseParams() + '&size=' + size,
|
|
||||||
method: 'GET',
|
|
||||||
dataType: globals.settings.Protocol,
|
|
||||||
timeout: globals.settings.Timeout,
|
|
||||||
success: function (data) {
|
|
||||||
if (typeof data["subsonic-response"].starred !== 'undefined') {
|
|
||||||
var items = [];
|
|
||||||
switch (type) {
|
|
||||||
case 'artist':
|
|
||||||
if (typeof data["subsonic-response"].starred.artist !== 'undefined') {
|
|
||||||
if (data["subsonic-response"].starred.artist.length > 0) {
|
|
||||||
items = data["subsonic-response"].starred.artist;
|
|
||||||
} else {
|
|
||||||
items[0] = data["subsonic-response"].starred.artist;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'album':
|
|
||||||
if (typeof data["subsonic-response"].starred.album !== 'undefined') {
|
|
||||||
if (data["subsonic-response"].starred.album.length > 0) {
|
|
||||||
items = data["subsonic-response"].starred.album;
|
|
||||||
} else {
|
|
||||||
items[0] = data["subsonic-response"].starred.album;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'song':
|
|
||||||
if (typeof data["subsonic-response"].starred.song !== 'undefined') {
|
|
||||||
if (data["subsonic-response"].starred.song.length > 0) {
|
|
||||||
items = data["subsonic-response"].starred.song;
|
|
||||||
} else {
|
|
||||||
items[0] = data["subsonic-response"].starred.song;
|
|
||||||
}
|
|
||||||
if (action == 'add') {
|
|
||||||
angular.forEach(items, function (item, key) {
|
|
||||||
$rootScope.queue.push(utils.mapSong(item));
|
|
||||||
});
|
|
||||||
$scope.$apply();
|
|
||||||
//$rootScope.showQueue();
|
|
||||||
notifications.updateMessage(items.length + ' Song(s) Added to Queue', true);
|
|
||||||
} else if (action == 'play') {
|
|
||||||
$rootScope.queue = [];
|
|
||||||
angular.forEach(items, function (item, key) {
|
|
||||||
$rootScope.queue.push(utils.mapSong(item));
|
|
||||||
});
|
|
||||||
var next = $rootScope.queue[0];
|
|
||||||
$scope.$apply(function () {
|
|
||||||
$rootScope.playSong(false, next);
|
|
||||||
});
|
|
||||||
//$rootScope.showQueue();
|
|
||||||
notifications.updateMessage(items.length + ' Song(s) Added to Queue', true);
|
|
||||||
} else {
|
|
||||||
$rootScope.song = [];
|
|
||||||
angular.forEach(items, function (item, key) {
|
|
||||||
$rootScope.song.push(utils.mapSong(item));
|
|
||||||
});
|
|
||||||
$scope.$apply();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
$scope.newPlaylist = function (data, event) {
|
|
||||||
var reply = prompt("Choose a name for your new playlist.", "");
|
|
||||||
if (reply != 'null' && reply !== null && reply !== '') {
|
|
||||||
$.ajax({
|
|
||||||
url: globals.BaseURL() + '/createPlaylist.view?' + globals.BaseParams() + '&name=' + reply,
|
|
||||||
method: 'GET',
|
|
||||||
dataType: globals.settings.Protocol,
|
|
||||||
timeout: globals.settings.Timeout,
|
|
||||||
success: function (data) {
|
|
||||||
loadPlaylists(true);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
$scope.deletePlaylist = function () {
|
|
||||||
if ($rootScope.selectedPlaylist !== null) {
|
|
||||||
var id = $rootScope.selectedPlaylist;
|
|
||||||
if (utils.confirmDelete('Are you sure you want to delete the selected playlist?')) {
|
|
||||||
$.ajax({
|
|
||||||
url: globals.BaseURL() + '/deletePlaylist.view?' + globals.BaseParams() + '&id=' + id,
|
|
||||||
method: 'GET',
|
|
||||||
dataType: globals.settings.Protocol,
|
|
||||||
timeout: globals.settings.Timeout,
|
|
||||||
success: function (data) {
|
|
||||||
$scope.getPlaylists();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
$scope.savePlaylist = function () {
|
|
||||||
if ($rootScope.selectedPlaylist() !== null) {
|
|
||||||
var id = $rootScope.selectedPlaylist().id();
|
|
||||||
var songs = [];
|
|
||||||
ko.utils.arrayForEach($rootScope.song(), function (item) {
|
|
||||||
songs.push(item.id);
|
|
||||||
});
|
|
||||||
if (songs.length > 0) {
|
|
||||||
$.ajax({
|
|
||||||
type: 'GET',
|
|
||||||
url: globals.BaseURL() + '/createPlaylist.view?' + globals.BaseParams(),
|
|
||||||
dataType: globals.settings.Protocol,
|
|
||||||
timeout: globals.settings.Timeout,
|
|
||||||
data: { playlistId: id, songId: songs },
|
|
||||||
success: function () {
|
|
||||||
$scope.getPlaylist(id);
|
|
||||||
notifications.updateMessage('Playlist Updated!', true);
|
|
||||||
},
|
|
||||||
traditional: true // Fixes POST with an array in JQuery 1.4
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
$scope.removeSelectedSongs = function (data, event) {
|
|
||||||
ko.utils.arrayForEach($scope.selectedSongs(), function (item) {
|
|
||||||
$rootScope.song.remove(item);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
/* End Playlists */
|
|
||||||
|
|
||||||
/* Launch on Startup */
|
|
||||||
$scope.getPlaylists();
|
|
||||||
//$scope.getMusicFolders();
|
|
||||||
$scope.getGenres();
|
|
||||||
/* End Startup */
|
|
||||||
});
|
|
|
@ -1,110 +1,7 @@
|
||||||
JamStash.controller('PodcastCtrl',
|
JamStash.controller('PodcastCtrl',
|
||||||
function PodcastCtrl($scope, $rootScope, $location, utils, globals, model, notifications) {
|
function PodcastCtrl($scope, $rootScope, $location, utils, globals, model, notifications) {
|
||||||
//$("#left-component").layout($scope.layoutTwoCol);
|
|
||||||
|
|
||||||
$rootScope.song = [];
|
$rootScope.song = [];
|
||||||
$scope.podcasts = [];
|
|
||||||
$scope.selectedPodcast = null;
|
|
||||||
$scope.getPodcasts = function (refresh) {
|
|
||||||
if (globals.settings.Debug) { console.log("LOAD PODCASTS"); }
|
|
||||||
$.ajax({
|
|
||||||
url: globals.BaseURL() + '/getPodcasts.view?' + globals.BaseParams(),
|
|
||||||
method: 'GET',
|
|
||||||
dataType: globals.settings.Protocol,
|
|
||||||
timeout: globals.settings.Timeout,
|
|
||||||
success: function (data) {
|
|
||||||
if (data["subsonic-response"].podcasts.channel !== undefined) {
|
|
||||||
var items = [];
|
|
||||||
if (data["subsonic-response"].podcasts.channel.length > 0) {
|
|
||||||
items = data["subsonic-response"].podcasts.channel;
|
|
||||||
} else {
|
|
||||||
items[0] = data["subsonic-response"].podcasts.channel;
|
|
||||||
}
|
|
||||||
$scope.podcasts = items;
|
|
||||||
$scope.$apply();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
$scope.getPodcast = function (id, action) {
|
|
||||||
$scope.selectedPodcast = id;
|
|
||||||
var map = function (data) {
|
|
||||||
var song = data;
|
|
||||||
var url, track, rating, starred, contenttype, suffix, description;
|
|
||||||
var specs = '', coverartthumb = '', coverartfull = '';
|
|
||||||
if (typeof song.coverArt != 'undefined') {
|
|
||||||
coverartthumb = globals.BaseURL() + '/getCoverArt.view?' + globals.BaseParams() + '&size=60&id=' + song.coverArt;
|
|
||||||
coverartfull = globals.BaseURL() + '/getCoverArt.view?' + globals.BaseParams() + '&id=' + song.coverArt;
|
|
||||||
}
|
|
||||||
if (typeof song.description == 'undefined') { description = ''; } else { description = song.description; }
|
|
||||||
if (typeof song.track == 'undefined') { track = ' '; } else { track = song.track; }
|
|
||||||
if (typeof song.starred !== 'undefined') { starred = true; } else { starred = false; }
|
|
||||||
if (song.bitRate !== undefined) { specs += song.bitRate + ' Kbps'; }
|
|
||||||
if (song.transcodedSuffix !== undefined) { specs += ', transcoding:' + song.suffix + ' > ' + song.transcodedSuffix; } else { specs += ', ' + song.suffix; }
|
|
||||||
if (song.transcodedSuffix !== undefined) { suffix = song.transcodedSuffix; } else { suffix = song.suffix; }
|
|
||||||
if (suffix == 'ogg') { suffix = 'oga'; }
|
|
||||||
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',
|
|
||||||
dataType: globals.settings.Protocol,
|
|
||||||
timeout: globals.settings.Timeout,
|
|
||||||
success: function (data) {
|
|
||||||
if (data["subsonic-response"].podcasts.channel !== undefined) {
|
|
||||||
var podcasts = [];
|
|
||||||
if (data["subsonic-response"].podcasts.channel.length > 0) {
|
|
||||||
podcasts = data["subsonic-response"].podcasts.channel;
|
|
||||||
} else {
|
|
||||||
podcasts[0] = data["subsonic-response"].podcasts.channel;
|
|
||||||
}
|
|
||||||
var items = [];
|
|
||||||
$.each(podcasts, function (i, item) {
|
|
||||||
if (item.id == id) {
|
|
||||||
items = item.episode;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (typeof items != 'undefined') {
|
|
||||||
if (action == 'add') {
|
|
||||||
angular.forEach(items, function (item, key) {
|
|
||||||
if (item.status != "skipped") {
|
|
||||||
$rootScope.queue.push(map(item));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$scope.$apply();
|
|
||||||
//$rootScope.showQueue();
|
|
||||||
notifications.updateMessage(items.length + ' Song(s) Added to Queue', true);
|
|
||||||
} else if (action == 'play') {
|
|
||||||
$rootScope.queue = [];
|
|
||||||
angular.forEach(items, function (item, key) {
|
|
||||||
if (item.status != "skipped") {
|
|
||||||
$rootScope.queue.push(map(item));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
var next = $rootScope.queue[0];
|
|
||||||
$scope.$apply(function () {
|
|
||||||
$rootScope.playSong(false, next);
|
|
||||||
});
|
|
||||||
//$rootScope.showQueue();
|
|
||||||
notifications.updateMessage(items.length + ' Song(s) Added to Queue', true);
|
|
||||||
} else {
|
|
||||||
$scope.album = [];
|
|
||||||
$rootScope.song = [];
|
|
||||||
angular.forEach(items, function (item, key) {
|
|
||||||
if (item.status != "skipped") {
|
|
||||||
$rootScope.song.push(map(item));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$scope.$apply();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Launch on Startup */
|
/* Launch on Startup */
|
||||||
$scope.getPodcasts();
|
$scope.getPodcasts();
|
||||||
|
|
|
@ -1,4 +1,10 @@
|
||||||
[
|
[
|
||||||
|
{
|
||||||
|
"date": "5/2/2014", "version": "3.4",
|
||||||
|
"changes": [
|
||||||
|
{ "text": "- Tab state saved, consolidated Subsonic artists, playlist and podcasts" }
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"date": "4/11/2014", "version": "3.3.1",
|
"date": "4/11/2014", "version": "3.3.1",
|
||||||
"changes": [
|
"changes": [
|
||||||
|
|
|
@ -2,15 +2,22 @@
|
||||||
<div id="tab1" class="tabcontent">
|
<div id="tab1" class="tabcontent">
|
||||||
<div id="tabLibrary">
|
<div id="tabLibrary">
|
||||||
<div class="actions floatleft">
|
<div class="actions floatleft">
|
||||||
<a href="" class="button" id="action_RefreshArtists" title="Refresh Artists" ng-click="refreshArtists()"><img class="pad" src="images/reload_9x11.png" /></a>
|
<a href="" class="button" id="action_RefreshArtists" title="Refresh List" ng-click="refreshArtists()"><img class="pad" src="images/reload_9x11.png" /></a>
|
||||||
<a href="" class="button" id="action_RescanLibrary" title="Rescan Library" ng-click="rescanLibrary()"><img class="pad" src="images/loop_alt1_gd_12x9.png" /></a>
|
<a href="" class="button" id="action_RescanLibrary" title="Rescan Library" ng-click="rescanLibrary()"><img class="pad" src="images/loop_alt1_gd_12x9.png" /></a>
|
||||||
</div>
|
</div>
|
||||||
<div id="search">
|
<div id="search">
|
||||||
<input type="text" id="Search" class="medium" title="Wildcards (*) supported" placeholder="Search..." ng-enter="search()"/>
|
<input type="text" id="Search" name="Search" class="medium" title="Wildcards (*) supported" placeholder="Search..." ng-enter="search()"/>
|
||||||
<select id="SearchType" name="SearchType" ng-model="SearchType.id" ng-options="o.id as o.name for o in SearchTypes"></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>
|
<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>
|
||||||
<div class="subactions">
|
<div class="subactions">
|
||||||
|
<div class="floatleft" ng-show="selectedPlaylist">
|
||||||
|
<label>Playlist Actions</label>
|
||||||
|
<a href="" class="button" id="action_DeletePlaylist" title="Delete Selected Playlist" ng-click="deletePlaylist()">Delete</a>
|
||||||
|
<a href="" class="button" id="action_SavePlaylist" title="Save Playlist" ng-click="savePlaylist()">Save</a>
|
||||||
|
<a href="" class="button" id="action_RemoveSongs" title="Remove selected song(s) from playlist" ng-click="songsRemoveSelected()">Remove Song(s)</a>
|
||||||
|
|
||||||
|
</div>
|
||||||
<a href="" class="button" id="action_PlayAlbum" title="Play Album" ng-click="playAll()"><img src="images/play_gl_6x8.png"></a>
|
<a href="" class="button" id="action_PlayAlbum" title="Play Album" ng-click="playAll()"><img src="images/play_gl_6x8.png"></a>
|
||||||
<a href="" class="button" id="action_SelectAll" title="Select All" ng-click="selectAll()">All</a>
|
<a href="" class="button" id="action_SelectAll" title="Select All" ng-click="selectAll()">All</a>
|
||||||
<a href="" class="button" id="action_SelectNone" title="Select None" ng-click="selectNone()">None</a>
|
<a href="" class="button" id="action_SelectNone" title="Select None" ng-click="selectNone()">None</a>
|
||||||
|
@ -19,6 +26,7 @@
|
||||||
<div id="submenu_AddToPlaylist" class="submenu shadow" style="display: none;">
|
<div id="submenu_AddToPlaylist" class="submenu shadow" style="display: none;">
|
||||||
<a href="" ng-repeat="o in playlistMenu" ng-click="addToPlaylist(o.id)">{{o.name}}</a>
|
<a href="" ng-repeat="o in playlistMenu" ng-click="addToPlaylist(o.id)">{{o.name}}</a>
|
||||||
</div>
|
</div>
|
||||||
|
<a href="" class="button" id="action_NewPlaylist" title="New Playlist" ng-click="newPlaylist()">+ New</a>
|
||||||
</div>
|
</div>
|
||||||
<div id="SubsonicAlbums" class="section lgsection split-pane fixed-left" split>
|
<div id="SubsonicAlbums" class="section lgsection split-pane fixed-left" split>
|
||||||
<div id="left-component" class="split-pane-component smcolumn noselect" tabindex="0">
|
<div id="left-component" class="split-pane-component smcolumn noselect" tabindex="0">
|
||||||
|
@ -27,6 +35,8 @@
|
||||||
</div>
|
</div>
|
||||||
<select id="MusicFolders" class="folders" ng-model="$root.SelectedMusicFolder" ng-options="o.name for o in MusicFolders">
|
<select id="MusicFolders" class="folders" ng-model="$root.SelectedMusicFolder" ng-options="o.name for o in MusicFolders">
|
||||||
</select>
|
</select>
|
||||||
|
<ul class="simplelist"><li class="heading" ng-click="toggleIndex()"><a href="">Artists</a></li></ul>
|
||||||
|
<div id="IndexContainer" ng-show="showIndex">
|
||||||
<ul id="AutoAlbumContainer" class="simplelist mainlist noselect">
|
<ul id="AutoAlbumContainer" class="simplelist mainlist noselect">
|
||||||
<li class="index" id="auto">Auto Albums</li>
|
<li class="index" id="auto">Auto Albums</li>
|
||||||
<li class="item" ng-repeat="o in AutoAlbums" id="{{o.id}}" ng-click="getAlbumListBy(o.id)" ng-class="{'selected': selectedAutoAlbum == o.id }">
|
<li class="item" ng-repeat="o in AutoAlbums" id="{{o.id}}" ng-click="getAlbumListBy(o.id)" ng-class="{'selected': selectedAutoAlbum == o.id }">
|
||||||
|
@ -52,6 +62,75 @@
|
||||||
</ul>
|
</ul>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- Playlist -->
|
||||||
|
<ul class="simplelist"><li class="heading" ng-click="togglePlaylist()"><a href="">Playlists</a></li></ul>
|
||||||
|
<div id="PlaylistContainer" ng-show="showPlaylist">
|
||||||
|
<ul class="simplelist mainlist noselect">
|
||||||
|
<li class="index" id="auto">Auto Playlists</li>
|
||||||
|
<li class="item" ng-click="getStarred('', 'song')" ng-class="{'selected': selectedAutoPlaylist == 'starred'}">
|
||||||
|
<div class="itemactions">
|
||||||
|
<a class="add" href="" ng-click="getStarred('add', 'song')" title="Add To Play Queue" stop-event="click"></a><a class="play" href="" ng-click="getStarred('play', 'song')" title="Play" stop-event="click"></a>
|
||||||
|
</div>
|
||||||
|
<div class="title">Starred</div>
|
||||||
|
</li>
|
||||||
|
<li class="item" ng-click="getRandomSongs('', '', '')" ng-class="{'selected': selectedAutoPlaylist == 'random'}">
|
||||||
|
<div class="itemactions">
|
||||||
|
<a class="add" href="" title="Add To Play Queue" ng-click="getRandomSongs('add', '', '')" stop-event="click"></a><a class="play" href="" title="Play" ng-click="getRandomSongs('play', '', '')" stop-event="click"></a>
|
||||||
|
</div>
|
||||||
|
<div class="title">Random</div>
|
||||||
|
</li>
|
||||||
|
<li class="index" id="auto">Genre Playlists</li>
|
||||||
|
<select id="Genres" name="Genres" class="large" ng-model="selectedGenre" ng-options="o for o in Genres">
|
||||||
|
<option value="">[Select Genre]</option>
|
||||||
|
</select>
|
||||||
|
<li class="item" ng-repeat="o in playlistsGenre" ng-click="getRandomSongs('', o, '')" ng-class="{'selected': selectedAutoPlaylist == o}">
|
||||||
|
<div class="itemactions">
|
||||||
|
<a class="add" href="" title="Add To Play Queue" ng-click="getRandomSongs('add', o, '')" stop-event="click"></a><a class="play" href="" title="Play" ng-click="getRandomSongs('play', o, '')" stop-event="click"></a>
|
||||||
|
</div>
|
||||||
|
<div class="title">{{o}}</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<ul class="simplelist mainlist noselect">
|
||||||
|
<li class="index" id="folder">Folder Playlists</li>
|
||||||
|
<li class="item" ng-repeat="o in MusicFolders | musicfolder" ng-click=" getRandomSongs('', '' , o.id)" ng-class="{'selected': o.id == selectedAutoPlaylist}">
|
||||||
|
<div class="itemactions">
|
||||||
|
<a class="add" href="" title="Add To Play Queue" ng-click="getRandomSongs('add', '', o.id)" stop-event="click"></a><a class="play" href="" title="Play" ng-click="getRandomSongs('play', '', o.id)" stop-event="click"></a>
|
||||||
|
</div>
|
||||||
|
<div class="title">{{o.name}}</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<ul class="simplelist mainlist noselect">
|
||||||
|
<li class="index" id="auto">My Playlists</li>
|
||||||
|
<li class="item" ng-repeat="o in playlists" ng-click="getPlaylist(o.id, '')" ng-class="{'selected': o.id == selectedPlaylist}">
|
||||||
|
<div class="itemactions">
|
||||||
|
<a class="add" href="" title="Add To Play Queue" ng-click="getPlaylist(o.id, 'add')" stop-event="click"></a><a class="play" href="" title="Play" ng-click="getPlaylist(o.id, 'play')" stop-event="click"></a>
|
||||||
|
</div>
|
||||||
|
<div class="title" title="{{'Songs: ' + o.songCount + ', Public: ' + o.public}}">{{o.name}}</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<ul class="simplelist mainlist noselect">
|
||||||
|
<li class="index" id="auto">Shared Playlists</li>
|
||||||
|
<li class="item" ng-repeat="o in playlistsPublic" ng-click="getPlaylist(o.id, '')" ng-class="{'selected': o.id == selectedPlaylist}">
|
||||||
|
<div class="itemactions">
|
||||||
|
<a class="add" href="" title="Add To Play Queue" ng-click="getPlaylist(o.id, 'add')" stop-event="click"></a><a class="play" href="" title="Play" ng-click="getPlaylist(o.id, 'play')" stop-event="click"></a>
|
||||||
|
</div>
|
||||||
|
<div class="title" title="{{'Owner: ' + o.owner + ' Songs: ' + o.songCount}}">{{o.name}}</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<!-- Podcasts -->
|
||||||
|
<ul class="simplelist"><li class="heading" ng-click="togglePodcast()"><a href="">Podcasts</a></li></ul>
|
||||||
|
<div id="PodcastContainer" ng-show="showPodcast">
|
||||||
|
<ul class="simplelist mainlist noselect">
|
||||||
|
<li class="item" ng-repeat="o in podcasts" ng-click="getPodcast(o.id, '')" ng-class="{ 'selected': o.id == selectedPodcast }">
|
||||||
|
<div class="itemactions">
|
||||||
|
<a class="add" href="" title="Add To Play Queue" ng-click="getPodcast(o.id, 'add')" stop-event="click"></a><a class="play" href="" title="Play" ng-click="getPodcast(o.id, 'play')" stop-event="click"></a>
|
||||||
|
</div>
|
||||||
|
<div class="title" title="{{o.description}}">{{o.title}}</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="split-pane-divider" id="my-divider"></div>
|
<div class="split-pane-divider" id="my-divider"></div>
|
||||||
<!-- Album -->
|
<!-- Album -->
|
||||||
<div id="right-component" class="split-pane-component lgcolumn">
|
<div id="right-component" class="split-pane-component lgcolumn">
|
||||||
|
@ -106,7 +185,6 @@
|
||||||
<li><a href="" class="close" ng-click="toggleAZ()">[Close]</a></li>
|
<li><a href="" class="close" ng-click="toggleAZ()">[Close]</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<!--<songpreview class="songpreview"></songpreview>-->
|
|
||||||
</div>
|
</div>
|
||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<li class="row song" ng-repeat="o in song" ng-click="selectSong(o)" ng-dblclick="playSong(false, o)" ng-class="{'selected': o.selected, 'playing': o.playing}">
|
<li class="row song" ng-repeat="o in song" ng-click="selectSong(o)" ng-dblclick="playSong(false, o)" ng-class="{'selected': o.selected, 'playing': o.playing}">
|
||||||
<div class="itemactions">
|
<div class="itemactions">
|
||||||
<a class="add" href="" title="Add To Queue" ng-click="addSongToQueue(o)" stop-event="click"></a>
|
<a class="add" href="" title="Add To Queue" ng-click="addSongToQueue(o)" stop-event="click"></a>
|
||||||
<a class="remove" href="" title="Remove From Queue" ng-click="removeSongFromQueue(o)" stop-event="click"></a>
|
<!--<a class="remove" href="" title="Remove Song" ng-click="removeSongFromQueue(o)" stop-event="click"></a>-->
|
||||||
<a class="play" href="" title="Start Playing From This Song" ng-click="playFrom($index)" stop-event="click"></a>
|
<a class="play" href="" title="Start Playing From This Song" ng-click="playFrom($index)" stop-event="click"></a>
|
||||||
<a class="download" href="" title="Download Song" ng-click="download(o.id)"></a>
|
<a class="download" href="" title="Download Song" ng-click="download(o.id)"></a>
|
||||||
<a href="" title="Favorite" ng-class="{'favorite': o.starred, 'rate': !o.starred}" ng-click="updateFavorite(o)" stop-event="click"></a>
|
<a href="" title="Favorite" ng-class="{'favorite': o.starred, 'rate': !o.starred}" ng-click="updateFavorite(o)" stop-event="click"></a>
|
||||||
|
|
|
@ -1,47 +0,0 @@
|
||||||
<!-- Start: Template Tab -->
|
|
||||||
<div class="tabcontent">
|
|
||||||
<div id="tabTemplate">
|
|
||||||
<div class="actions floatleft">
|
|
||||||
<a href="" class="button" id="action_RefreshArtists" title="Refresh Artist List" ng-click="getArtists()"><img class="pad" src="images/reload_9x11.png" /></a>
|
|
||||||
</div>
|
|
||||||
<div class="subactions">
|
|
||||||
<a href="" class="button" id="action_SelectAll" title="Select All" ng-click="selectAll()">All</a>
|
|
||||||
</div>
|
|
||||||
<div class="clear"></div>
|
|
||||||
<div id="left-component" class="section lgsection">
|
|
||||||
<!-- Artist -->
|
|
||||||
<div class="ui-layout-west noselect hide" tabindex="0">
|
|
||||||
<ul class="simplelist mainlist noselect">
|
|
||||||
<li class="index" id="auto">Auto Albums</li>
|
|
||||||
<li class="item" ng-repeat="o in AutoAlbums" id="{{o.id}}" ng-click="getAlbumListBy(o.id)" ng-class="{'selected': selectedAutoAlbum == o.id }"><span>{{o.name}}</span>
|
|
||||||
<div class="floatright">
|
|
||||||
<a href="" class="nextprev hover" id="random" title="Previous" ng-click="getAlbumListBy(o.id, 'prev')" stop-event="click">‹</a>
|
|
||||||
<a href="" class="nextprev hover" id="random" title="Next" ng-click="getAlbumListBy(o.id, 'next')" stop-event="click">›</a>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<!-- Album -->
|
|
||||||
<div class="ui-layout-center">
|
|
||||||
<ul class="simplelist songlist noselect">
|
|
||||||
<li class="album" id="{{o.id}}" ng-class="{'selected': selectedAlbum == o.id}" ng-click="getSongs(o.id, '')" ng-repeat="o in album" 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>
|
|
||||||
<a class="download" href="" title="Download"></a>
|
|
||||||
<a href="" title="Favorite" ng-class="{'favorite': o.starred, 'rate': !o.starred}" ng-click="updateFavorite(o)" stop-event="click"></a>
|
|
||||||
</div>
|
|
||||||
<div class="albumart"><img ng-src="{{o.coverart}}" src="images/albumdefault_50.jpg"></div>
|
|
||||||
<div class="title">{{o.name}}</div>
|
|
||||||
<div class="artist"><a href="" id="{{o.parentid}}" ng-click="getAlbums(o.parentid)" stop-event="click">{{o.artist}}</a></div>
|
|
||||||
<div class="clear"></div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<!-- Song -->
|
|
||||||
<div class="ui-layout-east noselect hide" ng-if="song.length > 0" ng-include src="'js/partials/songs.html'"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="clear"></div>
|
|
||||||
</div>
|
|
||||||
<!-- End: Library Tab -->
|
|
|
@ -18,6 +18,8 @@
|
||||||
var next = getNextSong(true);
|
var next = getNextSong(true);
|
||||||
if (next) {
|
if (next) {
|
||||||
$rootScope.playSong(false, next);
|
$rootScope.playSong(false, next);
|
||||||
|
} else {
|
||||||
|
$rootScope.restartSong();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
getNextSong = function (previous) {
|
getNextSong = function (previous) {
|
||||||
|
@ -133,6 +135,10 @@
|
||||||
if (globals.settings.Debug) { console.log('HTML5::loadStorage not supported on your browser, ' + html.length + ' characters'); }
|
if (globals.settings.Debug) { console.log('HTML5::loadStorage not supported on your browser, ' + html.length + ' characters'); }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
$rootScope.restartSong = function (loadonly, data) {
|
||||||
|
var audio = $(player1).data("jPlayer");
|
||||||
|
audio.play(0);
|
||||||
|
};
|
||||||
$rootScope.playSong = function (loadonly, data) {
|
$rootScope.playSong = function (loadonly, data) {
|
||||||
if (globals.settings.Debug) { console.log('Play: ' + JSON.stringify(data, null, 2)); }
|
if (globals.settings.Debug) { console.log('Play: ' + JSON.stringify(data, null, 2)); }
|
||||||
angular.forEach($rootScope.queue, function(item, key) {
|
angular.forEach($rootScope.queue, function(item, key) {
|
||||||
|
|
7
js/plugins/angular-ui-router.min.js
vendored
Normal file
7
js/plugins/angular-ui-router.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
961
js/service.js
961
js/service.js
File diff suppressed because it is too large
Load diff
34
js/utils.js
34
js/utils.js
|
@ -44,29 +44,17 @@ JamStash.service('utils', function ($cookieStore, globals, model) {
|
||||||
if (globals.settings.Debug) { console.log(e); }
|
if (globals.settings.Debug) { console.log(e); }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
this.mapSong = function (data) {
|
this.sortDateFunction = function (a, b) {
|
||||||
var song = data;
|
return a.date < b.date ? 1 : -1;
|
||||||
var url, title, artist, track, rating, starred, contenttype, suffix, description;
|
};
|
||||||
var specs = '', coverartthumb = '', coverartfull = '';
|
this.sortArtistFunction = function (a, b) {
|
||||||
if (typeof song.coverArt != 'undefined') {
|
return a.artist.toLowerCase() < b.artist.toLowerCase() ? -1 : 1;
|
||||||
coverartthumb = globals.BaseURL() + '/getCoverArt.view?' + globals.BaseParams() + '&size=60&id=' + song.coverArt;
|
};
|
||||||
coverartfull = globals.BaseURL() + '/getCoverArt.view?' + globals.BaseParams() + '&id=' + song.coverArt;
|
this.sortAlbumFunction = function (a, b) {
|
||||||
} else {
|
return a.name.toLowerCase() < b.name.toLowerCase() ? -1 : 1;
|
||||||
coverartthumb = 'images/albumdefault_60.jpg';
|
};
|
||||||
coverartfull = 'images/albumdefault_160.jpg';
|
this.sortTrackFunction = function (a, b) {
|
||||||
}
|
return parseInt(a.track) > parseInt(b.track) ? -1 : 1;
|
||||||
if (typeof song.description == 'undefined') { description = ''; } else { description = song.description; }
|
|
||||||
if (typeof song.artist == 'undefined') { artist = ' '; } else { artist = song.artist.toString(); }
|
|
||||||
if (typeof song.title == 'undefined') { title = ' '; } else { title = song.title.toString(); }
|
|
||||||
if (typeof song.track == 'undefined') { track = ' '; } else { track = song.track.toString(); }
|
|
||||||
if (typeof song.starred !== 'undefined') { starred = true; } else { starred = false; }
|
|
||||||
if (song.bitRate !== undefined) { specs += song.bitRate + ' Kbps'; }
|
|
||||||
if (song.transcodedSuffix !== undefined) { specs += ', transcoding:' + song.suffix + ' > ' + song.transcodedSuffix; } else { specs += ', ' + song.suffix; }
|
|
||||||
if (song.transcodedSuffix !== undefined) { suffix = song.transcodedSuffix; } else { suffix = song.suffix; }
|
|
||||||
if (suffix == 'ogg') { suffix = 'oga'; }
|
|
||||||
var salt = Math.floor(Math.random() * 100000);
|
|
||||||
url = globals.BaseURL() + '/stream.view?' + globals.BaseParams() + '&id=' + song.id + '&salt=' + salt;
|
|
||||||
return new model.Song(song.id, song.parent, track, title, artist, song.artistId, song.album, song.albumId, coverartthumb, coverartfull, song.duration, song.userRating, starred, suffix, specs, url, 0, description);
|
|
||||||
};
|
};
|
||||||
this.confirmDelete = function (text) {
|
this.confirmDelete = function (text) {
|
||||||
var question = confirm(text);
|
var question = confirm(text);
|
||||||
|
|
|
@ -463,6 +463,23 @@ ul.simplelist li.index a
|
||||||
{
|
{
|
||||||
color: #A7A7A7;
|
color: #A7A7A7;
|
||||||
}
|
}
|
||||||
|
ul.simplelist li.heading
|
||||||
|
{
|
||||||
|
background: #F0F0F0;
|
||||||
|
border-left: 1px solid #DDDDDD;
|
||||||
|
border-bottom: 1px solid #DDDDDD;
|
||||||
|
color: #A7A7A7;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: bold;
|
||||||
|
margin: 0px 4px 2px 4px;
|
||||||
|
padding: 8px 4px;
|
||||||
|
}
|
||||||
|
ul.simplelist li.heading a
|
||||||
|
{
|
||||||
|
color: #7EA8D5;
|
||||||
|
font-variant: small-caps;
|
||||||
|
font-size: 15px;
|
||||||
|
}
|
||||||
ul.mainlist
|
ul.mainlist
|
||||||
{
|
{
|
||||||
padding: 0 4px;
|
padding: 0 4px;
|
||||||
|
@ -472,6 +489,10 @@ ul.mainlist li.selected
|
||||||
color: #f2f2f2;
|
color: #f2f2f2;
|
||||||
background-color: #528AC6;
|
background-color: #528AC6;
|
||||||
}
|
}
|
||||||
|
ul.mainlist li.selected a
|
||||||
|
{
|
||||||
|
color: #f2f2f2;
|
||||||
|
}
|
||||||
ul.mainlist li.item a.play
|
ul.mainlist li.item a.play
|
||||||
{
|
{
|
||||||
width: 20px;
|
width: 20px;
|
||||||
|
@ -539,7 +560,7 @@ ul.mainlist li.item a.add:hover
|
||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
#TrackContainer, #PodcastContainer
|
#TrackContainer
|
||||||
{
|
{
|
||||||
margin: 5px 5px 5px 0;
|
margin: 5px 5px 5px 0;
|
||||||
width: 60%;
|
width: 60%;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue