Saavn Link Extraction Fix

This commit is contained in:
shabinder 2021-07-11 10:04:48 +05:30
parent 994b20d0a1
commit 37fe18ef16
2 changed files with 6 additions and 5 deletions

View File

@ -88,7 +88,7 @@ actual fun GithubLogo() = rememberVectorPainter(vectorXmlResource("drawable/ic_g
actual fun PaypalLogo() = rememberVectorPainter(vectorXmlResource("drawable/ic_paypal_logo.xml")) as Painter actual fun PaypalLogo() = rememberVectorPainter(vectorXmlResource("drawable/ic_paypal_logo.xml")) as Painter
@Composable @Composable
actual fun OpenCollectiveLogo() = rememberVectorPainter(vectorXmlResource("drawable/ic_opencollective_icon")) as Painter actual fun OpenCollectiveLogo() = rememberVectorPainter(vectorXmlResource("drawable/ic_opencollective_icon.xml")) as Painter
@Composable @Composable
actual fun RazorPay() = rememberVectorPainter(vectorXmlResource("drawable/ic_indian_rupee.xml")) as Painter actual fun RazorPay() = rememberVectorPainter(vectorXmlResource("drawable/ic_indian_rupee.xml")) as Painter

View File

@ -31,8 +31,9 @@ class SaavnProvider(
trackList = listOf(), trackList = listOf(),
Source.JioSaavn Source.JioSaavn
).apply { ).apply {
when (fullLink.substringAfter("saavn.com/").substringBefore("/")) { val pageLink = fullLink.substringAfter("saavn.com/").substringBefore("?")
"song" -> { when {
pageLink.contains("/song/",true) -> {
getSong(fullLink).value.let { getSong(fullLink).value.let {
folderType = "Tracks" folderType = "Tracks"
subFolder = "" subFolder = ""
@ -41,7 +42,7 @@ class SaavnProvider(
coverUrl = it.image.replace("http:", "https:") coverUrl = it.image.replace("http:", "https:")
} }
} }
"album" -> { pageLink.contains("/album/",true) -> {
getAlbum(fullLink).value.let { getAlbum(fullLink).value.let {
folderType = "Albums" folderType = "Albums"
subFolder = removeIllegalChars(it.title) subFolder = removeIllegalChars(it.title)
@ -50,7 +51,7 @@ class SaavnProvider(
coverUrl = it.image.replace("http:", "https:") coverUrl = it.image.replace("http:", "https:")
} }
} }
"featured" -> { // Playlist pageLink.contains("/featured/",true) -> { // Playlist
getPlaylist(fullLink).value.let { getPlaylist(fullLink).value.let {
folderType = "Playlists" folderType = "Playlists"
subFolder = removeIllegalChars(it.listname) subFolder = removeIllegalChars(it.listname)