Add option to delete media (#1014)

## Description
Adds a setting to enable "Media management" which adds a context menu
item to delete media. This is accessible using either the More button or
long clicking.

You can delete episodes, seasons, series and movies/videos.

If order for the option to appear the current user must have server-side
settings for "Allow media deletion from" enabled for the library and the
in-app setting under Settings->Advanced Settings->"Show media management
options".

### Related issues
Closes #104 

### Testing
Emulator

## Screenshots
### Context menu
![delete_context_2
Large](https://github.com/user-attachments/assets/cabc3c24-1b43-4f88-8d71-b7275f9eadc4)


### Confirmation
![delete_confirm
Large](https://github.com/user-attachments/assets/8036dde1-8a51-424b-bbdd-f2826dd3e0ab)

## AI or LLM usage
None
This commit is contained in:
Ray 2026-03-02 15:38:41 -05:00 committed by GitHub
parent 0b73b4cf64
commit 8935067c5a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 597 additions and 53 deletions

View file

@ -166,6 +166,22 @@ class ApiRequestPager<T>(
}
}
/**
* Dumps the cache for all the pages at or after the given position and fetches a new page
*/
suspend fun refreshPagesAfter(position: Int) {
val pageNumber = position / pageSize
cachedPages.asMap().apply {
keys.forEach { pageKey ->
if (pageKey >= pageNumber) {
if (DEBUG) Timber.v("refreshPagesAfter: dropping %s", pageKey)
remove(pageKey)
}
}
}
fetchPageBlocking(position, true)
}
companion object {
private const val DEBUG = false
}