Class SpotifyAdapter
java.lang.Object
yearreview.app.data.sources.audio.adapter.AudioDatabaseAdapter
yearreview.app.data.sources.audio.adapter.SpotifyAdapter
An Adapter to input the Spotify extended listening (that can be exported here) into the
AudioDatabase
.- Author:
- ColdStone37
-
Field Summary
Fields inherited from class yearreview.app.data.sources.audio.adapter.AudioDatabaseAdapter
database
-
Constructor Summary
ConstructorDescriptionSpotifyAdapter
(AudioDatabase database, XmlNode config) Constructs a new SpotifyAdapter with a database to use and a configuration. -
Method Summary
Modifier and TypeMethodDescriptionprivate boolean
Tests if a time is between toInstant
void
Loads the data from the specified path.private void
processJsonObject
(javax.json.JsonObject object, Instant start, Instant end) Processes a JsonObject from the Stream and inserts it into the database.Methods inherited from class yearreview.app.data.sources.audio.adapter.AudioDatabaseAdapter
getAdapter
-
Field Details
-
dataPath
Path to the files exported from spotify.
-
-
Constructor Details
-
SpotifyAdapter
Constructs a new SpotifyAdapter with a database to use and a configuration.- Parameters:
database
- database to insert the songsconfig
- configuration for the adapter
-
-
Method Details
-
loadData
Loads the data from the specified path.- Specified by:
loadData
in classAudioDatabaseAdapter
- Parameters:
start
- start time of data to loadend
- end time of data to load- Throws:
IOException
- if the all or some of the files can't be read
-
processJsonObject
Processes a JsonObject from the Stream and inserts it into the database.- Parameters:
object
- object to processstart
- start time of data to loadend
- end time of data to load
-
isBetween
Tests if a time is between toInstant
- Parameters:
val
- value to test whether it lies in betweenstart
- start of interval to testend
- end of interval to test- Returns:
- true if val is between start and end, false otherwise
-