From ca6dbba18390ad6f8b8d7b7dbcf797dbfd95e2db Mon Sep 17 00:00:00 2001 From: Alex Stanev Date: Sun, 30 Jun 2019 20:41:39 +0300 Subject: [PATCH] clients: Fix bookmarks on Samsung Q series Add flag for milliseconds conversion for bookmarks and model for Samsung Q series, which needs this. This allows for bookmark synchronization when 2 or more TVs are using the same DLNA server. --- clients.c | 9 +++++++++ clients.h | 2 ++ upnpsoap.c | 10 ++++++++++ 3 files changed, 21 insertions(+) diff --git a/clients.c b/clients.c index 42f0d1c..543835e 100644 --- a/clients.c +++ b/clients.c @@ -81,6 +81,15 @@ struct client_type_s client_types[] = EUserAgent }, + /* Samsung Series [Q] TVs work wit milliseconds for bookmarks */ + /* User-Agent: DLNADOC/1.50 SEC_HHP_[TV] Samsung Q7 Series (49)/1.0 */ + { ESamsungSeriesQ, + FLAG_SAMSUNG | FLAG_DLNA | FLAG_NO_RESIZE | FLAG_SAMSUNG_DCM10 | FLAG_CAPTION_RES | FLAG_CONVERT_MS, + "Samsung Series [Q]", + "SEC_HHP_[TV] Samsung Q", + EUserAgent + }, + /* User-Agent: DLNADOC/1.50 SEC_HHP_[TV]UE40D7000/1.0 */ /* User-Agent: DLNADOC/1.50 SEC_HHP_ Family TV/1.0 */ /* USER-AGENT: DLNADOC/1.50 SEC_HHP_[TV] UE65JU7000/1.0 UPnP/1.0 */ diff --git a/clients.h b/clients.h index f982ea5..cffc7d5 100644 --- a/clients.h +++ b/clients.h @@ -38,6 +38,7 @@ #define FLAG_FORCE_SORT 0x00000800 #define FLAG_CAPTION_RES 0x00001000 #define FLAG_SKIP_DLNA_PN 0x00002000 /* during browsing */ +#define FLAG_CONVERT_MS 0x00004000 /* convert ms to s */ /* Response-related flags */ #define FLAG_HAS_CAPTIONS 0x80000000 #define RESPONSE_FLAGS 0xF0000000 @@ -69,6 +70,7 @@ enum client_types { ESamsungSeriesA, ESamsungSeriesB, ESamsungSeriesCDEBDP, + ESamsungSeriesQ, ESamsungSeriesCDE, ESamsungBDJ5500, ESonyBDP, diff --git a/upnpsoap.c b/upnpsoap.c index 0f3caba..d7db050 100644 --- a/upnpsoap.c +++ b/upnpsoap.c @@ -1023,6 +1023,9 @@ callback(void *args, int argc, char **argv, char **azColName) ** so HH:MM:SS. But Kodi seems to be the only user of this tag, and it only works with a ** raw seconds value. ** If Kodi gets fixed, we can use duration_str(sec * 1000) here */ + if( passed_args->flags & FLAG_CONVERT_MS ) { + sec *= 1000; + } if( passed_args->filter & FILTER_UPNP_LASTPLAYBACKPOSITION ) ret = strcatf(str, "<upnp:lastPlaybackPosition>%d</upnp:lastPlaybackPosition>", sec); @@ -2119,7 +2122,11 @@ static void UpdateObject(struct upnphttp * h, const char * action) } else if (strcmp(tag, "upnp:lastPlaybackPosition") == 0) { + int sec = duration_sec(new); + if( h->req_client && (h->req_client->type->flags & FLAG_CONVERT_MS) ) { + sec /= 1000; + } if (sec < 30) sec = 0; else @@ -2216,6 +2223,9 @@ SamsungSetBookmark(struct upnphttp * h, const char * action) in_magic_container(ObjectID, 0, &rid); detailID = sql_get_int64_field(db, "SELECT DETAIL_ID from OBJECTS where OBJECT_ID = '%q'", rid); + if( h->req_client && (h->req_client->type->flags & FLAG_CONVERT_MS) ) { + sec /= 1000; + } if ( sec < 30 ) sec = 0; ret = sql_exec(db, "INSERT OR IGNORE into BOOKMARKS (ID, SEC)"