Skip to content

Instantly share code, notes, and snippets.

@kgilmer
Created April 10, 2018 02:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kgilmer/0267630e2df6f3deab1b0e8c98074da9 to your computer and use it in GitHub Desktop.
Save kgilmer/0267630e2df6f3deab1b0e8c98074da9 to your computer and use it in GitHub Desktop.
val manifestWriter = System.out.writer()
manifestWriter.use {
sourceDirectory
.walk()
.filter {
it.isFile && it.extension.equals("mp3", ignoreCase = true)
}
.mapNotNull { file ->
readAudioFileOrNull(file)
}
.mapNotNull { audioFile ->
extractMetadataOrNull(audioFile)
}
.joinTo(manifestWriter, prefix = """{ "music": [""", postfix = "]}") {
it.toJsonString(true)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment