use new queuelist
This commit is contained in:
parent
43ffa9c186
commit
e1539e4d33
2 changed files with 43 additions and 5 deletions
|
@ -52,10 +52,8 @@ function FeedCtrl($scope, $routeParams, $location, feeds, pageSwitcher) {
|
||||||
pageSwitcher.setBack('feeds');
|
pageSwitcher.setBack('feeds');
|
||||||
}
|
}
|
||||||
|
|
||||||
function QueueListCtrl($scope, $rootScope, pageSwitcher, feedItems, feeds, queueList) {
|
function QueueListCtrl($scope, $rootScope, pageSwitcher, feedItems, feeds, downloader, newQueueList) {
|
||||||
$scope.queue = [];
|
$scope.queue = newQueueList.getQueueList();
|
||||||
queueList.init($scope);
|
|
||||||
feedItems.listQueue(queueList);
|
|
||||||
|
|
||||||
$scope.playItem = function(id) {
|
$scope.playItem = function(id) {
|
||||||
feedItems.get(id, function(feedItem) {
|
feedItems.get(id, function(feedItem) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
/* Services */
|
/* Services */
|
||||||
angular.module('podcasts.services', ['podcasts.utilities'])
|
angular.module('podcasts.services', ['podcasts.utilities', 'podcasts.queueList'])
|
||||||
.value('queueList', {
|
.value('queueList', {
|
||||||
queue: [],
|
queue: [],
|
||||||
scope: null,
|
scope: null,
|
||||||
|
@ -828,6 +828,46 @@ angular.module('podcasts.settings', ['podcasts.database'])
|
||||||
}])
|
}])
|
||||||
;
|
;
|
||||||
|
|
||||||
|
angular.module('podcasts.queueList', ['podcasts.database'])
|
||||||
|
.run(['newQueueList', function(queueList) {
|
||||||
|
queueList.rebuildList();
|
||||||
|
}])
|
||||||
|
.service('newQueueList', ['db', '$rootScope', function(oldDb, $rootScope) {
|
||||||
|
var queueList = [];
|
||||||
|
|
||||||
|
function getQueueList() {
|
||||||
|
return queueList;
|
||||||
|
}
|
||||||
|
|
||||||
|
function rebuildList() {
|
||||||
|
oldDb.getCursor("feedItem", function(ixDbCursorReq)
|
||||||
|
{
|
||||||
|
if(typeof ixDbCursorReq !== "undefined") {
|
||||||
|
ixDbCursorReq.onsuccess = function (e) {
|
||||||
|
var cursor = ixDbCursorReq.result || e.result;
|
||||||
|
if (cursor) {
|
||||||
|
// This additional check is necessary, since the index doesn't seem to always catch correctly
|
||||||
|
if (cursor.value.queued) {
|
||||||
|
queueList.push(cursor.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
cursor.continue();
|
||||||
|
} else {
|
||||||
|
$rootScope.$apply();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, undefined, IDBKeyRange.only(1), false, 'ixQueued');
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
rebuildList: rebuildList,
|
||||||
|
getQueueList: getQueueList
|
||||||
|
};
|
||||||
|
}])
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
angular.module('podcasts.importer', ['podcasts.utilities', 'podcasts.services'])
|
angular.module('podcasts.importer', ['podcasts.utilities', 'podcasts.services'])
|
||||||
.service('opml', ['xmlParser', 'feeds', function(xmlParser, feeds) {
|
.service('opml', ['xmlParser', 'feeds', function(xmlParser, feeds) {
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue