5.5.1 commit

This commit is contained in:
Xilin Jia 2024-06-18 21:26:44 +01:00
parent 2c23d9fc7e
commit a78d108dc9
7 changed files with 34 additions and 4 deletions

View File

@ -159,8 +159,8 @@ android {
// Version code schema (not used): // Version code schema (not used):
// "1.2.3-beta4" -> 1020304 // "1.2.3-beta4" -> 1020304
// "1.2.3" -> 1020395 // "1.2.3" -> 1020395
versionCode 3020150 versionCode 3020151
versionName "5.5.0" versionName "5.5.1"
def commit = "" def commit = ""
try { try {

View File

@ -36,12 +36,15 @@ class EpisodeAction private constructor(builder: Builder) {
*/ */
val total: Int val total: Int
val playState: Int
init { init {
this.guid = builder.guid this.guid = builder.guid
this.action = builder.action this.action = builder.action
this.timestamp = builder.timestamp this.timestamp = builder.timestamp
this.started = builder.started this.started = builder.started
this.position = builder.position this.position = builder.position
this.playState = builder.playState
this.total = builder.total this.total = builder.total
} }
@ -54,7 +57,7 @@ class EpisodeAction private constructor(builder: Builder) {
if (o !is EpisodeAction) return false if (o !is EpisodeAction) return false
val that = o 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 { override fun hashCode(): Int {
@ -65,6 +68,7 @@ class EpisodeAction private constructor(builder: Builder) {
result = 31 * result + (timestamp?.hashCode() ?: 0) result = 31 * result + (timestamp?.hashCode() ?: 0)
result = 31 * result + started result = 31 * result + started
result = 31 * result + position result = 31 * result + position
result = 31 * result + playState
result = 31 * result + total result = 31 * result + total
return result return result
} }
@ -87,6 +91,7 @@ class EpisodeAction private constructor(builder: Builder) {
if (this.action == Action.PLAY) { if (this.action == Action.PLAY) {
obj.put("started", this.started) obj.put("started", this.started)
obj.put("position", this.position) obj.put("position", this.position)
obj.put("playState", this.playState)
obj.put("total", this.total) obj.put("total", this.total)
} }
} catch (e: JSONException) { } catch (e: JSONException) {
@ -97,7 +102,7 @@ class EpisodeAction private constructor(builder: Builder) {
} }
override fun toString(): String { 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 { enum class Action {
@ -111,6 +116,7 @@ class EpisodeAction private constructor(builder: Builder) {
var started: Int = -1 var started: Int = -1
var position: Int = -1 var position: Int = -1
var total: Int = -1 var total: Int = -1
var playState: Int = 0
var guid: String? = null var guid: String? = null
constructor(item: FeedItem, action: Action) : this(item.feed?.download_url, item.media?.download_url, action) { 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 return this
} }
fun playState(playState: Int): Builder {
if (action == Action.PLAY) this.playState = playState
return this
}
fun build(): EpisodeAction { fun build(): EpisodeAction {
return EpisodeAction(this) return EpisodeAction(this)
} }
@ -197,6 +208,8 @@ class EpisodeAction private constructor(builder: Builder) {
val started = `object`.optInt("started", -1) val started = `object`.optInt("started", -1)
val position = `object`.optInt("position", -1) val position = `object`.optInt("position", -1)
val total = `object`.optInt("total", -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) if (started >= 0 && position > 0 && total > 0) builder.started(started).position(position).total(total)
} }
return builder.build() return builder.build()

View File

@ -12,6 +12,7 @@ import ac.mdiq.podcini.storage.DBReader.getFeedItemByGuidOrEpisodeUrl
import ac.mdiq.podcini.storage.DBReader.getFeedMedia import ac.mdiq.podcini.storage.DBReader.getFeedMedia
import ac.mdiq.podcini.storage.DBWriter.persistFeedMediaPlaybackInfo import ac.mdiq.podcini.storage.DBWriter.persistFeedMediaPlaybackInfo
import ac.mdiq.podcini.storage.model.feed.FeedItem 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.FeedItemFilter
import ac.mdiq.podcini.storage.model.feed.SortOrder import ac.mdiq.podcini.storage.model.feed.SortOrder
import ac.mdiq.podcini.util.FeedItemUtil.hasAlmostEnded import ac.mdiq.podcini.util.FeedItemUtil.hasAlmostEnded
@ -256,6 +257,7 @@ import kotlin.math.min
.started(media.getPosition() / 1000) .started(media.getPosition() / 1000)
.position(media.getPosition() / 1000) .position(media.getPosition() / 1000)
.total(media.getDuration() / 1000) .total(media.getDuration() / 1000)
.playState(item.playState)
.build() .build()
queuedEpisodeActions.add(played) queuedEpisodeActions.add(played)
} }
@ -324,6 +326,7 @@ import kotlin.math.min
if (feedItem.media!!.getLastPlayedTime() < (action.timestamp?.time?:0L)) { if (feedItem.media!!.getLastPlayedTime() < (action.timestamp?.time?:0L)) {
feedItem.media!!.setPosition(action.position * 1000) feedItem.media!!.setPosition(action.position * 1000)
feedItem.media!!.setLastPlayedTime(action.timestamp!!.time) feedItem.media!!.setLastPlayedTime(action.timestamp!!.time)
feedItem.setPlayed(action.playState == PLAYED)
if (hasAlmostEnded(feedItem.media!!)) { if (hasAlmostEnded(feedItem.media!!)) {
Logd(TAG, "Marking as played") Logd(TAG, "Marking as played")
feedItem.setPlayed(true) feedItem.setPlayed(true)

View File

@ -8,6 +8,7 @@ import ac.mdiq.podcini.storage.DBReader.getFeedItemByGuidOrEpisodeUrl
import ac.mdiq.podcini.storage.DBReader.loadAdditionalFeedItemListData import ac.mdiq.podcini.storage.DBReader.loadAdditionalFeedItemListData
import ac.mdiq.podcini.storage.DBWriter.persistItemList import ac.mdiq.podcini.storage.DBWriter.persistItemList
import ac.mdiq.podcini.storage.model.feed.FeedItem 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.FeedItemUtil.hasAlmostEnded
import ac.mdiq.podcini.util.Logd import ac.mdiq.podcini.util.Logd
import android.util.Log import android.util.Log
@ -58,6 +59,8 @@ object EpisodeProgressReader {
} }
var idRemove = 0L var idRemove = 0L
feedItem.media!!.setPosition(action.position * 1000) feedItem.media!!.setPosition(action.position * 1000)
feedItem.setPlayed(action.playState == PLAYED)
feedItem.media!!.setLastPlayedTime(action.timestamp!!.time)
if (hasAlmostEnded(feedItem.media!!)) { if (hasAlmostEnded(feedItem.media!!)) {
Logd(SyncService.TAG, "Marking as played: $action") Logd(SyncService.TAG, "Marking as played: $action")
feedItem.setPlayed(true) feedItem.setPlayed(true)

View File

@ -36,6 +36,7 @@ class EpisodesProgressWriter : ExportWriter {
.started(media.getPosition() / 1000) .started(media.getPosition() / 1000)
.position(media.getPosition() / 1000) .position(media.getPosition() / 1000)
.total(media.getDuration() / 1000) .total(media.getDuration() / 1000)
.playState(item.playState)
.build() .build()
queuedEpisodeActions.add(played) queuedEpisodeActions.add(played)
} }

View File

@ -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 ## 5.5.0
* likely fixed Nextcloud Gpoddersync fails * likely fixed Nextcloud Gpoddersync fails

View File

@ -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