Class AudioDataSource
java.lang.Object
java.lang.Thread
yearreview.app.data.sources.DataSource
yearreview.app.data.sources.audio.AudioDataSource
- All Implemented Interfaces:
Runnable
A
DataSource
that uses adapters
to load the listening-history from files exported from services like Spotify.- Author:
- ColdStone37
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
Field Summary
Modifier and TypeFieldDescriptionprivate List<AudioDatabaseAdapter>
Adapters used for loading the listening histories.private AudioDatabase
Database to store the data in.Fields inherited from class yearreview.app.data.sources.DataSource
logger, tag
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
Constructor Summary
ConstructorDescriptionConstructs a new AudioDataSource from a given configuration. -
Method Summary
Modifier and TypeMethodDescriptionGets the TopListAdapter for theAudioDatabase
that can be used to create a TopList from thisDataSource
.void
Loads the data from theadapters
.void
parseConfig
(XmlNode config) Parses the passed configuration, initializes the databse and creates the adapters.Methods inherited from class yearreview.app.data.sources.DataSource
getDataSource, run
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
Field Details
-
adapters
Adapters used for loading the listening histories. -
database
Database to store the data in.
-
-
Constructor Details
-
AudioDataSource
Constructs a new AudioDataSource from a given configuration.- Parameters:
c
- configuration to use
-
-
Method Details
-
parseConfig
Parses the passed configuration, initializes the databse and creates the adapters.- Specified by:
parseConfig
in classDataSource
- Parameters:
config
- configuration to parse
-
loadData
Loads the data from theadapters
.- Specified by:
loadData
in classDataSource
- Parameters:
start
- start of interval to load data fromend
- end of interval to load data from- Throws:
IOException
- if the data cannot be loaded
-
getTopListAdapter
Gets the TopListAdapter for theAudioDatabase
that can be used to create a TopList from thisDataSource
.- Parameters:
type
- type of data to filter the TopList by- Returns:
- adapter for the TopList
-