Add playlist updated field
This commit is contained in:
1 parent
b7fe0feb94
commit
ae82ad4b28
8 files changed
+68
-16
No files matched your search
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
|||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- A field to indicate when a playlist was last updated
|
||||||
|
|
||||||
## [0.11.0] - 2023-09-10
|
## [0.11.0] - 2023-09-10
|
||||||
|
|
||||||
This version went through a major refactor, which resulted in a different arcitecture of the app to support new features, the rewrite of many pieces, as well as new features.
|
This version went through a major refactor, which resulted in a different arcitecture of the app to support new features, the rewrite of many pieces, as well as new features.
|
||||||
|
|||||||
@@ -29,5 +29,7 @@
|
|||||||
<field id="videoCountText" type="string" />
|
<field id="videoCountText" type="string" />
|
||||||
<field id="viewCount" type="integer" />
|
<field id="viewCount" type="integer" />
|
||||||
<field id="viewCountText" type="string" />
|
<field id="viewCountText" type="string" />
|
||||||
|
<field id="updated" type="integer" />
|
||||||
|
<field id="updatedText" type="string" />
|
||||||
</interface>
|
</interface>
|
||||||
</component>
|
</component>
|
||||||
@@ -61,9 +61,6 @@
|
|||||||
invidious="bind:../Invidious"
|
invidious="bind:../Invidious"
|
||||||
preferences="bind:../Preferences"
|
preferences="bind:../Preferences"
|
||||||
playQueue="bind:../PlayQueue" />
|
playQueue="bind:../PlayQueue" />
|
||||||
|
|
||||||
<!-- Inherits from WebServer
|
|
||||||
<WebSocketServer id="WebSocketServer" webserver="ref:../WebServer" /> -->
|
|
||||||
</AppController>
|
</AppController>
|
||||||
</children>
|
</children>
|
||||||
</component>
|
</component>
|
||||||
@@ -17,6 +17,7 @@ function Init()
|
|||||||
m.backgroundSmall = m.top.findNode("backgroundSmall")
|
m.backgroundSmall = m.top.findNode("backgroundSmall")
|
||||||
m.titleLabel = m.top.findNode("titleLabel")
|
m.titleLabel = m.top.findNode("titleLabel")
|
||||||
m.subtitleLabel = m.top.findNode("subtitleLabel")
|
m.subtitleLabel = m.top.findNode("subtitleLabel")
|
||||||
|
m.updatedLabel = m.top.findNode("updatedLabel")
|
||||||
m.descriptionLabel = m.top.findNode("descriptionLabel")
|
m.descriptionLabel = m.top.findNode("descriptionLabel")
|
||||||
m.list = m.top.findNode("list")
|
m.list = m.top.findNode("list")
|
||||||
end function
|
end function
|
||||||
@@ -43,6 +44,7 @@ function OnContentSet() as void
|
|||||||
m.titleLabel.text = content.title
|
m.titleLabel.text = content.title
|
||||||
' NOTE: "_author" not "author". See PlaylistContentNode.xml for explanation.
|
' NOTE: "_author" not "author". See PlaylistContentNode.xml for explanation.
|
||||||
m.subtitleLabel.text = `${content._author} • ${content.videoCountText} • ${content.viewCountText}`
|
m.subtitleLabel.text = `${content._author} • ${content.videoCountText} • ${content.viewCountText}`
|
||||||
|
m.updatedLabel.text = content.updatedText
|
||||||
m.descriptionLabel.text = content.description
|
m.descriptionLabel.text = content.description
|
||||||
|
|
||||||
' TODO:P2 cross fade
|
' TODO:P2 cross fade
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
height="720"
|
height="720"
|
||||||
blendColor="0x323232">
|
blendColor="0x323232">
|
||||||
<LayoutGroup
|
<LayoutGroup
|
||||||
itemSpacings="[5,20]"
|
itemSpacings="[5,5,20]"
|
||||||
translation="[65,90]">
|
translation="[65,90]">
|
||||||
<Label
|
<Label
|
||||||
id="titleLabel"
|
id="titleLabel"
|
||||||
@@ -35,6 +35,10 @@
|
|||||||
id="subtitleLabel"
|
id="subtitleLabel"
|
||||||
width="500"
|
width="500"
|
||||||
font="font:SmallestBoldSystemFont" />
|
font="font:SmallestBoldSystemFont" />
|
||||||
|
<Label
|
||||||
|
id="updatedLabel"
|
||||||
|
width="500"
|
||||||
|
font="font:SmallestSystemFont" />
|
||||||
<Label
|
<Label
|
||||||
id="descriptionLabel"
|
id="descriptionLabel"
|
||||||
width="500"
|
width="500"
|
||||||
|
|||||||
@@ -70,6 +70,8 @@ namespace InvidiousContent
|
|||||||
node.videoCountText = PlaylistGetVideoCountText(item)
|
node.videoCountText = PlaylistGetVideoCountText(item)
|
||||||
SetIfExists(node, "viewCount", item, "viewCount")
|
SetIfExists(node, "viewCount", item, "viewCount")
|
||||||
node.viewCountText = PlaylistGetViewCountText(item)
|
node.viewCountText = PlaylistGetViewCountText(item)
|
||||||
|
SetIfExists(node, "updated", item, "updated")
|
||||||
|
node.updatedText = PlaylistGetUpdatedText(item)
|
||||||
|
|
||||||
if item.videos <> invalid
|
if item.videos <> invalid
|
||||||
childCount = node.getChildCount()
|
childCount = node.getChildCount()
|
||||||
@@ -208,4 +210,42 @@ namespace InvidiousContent
|
|||||||
return VideoGetViewCountText(playlistItem)
|
return VideoGetViewCountText(playlistItem)
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
function PlaylistGetUpdatedText(playlistItem as object) as string
|
||||||
|
updated = playlistItem.updated
|
||||||
|
if not IsInt(updated)
|
||||||
|
return ""
|
||||||
|
end if
|
||||||
|
span = TimeUtils.Now().AsSeconds() - updated
|
||||||
|
if span < 1
|
||||||
|
return ""
|
||||||
|
end if
|
||||||
|
|
||||||
|
count = ""
|
||||||
|
total_days = span \ 86400
|
||||||
|
if total_days > 365
|
||||||
|
years = total_days \ 365
|
||||||
|
count = years > 1 ? `${years} years` : "1 year"
|
||||||
|
else if total_days > 30
|
||||||
|
months = total_days \ 30
|
||||||
|
count = months > 1 ? `${months} months` : "1 month"
|
||||||
|
else if total_days > 7
|
||||||
|
weeks = total_days \ 7
|
||||||
|
count = weeks > 1 ? `${weeks} weeks` : "1 week"
|
||||||
|
else if total_days > 1
|
||||||
|
count = `${total_days} days`
|
||||||
|
else if span > 3600
|
||||||
|
hours = span \ 3600
|
||||||
|
count = hours > 1 ? `${hours} hours` : "1 hour"
|
||||||
|
else if span > 60
|
||||||
|
minutes = span \ 60
|
||||||
|
count = minutes > 1 ? `${minutes} minutes` : "1 minute"
|
||||||
|
else
|
||||||
|
count = span > 1 ? `${span} seconds` : "1 second"
|
||||||
|
end if
|
||||||
|
|
||||||
|
if StringUtils.IsNullOrEmpty(count)
|
||||||
|
return ""
|
||||||
|
end if
|
||||||
|
return `Updated ${count} ago`
|
||||||
|
end function
|
||||||
end namespace
|
end namespace
|
||||||
@@ -3,6 +3,7 @@ import "pkg:/source/utils/Types.bs"
|
|||||||
function Init()
|
function Init()
|
||||||
m.titleLabel = m.top.FindNode("titleLabel")
|
m.titleLabel = m.top.FindNode("titleLabel")
|
||||||
m.authorLabel = m.top.FindNode("authorLabel")
|
m.authorLabel = m.top.FindNode("authorLabel")
|
||||||
|
m.updatedLabel = m.top.FindNode("updatedLabel")
|
||||||
m.videoCountRect = m.top.FindNode("videoCountRect")
|
m.videoCountRect = m.top.FindNode("videoCountRect")
|
||||||
m.videoCountLabel = m.top.FindNode("videoCountLabel")
|
m.videoCountLabel = m.top.FindNode("videoCountLabel")
|
||||||
m.thumbnail = m.top.FindNode("thumbnail")
|
m.thumbnail = m.top.FindNode("thumbnail")
|
||||||
@@ -19,6 +20,7 @@ function OnContentSet() as void
|
|||||||
m.titleLabel.text = content.title
|
m.titleLabel.text = content.title
|
||||||
' NOTE: "_author" not "author". See PlaylistContentNode.xml for explanation.
|
' NOTE: "_author" not "author". See PlaylistContentNode.xml for explanation.
|
||||||
m.authorLabel.text = content._author
|
m.authorLabel.text = content._author
|
||||||
|
m.updatedLabel.text = content.updatedText
|
||||||
|
|
||||||
m.thumbnail.uri = content.thumbnail
|
m.thumbnail.uri = content.thumbnail
|
||||||
|
|
||||||
|
|||||||
@@ -7,30 +7,26 @@
|
|||||||
</interface>
|
</interface>
|
||||||
<children>
|
<children>
|
||||||
<LayoutGroup
|
<LayoutGroup
|
||||||
itemSpacings="[24,5]"
|
itemSpacings="[24,5,5]">
|
||||||
>
|
|
||||||
<Poster
|
<Poster
|
||||||
id="thumbnail"
|
id="thumbnail"
|
||||||
loadDisplayMode="scaleToZoom"
|
loadDisplayMode="scaleToZoom"
|
||||||
width="350"
|
width="350"
|
||||||
height="196"
|
height="196">
|
||||||
>
|
|
||||||
<Rectangle
|
<Rectangle
|
||||||
id="videoCountRect"
|
id="videoCountRect"
|
||||||
width="60"
|
width="60"
|
||||||
height="26"
|
height="26"
|
||||||
color="0x000000"
|
color="0x000000"
|
||||||
opacity="0.8"
|
opacity="0.8"
|
||||||
translation="[290, 162]"
|
translation="[290, 162]">
|
||||||
>
|
|
||||||
<Label
|
<Label
|
||||||
height="26"
|
height="26"
|
||||||
id="videoCountLabel"
|
id="videoCountLabel"
|
||||||
horizAlign="center"
|
horizAlign="center"
|
||||||
vertAlign="center"
|
vertAlign="center"
|
||||||
font="font:SmallestSystemFont"
|
font="font:SmallestSystemFont"
|
||||||
translation="[8, 0]"
|
translation="[8, 0]" />
|
||||||
/>
|
|
||||||
</Rectangle>
|
</Rectangle>
|
||||||
</Poster>
|
</Poster>
|
||||||
|
|
||||||
@@ -39,14 +35,17 @@
|
|||||||
width="350"
|
width="350"
|
||||||
font="font:SmallestBoldSystemFont"
|
font="font:SmallestBoldSystemFont"
|
||||||
maxLines="2"
|
maxLines="2"
|
||||||
wrap="true"
|
wrap="true" />
|
||||||
/>
|
|
||||||
<Label
|
<Label
|
||||||
id="authorLabel"
|
id="authorLabel"
|
||||||
width="350"
|
width="350"
|
||||||
height="25"
|
height="25"
|
||||||
font="font:SmallestSystemFont"
|
font="font:SmallestSystemFont" />
|
||||||
/>
|
<Label
|
||||||
|
id="updatedLabel"
|
||||||
|
width="350"
|
||||||
|
height="25"
|
||||||
|
font="font:SmallestSystemFont" />
|
||||||
</LayoutGroup>
|
</LayoutGroup>
|
||||||
</children>
|
</children>
|
||||||
</component>
|
</component>
|
||||||
Reference in new issue
Block a user