[httpd] Add parameter "no_register_playback" for DAAP/RSP streaming

This commit is contained in:
ejurgensen 2024-10-17 19:48:14 +02:00
parent 880f5b2bf6
commit 5d7e3dc090

View File

@ -102,7 +102,7 @@ struct stream_ctx {
off_t offset; off_t offset;
off_t start_offset; off_t start_offset;
off_t end_offset; off_t end_offset;
int marked; bool no_register_playback;
struct transcode_ctx *xcode; struct transcode_ctx *xcode;
}; };
@ -666,11 +666,11 @@ stream_end(struct stream_ctx *st)
static void static void
stream_end_register(struct stream_ctx *st) stream_end_register(struct stream_ctx *st)
{ {
if (!st->marked if (!st->no_register_playback
&& (st->stream_size > ((st->size * 50) / 100)) && (st->stream_size > ((st->size * 50) / 100))
&& (st->offset > ((st->size * 80) / 100))) && (st->offset > ((st->size * 80) / 100)))
{ {
st->marked = 1; st->no_register_playback = true;
worker_execute(playcount_inc_cb, &st->id, sizeof(int), 0); worker_execute(playcount_inc_cb, &st->id, sizeof(int), 0);
#ifdef LASTFM #ifdef LASTFM
worker_execute(scrobble_cb, &st->id, sizeof(int), 1); worker_execute(scrobble_cb, &st->id, sizeof(int), 1);
@ -697,6 +697,7 @@ stream_new(struct media_file_info *mfi, struct httpd_request *hreq, event_callba
event_active(st->ev, 0, 0); event_active(st->ev, 0, 0);
st->no_register_playback = httpd_query_value_find(hreq->query, "no_register_playback");
st->id = mfi->id; st->id = mfi->id;
st->hreq = hreq; st->hreq = hreq;
return st; return st;