git.iko.soy/maciek134/podphoenix
on main help sign in
* Add instructions for viewing hidden actions by right clicking for desktop users

* Add missing action text entries * Fix spelling of ok * Updated framework to 15.04.5 * Store download related data that needs to persist across app reboots in that download's custom metadata * Added settings option to disable downloads over cellular data * Fix for download duplication when restarting Podbird * Updated pot file

commit9c9fb221f7c86baade53ccc9fed17a625c7a317e authorNekhelesh Ramananthan <krnekhelesh@gmail.com> dateSun 11 Dec 2016, 21:23 (10 years ago) parent040ff4332ffee0
8 files changed+133−40
app/podbird.qml+36−11 app/podcasts.js+5−4 app/ui/EpisodesPage.qml+7−2 app/ui/EpisodesTab.qml+4−4 app/ui/SettingsPage.qml+19−2 app/welcomewizard/Slide5.qml+1−1 manifest.json.in+1−1 po/com.mikeasoft.podbird.pot+60−15
app/podbird.qml+36−11
@@ -43,7 +43,6 @@ MainView {
4343 : "Ubuntu.Components.Themes.Ambiance"
4444
4545 Component.onDestruction: {
46− console.log("[LOG]: Download cancelled");
4746 var db = Podcasts.init()
4847 db.transaction(function (tx) {
4948 tx.executeSql('UPDATE Episode SET queued=0 WHERE queued=1');
@@ -79,12 +78,21 @@ MainView {
7978 settings.lastCheck = today
8079 }
8180
82− if (!NetworkingStatus.online || settings.maxEpisodeDownload === -1) {
83− console.log("[LOG]: Skipped autodownloading of new episodes...")
84− console.log("[LOG]: Online connectivity: " + NetworkingStatus.online)
85− console.log("[LOG]: User settings (maxEpisodeDownload): " + settings.maxEpisodeDownload)
86− } else {
87− Podcasts.autoDownloadEpisodes(settings.maxEpisodeDownload)
81+ delayStartTimer.start();
82+ }
83+
84+ Timer {
85+ id: delayStartTimer
86+ interval: 500
87+ repeat: false
88+ onTriggered: {
89+ if (!NetworkingStatus.online || podbird.settings.maxEpisodeDownload === -1) {
90+ console.log("[LOG]: Skipped autodownloading of new episodes...")
91+ console.log("[LOG]: Online connectivity: " + NetworkingStatus.online)
92+ console.log("[LOG]: User settings (maxEpisodeDownload): " + podbird.settings.maxEpisodeDownload)
93+ } else {
94+ Podcasts.autoDownloadEpisodes(podbird.settings.maxEpisodeDownload)
95+ }
8896 }
8997 }
9098
@@ -118,6 +126,7 @@ MainView {
118126 property bool showListView: true
119127 property int skipForward: 30
120128 property int skipBack: 10
129+ property bool downloadOverWifiOnly: true
121130 }
122131
123132 FileManager {
@@ -167,27 +176,43 @@ MainView {
167176 metadata: Metadata {
168177 showInIndicator: true
169178 title: singleDownloadObject.title
179+ custom: {"guid": singleDownloadObject.guid, "image" : singleDownloadObject.image}
170180 }
171181 }
172182 }
173183
174− function downloadEpisode(image, title, guid, url) {
175− var singleDownload = singleDownloadComponent.createObject(podbird, {"image": image, "title": title, "guid": guid})
184+ function downloadEpisode(image, title, guid, url, disableMobileDownload) {
185+ if(downloader.isDownloadInQueue(guid)) {
186+ console.log("[LOG]: Download with GUID of :"+guid+ " is already in the download queue.")
187+ return false;
188+ }
189+
190+ var singleDownload = singleDownloadComponent.createObject(podbird, {"image": image, "title": title, "guid": guid, allowMobileDownload : !disableMobileDownload })
176191 singleDownload.download(url)
177192 }
178193
179194 DownloadManager {
180195 id: downloader
181196
182− property string downloadingGuid: downloads.length > 0 ? downloads[0].guid : "NULL"
197+ property string downloadingGuid: downloads.length > 0 ? downloads[0].metadata.custom.guid : "NULL"
183198 property int progress: downloads.length > 0 ? downloads[0].progress : 0
184199
185200 cleanDownloads: true
201+
202+ function isDownloadInQueue ( guid ) {
203+ for( var i=0; i < downloads.length; i++) {
204+ if( downloads[i].metadata.custom.guid && guid === downloads[i].metadata.custom.guid) {
205+ return true ;
206+ }
207+ }
208+ return false;
209+ }
210+
186211 onDownloadFinished: {
187212 var db = Podcasts.init();
188213 var finalLocation = fileManager.saveDownload(path);
189214 db.transaction(function (tx) {
190− tx.executeSql("UPDATE Episode SET downloadedfile=?, queued=0 WHERE guid=?", [finalLocation, download.guid]);
215+ tx.executeSql("UPDATE Episode SET downloadedfile=?, queued=0 WHERE guid=?", [finalLocation, download.metadata.custom.guid]);
191216 });
192217 }
193218
app/podcasts.js+5−4
@@ -356,12 +356,13 @@ function autoDownloadEpisodes(maxEpisodeDownload) {
356356 var rs = tx.executeSql("SELECT rowid, * FROM Podcast ORDER BY name ASC");
357357 for (var i=0; i < rs.rows.length; i++) {
358358 var podcast = rs.rows.item(i);
359− var rs2 = tx.executeSql("SELECT rowid, * FROM Episode WHERE podcast=? ORDER BY published DESC", [rs.rows.item(i).rowid]);
359+ var rs2 = tx.executeSql("SELECT rowid, * FROM Episode WHERE podcast=? ORDER BY published DESC", [podcast.rowid]);
360360 var loopCount = maxEpisodeDownload > rs2.rows.length ? rs2.rows.length : maxEpisodeDownload
361361 for (var j=0; j < loopCount; j++) {
362− if (!rs2.rows.item(j).downloadedfile && !rs2.rows.item(j).listened && rs2.rows.item(j).audiourl) {
363− podbird.downloadEpisode(rs.rows.item(i).image, rs2.rows.item(j).name, rs2.rows.item(j).guid, rs2.rows.item(j).audiourl)
364− tx.executeSql("UPDATE Episode SET queued=1 WHERE guid = ?", [rs2.rows.item(j).guid]);
362+ var episode = rs2.rows.item(j);
363+ if ( !episode.downloadedfile && !episode.listened && episode.audiourl && !episode.queued ) {
364+ podbird.downloadEpisode(podcast.image, episode.name, episode.guid, episode.audiourl, podbird.settings.downloadOverWifiOnly)
365+ tx.executeSql("UPDATE Episode SET queued=1 WHERE guid = ?", [episode.guid]);
365366 }
366367 }
367368 }
app/ui/EpisodesPage.qml+7−2
@@ -166,7 +166,7 @@ Page {
166166 episodeModel.setProperty(index, "queued", 1)
167167 tx.executeSql("UPDATE Episode SET queued=1 WHERE guid = ?", [episodeModel.get(index).guid]);
168168 if (episodeModel.get(index).audiourl) {
169− podbird.downloadEpisode(episodeModel.get(index).image, episodeModel.get(index).name, episodeModel.get(index).guid, episodeModel.get(index).audiourl)
169+ podbird.downloadEpisode(episodeModel.get(index).image, episodeModel.get(index).name, episodeModel.get(index).guid, episodeModel.get(index).audiourl, false)
170170 } else {
171171 console.log("[ERROR]: Invalid download url: " + episodeModel.get(index).audiourl)
172172 }
@@ -602,6 +602,7 @@ Page {
602602 actions: [
603603 Action {
604604 iconName: model.listened ? "view-collapse" : "select"
605+ text: model.listened ? i18n.tr("Mark as unheard") : i18n.tr("Mark as listened")
605606 onTriggered: {
606607 var db = Podcasts.init();
607608 db.transaction(function (tx) {
@@ -617,6 +618,7 @@ Page {
617618 Action {
618619 enabled: downloader.downloadingGuid !== model.guid
619620 iconName: model.downloadedfile ? "delete" : (model.queued && downloader.downloadingGuid !== model.guid ? "history" : "save")
621+ text: model.downloadedfile ? i18n.tr("Delete downloaded file") : (model.queued && downloader.downloadingGuid !== model.guid ? i18n.tr("Queued") : i18n.tr("Download"))
620622 onTriggered: {
621623 var db = Podcasts.init();
622624 if (model.downloadedfile) {
@@ -631,7 +633,7 @@ Page {
631633 });
632634 episodeModel.setProperty(model.index, "queued", 1)
633635 if (model.audiourl) {
634− podbird.downloadEpisode(model.image, model.name, model.guid, model.audiourl)
636+ podbird.downloadEpisode(model.image, model.name, model.guid, model.audiourl, false)
635637 } else {
636638 console.log("[ERROR]: Invalid download url: " + model.audiourl)
637639 }
@@ -641,6 +643,7 @@ Page {
641643
642644 Action {
643645 iconName: "add-to-playlist"
646+ text: i18n.tr("Add to playlist")
644647 onTriggered: {
645648 var url = model.downloadedfile ? "file://" + model.downloadedfile : model.audiourl
646649 player.addEpisodeToQueue(model.guid, model.image, model.name, model.artist, url)
@@ -649,6 +652,7 @@ Page {
649652
650653 Action {
651654 iconName: model.favourited ? "unlike" : "like"
655+ text: model.favourited ? i18n.tr("Unfavourite") : i18n.tr("Favourite")
652656 onTriggered: {
653657 var db = Podcasts.init();
654658 db.transaction(function (tx) {
@@ -663,6 +667,7 @@ Page {
663667
664668 Action {
665669 iconName: "info"
670+ text: i18n.tr("Show episode description")
666671 onTriggered: {
667672 var popup = PopupUtils.open(episodeDescriptionDialog, episodesPage);
668673 popup.description = model.description
app/ui/EpisodesTab.qml+4−4
@@ -183,7 +183,7 @@ Tab {
183183 episodesModel.setProperty(index, "queued", 1)
184184 tx.executeSql("UPDATE Episode SET queued=1 WHERE guid = ?", [episodesModel.get(index).guid]);
185185 if (episodesModel.get(index).audiourl) {
186− podbird.downloadEpisode(episodesModel.get(index).image, episodesModel.get(index).name, episodesModel.get(index).guid, episodesModel.get(index).audiourl)
186+ podbird.downloadEpisode(episodesModel.get(index).image, episodesModel.get(index).name, episodesModel.get(index).guid, episodesModel.get(index).audiourl, false)
187187 } else {
188188 console.log("[ERROR]: Invalid download url: " + episodesModel.get(index).audiourl)
189189 }
@@ -468,7 +468,7 @@ Tab {
468468 Image {
469469 height: width
470470 width: units.gu(6)
471− source: modelData.image !== undefined ? modelData.image : Qt.resolvedUrl("../graphics/podbird.png")
471+ source: modelData.metadata.custom.image !== undefined ? modelData.metadata.custom.image : Qt.resolvedUrl("../graphics/podbird.png")
472472 SlotsLayout.position: SlotsLayout.Leading
473473 sourceSize { width: width; height: height }
474474 }
@@ -477,7 +477,7 @@ Tab {
477477 spacing: units.gu(0.5)
478478
479479 Label {
480− text: modelData.title
480+ text: modelData.metadata.title
481481 width: parent.width
482482 elide: Text.ElideRight
483483 }
@@ -597,7 +597,7 @@ Tab {
597597 });
598598 episodesModel.setProperty(model.index, "queued", 1)
599599 if (model.audiourl) {
600− podbird.downloadEpisode(model.image, model.name, model.guid, model.audiourl)
600+ podbird.downloadEpisode(model.image, model.name, model.guid, model.audiourl, false)
601601 } else {
602602 console.log("[ERROR]: Invalid download url: " + model.audiourl)
603603 }
app/ui/SettingsPage.qml+19−2
@@ -74,7 +74,7 @@ Page {
7474 }
7575
7676 Button {
77− text: i18n.tr("Ok")
77+ text: i18n.tr("OK")
7878 color: podbird.appTheme.positiveActionButton
7979 onClicked: {
8080 podbird.settings.skipForward = Math.round(slider.value)
@@ -109,7 +109,7 @@ Page {
109109 }
110110
111111 Button {
112− text: i18n.tr("Ok")
112+ text: i18n.tr("OK")
113113 color: podbird.appTheme.positiveActionButton
114114 onClicked: {
115115 podbird.settings.skipBack = Math.round(slider.value)
@@ -212,6 +212,23 @@ Page {
212212 onClicked: mainStack.push(Qt.resolvedUrl("../settings/DownloadSetting.qml"))
213213 }
214214
215+ ListItem {
216+ ListItemLayout {
217+ id: downloadWifiOnlyLayout
218+ title.text: i18n.tr("Only download over WiFi")
219+ title.color: podbird.appTheme.baseText
220+ summary.text: i18n.tr("Download episodes only when the device is using WiFi")
221+ summary.color: podbird.appTheme.baseSubText
222+ Switch {
223+ SlotsLayout.position: SlotsLayout.Last
224+ checked: podbird.settings.downloadOverWifiOnly
225+ onClicked: podbird.settings.downloadOverWifiOnly = checked
226+ }
227+ }
228+ divider.visible: false
229+ height: downloadWifiOnlyLayout.height
230+ }
231+
215232 ListItem {
216233 id: refreshArtListItem
217234
app/welcomewizard/Slide5.qml+1−1
@@ -61,7 +61,7 @@ Component {
6161 wrapMode: Text.WordWrap
6262 horizontalAlignment: Text.AlignHCenter
6363 linkColor: podbird.appTheme.linkText
64− text: i18n.tr("Episodes can be swiped left to reveal more actions. You can also multi-select them by long-pressing on an episode.")
64+ text: i18n.tr("Episodes can be swiped left to reveal more actions (or right click if you're using a mouse). You can also multi-select them by long-pressing on an episode.")
6565 onLinkActivated: Qt.openUrlExternally(link)
6666 }
6767 }
manifest.json.in+1−1
@@ -11,5 +11,5 @@
1111 },
1212 "version": "0.7",
1313 "maintainer": "Michael Sheldon <mike@mikeasoft.com>",
14− "framework": "ubuntu-sdk-15.04.3"
14+ "framework": "ubuntu-sdk-15.04.5"
1515}
po/com.mikeasoft.podbird.pot+60−15
@@ -55,7 +55,7 @@ msgstr ""
5555
5656#. TRANSLATORS: About as in information about the app
5757#: ../app/settings/About.qml:28 ../app/settings/About.qml:46
58−#: ../app/ui/SettingsPage.qml:321
58+#: ../app/ui/SettingsPage.qml:338
5959msgid "About"
6060msgstr ""
6161
@@ -223,7 +223,7 @@ msgid "Episode Description"
223223msgstr ""
224224
225225#: ../app/ui/EpisodesPage.qml:356 ../app/ui/EpisodesTab.qml:418
226−#: ../app/ui/SearchPage.qml:179 ../app/ui/SettingsPage.qml:303
226+#: ../app/ui/SearchPage.qml:179 ../app/ui/SettingsPage.qml:320
227227msgid "Close"
228228msgstr ""
229229
@@ -247,6 +247,42 @@ msgstr ""
247247msgid "Downloaded"
248248msgstr ""
249249
250+#: ../app/ui/EpisodesPage.qml:605
251+msgid "Make as unheard"
252+msgstr ""
253+
254+#: ../app/ui/EpisodesPage.qml:605
255+msgid "Mark as listened"
256+msgstr ""
257+
258+#: ../app/ui/EpisodesPage.qml:621
259+msgid "Delete downloaded file"
260+msgstr ""
261+
262+#: ../app/ui/EpisodesPage.qml:621
263+msgid "Queued"
264+msgstr ""
265+
266+#: ../app/ui/EpisodesPage.qml:621
267+msgid "Download"
268+msgstr ""
269+
270+#: ../app/ui/EpisodesPage.qml:646
271+msgid "Add to playlist"
272+msgstr ""
273+
274+#: ../app/ui/EpisodesPage.qml:655
275+msgid "Unfavourite"
276+msgstr ""
277+
278+#: ../app/ui/EpisodesPage.qml:655
279+msgid "Favourite"
280+msgstr ""
281+
282+#: ../app/ui/EpisodesPage.qml:670
283+msgid "Show episode description"
284+msgstr ""
285+
250286#: ../app/ui/EpisodesTab.qml:82
251287msgid "Recent"
252288msgstr ""
@@ -432,7 +468,7 @@ msgid "%1 seconds"
432468msgstr ""
433469
434470#: ../app/ui/SettingsPage.qml:77 ../app/ui/SettingsPage.qml:112
435−msgid "Ok"
471+msgid "OK"
436472msgstr ""
437473
438474#. TRANSLATORS: This strings refers to the seeking of the episode playback. Users can set how far they
@@ -476,7 +512,15 @@ msgstr ""
476512msgid "Default number of new episodes to download for each podcast"
477513msgstr ""
478514
479−#: ../app/ui/SettingsPage.qml:223
515+#: ../app/ui/SettingsPage.qml:218
516+msgid "Only download over wifi"
517+msgstr ""
518+
519+#: ../app/ui/SettingsPage.qml:220
520+msgid "Download episodes only when the device is using WiFi"
521+msgstr ""
522+
523+#: ../app/ui/SettingsPage.qml:240
480524msgid "Refresh podcast artwork"
481525msgstr ""
482526
@@ -484,15 +528,15 @@ msgstr ""
484528msgid "Update all podcasts artwork and fix missing ones"
485529msgstr ""
486530
487−#: ../app/ui/SettingsPage.qml:254
531+#: ../app/ui/SettingsPage.qml:271
488532msgid "Storage Settings"
489533msgstr ""
490534
491−#: ../app/ui/SettingsPage.qml:265
535+#: ../app/ui/SettingsPage.qml:282
492536msgid "Delete orphaned files and links"
493537msgstr ""
494538
495−#: ../app/ui/SettingsPage.qml:267
539+#: ../app/ui/SettingsPage.qml:284
496540msgid "Free space by removing orphaned downloaded files and links"
497541msgstr ""
498542
@@ -504,13 +548,13 @@ msgstr ""
504548msgid "No orphans found!"
505549msgstr ""
506550
507−#: ../app/ui/SettingsPage.qml:298
551+#: ../app/ui/SettingsPage.qml:315
508552msgid ""
509553"All orphaned files have been deleted to recover disk space. Orphaned links "
510554"pointing at invalid files have also been cleaned up."
511555msgstr ""
512556
513−#: ../app/ui/SettingsPage.qml:300
557+#: ../app/ui/SettingsPage.qml:317
514558msgid ""
515559"No orphaned files have been found to recover disk space. Podbird database is "
516560"clean."
@@ -518,11 +562,11 @@ msgstr ""
518562
519563#. TRANSLATORS: Shortened form of "Miscellaneous" which is shown to denote other setting options
520564#. that doesn't fit into any other category.
521−#: ../app/ui/SettingsPage.qml:315
565+#: ../app/ui/SettingsPage.qml:332
522566msgid "Misc."
523567msgstr ""
524568
525−#: ../app/ui/SettingsPage.qml:331
569+#: ../app/ui/SettingsPage.qml:348
526570msgid "Report Bug"
527571msgstr ""
528572
@@ -582,8 +626,9 @@ msgstr ""
582626
583627#: ../app/welcomewizard/Slide5.qml:64
584628msgid ""
585−"Episodes can be swiped left to reveal more actions. You can also multi-"
586−"select them by long-pressing on an episode."
629+"Episodes can be swiped left to reveal more actions (or right click if you're "
630+"using a mouse). You can also multi-select them by long-pressing on an "
631+"episode."
587632msgstr ""
588633
589634#: ../app/welcomewizard/Slide6.qml:45
@@ -610,10 +655,10 @@ msgstr ""
610655msgid "Finish"
611656msgstr ""
612657
613−#: /home/krnekhelesh/Development/Builds/build-devel-branch-sync-4-UbuntuSDK_for_desktop_GCC_amd64_ubuntu_sdk_15_04-Default/po/Podbird.desktop.in.h:1
658+#: /home/krnekhelesh/Development/build-devel-branch-sync-5-UbuntuSDK_for_desktop_GCC_amd64_ubuntu_sdk_15_04-Default/po/Podbird.desktop.in.h:1
614659msgid "The chirpiest podcast manager for Ubuntu"
615660msgstr ""
616661
617−#: /home/krnekhelesh/Development/Builds/build-devel-branch-sync-4-UbuntuSDK_for_desktop_GCC_amd64_ubuntu_sdk_15_04-Default/po/Podbird.desktop.in.h:2
662+#: /home/krnekhelesh/Development/build-devel-branch-sync-5-UbuntuSDK_for_desktop_GCC_amd64_ubuntu_sdk_15_04-Default/po/Podbird.desktop.in.h:2
618663msgid "podcast;audio;itunes;broadcast;digital;stream;podcatcher;video;vodcast;"
619664msgstr ""