all: fixes/reformat
This commit is contained in:
parent
248fc89c9b
commit
1c74f05222
3 changed files with 25 additions and 21 deletions
|
@ -28,8 +28,6 @@ import dagger.hilt.android.AndroidEntryPoint
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import org.oxycblt.auxio.music.service.IndexerServiceFragment
|
import org.oxycblt.auxio.music.service.IndexerServiceFragment
|
||||||
import org.oxycblt.auxio.playback.service.MediaSessionServiceFragment
|
import org.oxycblt.auxio.playback.service.MediaSessionServiceFragment
|
||||||
import org.oxycblt.auxio.tasker.indicateServiceRunning
|
|
||||||
import org.oxycblt.auxio.tasker.indicateServiceStopped
|
|
||||||
|
|
||||||
@AndroidEntryPoint
|
@AndroidEntryPoint
|
||||||
class AuxioService : MediaLibraryService(), ForegroundListener {
|
class AuxioService : MediaLibraryService(), ForegroundListener {
|
||||||
|
@ -42,7 +40,6 @@ class AuxioService : MediaLibraryService(), ForegroundListener {
|
||||||
super.onCreate()
|
super.onCreate()
|
||||||
mediaSessionFragment.attach(this, this)
|
mediaSessionFragment.attach(this, this)
|
||||||
indexingFragment.attach(this)
|
indexingFragment.attach(this)
|
||||||
indicateServiceRunning()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onBind(intent: Intent?): IBinder? {
|
override fun onBind(intent: Intent?): IBinder? {
|
||||||
|
@ -73,7 +70,6 @@ class AuxioService : MediaLibraryService(), ForegroundListener {
|
||||||
|
|
||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
super.onDestroy()
|
super.onDestroy()
|
||||||
indicateServiceStopped()
|
|
||||||
indexingFragment.release()
|
indexingFragment.release()
|
||||||
mediaSessionFragment.release()
|
mediaSessionFragment.release()
|
||||||
}
|
}
|
||||||
|
|
|
@ -164,8 +164,10 @@ constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
val deviceLibrary = musicRepository.deviceLibrary ?: return@launch
|
val deviceLibrary = musicRepository.deviceLibrary ?: return@launch
|
||||||
val songs = importedPlaylist.paths.mapNotNull {
|
val songs =
|
||||||
it.firstNotNullOfOrNull(deviceLibrary::findSongByPath) }
|
importedPlaylist.paths.mapNotNull {
|
||||||
|
it.firstNotNullOfOrNull(deviceLibrary::findSongByPath)
|
||||||
|
}
|
||||||
|
|
||||||
if (songs.isEmpty()) {
|
if (songs.isEmpty()) {
|
||||||
logE("No songs found")
|
logE("No songs found")
|
||||||
|
|
|
@ -122,48 +122,54 @@ class M3UImpl @Inject constructor(@ApplicationContext private val context: Conte
|
||||||
// the same volume as the M3U file. There's no sane way to map the volume
|
// the same volume as the M3U file. There's no sane way to map the volume
|
||||||
// to the phone's volumes, so this is the only thing we can do.
|
// to the phone's volumes, so this is the only thing we can do.
|
||||||
val absoluteInterpretation = Components.parseUnix(path)
|
val absoluteInterpretation = Components.parseUnix(path)
|
||||||
val relativeInterpretation = absoluteInterpretation.absoluteTo(workingDirectory.components)
|
val relativeInterpretation =
|
||||||
|
absoluteInterpretation.absoluteTo(workingDirectory.components)
|
||||||
listOf(absoluteInterpretation, relativeInterpretation)
|
listOf(absoluteInterpretation, relativeInterpretation)
|
||||||
}
|
}
|
||||||
|
|
||||||
path.startsWith("./") -> {
|
path.startsWith("./") -> {
|
||||||
// Unix relative path, resolve it
|
// Unix relative path, resolve it
|
||||||
val absoluteInterpretation = Components.parseUnix(path)
|
val absoluteInterpretation = Components.parseUnix(path)
|
||||||
val relativeInterpretation = absoluteInterpretation.absoluteTo(workingDirectory.components)
|
val relativeInterpretation =
|
||||||
|
absoluteInterpretation.absoluteTo(workingDirectory.components)
|
||||||
listOf(relativeInterpretation, absoluteInterpretation)
|
listOf(relativeInterpretation, absoluteInterpretation)
|
||||||
}
|
}
|
||||||
|
|
||||||
path.matches(WINDOWS_VOLUME_PREFIX_REGEX) -> {
|
path.matches(WINDOWS_VOLUME_PREFIX_REGEX) -> {
|
||||||
// Windows absolute path, we should get rid of the volume prefix, but
|
// Windows absolute path, we should get rid of the volume prefix, but
|
||||||
// otherwise the rest should be fine. Again, we have to disregard what the
|
// otherwise the rest should be fine. Again, we have to disregard what the
|
||||||
// volume actually is since there's no sane way to map it to the phone's volumes.
|
// volume actually is since there's no sane way to map it to the phone's
|
||||||
|
// volumes.
|
||||||
val absoluteInterpretation = Components.parseWindows(path.substring(2))
|
val absoluteInterpretation = Components.parseWindows(path.substring(2))
|
||||||
val relativeInterpretation = absoluteInterpretation.absoluteTo(workingDirectory.components)
|
val relativeInterpretation =
|
||||||
|
absoluteInterpretation.absoluteTo(workingDirectory.components)
|
||||||
listOf(absoluteInterpretation, relativeInterpretation)
|
listOf(absoluteInterpretation, relativeInterpretation)
|
||||||
}
|
}
|
||||||
|
|
||||||
path.startsWith("\\") -> {
|
path.startsWith("\\") -> {
|
||||||
// Weird unix/windows hybrid absolute path that appears sometimes
|
// Weird unix/windows hybrid absolute path that appears sometimes
|
||||||
val absoluteInterpretation = Components.parseWindows(path)
|
val absoluteInterpretation = Components.parseWindows(path)
|
||||||
val relativeInterpretation = absoluteInterpretation.absoluteTo(workingDirectory.components)
|
val relativeInterpretation =
|
||||||
|
absoluteInterpretation.absoluteTo(workingDirectory.components)
|
||||||
listOf(absoluteInterpretation, relativeInterpretation)
|
listOf(absoluteInterpretation, relativeInterpretation)
|
||||||
}
|
}
|
||||||
|
|
||||||
path.startsWith(".\\") -> {
|
path.startsWith(".\\") -> {
|
||||||
// Windows-style relative path
|
// Windows-style relative path
|
||||||
val absoluteInterpretation = Components.parseWindows(path)
|
val absoluteInterpretation = Components.parseWindows(path)
|
||||||
val relativeInterpretation = absoluteInterpretation.absoluteTo(workingDirectory.components)
|
val relativeInterpretation =
|
||||||
|
absoluteInterpretation.absoluteTo(workingDirectory.components)
|
||||||
listOf(relativeInterpretation, absoluteInterpretation)
|
listOf(relativeInterpretation, absoluteInterpretation)
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
// No clue, just go wild and assume all possible combinations.
|
// No clue, just go wild and assume all possible combinations.
|
||||||
val unixAbsoluteInterpretation = Components.parseUnix(path)
|
val unixAbsoluteInterpretation = Components.parseUnix(path)
|
||||||
val unixRelativeInterpretation = unixAbsoluteInterpretation.absoluteTo(workingDirectory.components)
|
val unixRelativeInterpretation =
|
||||||
|
unixAbsoluteInterpretation.absoluteTo(workingDirectory.components)
|
||||||
val windowsAbsoluteInterpretation = Components.parseWindows(path)
|
val windowsAbsoluteInterpretation = Components.parseWindows(path)
|
||||||
val windowsRelativeInterpretation = windowsAbsoluteInterpretation.absoluteTo(workingDirectory.components)
|
val windowsRelativeInterpretation =
|
||||||
listOf(unixRelativeInterpretation, unixAbsoluteInterpretation,
|
windowsAbsoluteInterpretation.absoluteTo(workingDirectory.components)
|
||||||
windowsRelativeInterpretation, windowsAbsoluteInterpretation)
|
listOf(
|
||||||
|
unixRelativeInterpretation,
|
||||||
|
unixAbsoluteInterpretation,
|
||||||
|
windowsRelativeInterpretation,
|
||||||
|
windowsAbsoluteInterpretation)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue