Skip to content

Instantly share code, notes, and snippets.

@AOrobator
Created April 7, 2018 19:36
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 AOrobator/a96e9dbe52df3608684350996150e935 to your computer and use it in GitHub Desktop.
Save AOrobator/a96e9dbe52df3608684350996150e935 to your computer and use it in GitHub Desktop.
override fun scanSongIntoLibrary(filePath: String): SongId {
var newSongId: SongId = InvalidSongId
realmTransaction {
if (getSongForFilepath(it, filePath) == null) {
val song = Song {
id = Database.getNextId(it, Song::class.java)
newSongId = // get next ValidSongId
// Initialize title, artist, and album for the song
}
it.copyToRealm(song)
}
}
return newSongId
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment