mirror of
https://github.com/alexta69/metube.git
synced 2026-09-21 13:35:01 +00:00
feat: carry the SponsorBlock toggle into subscriptions
Subscriptions download unattended, which is where skipping sponsor reads is most useful, so the flag now travels the same path the other download options take: stored on SubscriptionInfo, persisted in the record, and passed to add_entry for every entry a check queues. Like the clip bounds, it is set when the subscription is created; the update endpoint's field list is unchanged. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -366,6 +366,25 @@ async def test_subscribe_passes_clip_bounds(mock_dqueue, monkeypatch):
|
||||
assert kwargs["clip_end"] == pytest.approx(204.0)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_subscribe_passes_sponsorblock(mock_dqueue, monkeypatch):
|
||||
monkeypatch.setattr(main.submgr, "add_subscription", AsyncMock(return_value={"status": "ok"}))
|
||||
req = _json_request(
|
||||
{**_valid_video_add_body(), "check_interval_minutes": 60, "sponsorblock": True}
|
||||
)
|
||||
resp = await main.subscribe(req)
|
||||
assert resp.status == 200
|
||||
assert main.submgr.add_subscription.await_args.kwargs["sponsorblock"] is True
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_subscribe_defaults_sponsorblock_off(mock_dqueue, monkeypatch):
|
||||
monkeypatch.setattr(main.submgr, "add_subscription", AsyncMock(return_value={"status": "ok"}))
|
||||
req = _json_request({**_valid_video_add_body(), "check_interval_minutes": 60})
|
||||
await main.subscribe(req)
|
||||
assert main.submgr.add_subscription.await_args.kwargs["sponsorblock"] is False
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_subscribe_without_clip_fields_stores_none(mock_dqueue, monkeypatch):
|
||||
monkeypatch.setattr(main.submgr, "add_subscription", AsyncMock(return_value={"status": "ok"}))
|
||||
|
||||
Reference in New Issue
Block a user