Ensure that request for first few bytes doesn't count as full download #13

Closed
opened 2026-04-26 20:23:09 +02:00 by rik · 1 comment
Owner

When browser loads homepage, the counts shouldn't all shoot up

When browser loads homepage, the counts shouldn't all shoot up
Author
Owner

This is what apple podcasts does,

kjv_sermons  | 2026-04-26T20:17:51.543517Z  INFO Getting audio for episode 20 with sha 7d221065a4c64bb8.mp3
kjv_sermons  | 2026-04-26T20:17:51.544624Z DEBUG requested bound: (Included(0), Included(1))
kjv_sermons  | 2026-04-26T20:17:51.555508Z  INFO Getting audio for episode 20 with sha 7d221065a4c64bb8.mp3
kjv_sermons  | 2026-04-26T20:17:51.556190Z DEBUG requested bound: (Included(0), Included(11320535))
kjv_sermons  | 2026-04-26T20:17:51.556267Z DEBUG Increasing download count for episode 20
kjv_sermons  | 2026-04-26T20:17:51.593032Z  INFO Getting audio for episode 20 with sha 7d221065a4c64bb8.mp3
kjv_sermons  | 2026-04-26T20:17:51.594671Z DEBUG requested bound: (Included(29416), Included(11320535))
kjv_sermons  | 2026-04-26T20:17:51.595292Z DEBUG Increasing download count for episode 20

so it first does a probe with 0-1. Then it gets an MP3 frame and closes connection so that playback can start, and then it downloads the full file.

To solve these problems, I could send back smaller ranges even when the player requested longer ranges. But then buffering will take say 4 round trips instead of one upload burst. Or maybe some other solution. Instead of downloads maybe rename to "plays" and just count whenever someone requests the first 0 bytes. This usually happens only once usually. Can omit the 0-1 because the 0-1 is just to test whether range requests work

This is what apple podcasts does, ``` kjv_sermons | 2026-04-26T20:17:51.543517Z INFO Getting audio for episode 20 with sha 7d221065a4c64bb8.mp3 kjv_sermons | 2026-04-26T20:17:51.544624Z DEBUG requested bound: (Included(0), Included(1)) kjv_sermons | 2026-04-26T20:17:51.555508Z INFO Getting audio for episode 20 with sha 7d221065a4c64bb8.mp3 kjv_sermons | 2026-04-26T20:17:51.556190Z DEBUG requested bound: (Included(0), Included(11320535)) kjv_sermons | 2026-04-26T20:17:51.556267Z DEBUG Increasing download count for episode 20 kjv_sermons | 2026-04-26T20:17:51.593032Z INFO Getting audio for episode 20 with sha 7d221065a4c64bb8.mp3 kjv_sermons | 2026-04-26T20:17:51.594671Z DEBUG requested bound: (Included(29416), Included(11320535)) kjv_sermons | 2026-04-26T20:17:51.595292Z DEBUG Increasing download count for episode 20 ``` so it first does a probe with 0-1. Then it gets an MP3 frame and closes connection so that playback can start, and then it downloads the full file. To solve these problems, I could send back smaller ranges even when the player requested longer ranges. But then buffering will take say 4 round trips instead of one upload burst. Or maybe some other solution. Instead of downloads maybe rename to "plays" and just count whenever someone requests the first 0 bytes. This usually happens only once usually. Can omit the 0-1 because the 0-1 is just to test whether range requests work
rik closed this issue 2026-04-27 08:50:28 +02:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
rik/podlite#13
No description provided.