add my import :)
This commit is contained in:
parent
c11fdb9787
commit
cb5242f79b
3 changed files with 36 additions and 7 deletions
|
@ -164,7 +164,7 @@ function ImportCtrl($scope, pageSwitcher, google)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function DevCtrl($scope, downloader, updateFeedsAlarmManager)
|
function DevCtrl($scope, downloader, updateFeedsAlarmManager, opml, downloaderBackend)
|
||||||
{
|
{
|
||||||
$scope.downloadFiles = function() {
|
$scope.downloadFiles = function() {
|
||||||
downloader.downloadAll();
|
downloader.downloadAll();
|
||||||
|
@ -177,4 +177,12 @@ function DevCtrl($scope, downloader, updateFeedsAlarmManager)
|
||||||
$scope.setAlarmTmp = function() {
|
$scope.setAlarmTmp = function() {
|
||||||
updateFeedsAlarmManager.setAlarm();
|
updateFeedsAlarmManager.setAlarm();
|
||||||
};
|
};
|
||||||
|
$scope.importColinsOpml = function() {
|
||||||
|
var url = 'https://raw.github.com/colinfrei/Podcast/master/podcasts.xml';
|
||||||
|
var xmlPromise = downloaderBackend.downloadXml(url);
|
||||||
|
|
||||||
|
xmlPromise.then(function(xml) {
|
||||||
|
opml.import(xml);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -828,14 +828,25 @@ angular.module('podcasts.settings', ['podcasts.database'])
|
||||||
}])
|
}])
|
||||||
;
|
;
|
||||||
|
|
||||||
angular.module('podcasts.importer', [])
|
angular.module('podcasts.importer', ['podcasts.utilities', 'podcasts.services'])
|
||||||
.service('opml', function() {
|
.service('opml', ['xmlParser', 'feeds', function(xmlParser, feeds) {
|
||||||
return {
|
return {
|
||||||
import: function(url) {
|
import: function(xml) {
|
||||||
|
angular.forEach(xml.find('outline'), function(value, key) {
|
||||||
|
var element = angular.element(value);
|
||||||
|
if ("rss" != element.attr('type')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var feedUrl = element.attr('xmlUrl');
|
||||||
|
if (feedUrl) {
|
||||||
|
console.log('adding something');
|
||||||
|
feeds.add(feedUrl);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
}])
|
||||||
.service('google', ['$q', '$http', 'feeds', function($q, $http, feeds) {
|
.service('google', ['$q', '$http', 'feeds', function($q, $http, feeds) {
|
||||||
return {
|
return {
|
||||||
import: function(email, password) {
|
import: function(email, password) {
|
||||||
|
|
|
@ -2,7 +2,16 @@
|
||||||
<button ng-click="setAlarmTmp()">Set Alarm in 10 Seconds</button>
|
<button ng-click="setAlarmTmp()">Set Alarm in 10 Seconds</button>
|
||||||
<button ng-click="checkForPendingMessage()">Check for pending Messages</button>
|
<button ng-click="checkForPendingMessage()">Check for pending Messages</button>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
Import OPML File<br />
|
||||||
|
<button ng-click="importColinsOpml()">Import Colin's OPML File</button>
|
||||||
|
<!--
|
||||||
|
File input fields don't work yet on FirefoxOS, see https://bugzilla.mozilla.org/show_bug.cgi?id=832923
|
||||||
|
<input type="file" onchange="angular.element(this).scope().importOpmlFile(this)" />
|
||||||
|
-->
|
||||||
|
</div>
|
||||||
|
<!--
|
||||||
|
<br />
|
||||||
List of ALarms
|
List of ALarms
|
||||||
$scope.feeds
|
$scope.feeds
|
||||||
<table>
|
<table>
|
||||||
|
@ -15,3 +24,4 @@ $scope.feeds
|
||||||
<td>alarm.</td>
|
<td>alarm.</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
-->
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue