mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2025-08-30 14:49:47 +02:00
Remove: unused AudioProbeResult.kt
This commit is contained in:
parent
f0c92be5f2
commit
2b615a51fb
3 changed files with 20 additions and 93 deletions
|
@ -1,74 +0,0 @@
|
||||||
package com.audiobookshelf.app.data
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
|
|
||||||
|
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
|
||||||
data class AudioProbeStream(
|
|
||||||
val index:Int,
|
|
||||||
val codec_name:String,
|
|
||||||
val codec_long_name:String,
|
|
||||||
val channels:Int,
|
|
||||||
val channel_layout:String,
|
|
||||||
val duration:Double,
|
|
||||||
val bit_rate:Double
|
|
||||||
)
|
|
||||||
|
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
|
||||||
data class AudioProbeChapterTags(
|
|
||||||
val title:String
|
|
||||||
)
|
|
||||||
|
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
|
||||||
data class AudioProbeChapter(
|
|
||||||
val id:Int,
|
|
||||||
val start:Long,
|
|
||||||
val end:Long,
|
|
||||||
val tags:AudioProbeChapterTags?
|
|
||||||
) {
|
|
||||||
@JsonIgnore
|
|
||||||
fun getBookChapter():BookChapter {
|
|
||||||
val startS = start / 1000.0
|
|
||||||
val endS = end / 1000.0
|
|
||||||
val title = tags?.title ?: "Chapter $id"
|
|
||||||
return BookChapter(id, startS, endS, title)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
|
||||||
data class AudioProbeFormatTags(
|
|
||||||
val artist:String?,
|
|
||||||
val album:String?,
|
|
||||||
val comment:String?,
|
|
||||||
val date:String?,
|
|
||||||
val genre:String?,
|
|
||||||
val title:String?
|
|
||||||
)
|
|
||||||
|
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
|
||||||
data class AudioProbeFormat(
|
|
||||||
val filename:String,
|
|
||||||
val format_name:String,
|
|
||||||
val duration:Double,
|
|
||||||
val size:Long,
|
|
||||||
val bit_rate:Double,
|
|
||||||
val tags:AudioProbeFormatTags?
|
|
||||||
)
|
|
||||||
|
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
|
||||||
class AudioProbeResult (
|
|
||||||
val streams:MutableList<AudioProbeStream>,
|
|
||||||
val chapters:MutableList<AudioProbeChapter>,
|
|
||||||
val format:AudioProbeFormat) {
|
|
||||||
|
|
||||||
val duration get() = format.duration
|
|
||||||
val size get() = format.size
|
|
||||||
val title get() = format.tags?.title ?: format.filename.split("/").last()
|
|
||||||
val artist get() = format.tags?.artist ?: ""
|
|
||||||
|
|
||||||
@JsonIgnore
|
|
||||||
fun getBookChapters(): List<BookChapter> {
|
|
||||||
if (chapters.isEmpty()) return mutableListOf()
|
|
||||||
return chapters.map { it.getBookChapter() }
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -5,30 +5,33 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties
|
||||||
|
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
data class AudioTrack(
|
data class AudioTrack(
|
||||||
var index:Int,
|
var index: Int,
|
||||||
var startOffset:Double,
|
var startOffset: Double,
|
||||||
var duration:Double,
|
var duration: Double,
|
||||||
var title:String,
|
var title: String,
|
||||||
var contentUrl:String,
|
var contentUrl: String,
|
||||||
var mimeType:String,
|
var mimeType: String,
|
||||||
var metadata:FileMetadata?,
|
var metadata: FileMetadata?,
|
||||||
var isLocal:Boolean,
|
var isLocal: Boolean,
|
||||||
var localFileId:String?,
|
var localFileId: String?,
|
||||||
var audioProbeResult:AudioProbeResult?,
|
var serverIndex: Int? // Need to know if server track index is different
|
||||||
var serverIndex:Int? // Need to know if server track index is different
|
|
||||||
) {
|
) {
|
||||||
|
|
||||||
@get:JsonIgnore
|
@get:JsonIgnore
|
||||||
val startOffsetMs get() = (startOffset * 1000L).toLong()
|
val startOffsetMs
|
||||||
|
get() = (startOffset * 1000L).toLong()
|
||||||
@get:JsonIgnore
|
@get:JsonIgnore
|
||||||
val durationMs get() = (duration * 1000L).toLong()
|
val durationMs
|
||||||
|
get() = (duration * 1000L).toLong()
|
||||||
@get:JsonIgnore
|
@get:JsonIgnore
|
||||||
val endOffsetMs get() = startOffsetMs + durationMs
|
val endOffsetMs
|
||||||
|
get() = startOffsetMs + durationMs
|
||||||
@get:JsonIgnore
|
@get:JsonIgnore
|
||||||
val relPath get() = metadata?.relPath ?: ""
|
val relPath
|
||||||
|
get() = metadata?.relPath ?: ""
|
||||||
|
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
fun getBookChapter():BookChapter {
|
fun getBookChapter(): BookChapter {
|
||||||
return BookChapter(index + 1,startOffset, startOffset + duration, title)
|
return BookChapter(index + 1, startOffset, startOffset + duration, title)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,7 +144,6 @@ class FolderScanner(var ctx: Context) {
|
||||||
trackFileMetadata,
|
trackFileMetadata,
|
||||||
true,
|
true,
|
||||||
localFileId,
|
localFileId,
|
||||||
null,
|
|
||||||
audioTrackFromServer.index
|
audioTrackFromServer.index
|
||||||
)
|
)
|
||||||
audioTracks.add(track)
|
audioTracks.add(track)
|
||||||
|
@ -440,7 +439,6 @@ class FolderScanner(var ctx: Context) {
|
||||||
trackFileMetadata,
|
trackFileMetadata,
|
||||||
true,
|
true,
|
||||||
localFileId,
|
localFileId,
|
||||||
null,
|
|
||||||
audioTrackFromServer.index
|
audioTrackFromServer.index
|
||||||
)
|
)
|
||||||
audioTracks.add(track)
|
audioTracks.add(track)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue