musikr: rename indexer to musikr

This commit is contained in:
Alexander Capehart 2024-12-09 08:58:45 -07:00
parent 0f8294bf43
commit 3528392f95
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
9 changed files with 34 additions and 29 deletions

View file

@ -25,7 +25,7 @@ import kotlinx.coroutines.Job
import kotlinx.coroutines.withContext
import kotlinx.coroutines.yield
import org.oxycblt.auxio.music.MusicRepository.IndexingWorker
import org.oxycblt.musikr.Indexer
import org.oxycblt.musikr.Musikr
import org.oxycblt.musikr.IndexingProgress
import org.oxycblt.musikr.Library
import org.oxycblt.musikr.Music
@ -203,7 +203,7 @@ interface MusicRepository {
class MusicRepositoryImpl
@Inject
constructor(private val indexer: Indexer, private val musicSettings: MusicSettings) :
constructor(private val musikr: Musikr, private val musicSettings: MusicSettings) :
MusicRepository {
private val updateListeners = mutableListOf<MusicRepository.UpdateListener>()
private val indexingListeners = mutableListOf<MusicRepository.IndexingListener>()
@ -350,7 +350,7 @@ constructor(private val indexer: Indexer, private val musicSettings: MusicSettin
val locations = musicSettings.musicLocations
val newLibrary =
indexer.run(locations, Interpretation(nameFactory, separators), ::emitIndexingProgress)
musikr.run(locations, Interpretation(nameFactory, separators), ::emitIndexingProgress)
emitIndexingCompletion(null)

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2024 Auxio Project
* Indexer.kt is part of Auxio.
* Musikr.kt is part of Auxio.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -31,7 +31,7 @@ import org.oxycblt.musikr.pipeline.ExploreStep
import org.oxycblt.musikr.pipeline.ExtractStep
import org.oxycblt.musikr.tag.Interpretation
interface Indexer {
interface Musikr {
suspend fun run(
locations: List<MusicLocation>,
interpretation: Interpretation,
@ -50,13 +50,13 @@ sealed interface IndexingProgress {
data object Indeterminate : IndexingProgress
}
class IndexerImpl
class MusikrImpl
@Inject
constructor(
private val exploreStep: ExploreStep,
private val extractStep: ExtractStep,
private val evaluateStep: EvaluateStep
) : Indexer {
) : Musikr {
override suspend fun run(
locations: List<MusicLocation>,
interpretation: Interpretation,

View file

@ -25,6 +25,6 @@ import dagger.hilt.components.SingletonComponent
@Module
@InstallIn(SingletonComponent::class)
interface StackModule {
@Binds fun indexer(impl: IndexerImpl): Indexer
interface MusikrModule {
@Binds fun musikr(impl: MusikrImpl): Musikr
}

View file

@ -18,17 +18,10 @@
package org.oxycblt.musikr.fs
import android.content.ContentResolver
import android.content.Context
import dagger.Binds
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.android.qualifiers.ApplicationContext
import dagger.hilt.components.SingletonComponent
import org.oxycblt.musikr.fs.query.DeviceFiles
import org.oxycblt.musikr.fs.query.DeviceFilesImpl
import org.oxycblt.musikr.fs.query.contentResolverSafe
@Module
@InstallIn(SingletonComponent::class)

View file

@ -68,8 +68,7 @@ class DeviceFilesImpl @Inject constructor(@ApplicationContext private val contex
): Flow<DeviceFile> = flow {
contentResolver.useQuery(
DocumentsContract.buildChildDocumentsUriUsingTree(rootUri, treeDocumentId),
PROJECTION
) { cursor ->
PROJECTION) { cursor ->
val childUriIndex =
cursor.getColumnIndexOrThrow(DocumentsContract.Document.COLUMN_DOCUMENT_ID)
val displayNameIndex =
@ -101,8 +100,7 @@ class DeviceFilesImpl @Inject constructor(@ApplicationContext private val contex
mimeType,
newPath,
size,
lastModified)
)
lastModified))
}
}
emitAll(recursive.asFlow().flattenMerge())

View file

@ -1,3 +1,21 @@
/*
* Copyright (c) 2024 Auxio Project
* QueryModule.kt is part of Auxio.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package org.oxycblt.musikr.fs.query
import android.content.ContentResolver
@ -8,8 +26,6 @@ import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.android.qualifiers.ApplicationContext
import dagger.hilt.components.SingletonComponent
import org.oxycblt.musikr.fs.MusicLocation
import org.oxycblt.musikr.fs.MusicLocationFactoryImpl
@Module
@InstallIn(SingletonComponent::class)
@ -22,6 +38,5 @@ class QueryProvidesModule {
@Module
@InstallIn(SingletonComponent::class)
interface QueryBindsModule {
@Binds
fun deviceFiles(deviceFilesImpl: DeviceFilesImpl): DeviceFiles
@Binds fun deviceFiles(deviceFilesImpl: DeviceFilesImpl): DeviceFiles
}

View file

@ -23,8 +23,8 @@ import android.media.MediaExtractor
import android.media.MediaFormat
import dagger.hilt.android.qualifiers.ApplicationContext
import javax.inject.Inject
import org.oxycblt.musikr.fs.MimeType
import org.oxycblt.musikr.Song
import org.oxycblt.musikr.fs.MimeType
import timber.log.Timber as L
/**
@ -119,7 +119,6 @@ constructor(@ApplicationContext private val context: Context) : AudioProperties.
return AudioProperties(
bitrate,
sampleRate,
MimeType(fromExtension = song.mimeType.fromExtension, fromFormat = formatMimeType)
)
MimeType(fromExtension = song.mimeType.fromExtension, fromFormat = formatMimeType))
}
}

View file

@ -24,9 +24,9 @@ import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.asFlow
import kotlinx.coroutines.flow.flowOn
import kotlinx.coroutines.flow.mapNotNull
import org.oxycblt.musikr.fs.MusicLocation
import org.oxycblt.musikr.fs.query.DeviceFile
import org.oxycblt.musikr.fs.query.DeviceFiles
import org.oxycblt.musikr.fs.MusicLocation
import org.oxycblt.musikr.playlist.m3u.M3U
interface ExploreStep {

View file

@ -23,8 +23,8 @@ import java.util.UUID
import org.oxycblt.auxio.music.MusicType
import org.oxycblt.auxio.playback.replaygain.ReplayGainAdjustment
import org.oxycblt.auxio.util.update
import org.oxycblt.musikr.fs.MimeType
import org.oxycblt.musikr.Music
import org.oxycblt.musikr.fs.MimeType
import org.oxycblt.musikr.fs.Path
import org.oxycblt.musikr.playlist.PlaylistHandle
import org.oxycblt.musikr.tag.Date