From a78d108dc9439b4d31ed356f877567adc7aebfc3 Mon Sep 17 00:00:00 2001 From: Xilin Jia <6257601+XilinJia@users.noreply.github.com> Date: Tue, 18 Jun 2024 21:26:44 +0100 Subject: [PATCH] 5.5.1 commit --- app/build.gradle | 4 ++-- .../podcini/net/sync/model/EpisodeAction.kt | 17 +++++++++++++++-- .../podcini/net/sync/wifi/WifiSyncService.kt | 3 +++ .../export/progress/EpisodeProgressReader.kt | 3 +++ .../export/progress/EpisodesProgressWriter.kt | 1 + changelog.md | 5 +++++ .../android/en-US/changelogs/3020151.txt | 5 +++++ 7 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 fastlane/metadata/android/en-US/changelogs/3020151.txt diff --git a/app/build.gradle b/app/build.gradle index b021c42d..ed92a517 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -159,8 +159,8 @@ android { // Version code schema (not used): // "1.2.3-beta4" -> 1020304 // "1.2.3" -> 1020395 - versionCode 3020150 - versionName "5.5.0" + versionCode 3020151 + versionName "5.5.1" def commit = "" try { diff --git a/app/src/main/java/ac/mdiq/podcini/net/sync/model/EpisodeAction.kt b/app/src/main/java/ac/mdiq/podcini/net/sync/model/EpisodeAction.kt index c17edcd9..257c5487 100644 --- a/app/src/main/java/ac/mdiq/podcini/net/sync/model/EpisodeAction.kt +++ b/app/src/main/java/ac/mdiq/podcini/net/sync/model/EpisodeAction.kt @@ -36,12 +36,15 @@ class EpisodeAction private constructor(builder: Builder) { */ val total: Int + val playState: Int + init { this.guid = builder.guid this.action = builder.action this.timestamp = builder.timestamp this.started = builder.started this.position = builder.position + this.playState = builder.playState this.total = builder.total } @@ -54,7 +57,7 @@ class EpisodeAction private constructor(builder: Builder) { if (o !is EpisodeAction) return false val that = o - return started == that.started && position == that.position && total == that.total && action != that.action && podcast == that.podcast && episode == that.episode && timestamp == that.timestamp && guid == that.guid + return started == that.started && position == that.position && total == that.total && playState == that.playState && action != that.action && podcast == that.podcast && episode == that.episode && timestamp == that.timestamp && guid == that.guid } override fun hashCode(): Int { @@ -65,6 +68,7 @@ class EpisodeAction private constructor(builder: Builder) { result = 31 * result + (timestamp?.hashCode() ?: 0) result = 31 * result + started result = 31 * result + position + result = 31 * result + playState result = 31 * result + total return result } @@ -87,6 +91,7 @@ class EpisodeAction private constructor(builder: Builder) { if (this.action == Action.PLAY) { obj.put("started", this.started) obj.put("position", this.position) + obj.put("playState", this.playState) obj.put("total", this.total) } } catch (e: JSONException) { @@ -97,7 +102,7 @@ class EpisodeAction private constructor(builder: Builder) { } override fun toString(): String { - return ("EpisodeAction{podcast='$podcast', episode='$episode', guid='$guid', action=$action, timestamp=$timestamp, started=$started, position=$position, total=$total}") + return ("EpisodeAction{podcast='$podcast', episode='$episode', guid='$guid', action=$action, timestamp=$timestamp, started=$started, position=$position, total=$total playState=$playState}") } enum class Action { @@ -111,6 +116,7 @@ class EpisodeAction private constructor(builder: Builder) { var started: Int = -1 var position: Int = -1 var total: Int = -1 + var playState: Int = 0 var guid: String? = null constructor(item: FeedItem, action: Action) : this(item.feed?.download_url, item.media?.download_url, action) { @@ -146,6 +152,11 @@ class EpisodeAction private constructor(builder: Builder) { return this } + fun playState(playState: Int): Builder { + if (action == Action.PLAY) this.playState = playState + return this + } + fun build(): EpisodeAction { return EpisodeAction(this) } @@ -197,6 +208,8 @@ class EpisodeAction private constructor(builder: Builder) { val started = `object`.optInt("started", -1) val position = `object`.optInt("position", -1) val total = `object`.optInt("total", -1) + val playState = `object`.optInt("playState", 0) + builder.playState(playState) if (started >= 0 && position > 0 && total > 0) builder.started(started).position(position).total(total) } return builder.build() diff --git a/app/src/main/java/ac/mdiq/podcini/net/sync/wifi/WifiSyncService.kt b/app/src/main/java/ac/mdiq/podcini/net/sync/wifi/WifiSyncService.kt index de1d305e..fe1f6cfc 100644 --- a/app/src/main/java/ac/mdiq/podcini/net/sync/wifi/WifiSyncService.kt +++ b/app/src/main/java/ac/mdiq/podcini/net/sync/wifi/WifiSyncService.kt @@ -12,6 +12,7 @@ import ac.mdiq.podcini.storage.DBReader.getFeedItemByGuidOrEpisodeUrl import ac.mdiq.podcini.storage.DBReader.getFeedMedia import ac.mdiq.podcini.storage.DBWriter.persistFeedMediaPlaybackInfo import ac.mdiq.podcini.storage.model.feed.FeedItem +import ac.mdiq.podcini.storage.model.feed.FeedItem.Companion.PLAYED import ac.mdiq.podcini.storage.model.feed.FeedItemFilter import ac.mdiq.podcini.storage.model.feed.SortOrder import ac.mdiq.podcini.util.FeedItemUtil.hasAlmostEnded @@ -256,6 +257,7 @@ import kotlin.math.min .started(media.getPosition() / 1000) .position(media.getPosition() / 1000) .total(media.getDuration() / 1000) + .playState(item.playState) .build() queuedEpisodeActions.add(played) } @@ -324,6 +326,7 @@ import kotlin.math.min if (feedItem.media!!.getLastPlayedTime() < (action.timestamp?.time?:0L)) { feedItem.media!!.setPosition(action.position * 1000) feedItem.media!!.setLastPlayedTime(action.timestamp!!.time) + feedItem.setPlayed(action.playState == PLAYED) if (hasAlmostEnded(feedItem.media!!)) { Logd(TAG, "Marking as played") feedItem.setPlayed(true) diff --git a/app/src/main/java/ac/mdiq/podcini/storage/export/progress/EpisodeProgressReader.kt b/app/src/main/java/ac/mdiq/podcini/storage/export/progress/EpisodeProgressReader.kt index b32ed545..403119a3 100644 --- a/app/src/main/java/ac/mdiq/podcini/storage/export/progress/EpisodeProgressReader.kt +++ b/app/src/main/java/ac/mdiq/podcini/storage/export/progress/EpisodeProgressReader.kt @@ -8,6 +8,7 @@ import ac.mdiq.podcini.storage.DBReader.getFeedItemByGuidOrEpisodeUrl import ac.mdiq.podcini.storage.DBReader.loadAdditionalFeedItemListData import ac.mdiq.podcini.storage.DBWriter.persistItemList import ac.mdiq.podcini.storage.model.feed.FeedItem +import ac.mdiq.podcini.storage.model.feed.FeedItem.Companion.PLAYED import ac.mdiq.podcini.util.FeedItemUtil.hasAlmostEnded import ac.mdiq.podcini.util.Logd import android.util.Log @@ -58,6 +59,8 @@ object EpisodeProgressReader { } var idRemove = 0L feedItem.media!!.setPosition(action.position * 1000) + feedItem.setPlayed(action.playState == PLAYED) + feedItem.media!!.setLastPlayedTime(action.timestamp!!.time) if (hasAlmostEnded(feedItem.media!!)) { Logd(SyncService.TAG, "Marking as played: $action") feedItem.setPlayed(true) diff --git a/app/src/main/java/ac/mdiq/podcini/storage/export/progress/EpisodesProgressWriter.kt b/app/src/main/java/ac/mdiq/podcini/storage/export/progress/EpisodesProgressWriter.kt index fa5bcfc2..bbe1669b 100644 --- a/app/src/main/java/ac/mdiq/podcini/storage/export/progress/EpisodesProgressWriter.kt +++ b/app/src/main/java/ac/mdiq/podcini/storage/export/progress/EpisodesProgressWriter.kt @@ -36,6 +36,7 @@ class EpisodesProgressWriter : ExportWriter { .started(media.getPosition() / 1000) .position(media.getPosition() / 1000) .total(media.getDuration() / 1000) + .playState(item.playState) .build() queuedEpisodeActions.add(played) } diff --git a/changelog.md b/changelog.md index 5acc3011..13aa3c4d 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,8 @@ +## 5.5.1 + +* a minor release for better migration to Podcini 6 +* in wifi sync and episode progress export/import, included the info for episodes not played or not finished playing but marked as played + ## 5.5.0 * likely fixed Nextcloud Gpoddersync fails diff --git a/fastlane/metadata/android/en-US/changelogs/3020151.txt b/fastlane/metadata/android/en-US/changelogs/3020151.txt new file mode 100644 index 00000000..8ed1604a --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/3020151.txt @@ -0,0 +1,5 @@ + +Version 5.5.1 brings several changes: + +* a minor release for better migration to Podcini 6 +* in wifi sync and episode progress export/import, included the info for episodes not played or not finished playing but marked as played