musikr: cleanup
This commit is contained in:
parent
3eac245aea
commit
3a12c4dc25
1 changed files with 7 additions and 7 deletions
|
@ -54,7 +54,7 @@ private class ExtractStepImpl(
|
||||||
override fun extract(nodes: Flow<Explored.New>): Flow<Extracted> {
|
override fun extract(nodes: Flow<Explored.New>): Flow<Extracted> {
|
||||||
val newSongs = nodes.filterIsInstance<NewSong>()
|
val newSongs = nodes.filterIsInstance<NewSong>()
|
||||||
|
|
||||||
val handles: Flow<ExtractedInternal.Pre> =
|
val handles =
|
||||||
newSongs
|
newSongs
|
||||||
.tryMap {
|
.tryMap {
|
||||||
val handle = metadataExtractor.open(it.file)
|
val handle = metadataExtractor.open(it.file)
|
||||||
|
@ -63,7 +63,7 @@ private class ExtractStepImpl(
|
||||||
.flowOn(Dispatchers.IO)
|
.flowOn(Dispatchers.IO)
|
||||||
.buffer(Channel.UNLIMITED)
|
.buffer(Channel.UNLIMITED)
|
||||||
|
|
||||||
val extracted: Flow<ExtractedInternal.Post> =
|
val extracted =
|
||||||
handles
|
handles
|
||||||
.tryMap { item ->
|
.tryMap { item ->
|
||||||
when (item) {
|
when (item) {
|
||||||
|
@ -88,11 +88,11 @@ private class ExtractStepImpl(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val validSongs = validDiversion.right
|
val success = validDiversion.right
|
||||||
val invalidSongs = validDiversion.left
|
val failed = validDiversion.left
|
||||||
|
|
||||||
val parsed =
|
val parsed =
|
||||||
validSongs
|
success
|
||||||
.tryMap { item ->
|
.tryMap { item ->
|
||||||
val tags = tagParser.parse(item.song.file, item.metadata)
|
val tags = tagParser.parse(item.song.file, item.metadata)
|
||||||
val cover = item.metadata.cover?.let { storedCovers.write(it) }
|
val cover = item.metadata.cover?.let { storedCovers.write(it) }
|
||||||
|
@ -114,9 +114,9 @@ private class ExtractStepImpl(
|
||||||
.buffer(Channel.UNLIMITED)
|
.buffer(Channel.UNLIMITED)
|
||||||
}
|
}
|
||||||
|
|
||||||
val invalid = invalidSongs.map { InvalidSong }
|
val invalidSongs = failed.map { InvalidSong }
|
||||||
|
|
||||||
return merge(validDiversion.manager, writeDistribution.manager, *writtenSongs, invalid)
|
return merge(validDiversion.manager, writeDistribution.manager, *writtenSongs, invalidSongs)
|
||||||
}
|
}
|
||||||
|
|
||||||
private sealed interface ExtractedInternal {
|
private sealed interface ExtractedInternal {
|
||||||
|
|
Loading…
Reference in a new issue