Skip to content

Commit

Permalink
fix: never played in recently sort mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
oxyroid committed Jan 28, 2024
1 parent daa2f41 commit d526fd0
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ class PlaylistRepositoryImpl @Inject constructor(
seen: Long,
input: InputStream
): List<Stream> = logger.execute {
parser.execute(input).map { it.toStream(playlistUrl, seen) }
parser.execute(input).map { it.toStream(playlistUrl, 0L) }
} ?: emptyList()

override suspend fun rename(url: String, target: String) = logger.sandBox {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ private fun FavoriteItemImpl(
val tv = isTelevision()
val recently = sort == Sort.RECENTLY
val recentlyString = stringResource(string.ui_sort_recently)
val neverPlayedString = stringResource(string.ui_sort_never_played)

val scheme = remember(stream.url) {
URI(stream.url).scheme ?: context.getString(string.feat_playlist_scheme_unknown)
Expand Down Expand Up @@ -143,6 +144,7 @@ private fun FavoriteItemImpl(
val duration = now - instant
duration.toComponents { days, hours, minutes, seconds, _ ->
when {
stream.seen == 0L -> neverPlayedString
days > 0 -> days.days.toString()
hours > 0 -> hours.hours.toString()
minutes > 0 -> minutes.minutes.toString()
Expand Down Expand Up @@ -214,6 +216,7 @@ private fun FavoriteItemImpl(
val duration = now - instant
duration.toComponents { days, hours, minutes, seconds, _ ->
when {
stream.seen == 0L -> neverPlayedString
days > 0 -> days.days.toString()
hours > 0 -> hours.hours.toString()
minutes > 0 -> minutes.minutes.toString()
Expand Down Expand Up @@ -261,6 +264,7 @@ private fun CompactFavoriteItemImpl(

val recently = sort == Sort.RECENTLY
val recentlyString = stringResource(string.ui_sort_recently)
val neverPlayedString = stringResource(string.ui_sort_never_played)

MaterialTheme(
colorScheme = colorScheme.copy(
Expand Down Expand Up @@ -310,6 +314,7 @@ private fun CompactFavoriteItemImpl(
val duration = now - instant
duration.toComponents { days, hours, minutes, seconds, _ ->
when {
stream.seen == 0L -> neverPlayedString
days > 0 -> "$days d"
hours > 0 -> "$hours h"
minutes > 0 -> "$minutes m"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ private fun StreamItemImpl(
val recently = sort == Sort.RECENTLY

val recentlyString = stringResource(string.ui_sort_recently)
val neverPlayedString = stringResource(string.ui_sort_never_played)

val scheme = remember(stream) {
try {
Expand Down Expand Up @@ -164,6 +165,7 @@ private fun StreamItemImpl(
val duration = now - instant
duration.toComponents { days, hours, minutes, seconds, _ ->
when {
stream.seen == 0L -> neverPlayedString
days > 0 -> days.days.toString()
hours > 0 -> hours.hours.toString()
minutes > 0 -> minutes.minutes.toString()
Expand Down Expand Up @@ -222,7 +224,9 @@ private fun CompactStreamItem(
val spacing = LocalSpacing.current
val favourite = stream.favourite
val recently = sort == Sort.RECENTLY

val recentlyString = stringResource(string.ui_sort_recently)
val neverPlayedString = stringResource(string.ui_sort_never_played)

val colorScheme = MaterialTheme.colorScheme
MaterialTheme(
Expand Down Expand Up @@ -288,6 +292,7 @@ private fun CompactStreamItem(
val duration = now - instant
duration.toComponents { days, hours, minutes, seconds, _ ->
when {
stream.seen == 0L -> neverPlayedString
days > 0 -> "$days d"
hours > 0 -> "$hours h"
minutes > 0 -> "$minutes m"
Expand Down
1 change: 1 addition & 0 deletions i18n/src/main/res/values-zh-rCN/ui.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@
<string name="ui_sort_asc">A-Z</string>
<string name="ui_sort_desc">Z-A</string>
<string name="ui_sort_recently">最近</string>
<string name="ui_sort_never_played">从未播放过</string>
<string name="ui_sort_unspecified">默认</string>
</resources>
1 change: 1 addition & 0 deletions i18n/src/main/res/values/ui.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<string name="ui_sort_asc">A-Z</string>
<string name="ui_sort_desc">Z-A</string>
<string name="ui_sort_recently">recently</string>
<string name="ui_sort_never_played">never played</string>
<string name="ui_sort_unspecified">Unspecified</string>

<string name="ui_connect">Connect</string>
Expand Down

0 comments on commit d526fd0

Please sign in to comment.