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
1=== modified file 'Podbird.apparmor'
2--- Podbird.apparmor 2018-08-17 15:19:43 +0000
3+++ Podbird.apparmor 2020-04-04 17:46:04 +0000
4@@ -3,7 +3,8 @@
5 "networking",
6 "audio",
7 "connectivity",
8- "usermetrics"
9+ "usermetrics",
10+ "content_exchange"
11 ],
12 "policy_version": 16.04
13 }
14
15=== added file 'app/ui/ImportPage.qml'
16--- app/ui/ImportPage.qml 1970-01-01 00:00:00 +0000
17+++ app/ui/ImportPage.qml 2020-04-04 17:46:04 +0000
18@@ -0,0 +1,62 @@
19+import QtQuick 2.4
20+import Ubuntu.Components 1.3
21+import Ubuntu.Content 1.3
22+
23+
24+
25+Page {
26+ id: picker
27+ property var activeTransfer
28+
29+ property var url
30+ property var handler
31+ property var contentType
32+
33+ signal cancel()
34+ signal imported(string fileUrl)
35+
36+ header: PageHeader {
37+ title: i18n.tr("Choose")
38+ }
39+
40+ ContentPeerPicker {
41+ anchors { fill: parent; topMargin: picker.header.height }
42+ visible: parent.visible
43+ showTitle: false
44+ contentType: picker.contentType //ContentType.Pictures
45+ handler: picker.handler //ContentHandler.Source
46+
47+ onPeerSelected: {
48+ peer.selectionType = ContentTransfer.Single
49+ picker.activeTransfer = peer.request()
50+ picker.activeTransfer.stateChanged.connect(function() {
51+ if (picker.activeTransfer.state === ContentTransfer.InProgress) {
52+ console.log("In progress");
53+ picker.activeTransfer.items = picker.activeTransfer.items[0].url = url;
54+ picker.activeTransfer.state = ContentTransfer.Charged;
55+ }
56+ if (picker.activeTransfer.state === ContentTransfer.Charged) {
57+ console.log("Charged");
58+ picker.imported(picker.activeTransfer.items[0].url)
59+ console.log(picker.activeTransfer.items[0].url)
60+ picker.activeTransfer = null
61+ }
62+ })
63+ }
64+
65+
66+ onCancelPressed: {
67+ pageStack.pop()
68+ }
69+ }
70+
71+ ContentTransferHint {
72+ id: transferHint
73+ anchors.fill: parent
74+ activeTransfer: picker.activeTransfer
75+ }
76+ Component {
77+ id: resultComponent
78+ ContentItem {}
79+ }
80+}
81
82=== modified file 'app/ui/SearchPage.qml'
83--- app/ui/SearchPage.qml 2016-03-29 11:30:03 +0000
84+++ app/ui/SearchPage.qml 2020-04-04 17:46:04 +0000
85@@ -19,7 +19,9 @@
86 import QtQuick 2.4
87 import Ubuntu.Components 1.3
88 import QtQuick.LocalStorage 2.0
89+import QtQuick.XmlListModel 2.0
90 import Ubuntu.Components.Popups 1.3
91+import Ubuntu.Content 1.3
92 import "../podcasts.js" as Podcasts
93 import "../components"
94
95@@ -66,6 +68,17 @@
96 searchPage.header = addHeader
97 feedUrlField.item.forceActiveFocus()
98 }
99+ },
100+ Action {
101+ text:i18n.tr("Import Podcasts")
102+ iconName: "import"
103+ onTriggered: {
104+ var importPage = mainStack.push(Qt.resolvedUrl("ImportPage.qml"),{"contentType": ContentType.Unknown, "handler": ContentHandler.Source})
105+ importPage.imported.connect(function(fileUrl) {
106+ mainStack.pop()
107+ parseOPML(fileUrl)
108+ })
109+ }
110 }
111 ]
112 }
113@@ -123,6 +136,7 @@
114 onTriggered: {
115 resultsView.forceActiveFocus()
116 subscribeFromFeed(feedUrlField.item.text);
117+ tabs.selectedTabIndex = 2;
118 }
119 },
120 Action {
121@@ -150,6 +164,7 @@
122 onAccepted: {
123 resultsView.forceActiveFocus()
124 subscribeFromFeed(feedUrlField.text);
125+ tabs.selectedTabIndex = 2;
126 }
127 }
128 }
129@@ -292,7 +307,6 @@
130 }
131 });
132 }
133- tabs.selectedTabIndex = 2;
134 }
135 }
136 }
137@@ -412,6 +426,8 @@
138 var artist = "";
139 var image = "";
140 if (xhr.readyState === XMLHttpRequest.DONE) {
141+ if(loadingDialog.visible)
142+ progressBar.value++
143 if (xhr.status < 200 || xhr.status > 299 || xhr.responseXML === null) {
144 PopupUtils.open(subscribeFailedDialog);
145 searchPage.header = addHeader
146@@ -440,7 +456,6 @@
147 if(name != "") {
148 Podcasts.subscribe(artist, name, feed, image);
149 imageDownloader.addDownload(feed, image)
150- tabs.selectedTabIndex = 2;
151 } else {
152 PopupUtils.open(subscribeFailedDialog);
153 searchPage.header = addHeader
154@@ -451,4 +466,56 @@
155 }
156 xhr.send();
157 }
158+
159+ function parseOPML(fileUrl) {
160+ opmlModel.source = fileUrl;
161+ opmlModel.reload()
162+ }
163+
164+ XmlListModel {
165+ id:opmlModel
166+
167+ query: "/opml/body/outline"
168+ XmlRole { name: "text"; query: "@text/string()" }
169+ XmlRole { name: "type"; query: "@type/string()" }
170+ XmlRole { name: "xmlUrl"; query: "@xmlUrl/string()" }
171+
172+ onRowsInserted: {
173+ progressBar.minimumValue = first
174+ progressBar.maximumValue = last
175+ progressBar.value = first
176+ loadingDialog.show()
177+ for(var i=first;i<=last;i++){
178+ subscribeFromFeed(opmlModel.get(i).xmlUrl)
179+ }
180+ }
181+ }
182+
183+ Dialog {
184+ id: loadingDialog
185+
186+ modal: true;
187+ title: i18n.tr("Please wait!")
188+ text: i18n.tr("Importing podcasts.")
189+
190+ ActivityIndicator {
191+ running: true
192+ }
193+
194+ ProgressBar {
195+ id:progressBar
196+
197+ onValueChanged: {
198+ if(value > maximumValue) {
199+ PopupUtils.close(loadingDialog)
200+ tabs.selectedTabIndex = 2;
201+ }
202+ }
203+ }
204+
205+ Label {
206+ text: progressBar.value + "/" + (progressBar.maximumValue+1) + " " + i18n.tr("imported")
207+ horizontalAlignment: Text.AlignHCenter
208+ }
209+ }
210 }
211
212=== modified file 'manifest.json.in'
213--- manifest.json.in 2020-03-25 14:39:34 +0000
214+++ manifest.json.in 2020-04-04 17:46:04 +0000
215@@ -9,7 +9,7 @@
216 "desktop": "Podbird.desktop"
217 }
218 },
219- "version": "0.8.4",
220+ "version": "0.8.5",
221 "maintainer": "Michael Sheldon <mike@mikeasoft.com>",
222 "framework": "ubuntu-sdk-16.04.2"
223 }

Subscribers

People subscribed via source and target branches

to status/vote changes: