Update cover art urls

This commit is contained in:
advplyr 2021-10-03 06:43:43 -05:00
parent 683af098de
commit ee118abf59
5 changed files with 19 additions and 8 deletions

View file

@ -35,7 +35,6 @@ class MyNativeAudio : Plugin() {
jsobj.put("playWhenReady", playWhenReady) jsobj.put("playWhenReady", playWhenReady)
notifyListeners("onPrepareMedia", jsobj) notifyListeners("onPrepareMedia", jsobj)
} }
override fun onCar() {}
}) })
} }
mainActivity.pluginCallback = foregroundServiceReady mainActivity.pluginCallback = foregroundServiceReady

View file

@ -51,7 +51,6 @@ class PlayerNotificationService : MediaBrowserServiceCompat() {
fun onPlayingUpdate(isPlaying: Boolean) fun onPlayingUpdate(isPlaying: Boolean)
fun onMetadata(metadata: JSObject) fun onMetadata(metadata: JSObject)
fun onPrepare(audiobookId:String, playWhenReady:Boolean) fun onPrepare(audiobookId:String, playWhenReady:Boolean)
fun onCar()
} }
private val tag = "PlayerService" private val tag = "PlayerService"
@ -547,8 +546,6 @@ class PlayerNotificationService : MediaBrowserServiceCompat() {
// No further calls will be made to other media browsing methods. // No further calls will be made to other media browsing methods.
null null
} else { } else {
listener.onCar()
val extras = Bundle() val extras = Bundle()
extras.putInt( extras.putInt(
MediaConstants.DESCRIPTION_EXTRAS_KEY_CONTENT_STYLE_BROWSABLE, MediaConstants.DESCRIPTION_EXTRAS_KEY_CONTENT_STYLE_BROWSABLE,

View file

@ -47,6 +47,9 @@ export default {
} }
}, },
computed: { computed: {
userToken() {
return this.$store.getters['user/getToken']
},
currentChapter() { currentChapter() {
if (!this.audiobook || !this.chapters.length) return null if (!this.audiobook || !this.chapters.length) return null
return this.chapters.find((ch) => ch.start <= this.currentTime && ch.end > this.currentTime) return this.chapters.find((ch) => ch.start <= this.currentTime && ch.end > this.currentTime)
@ -112,7 +115,9 @@ export default {
var _clean = this.cover.replace(/\\/g, '/') var _clean = this.cover.replace(/\\/g, '/')
if (_clean.startsWith('/local')) { if (_clean.startsWith('/local')) {
var _cover = process.env.NODE_ENV !== 'production' && process.env.PROD !== '1' ? _clean.replace('/local', '') : _clean var _cover = process.env.NODE_ENV !== 'production' && process.env.PROD !== '1' ? _clean.replace('/local', '') : _clean
return `${this.$store.state.serverUrl}${_cover}` return `${this.$store.state.serverUrl}${_cover}?token=${this.userToken}&ts=${Date.now()}`
} else if (_clean.startsWith('/metadata')) {
return `${this.$store.state.serverUrl}${_clean}?token=${this.userToken}&ts=${Date.now()}`
} }
return _clean return _clean
} }
@ -257,7 +262,7 @@ export default {
cover: this.download.coverUrl || null, cover: this.download.coverUrl || null,
duration: String(Math.floor(this.duration * 1000)), duration: String(Math.floor(this.duration * 1000)),
series: this.seriesTxt, series: this.seriesTxt,
token: this.$store.getters['user/getToken'], token: this.userToken,
contentUrl: this.playingDownload.contentUrl, contentUrl: this.playingDownload.contentUrl,
isLocal: true isLocal: true
} }

View file

@ -60,6 +60,9 @@ export default {
} }
}, },
computed: { computed: {
userToken() {
return this.$store.getters['user/getToken']
},
book() { book() {
return this.audiobook.book || {} return this.audiobook.book || {}
}, },
@ -99,7 +102,9 @@ export default {
var _clean = this.cover.replace(/\\/g, '/') var _clean = this.cover.replace(/\\/g, '/')
if (_clean.startsWith('/local')) { if (_clean.startsWith('/local')) {
var _cover = process.env.NODE_ENV !== 'production' && process.env.PROD !== '1' ? _clean.replace('/local', '') : _clean var _cover = process.env.NODE_ENV !== 'production' && process.env.PROD !== '1' ? _clean.replace('/local', '') : _clean
return `${this.serverUrl}${_cover}` return `${this.$store.state.serverUrl}${_cover}?token=${this.userToken}&ts=${Date.now()}`
} else if (_clean.startsWith('/metadata')) {
return `${this.$store.state.serverUrl}${_clean}?token=${this.userToken}&ts=${Date.now()}`
} }
return _clean return _clean
}, },

View file

@ -117,6 +117,9 @@ export default {
userAudiobook() { userAudiobook() {
return this.userAudiobooks[this.audiobookId] || null return this.userAudiobooks[this.audiobookId] || null
}, },
userToken() {
return this.$store.getters['user/getToken']
},
localUserAudiobooks() { localUserAudiobooks() {
return this.$store.state.user.localUserAudiobooks || {} return this.$store.state.user.localUserAudiobooks || {}
}, },
@ -291,7 +294,9 @@ export default {
var _clean = cover.replace(/\\/g, '/') var _clean = cover.replace(/\\/g, '/')
if (_clean.startsWith('/local')) { if (_clean.startsWith('/local')) {
var _cover = process.env.NODE_ENV !== 'production' && process.env.PROD !== '1' ? _clean.replace('/local', '') : _clean var _cover = process.env.NODE_ENV !== 'production' && process.env.PROD !== '1' ? _clean.replace('/local', '') : _clean
return `${this.$store.state.serverUrl}${_cover}` return `${this.$store.state.serverUrl}${_cover}?token=${this.userToken}&ts=${Date.now()}`
} else if (_clean.startsWith('/metadata')) {
return `${this.$store.state.serverUrl}${_clean}?token=${this.userToken}&ts=${Date.now()}`
} }
return _clean return _clean
}, },