mirror of
https://github.com/sudoxnym/audiobookshelf-atv.git
synced 2026-07-18 01:42:30 +00:00
Enhanced check for local audio tracks
When check is triggered code now checks that are files really exists
This commit is contained in:
parent
8f181c74d4
commit
11804d1cb8
1 changed files with 12 additions and 0 deletions
|
|
@ -18,6 +18,7 @@ import com.audiobookshelf.app.device.DeviceManager
|
|||
import com.fasterxml.jackson.annotation.JsonIgnore
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
|
||||
import com.audiobookshelf.app.player.PLAYMETHOD_LOCAL
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
|
|
@ -85,6 +86,17 @@ class LocalLibraryItem(
|
|||
episode.audioTrack?.let { at -> mutableListOf(at) }?.let { tracks -> audioTracks = tracks }
|
||||
}
|
||||
if (audioTracks.size == 0) return false
|
||||
audioTracks.forEach {
|
||||
// Check that metadata is not null
|
||||
if (it.metadata === null) {
|
||||
return false
|
||||
}
|
||||
// Check that file exists
|
||||
val file = File(it.metadata!!.path)
|
||||
if (!file.exists()) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue