Add option to display extended episode title (SXX:EXX - Title) in player (#78)
* Add option to display extended episode title (SXX:EXX - Title) in player * ocd fix * add null check condition * Move setting to player category Yeah this would fit in either Appearance or Player. But I lean more towards Player. Co-authored-by: Jarne Demeulemeester <jarnedemeulemeester@gmail.com>
This commit is contained in:
parent
f2b090d09b
commit
3f37318c05
6 changed files with 30 additions and 4 deletions
|
@ -11,5 +11,7 @@ data class PlayerItem(
|
||||||
val mediaSourceId: String,
|
val mediaSourceId: String,
|
||||||
val playbackPosition: Long,
|
val playbackPosition: Long,
|
||||||
val mediaSourceUri: String = "",
|
val mediaSourceUri: String = "",
|
||||||
|
val parentIndexNumber: Int? = null,
|
||||||
|
val indexNumber: Int? = null,
|
||||||
val item: DownloadItem? = null
|
val item: DownloadItem? = null
|
||||||
) : Parcelable
|
) : Parcelable
|
|
@ -70,6 +70,8 @@ fun loadDownloadedEpisodes(downloadDatabase: DownloadDatabaseDao): List<PlayerIt
|
||||||
mediaSourceId = "",
|
mediaSourceId = "",
|
||||||
playbackPosition = it.playbackPosition ?: 0,
|
playbackPosition = it.playbackPosition ?: 0,
|
||||||
mediaSourceUri = File(defaultStorage, it.id.toString()).absolutePath,
|
mediaSourceUri = File(defaultStorage, it.id.toString()).absolutePath,
|
||||||
|
parentIndexNumber = it.parentIndexNumber,
|
||||||
|
indexNumber = it.indexNumber,
|
||||||
item = it
|
item = it
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -95,6 +97,8 @@ fun getDownloadPlayerItem(downloadDatabase: DownloadDatabaseDao, itemId: UUID):
|
||||||
"",
|
"",
|
||||||
metadata.playbackPosition!!,
|
metadata.playbackPosition!!,
|
||||||
file.absolutePath,
|
file.absolutePath,
|
||||||
|
metadata.parentIndexNumber,
|
||||||
|
metadata.indexNumber,
|
||||||
metadata
|
metadata
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -185,7 +185,15 @@ constructor(
|
||||||
try {
|
try {
|
||||||
for (item in items) {
|
for (item in items) {
|
||||||
if (item.itemId.toString() == player.currentMediaItem?.mediaId ?: "") {
|
if (item.itemId.toString() == player.currentMediaItem?.mediaId ?: "") {
|
||||||
_currentItemTitle.value = item.name.orEmpty()
|
if (sp.getBoolean(
|
||||||
|
"display_extended_title",
|
||||||
|
false
|
||||||
|
) && item.parentIndexNumber != null && item.indexNumber != null && item.name != null
|
||||||
|
)
|
||||||
|
_currentItemTitle.value =
|
||||||
|
"S${item.parentIndexNumber}:E${item.indexNumber} - ${item.name}"
|
||||||
|
else
|
||||||
|
_currentItemTitle.value = item.name.orEmpty()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
jellyfinRepository.postPlaybackStart(UUID.fromString(mediaItem?.mediaId))
|
jellyfinRepository.postPlaybackStart(UUID.fromString(mediaItem?.mediaId))
|
||||||
|
|
|
@ -171,20 +171,26 @@ class PlayerViewModel @Inject internal constructor(
|
||||||
name = name,
|
name = name,
|
||||||
itemId = id,
|
itemId = id,
|
||||||
mediaSourceId = mediaSource.id!!,
|
mediaSourceId = mediaSource.id!!,
|
||||||
playbackPosition = playbackPosition
|
playbackPosition = playbackPosition,
|
||||||
|
parentIndexNumber = parentIndexNumber,
|
||||||
|
indexNumber = indexNumber
|
||||||
)
|
)
|
||||||
MediaProtocol.HTTP -> PlayerItem(
|
MediaProtocol.HTTP -> PlayerItem(
|
||||||
name = name,
|
name = name,
|
||||||
itemId = id,
|
itemId = id,
|
||||||
mediaSourceId = mediaSource.id!!,
|
mediaSourceId = mediaSource.id!!,
|
||||||
mediaSourceUri = mediaSource.path!!,
|
mediaSourceUri = mediaSource.path!!,
|
||||||
playbackPosition = playbackPosition
|
playbackPosition = playbackPosition,
|
||||||
|
parentIndexNumber = parentIndexNumber,
|
||||||
|
indexNumber = indexNumber
|
||||||
)
|
)
|
||||||
else -> PlayerItem(
|
else -> PlayerItem(
|
||||||
name = name,
|
name = name,
|
||||||
itemId = id,
|
itemId = id,
|
||||||
mediaSourceId = mediaSource.id!!,
|
mediaSourceId = mediaSource.id!!,
|
||||||
playbackPosition = playbackPosition
|
playbackPosition = playbackPosition,
|
||||||
|
parentIndexNumber = parentIndexNumber,
|
||||||
|
indexNumber = indexNumber
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,4 +118,6 @@
|
||||||
<string name="player_controls_skip">Skip</string>
|
<string name="player_controls_skip">Skip</string>
|
||||||
<string name="track_selection">[%1$s] %2$s (%3$s)</string>
|
<string name="track_selection">[%1$s] %2$s (%3$s)</string>
|
||||||
<string name="add_server_empty_error">Empty server address</string>
|
<string name="add_server_empty_error">Empty server address</string>
|
||||||
|
<string name="display_extended_title_summary">Display extended episode title including season and episode information (SXX:EXX - EpisodeName).</string>
|
||||||
|
<string name="display_extended_title">Display extended title</string>
|
||||||
</resources>
|
</resources>
|
|
@ -53,6 +53,10 @@
|
||||||
app:key="mpv_disable_hwdec"
|
app:key="mpv_disable_hwdec"
|
||||||
app:summary="@string/force_software_decoding_summary"
|
app:summary="@string/force_software_decoding_summary"
|
||||||
app:title="@string/force_software_decoding" />
|
app:title="@string/force_software_decoding" />
|
||||||
|
<SwitchPreference
|
||||||
|
app:key="display_extended_title"
|
||||||
|
app:summary="@string/display_extended_title_summary"
|
||||||
|
app:title="@string/display_extended_title" />
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory app:title="@string/settings_category_device">
|
<PreferenceCategory app:title="@string/settings_category_device">
|
||||||
|
|
Loading…
Reference in a new issue