Dep Updates and Logging

This commit is contained in:
shabinder 2021-04-28 14:54:56 +05:30
parent 1b18b9cf09
commit 148d56956b
6 changed files with 14 additions and 10 deletions

View File

@ -29,11 +29,12 @@ class App: Application(), KoinComponent {
super.onCreate() super.onCreate()
appContext = this appContext = this
val loggingEnabled = true
initKoin { initKoin(loggingEnabled) {
androidLogger() androidLogger()
androidContext(this@App) androidContext(this@App)
modules(appModule) modules(appModule(loggingEnabled))
} }
} }
} }

View File

@ -21,15 +21,16 @@ import com.tonyodev.fetch2.Fetch
import com.tonyodev.fetch2.FetchConfiguration import com.tonyodev.fetch2.FetchConfiguration
import org.koin.dsl.module import org.koin.dsl.module
val appModule = module { fun appModule(enableLogging:Boolean = false) = module {
single { createFetchInstance() } single { createFetchInstance(enableLogging) }
} }
private fun createFetchInstance():Fetch{ private fun createFetchInstance(enableLogging:Boolean = false):Fetch{
val fetchConfiguration = val fetchConfiguration =
FetchConfiguration.Builder(appContext).run { FetchConfiguration.Builder(appContext).run {
setNamespace("ForegroundDownloaderService") setNamespace("ForegroundDownloaderService")
setDownloadConcurrentLimit(4) setDownloadConcurrentLimit(4)
enableLogging(enableLogging)
build() build()
} }

View File

@ -48,9 +48,9 @@ kotlin {
dependencies { dependencies {
implementation(project(":common:data-models")) implementation(project(":common:data-models"))
implementation(project(":common:database")) implementation(project(":common:database"))
implementation("org.jetbrains.kotlinx:atomicfu:0.15.2") implementation("org.jetbrains.kotlinx:atomicfu:0.16.1")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.1.0") implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.1.0")
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.1.1") implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.2.0")
implementation("com.shabinder.fuzzywuzzy:fuzzywuzzy:1.0") implementation("com.shabinder.fuzzywuzzy:fuzzywuzzy:1.0")
implementation(Ktor.clientCore) implementation(Ktor.clientCore)
implementation(Ktor.clientSerialization) implementation(Ktor.clientSerialization)

View File

@ -25,10 +25,11 @@ import io.ktor.client.HttpClient
class YoutubeMp3( class YoutubeMp3(
override val httpClient: HttpClient, override val httpClient: HttpClient,
private val logger: Kermit, override val logger: Kermit,
private val dir: Dir, private val dir: Dir,
) : Yt1sMp3 { ) : Yt1sMp3 {
suspend fun getMp3DownloadLink(videoID: String): String? = getLinkFromYt1sMp3(videoID)?.let { suspend fun getMp3DownloadLink(videoID: String): String? = getLinkFromYt1sMp3(videoID)?.let {
logger.i { "Download Link: $it" }
if (currentPlatform is AllPlatforms.Js/* && corsProxy !is CorsProxy.PublicProxyWithExtension*/) if (currentPlatform is AllPlatforms.Js/* && corsProxy !is CorsProxy.PublicProxyWithExtension*/)
"https://kind-grasshopper-73.telebit.io/cors/$it" "https://kind-grasshopper-73.telebit.io/cors/$it"
// "https://spotiflyer.azurewebsites.net/$it" // Data OUT Limit issue // "https://spotiflyer.azurewebsites.net/$it" // Data OUT Limit issue

View File

@ -20,7 +20,7 @@ import co.touchlab.kermit.Kermit
import com.shabinder.common.di.gaana.corsApi import com.shabinder.common.di.gaana.corsApi
import com.shabinder.common.models.TrackDetails import com.shabinder.common.models.TrackDetails
import com.shabinder.common.models.YoutubeTrack import com.shabinder.common.models.YoutubeTrack
import com.willowtreeapps.fuzzywuzzy.diffutils.FuzzySearch import com.shabinder.fuzzywuzzy.diffutils.FuzzySearch
import io.ktor.client.HttpClient import io.ktor.client.HttpClient
import io.ktor.client.request.headers import io.ktor.client.request.headers
import io.ktor.client.request.post import io.ktor.client.request.post

View File

@ -16,6 +16,7 @@
package com.shabinder.common.di.youtubeMp3 package com.shabinder.common.di.youtubeMp3
import co.touchlab.kermit.Kermit
import com.shabinder.common.di.gaana.corsApi import com.shabinder.common.di.gaana.corsApi
import io.ktor.client.HttpClient import io.ktor.client.HttpClient
import io.ktor.client.request.forms.FormDataContent import io.ktor.client.request.forms.FormDataContent
@ -31,7 +32,7 @@ import kotlinx.serialization.json.jsonPrimitive
interface Yt1sMp3 { interface Yt1sMp3 {
val httpClient: HttpClient val httpClient: HttpClient
val logger: Kermit
/* /*
* Downloadable Mp3 Link for YT videoID. * Downloadable Mp3 Link for YT videoID.
* */ * */