diff --git a/main.py b/main.py index 461a51e..f6c9558 100644 --- a/main.py +++ b/main.py @@ -334,8 +334,19 @@ class gPotherSide: return { 'title': episode.trimmed_title, 'description': util.remove_html_tags(episode.description), + 'metadata': ' | '.join(self._format_metadata(episode)), } + def _format_metadata(self, episode): + if episode.published: + yield datetime.datetime.fromtimestamp(episode.published).strftime('%Y-%m-%d') + + if episode.file_size > 0: + yield '%.2f MiB' % (episode.file_size / (1024 * 1024)) + + if episode.total_time > 0: + yield '%02d:%02d:%02d' % (episode.total_time / (60 * 60), (episode.total_time / 60) % 60, episode.total_time % 60) + gpotherside = gPotherSide() pyotherside.atexit(gpotherside.atexit) diff --git a/touch/EpisodeDetail.qml b/touch/EpisodeDetail.qml index 3ae428a..b0f8608 100644 --- a/touch/EpisodeDetail.qml +++ b/touch/EpisodeDetail.qml @@ -20,16 +20,25 @@ import QtQuick 2.0 +import 'common/constants.js' as Constants + SlidePage { id: detailPage property int episode_id property string title + property bool ready: false + + PBusyIndicator { + anchors.centerIn: parent + visible: !detailPage.ready + } Component.onCompleted: { - label.text = 'Loading...'; py.call('main.show_episode', [episode_id], function (episode) { - label.text = episode.description; + descriptionLabel.text = episode.description; + metadataLabel.text = episode.metadata; + detailPage.ready = true; }); } @@ -48,16 +57,37 @@ SlidePage { spacing: 10 * pgst.scalef SlidePageHeader { - title: detailPage.title + title: 'Shownotes' } - PLabel { - id: label - width: parent.width * .8 - font.pixelSize: 30 * pgst.scalef + Column { + width: parent.width - 2 * 30 * pgst.scalef anchors.horizontalCenter: parent.horizontalCenter - wrapMode: Text.WordWrap - } + spacing: 10 * pgst.scalef + + PLabel { + text: detailPage.title + width: parent.width + wrapMode: Text.WordWrap + font.pixelSize: 35 * pgst.scalef + color: Constants.colors.highlight + } + + PLabel { + id: metadataLabel + width: parent.width + wrapMode: Text.WordWrap + font.pixelSize: 20 * pgst.scalef + color: Constants.colors.placeholder + } + + PLabel { + id: descriptionLabel + width: parent.width + font.pixelSize: 30 * pgst.scalef + wrapMode: Text.WordWrap + } + } } }