Merge lp:~dano6/podbird/podbird into lp:podbird

Proposed by Daniel Kutka
Status: Merged
Merged at revision: 198
Proposed branch: lp:~dano6/podbird/podbird
Merge into: lp:podbird
Diff against target: 223 lines (+134/-4)
4 files modified
Podbird.apparmor (+2/-1)
app/ui/ImportPage.qml (+62/-0)
app/ui/SearchPage.qml (+69/-2)
manifest.json.in (+1/-1)
To merge this branch: bzr merge lp:~dano6/podbird/podbird
Reviewer Review Type Date Requested Status
Michael Sheldon Pending
Review via email: mp+381693@code.launchpad.net

Commit message

Implement importing podcast with OPML files.

To post a comment you must log in.
Revision history for this message
Daniel Kutka (dano6) wrote :

Version bump is because of AppArmor changes. Tested with OPML files from PodcastAddict for android and GNOME Podcasts.

Revision history for this message
Michael Sheldon (michael-sheldon) wrote :

This is very cool, thanks! I'll try to find some time to review it over the next few days

lp:~dano6/podbird/podbird updated
198. By Michael Sheldon

Merge lp:~dano6/podbird/podbird

Revision history for this message
Michael Sheldon (michael-sheldon) wrote :

Merged, thanks!

Revision history for this message
Daniel Kutka (dano6) wrote :

Thanks for the merge, I made small fix in new proposal

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'Podbird.apparmor'
--- Podbird.apparmor 2018-08-17 15:19:43 +0000
+++ Podbird.apparmor 2020-04-04 17:46:04 +0000
@@ -3,7 +3,8 @@
3 "networking",3 "networking",
4 "audio",4 "audio",
5 "connectivity",5 "connectivity",
6 "usermetrics"6 "usermetrics",
7 "content_exchange"
7 ],8 ],
8 "policy_version": 16.049 "policy_version": 16.04
9}10}
1011
=== added file 'app/ui/ImportPage.qml'
--- app/ui/ImportPage.qml 1970-01-01 00:00:00 +0000
+++ app/ui/ImportPage.qml 2020-04-04 17:46:04 +0000
@@ -0,0 +1,62 @@
1import QtQuick 2.4
2import Ubuntu.Components 1.3
3import Ubuntu.Content 1.3
4
5
6
7Page {
8 id: picker
9 property var activeTransfer
10
11 property var url
12 property var handler
13 property var contentType
14
15 signal cancel()
16 signal imported(string fileUrl)
17
18 header: PageHeader {
19 title: i18n.tr("Choose")
20 }
21
22 ContentPeerPicker {
23 anchors { fill: parent; topMargin: picker.header.height }
24 visible: parent.visible
25 showTitle: false
26 contentType: picker.contentType //ContentType.Pictures
27 handler: picker.handler //ContentHandler.Source
28
29 onPeerSelected: {
30 peer.selectionType = ContentTransfer.Single
31 picker.activeTransfer = peer.request()
32 picker.activeTransfer.stateChanged.connect(function() {
33 if (picker.activeTransfer.state === ContentTransfer.InProgress) {
34 console.log("In progress");
35 picker.activeTransfer.items = picker.activeTransfer.items[0].url = url;
36 picker.activeTransfer.state = ContentTransfer.Charged;
37 }
38 if (picker.activeTransfer.state === ContentTransfer.Charged) {
39 console.log("Charged");
40 picker.imported(picker.activeTransfer.items[0].url)
41 console.log(picker.activeTransfer.items[0].url)
42 picker.activeTransfer = null
43 }
44 })
45 }
46
47
48 onCancelPressed: {
49 pageStack.pop()
50 }
51 }
52
53 ContentTransferHint {
54 id: transferHint
55 anchors.fill: parent
56 activeTransfer: picker.activeTransfer
57 }
58 Component {
59 id: resultComponent
60 ContentItem {}
61 }
62}
063
=== modified file 'app/ui/SearchPage.qml'
--- app/ui/SearchPage.qml 2016-03-29 11:30:03 +0000
+++ app/ui/SearchPage.qml 2020-04-04 17:46:04 +0000
@@ -19,7 +19,9 @@
19import QtQuick 2.419import QtQuick 2.4
20import Ubuntu.Components 1.320import Ubuntu.Components 1.3
21import QtQuick.LocalStorage 2.021import QtQuick.LocalStorage 2.0
22import QtQuick.XmlListModel 2.0
22import Ubuntu.Components.Popups 1.323import Ubuntu.Components.Popups 1.3
24import Ubuntu.Content 1.3
23import "../podcasts.js" as Podcasts25import "../podcasts.js" as Podcasts
24import "../components"26import "../components"
2527
@@ -66,6 +68,17 @@
66 searchPage.header = addHeader68 searchPage.header = addHeader
67 feedUrlField.item.forceActiveFocus()69 feedUrlField.item.forceActiveFocus()
68 }70 }
71 },
72 Action {
73 text:i18n.tr("Import Podcasts")
74 iconName: "import"
75 onTriggered: {
76 var importPage = mainStack.push(Qt.resolvedUrl("ImportPage.qml"),{"contentType": ContentType.Unknown, "handler": ContentHandler.Source})
77 importPage.imported.connect(function(fileUrl) {
78 mainStack.pop()
79 parseOPML(fileUrl)
80 })
81 }
69 }82 }
70 ]83 ]
71 }84 }
@@ -123,6 +136,7 @@
123 onTriggered: {136 onTriggered: {
124 resultsView.forceActiveFocus()137 resultsView.forceActiveFocus()
125 subscribeFromFeed(feedUrlField.item.text);138 subscribeFromFeed(feedUrlField.item.text);
139 tabs.selectedTabIndex = 2;
126 }140 }
127 },141 },
128 Action {142 Action {
@@ -150,6 +164,7 @@
150 onAccepted: {164 onAccepted: {
151 resultsView.forceActiveFocus()165 resultsView.forceActiveFocus()
152 subscribeFromFeed(feedUrlField.text);166 subscribeFromFeed(feedUrlField.text);
167 tabs.selectedTabIndex = 2;
153 }168 }
154 }169 }
155 }170 }
@@ -292,7 +307,6 @@
292 }307 }
293 });308 });
294 }309 }
295 tabs.selectedTabIndex = 2;
296 }310 }
297 }311 }
298 }312 }
@@ -412,6 +426,8 @@
412 var artist = "";426 var artist = "";
413 var image = "";427 var image = "";
414 if (xhr.readyState === XMLHttpRequest.DONE) {428 if (xhr.readyState === XMLHttpRequest.DONE) {
429 if(loadingDialog.visible)
430 progressBar.value++
415 if (xhr.status < 200 || xhr.status > 299 || xhr.responseXML === null) {431 if (xhr.status < 200 || xhr.status > 299 || xhr.responseXML === null) {
416 PopupUtils.open(subscribeFailedDialog);432 PopupUtils.open(subscribeFailedDialog);
417 searchPage.header = addHeader433 searchPage.header = addHeader
@@ -440,7 +456,6 @@
440 if(name != "") {456 if(name != "") {
441 Podcasts.subscribe(artist, name, feed, image);457 Podcasts.subscribe(artist, name, feed, image);
442 imageDownloader.addDownload(feed, image)458 imageDownloader.addDownload(feed, image)
443 tabs.selectedTabIndex = 2;
444 } else {459 } else {
445 PopupUtils.open(subscribeFailedDialog);460 PopupUtils.open(subscribeFailedDialog);
446 searchPage.header = addHeader461 searchPage.header = addHeader
@@ -451,4 +466,56 @@
451 }466 }
452 xhr.send();467 xhr.send();
453 }468 }
469
470 function parseOPML(fileUrl) {
471 opmlModel.source = fileUrl;
472 opmlModel.reload()
473 }
474
475 XmlListModel {
476 id:opmlModel
477
478 query: "/opml/body/outline"
479 XmlRole { name: "text"; query: "@text/string()" }
480 XmlRole { name: "type"; query: "@type/string()" }
481 XmlRole { name: "xmlUrl"; query: "@xmlUrl/string()" }
482
483 onRowsInserted: {
484 progressBar.minimumValue = first
485 progressBar.maximumValue = last
486 progressBar.value = first
487 loadingDialog.show()
488 for(var i=first;i<=last;i++){
489 subscribeFromFeed(opmlModel.get(i).xmlUrl)
490 }
491 }
492 }
493
494 Dialog {
495 id: loadingDialog
496
497 modal: true;
498 title: i18n.tr("Please wait!")
499 text: i18n.tr("Importing podcasts.")
500
501 ActivityIndicator {
502 running: true
503 }
504
505 ProgressBar {
506 id:progressBar
507
508 onValueChanged: {
509 if(value > maximumValue) {
510 PopupUtils.close(loadingDialog)
511 tabs.selectedTabIndex = 2;
512 }
513 }
514 }
515
516 Label {
517 text: progressBar.value + "/" + (progressBar.maximumValue+1) + " " + i18n.tr("imported")
518 horizontalAlignment: Text.AlignHCenter
519 }
520 }
454}521}
455522
=== modified file 'manifest.json.in'
--- manifest.json.in 2020-03-25 14:39:34 +0000
+++ manifest.json.in 2020-04-04 17:46:04 +0000
@@ -9,7 +9,7 @@
9 "desktop": "Podbird.desktop"9 "desktop": "Podbird.desktop"
10 }10 }
11 },11 },
12 "version": "0.8.4",12 "version": "0.8.5",
13 "maintainer": "Michael Sheldon <mike@mikeasoft.com>",13 "maintainer": "Michael Sheldon <mike@mikeasoft.com>",
14 "framework": "ubuntu-sdk-16.04.2"14 "framework": "ubuntu-sdk-16.04.2"
15}15}

Subscribers

People subscribed via source and target branches

to status/vote changes: