mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2026-08-30 07:07:22 +02:00
Remove: unused functions from LocalMediaItem.kt
This commit is contained in:
@@ -41,33 +41,28 @@ data class LocalMediaItem(
|
|||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
fun getMediaMetadata(): MediaTypeMetadata {
|
fun getMediaMetadata(): MediaTypeMetadata {
|
||||||
return if (mediaType == "book") {
|
return if (mediaType == "book") {
|
||||||
BookMetadata(name,null, mutableListOf(), mutableListOf(), mutableListOf(),null,null,null,null,null,null,null,false,null,null,null, null, null)
|
BookMetadata(
|
||||||
|
name,
|
||||||
|
null,
|
||||||
|
mutableListOf(),
|
||||||
|
mutableListOf(),
|
||||||
|
mutableListOf(),
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
false,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
PodcastMetadata(name, null, null, mutableListOf(), false)
|
PodcastMetadata(name, null, null, mutableListOf(), false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonIgnore
|
|
||||||
fun getAudiobookChapters():List<BookChapter> {
|
|
||||||
if (mediaType != "book" || audioTracks.isEmpty()) return mutableListOf()
|
|
||||||
if (audioTracks.size == 1) { // Single track audiobook look for chapters from ffprobe
|
|
||||||
return audioTracks[0].audioProbeResult?.getBookChapters() ?: mutableListOf()
|
|
||||||
}
|
|
||||||
// Multi-track make chapters from tracks
|
|
||||||
return audioTracks.map { it.getBookChapter() }
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonIgnore
|
|
||||||
fun getLocalLibraryItem():LocalLibraryItem {
|
|
||||||
val mediaMetadata = getMediaMetadata()
|
|
||||||
if (mediaType == "book") {
|
|
||||||
val chapters = getAudiobookChapters()
|
|
||||||
val book = Book(mediaMetadata as BookMetadata, coverAbsolutePath, mutableListOf(), mutableListOf(), chapters,audioTracks,ebookFile,getTotalSize(),getDuration(),audioTracks.size)
|
|
||||||
return LocalLibraryItem(id, folderId, basePath,absolutePath, contentUrl, false,mediaType, book, localFiles, coverContentUrl, coverAbsolutePath,true,null,null,null,null)
|
|
||||||
} else {
|
|
||||||
val podcast = Podcast(mediaMetadata as PodcastMetadata, coverAbsolutePath, mutableListOf(), mutableListOf(), false, 0)
|
|
||||||
podcast.setAudioTracks(audioTracks) // Builds episodes from audio tracks
|
|
||||||
return LocalLibraryItem(id, folderId, basePath,absolutePath, contentUrl, false, mediaType, podcast,localFiles,coverContentUrl, coverAbsolutePath, true, null,null,null,null)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user