Reworked the whole sources/results area for a more premium, Netflix-y feel. Results — flat divider list → real CARDS: a bold cinematic quality badge (resolution over source), the release name as the hero, the meta as a row of crisp PILLS (codec / audio / HDR / repack / group) plus a clean availability stat, then size · verdict · Get grouped on the right. Cards have depth, a hover-lift, an accent edge on accepted releases, and the auto/grabbed pick lights up with an accent ring + glow. Sources — toned the full per-source colour wash down to a sophisticated dark-glass row with the brand colour as an ACCENT only (left-edge light that extends on hover + the glassy icon tile), so it reads calm and designed instead of busy. All functional hooks preserved (data-vdl-card/grab, .vdl-res-main tracker dock, status states, auto-pick). node --check + CSS balance clean; tracking/auto wiring tests green.
96 lines
4.1 KiB
Python
96 lines
4.1 KiB
Python
"""Live download tracking wiring: after a grab the user must (a) see WHICH release
|
|
was selected, (b) get a live progress bar on it, and (c) get a button to the
|
|
Downloads page — and a movie's detail page shows live progress for an in-flight
|
|
download that jumps back to Downloads.
|
|
|
|
Backed by GET /api/video/downloads/status (tested in test_video_api.py
|
|
::test_downloads_status_lookup_by_id_and_media). These pin the frontend wiring so
|
|
a refactor can't quietly unhook the tracker, the detail chip, or the navigation.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
_ROOT = Path(__file__).resolve().parent.parent
|
|
_VIEW = (_ROOT / "webui" / "static" / "video" / "video-download-view.js").read_text(encoding="utf-8")
|
|
_DETAIL = (_ROOT / "webui" / "static" / "video" / "video-detail.js").read_text(encoding="utf-8")
|
|
_SIDE = (_ROOT / "webui" / "static" / "video" / "video-side.js").read_text(encoding="utf-8")
|
|
_GETMODAL = (_ROOT / "webui" / "static" / "video" / "video-get-modal.js").read_text(encoding="utf-8")
|
|
_CSS = (_ROOT / "webui" / "static" / "video" / "video-side.css").read_text(encoding="utf-8")
|
|
|
|
|
|
# --- result card: redesign + selected/tracking state ----------------------
|
|
|
|
def test_result_card_redesigned_as_column_with_get_button():
|
|
assert 'vdl-res-main' in _VIEW # row wrapper so a tracker can dock below
|
|
assert 'data-vdl-card="' in _VIEW # addressable card (auto-pick targets it)
|
|
assert 'vdl-res-grab-ic' in _VIEW # the grab button is now a labelled "Get" pill
|
|
assert '.vdl-res-main' in _CSS
|
|
|
|
|
|
def test_grab_begins_live_tracking_on_the_card():
|
|
assert 'function beginTracking(' in _VIEW
|
|
assert 'vdl-res--grabbed' in _VIEW
|
|
assert 'data-vdl-track-fill' in _VIEW # the progress bar fill
|
|
assert "/api/video/downloads/status?id=" in _VIEW
|
|
# both the manual grab and the auto-pick start tracking the chosen card
|
|
assert _VIEW.count('beginTracking(') >= 3 # 1 def + doGrab + _autoPick
|
|
|
|
|
|
def test_track_button_goes_to_downloads_and_closes_modal():
|
|
assert 'Track on Downloads' in _VIEW
|
|
assert 'function gotoDownloads(' in _VIEW
|
|
assert 'VideoGet.close' in _VIEW
|
|
assert "'soulsync:video-navigate'" in _VIEW
|
|
assert '.vdl-res-track' in _CSS
|
|
|
|
|
|
def test_modal_exposes_close():
|
|
assert 'close: closeModal' in _GETMODAL
|
|
|
|
|
|
# --- movie detail page: live download chip --------------------------------
|
|
|
|
def test_detail_page_watches_movie_download():
|
|
assert 'function watchMovieDownload(' in _DETAIL
|
|
assert '/api/video/downloads/status?media_id=' in _DETAIL
|
|
assert 'data-vd-dlchip' in _DETAIL
|
|
# the chip jumps to the Downloads page
|
|
assert "'soulsync:video-navigate'" in _DETAIL
|
|
assert '.vd-dlchip' in _CSS
|
|
|
|
|
|
def test_detail_watch_started_for_library_movies():
|
|
assert 'watchMovieDownload(id)' in _DETAIL
|
|
assert 'stopMovieDownloadWatch()' in _DETAIL # cleared on (re)load / navigate away
|
|
|
|
|
|
# --- result cards: cinematic card redesign --------------------------------
|
|
|
|
def test_result_cards_are_cinematic_cards_with_meta_pills():
|
|
# quality badge + release-name hero + a row of meta PILLS + size/verdict/Get group.
|
|
assert 'vdl-info-title' in _VIEW and 'vdl-q-res' in _VIEW and 'vdl-flag' in _VIEW
|
|
assert 'vdl-info-tags' in _VIEW and 'vdl-tag' in _VIEW and 'vdl-res-right' in _VIEW
|
|
assert '.vdl-tag' in _CSS and '.vdl-info-tags' in _CSS and '.vdl-res-right' in _CSS
|
|
# the old "·"-joined sub-line is gone (meta is pills now)
|
|
assert 'vdl-info-sub' not in _VIEW
|
|
assert 'vdl-res-summary' not in _VIEW
|
|
|
|
|
|
# --- modal resumes an in-flight download on reopen ------------------------
|
|
|
|
def test_modal_resumes_active_download_on_reopen():
|
|
assert 'data-vdl-active' in _VIEW
|
|
assert 'function watchActiveDownload(' in _VIEW
|
|
assert '/api/video/downloads/status?media_id=' in _VIEW
|
|
# suppressed while a result card is already tracking inline (no double indicator)
|
|
assert "querySelector('[data-vdl-track]')" in _VIEW
|
|
assert '.vdl-active' in _CSS
|
|
|
|
|
|
# --- navigation plumbing --------------------------------------------------
|
|
|
|
def test_video_side_handles_navigate_event():
|
|
assert "'soulsync:video-navigate'" in _SIDE
|
|
assert 'navigate(pageId)' in _SIDE
|