Shownotes metadata
This commit is contained in:
parent
ec561ea966
commit
ab311a20c4
2 changed files with 50 additions and 9 deletions
11
main.py
11
main.py
|
@ -334,8 +334,19 @@ class gPotherSide:
|
||||||
return {
|
return {
|
||||||
'title': episode.trimmed_title,
|
'title': episode.trimmed_title,
|
||||||
'description': util.remove_html_tags(episode.description),
|
'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()
|
gpotherside = gPotherSide()
|
||||||
pyotherside.atexit(gpotherside.atexit)
|
pyotherside.atexit(gpotherside.atexit)
|
||||||
|
|
||||||
|
|
|
@ -20,16 +20,25 @@
|
||||||
|
|
||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
|
|
||||||
|
import 'common/constants.js' as Constants
|
||||||
|
|
||||||
SlidePage {
|
SlidePage {
|
||||||
id: detailPage
|
id: detailPage
|
||||||
|
|
||||||
property int episode_id
|
property int episode_id
|
||||||
property string title
|
property string title
|
||||||
|
property bool ready: false
|
||||||
|
|
||||||
|
PBusyIndicator {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
visible: !detailPage.ready
|
||||||
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
label.text = 'Loading...';
|
|
||||||
py.call('main.show_episode', [episode_id], function (episode) {
|
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,15 +57,36 @@ SlidePage {
|
||||||
spacing: 10 * pgst.scalef
|
spacing: 10 * pgst.scalef
|
||||||
|
|
||||||
SlidePageHeader {
|
SlidePageHeader {
|
||||||
title: detailPage.title
|
title: 'Shownotes'
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
width: parent.width - 2 * 30 * pgst.scalef
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
spacing: 10 * pgst.scalef
|
||||||
|
|
||||||
|
PLabel {
|
||||||
|
text: detailPage.title
|
||||||
|
width: parent.width
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
font.pixelSize: 35 * pgst.scalef
|
||||||
|
color: Constants.colors.highlight
|
||||||
}
|
}
|
||||||
|
|
||||||
PLabel {
|
PLabel {
|
||||||
id: label
|
id: metadataLabel
|
||||||
width: parent.width * .8
|
width: parent.width
|
||||||
font.pixelSize: 30 * pgst.scalef
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
wrapMode: Text.WordWrap
|
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue