Post session capabilities to the server
This commit is contained in:
parent
1f931ec6e2
commit
55e7b64628
3 changed files with 16 additions and 3 deletions
|
@ -73,6 +73,6 @@ dependencies {
|
||||||
|
|
||||||
// Testing
|
// Testing
|
||||||
testImplementation 'junit:junit:4.13.2'
|
testImplementation 'junit:junit:4.13.2'
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
||||||
}
|
}
|
|
@ -32,6 +32,7 @@ class JellyfinApi(context: Context, baseUrl: String) {
|
||||||
val itemsApi = ItemsApi(api)
|
val itemsApi = ItemsApi(api)
|
||||||
val userLibraryApi = UserLibraryApi(api)
|
val userLibraryApi = UserLibraryApi(api)
|
||||||
val showsApi = TvShowsApi(api)
|
val showsApi = TvShowsApi(api)
|
||||||
|
val sessionApi = SessionApi(api)
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@Volatile
|
@Volatile
|
||||||
|
|
|
@ -37,14 +37,26 @@ class ServerSelectViewModel(
|
||||||
}
|
}
|
||||||
|
|
||||||
fun connectToServer(server: Server) {
|
fun connectToServer(server: Server) {
|
||||||
JellyfinApi.newInstance(application, server.address).apply {
|
val jellyfinApi = JellyfinApi.newInstance(application, server.address).apply {
|
||||||
api.accessToken = server.accessToken
|
api.accessToken = server.accessToken
|
||||||
userId = UUID.fromString(server.userId)
|
userId = UUID.fromString(server.userId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
viewModelScope.launch {
|
||||||
|
postCapabilities(jellyfinApi)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
_navigateToMain.value = true
|
_navigateToMain.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
fun doneNavigatingToMain() {
|
fun doneNavigatingToMain() {
|
||||||
_navigateToMain.value = false
|
_navigateToMain.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private suspend fun postCapabilities(jellyfinApi: JellyfinApi) {
|
||||||
|
withContext(Dispatchers.IO) {
|
||||||
|
jellyfinApi.sessionApi.postCapabilities(playableMediaTypes = listOf("Video"), supportsMediaControl = false, supportsSync = false, supportsPersistentIdentifier = true)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue