mirror of
https://github.com/Shabinder/SpotiFlyer.git
synced 2024-12-22 12:47:54 +01:00
SoundCloud Fixes
This commit is contained in:
parent
33fef3dbd6
commit
9554a8fdcb
@ -250,6 +250,7 @@ class MainActivity : ComponentActivity() {
|
||||
if (long) android.widget.Toast.LENGTH_LONG else android.widget.Toast.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
Log.i("Toasting",string)
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
|
@ -4,6 +4,7 @@ import com.shabinder.common.models.AudioFormat
|
||||
import com.shabinder.common.models.soundcloud.Media
|
||||
import com.shabinder.common.models.soundcloud.PublisherMetadata
|
||||
import com.shabinder.common.models.soundcloud.User
|
||||
import com.shabinder.common.models.soundcloud.Visuals
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.json.JsonClassDiscriminator
|
||||
@ -149,7 +150,7 @@ sealed class SoundCloudResolveResponseBase {
|
||||
val user: User = User(),
|
||||
@SerialName("user_id")
|
||||
val userId: Int = 0,
|
||||
val visuals: String = "",
|
||||
val visuals: Visuals? = null,
|
||||
@SerialName("waveform_url")
|
||||
val waveformUrl: String = ""
|
||||
) : SoundCloudResolveResponseBase() {
|
||||
|
@ -1,7 +1,5 @@
|
||||
package com.shabinder.common.di
|
||||
|
||||
import com.shabinder.common.core_components.analytics.AnalyticsEvent
|
||||
import com.shabinder.common.core_components.analytics.AnalyticsManager
|
||||
import com.shabinder.common.models.dispatcherIO
|
||||
import com.shabinder.common.providers.spotify.SpotifyProvider
|
||||
import kotlinx.coroutines.DelicateCoroutinesApi
|
||||
|
@ -61,8 +61,6 @@ class FetchPlatformQueryResult(
|
||||
private val db: DownloadRecordDatabaseQueries?
|
||||
get() = fileManager.db?.downloadRecordDatabaseQueries
|
||||
|
||||
suspend fun authenticateSpotifyClient() = spotifyProvider.authenticateSpotifyClient()
|
||||
|
||||
suspend fun query(link: String): SuspendableEvent<PlatformQueryResult, Throwable> {
|
||||
val result = when {
|
||||
// SPOTIFY
|
||||
|
@ -46,7 +46,8 @@ class SoundCloudProvider(
|
||||
folderType = "Playlists"
|
||||
subFolder = response.title
|
||||
trackList = response.tracks.toTrackDetailsList(folderType, subFolder)
|
||||
coverUrl = response.artworkUrl.ifBlank { response.calculatedArtworkUrl }
|
||||
coverUrl = response.artworkUrl.formatArtworkUrl()
|
||||
.ifBlank { response.calculatedArtworkUrl.formatArtworkUrl() }
|
||||
title = response.title
|
||||
}
|
||||
}
|
||||
@ -110,6 +111,7 @@ class SoundCloudProvider(
|
||||
}
|
||||
|
||||
private fun String.formatArtworkUrl(): String {
|
||||
return substringBeforeLast("-") + "-t500x500." + substringAfterLast(".")
|
||||
return if (isBlank()) ""
|
||||
else substringBeforeLast("-") + "-t500x500." + substringAfterLast(".")
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user