Clarify and live-refresh media indexing state
This commit is contained in:
@@ -661,13 +661,25 @@ def _build_presentation(
|
||||
pipeline_torrents = []
|
||||
|
||||
if jellyfin_partial:
|
||||
available_state, available_summary = "partial", f"{available} of {total} episodes available"
|
||||
available_label = "Partially available"
|
||||
available_state = "partial"
|
||||
available_state_label = "Partly ready"
|
||||
available_summary = f"{available} of {total} episodes are ready to watch in Grizzlyflix."
|
||||
elif jellyfin_found:
|
||||
available_state, available_summary = "complete", "Available to watch"
|
||||
available_label = "Available to watch"
|
||||
available_state = "complete"
|
||||
available_state_label = "Ready"
|
||||
available_summary = "This title is ready to watch in Grizzlyflix."
|
||||
elif arr_state == "available":
|
||||
available_state, available_summary = "active", "Waiting for the media server to index this title"
|
||||
available_label = "Adding to Grizzlyflix"
|
||||
available_state = "active"
|
||||
available_state_label = "Indexing"
|
||||
available_summary = "The download is complete. Grizzlyflix is indexing this title now."
|
||||
else:
|
||||
available_state, available_summary = "waiting", "Not available on the media server yet"
|
||||
available_label = "Media server"
|
||||
available_state = "waiting"
|
||||
available_state_label = "Waiting"
|
||||
available_summary = "This title has not reached Grizzlyflix yet."
|
||||
|
||||
display_download = dict(download)
|
||||
if fully_available:
|
||||
@@ -723,8 +735,9 @@ def _build_presentation(
|
||||
},
|
||||
{
|
||||
"id": "available",
|
||||
"label": "Available",
|
||||
"label": available_label,
|
||||
"state": available_state,
|
||||
"stateLabel": available_state_label,
|
||||
"summary": available_summary,
|
||||
"link": jellyfin_link,
|
||||
},
|
||||
|
||||
@@ -475,8 +475,14 @@ class RequestPresentationTests(unittest.TestCase):
|
||||
"The requested content has been collected and is available to watch. No further action is needed.",
|
||||
)
|
||||
search_stage = next(stage for stage in presentation["pipeline"] if stage["id"] == "search")
|
||||
available_stage = next(stage for stage in presentation["pipeline"] if stage["id"] == "available")
|
||||
self.assertEqual(search_stage["state"], "complete")
|
||||
self.assertEqual(search_stage["actionIds"], [])
|
||||
self.assertEqual(available_stage["state"], "complete")
|
||||
self.assertEqual(available_stage["stateLabel"], "Ready")
|
||||
self.assertEqual(available_stage["label"], "Available to watch")
|
||||
self.assertEqual(available_stage["summary"], "This title is ready to watch in Grizzlyflix.")
|
||||
self.assertEqual(available_stage["link"], "https://media.test/title/3909")
|
||||
|
||||
def test_partially_available_content_keeps_missing_download_attention(self) -> None:
|
||||
snapshot = Snapshot(
|
||||
@@ -546,6 +552,12 @@ class RequestPresentationTests(unittest.TestCase):
|
||||
self.assertEqual(search_stage["state"], "complete")
|
||||
self.assertEqual(download_stage["state"], "complete")
|
||||
self.assertEqual(available_stage["state"], "active")
|
||||
self.assertEqual(available_stage["stateLabel"], "Indexing")
|
||||
self.assertEqual(available_stage["label"], "Adding to Grizzlyflix")
|
||||
self.assertEqual(
|
||||
available_stage["summary"],
|
||||
"The download is complete. Grizzlyflix is indexing this title now.",
|
||||
)
|
||||
|
||||
|
||||
class RequestCreationFlowTests(unittest.IsolatedAsyncioTestCase):
|
||||
|
||||
Reference in New Issue
Block a user