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