mirror of
https://github.com/Shabinder/SpotiFlyer.git
synced 2024-11-25 18:24:31 +01:00
Migrating to youtube-api-dl
This commit is contained in:
parent
e3c3a6cb6c
commit
1f5a962ddb
@ -21,9 +21,6 @@ import android.content.Intent
|
|||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import com.github.kiulian.downloader.model.YoutubeVideo
|
|
||||||
import com.github.kiulian.downloader.model.formats.Format
|
|
||||||
import com.github.kiulian.downloader.model.quality.AudioQuality
|
|
||||||
import com.razorpay.Checkout
|
import com.razorpay.Checkout
|
||||||
import com.shabinder.common.database.activityContext
|
import com.shabinder.common.database.activityContext
|
||||||
import com.shabinder.common.di.worker.ForegroundService
|
import com.shabinder.common.di.worker.ForegroundService
|
||||||
@ -110,20 +107,4 @@ actual suspend fun downloadTracks(
|
|||||||
serviceIntent.putParcelableArrayListExtra("object", ArrayList<TrackDetails>(list))
|
serviceIntent.putParcelableArrayListExtra("object", ArrayList<TrackDetails>(list))
|
||||||
activityContext.let { ContextCompat.startForegroundService(it, serviceIntent) }
|
activityContext.let { ContextCompat.startForegroundService(it, serviceIntent) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun YoutubeVideo.getData(): Format? {
|
|
||||||
return try {
|
|
||||||
findAudioWithQuality(AudioQuality.medium)?.get(0) as Format
|
|
||||||
} catch (e: java.lang.IndexOutOfBoundsException) {
|
|
||||||
try {
|
|
||||||
findAudioWithQuality(AudioQuality.high)?.get(0) as Format
|
|
||||||
} catch (e: java.lang.IndexOutOfBoundsException) {
|
|
||||||
try {
|
|
||||||
findAudioWithQuality(AudioQuality.low)?.get(0) as Format
|
|
||||||
} catch (e: java.lang.IndexOutOfBoundsException) {
|
|
||||||
null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user