Post session capabilities to the server

This commit is contained in:
Jarne Demeulemeester 2021-07-04 12:00:55 +02:00
parent 1f931ec6e2
commit 55e7b64628
No known key found for this signature in database
GPG key ID: 60884A0C1EBA43E5
3 changed files with 16 additions and 3 deletions

View file

@ -73,6 +73,6 @@ dependencies {
// Testing
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

View file

@ -32,6 +32,7 @@ class JellyfinApi(context: Context, baseUrl: String) {
val itemsApi = ItemsApi(api)
val userLibraryApi = UserLibraryApi(api)
val showsApi = TvShowsApi(api)
val sessionApi = SessionApi(api)
companion object {
@Volatile

View file

@ -37,14 +37,26 @@ class ServerSelectViewModel(
}
fun connectToServer(server: Server) {
JellyfinApi.newInstance(application, server.address).apply {
val jellyfinApi = JellyfinApi.newInstance(application, server.address).apply {
api.accessToken = server.accessToken
userId = UUID.fromString(server.userId)
}
viewModelScope.launch {
postCapabilities(jellyfinApi)
}
_navigateToMain.value = true
}
fun doneNavigatingToMain() {
_navigateToMain.value = false
}
private suspend fun postCapabilities(jellyfinApi: JellyfinApi) {
withContext(Dispatchers.IO) {
jellyfinApi.sessionApi.postCapabilities(playableMediaTypes = listOf("Video"), supportsMediaControl = false, supportsSync = false, supportsPersistentIdentifier = true)
}
}
}