mirror of
https://github.com/gabehf/tempus.git
synced 2026-03-14 01:45:55 -07:00
build: change of package name
This commit is contained in:
parent
49afdbe4eb
commit
b76a38cb30
274 changed files with 1981 additions and 2161 deletions
|
|
@ -1,59 +0,0 @@
|
|||
package com.cappielloantonio.play.subsonic
|
||||
|
||||
import com.cappielloantonio.play.App
|
||||
import com.cappielloantonio.play.subsonic.utils.CacheUtil
|
||||
import com.google.gson.GsonBuilder
|
||||
import okhttp3.Cache
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.logging.HttpLoggingInterceptor
|
||||
import retrofit2.Retrofit
|
||||
import retrofit2.converter.gson.GsonConverterFactory
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
class RetrofitClient(subsonic: Subsonic) {
|
||||
var retrofit: Retrofit
|
||||
|
||||
init {
|
||||
retrofit = Retrofit.Builder()
|
||||
.baseUrl(subsonic.url)
|
||||
.addConverterFactory(GsonConverterFactory.create(GsonBuilder().setLenient().create()))
|
||||
.client(getOkHttpClient())
|
||||
.build()
|
||||
}
|
||||
|
||||
private fun getOkHttpClient(): OkHttpClient {
|
||||
val cacheUtil = CacheUtil(60, 60 * 60 * 24 * 30)
|
||||
|
||||
// BrowsingClient 60
|
||||
// MediaAnnotationClient 0
|
||||
// MediaLibraryScanningClient 0
|
||||
// MediaRetrievalClient 0
|
||||
// PlaylistClient 0
|
||||
// PodcastClient 60
|
||||
// SearchClient 60
|
||||
// SystemClient 60
|
||||
// AlbumSongListClient 60
|
||||
|
||||
return OkHttpClient.Builder()
|
||||
.callTimeout(2, TimeUnit.MINUTES)
|
||||
.connectTimeout(20, TimeUnit.SECONDS)
|
||||
.readTimeout(30, TimeUnit.SECONDS)
|
||||
.writeTimeout(30, TimeUnit.SECONDS)
|
||||
.addInterceptor(getHttpLoggingInterceptor())
|
||||
.addInterceptor(cacheUtil.offlineInterceptor)
|
||||
// .addNetworkInterceptor(cacheUtil.onlineInterceptor)
|
||||
.cache(getCache())
|
||||
.build()
|
||||
}
|
||||
|
||||
private fun getHttpLoggingInterceptor(): HttpLoggingInterceptor {
|
||||
val loggingInterceptor = HttpLoggingInterceptor()
|
||||
loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY)
|
||||
return loggingInterceptor
|
||||
}
|
||||
|
||||
private fun getCache(): Cache {
|
||||
val cacheSize = 10 * 1024 * 1024
|
||||
return Cache(App.getContext().cacheDir, cacheSize.toLong())
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue