Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/vidxp/cli_commands/media.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,14 @@ def list_media(
table.add_column("Filename")
table.add_column("Duration", justify="right")
table.add_column("Size", justify="right")
table.add_column("State")
for asset in assets:
table.add_row(
asset.media_id,
asset.original_filename,
f"{asset.duration_seconds:.3f}s",
f"{asset.byte_size:,}",
asset.state.value
)
Console().print(table)

Expand Down
37 changes: 37 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
JobQueue,
JobState,
MediaAsset,
MediaPage,
PrepareModelsResult,
PrepareModelsJobResult,
QueryAnswer,
Expand Down Expand Up @@ -392,6 +393,42 @@ def test_worker_lifecycle_commands_use_the_existing_job_service(self):
},
)

def test_media_list_shows_media_state(self):
self.service.list_media.return_value = MediaPage(
items=(
MediaAsset(
schema_version=1,
media_id=MEDIA_ID,
video_id=MEDIA_ID,
original_filename="video.mp4",
sha256="1" * 64,
byte_size=5,
detected_mime_type="video/mp4",
container="mp4",
duration_seconds=1,
streams=(
MediaStream(
index=0,
kind="video",
codec="h264",
width=1,
height=1,
),
),
state=MediaState.ready,
created_at=datetime.now(timezone.utc),
),
),
next_cursor=None,
total =1,
)

result = self.invoke(["media", "list"])

self.assertEqual(result.exit_code, 0, result.output)
self.assertIn("State", result.output)
self.assertIn("ready", result.output)

def test_ui_share_uses_streamlit_wildcard_bind_and_warns(self):
with (
patch(
Expand Down