Skip to content

Commit 55404da

Browse files
DeltaMikeCharlieFlole998
authored andcommitted
Remove HTSP client version test for rating labels and string UUIDs
1 parent 9dec5b5 commit 55404da

1 file changed

Lines changed: 92 additions & 125 deletions

File tree

‎src/htsp_server.c‎

Lines changed: 92 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -869,11 +869,8 @@ htsp_build_channel(channel_t *ch, const char *method, htsp_connection_t *htsp)
869869
htsmsg_t *services = htsmsg_create_list();
870870

871871
htsmsg_add_u32(out, "channelId", channel_get_id(ch));
872-
873-
if (htsp->htsp_version > 40){
874-
htsmsg_add_str(out, "channelIdStr", idnode_uuid_as_str(&ch->ch_id, buf));
875-
}
876-
872+
htsmsg_add_str(out, "channelIdStr", idnode_uuid_as_str(&ch->ch_id, buf));
873+
877874
htsmsg_add_u32(out, "channelNumber", channel_get_major(chnum));
878875
if (channel_get_minor(chnum))
879876
htsmsg_add_u32(out, "channelNumberMinor", channel_get_minor(chnum));
@@ -939,10 +936,7 @@ htsp_build_tag(htsp_connection_t *htsp, channel_tag_t *ct, const char *method, i
939936
htsmsg_t *members = include_channels ? htsmsg_create_list() : NULL;
940937

941938
htsmsg_add_u32(out, "tagId", htsp_channel_tag_get_identifier(ct));
942-
943-
if (htsp->htsp_version > 40){
944-
htsmsg_add_str(out, "tagIdStr", idnode_uuid_as_str(&ct->ct_id, buf));
945-
}
939+
htsmsg_add_str(out, "tagIdStr", idnode_uuid_as_str(&ct->ct_id, buf));
946940

947941
htsmsg_add_u32(out, "tagIndex", ct->ct_index);
948942

@@ -979,10 +973,7 @@ htsp_build_dvrentry(htsp_connection_t *htsp, dvr_entry_t *de, const char *method
979973
const char *str;
980974

981975
htsmsg_add_u32(out, "id", idnode_get_short_uuid(&de->de_id));
982-
983-
if (htsp->htsp_version > 40){
984-
htsmsg_add_str(out, "idStr", idnode_uuid_as_str(&de->de_id, ubuf));
985-
}
976+
htsmsg_add_str(out, "idStr", idnode_uuid_as_str(&de->de_id, ubuf));
986977

987978
if (!statsonly) {
988979
htsmsg_add_u32(out, "enabled", de->de_enabled >= 1 ? 1 : 0);
@@ -1019,82 +1010,66 @@ htsp_build_dvrentry(htsp_connection_t *htsp, dvr_entry_t *de, const char *method
10191010
u32 = DVR_PRIO_NORMAL;
10201011
htsmsg_add_u32(out, "priority", u32);
10211012
htsmsg_add_u32(out, "contentType", de->de_content_type);
1013+
htsmsg_add_u32(out, "ageRating", de->de_age_rating);
10221014

1023-
//To not risk breaking older clients, only
1024-
//provide the 'age rating' via HTSP if the requested
1025-
//API version if greater than 36.
1026-
if (htsp->htsp_version > 36)
1027-
{
1028-
//Having the age in the DVR entry is new, that is why
1029-
//it is processed inside the version test.
1030-
htsmsg_add_u32(out, "ageRating", de->de_age_rating);
1031-
1032-
//Only go on to add the rating label stuff if
1033-
//rating labels are enabled.
1034-
if(epggrab_conf.epgdb_processparentallabels){
1035-
//If this is still scheduled (in the future) then send the current values,
1036-
//if not, send the 'saved' values.
1037-
1038-
if(de->de_sched_state == DVR_SCHEDULED){
1039-
if(de->de_rating_label){
1040-
if(de->de_rating_label->rl_display_label){
1041-
htsmsg_add_str(out, "ratingLabel", de->de_rating_label->rl_display_label);
1042-
}
1043-
//If the rating icon is not null.
1044-
if(de->de_rating_label->rl_icon){
1045-
str = de->de_rating_label->rl_icon;
1046-
if (!strempty(str)) {
1047-
str = imagecache_get_propstr(str, buf, sizeof(buf));
1048-
if (str)
1049-
htsmsg_add_str(out, "ratingIcon", str);
1050-
}//END got an imagecache location
1051-
}//END icon not null
1052-
1053-
//The authority and country are added for Kodi's parentalRatingSource field.
1054-
//Kodi looks for the authority first and if that is not present, then it uses the country.
1055-
//There could be no label, but there could be an age. The authority &
1056-
//country could still be useful.
1057-
if (htsp->htsp_version > 40){
1058-
if(de->de_rating_label->rl_authority){
1059-
htsmsg_add_str(out, "ratingAuthority", de->de_rating_label->rl_authority);
1060-
}//END authority saved not null
1061-
1062-
if(de->de_rating_label->rl_country){
1063-
htsmsg_add_str(out, "ratingCountry", de->de_rating_label->rl_country);
1064-
}//END country saved not null
1065-
}//END ver > 40
1066-
}//END rating label not null
1067-
}//END this is a scheduled recording.
1068-
else
1069-
{
1070-
if(de->de_rating_label_saved){
1071-
if(de->de_rating_label_saved){
1072-
htsmsg_add_str(out, "ratingLabel", de->de_rating_label_saved);
1073-
}
1074-
if(de->de_rating_icon_saved){
1075-
str = de->de_rating_icon_saved;
1076-
if (!strempty(str)) {
1077-
str = imagecache_get_propstr(str, buf, sizeof(buf));
1078-
if (str)
1079-
htsmsg_add_str(out, "ratingIcon", str);
1080-
}//END got an imagecache location
1081-
}//END icon not null
1082-
1083-
if (htsp->htsp_version > 40){
1084-
if(de->de_rating_authority_saved){
1085-
htsmsg_add_str(out, "ratingAuthority", de->de_rating_authority_saved);
1086-
}//END authority saved not null
1087-
1088-
if(de->de_rating_country_saved){
1089-
htsmsg_add_str(out, "ratingCountry", de->de_rating_country_saved);
1090-
}//END country saved not null
1091-
}//END version > 40
1015+
//Only add the rating label fields if rating labels are enabled.
1016+
if(epggrab_conf.epgdb_processparentallabels){
1017+
//If this is still scheduled (in the future) then send the current values,
1018+
//if not, send the 'saved' values.
10921019

1020+
if(de->de_sched_state == DVR_SCHEDULED){
1021+
if(de->de_rating_label){
1022+
if(de->de_rating_label->rl_display_label){
1023+
htsmsg_add_str(out, "ratingLabel", de->de_rating_label->rl_display_label);
10931024
}
1094-
}//END this is not a scheduled recording.
1095-
}//END processing rating labels is enabled
1096-
}
1025+
//If the rating icon is not null.
1026+
if(de->de_rating_label->rl_icon){
1027+
str = de->de_rating_label->rl_icon;
1028+
if (!strempty(str)) {
1029+
str = imagecache_get_propstr(str, buf, sizeof(buf));
1030+
if (str)
1031+
htsmsg_add_str(out, "ratingIcon", str);
1032+
}//END got an imagecache location
1033+
}//END icon not null
1034+
1035+
//The authority and country are added for Kodi's parentalRatingSource field.
1036+
//Kodi looks for the authority first and if that is not present, then it uses the country.
1037+
//There could be no label, but there could be an age. The authority &
1038+
//country could still be useful.
1039+
if(de->de_rating_label->rl_authority){
1040+
htsmsg_add_str(out, "ratingAuthority", de->de_rating_label->rl_authority);
1041+
}//END authority saved not null
1042+
1043+
if(de->de_rating_label->rl_country){
1044+
htsmsg_add_str(out, "ratingCountry", de->de_rating_label->rl_country);
1045+
}//END country saved not null
1046+
}//END rating label not null
1047+
}//END this is a scheduled recording.
1048+
else
1049+
{
1050+
if(de->de_rating_label_saved){
1051+
if(de->de_rating_label_saved){
1052+
htsmsg_add_str(out, "ratingLabel", de->de_rating_label_saved);
1053+
}
1054+
if(de->de_rating_icon_saved){
1055+
str = de->de_rating_icon_saved;
1056+
if (!strempty(str)) {
1057+
str = imagecache_get_propstr(str, buf, sizeof(buf));
1058+
if (str)
1059+
htsmsg_add_str(out, "ratingIcon", str);
1060+
}//END got an imagecache location
1061+
}//END icon not null
1062+
1063+
if(de->de_rating_authority_saved){
1064+
htsmsg_add_str(out, "ratingAuthority", de->de_rating_authority_saved);
1065+
}//END authority saved not null
10971066

1067+
if(de->de_rating_country_saved){
1068+
htsmsg_add_str(out, "ratingCountry", de->de_rating_country_saved);
1069+
}//END country saved not null
1070+
}//END got saved rating label
1071+
}//END this is not a scheduled recording.
1072+
}//END processing rating labels is enabled
10981073

10991074
if (de->de_sched_state == DVR_RECORDING || de->de_sched_state == DVR_COMPLETED) {
11001075
htsmsg_add_u32(out, "playcount", de->de_playcount);
@@ -1415,47 +1390,39 @@ htsp_build_event
14151390
if (e->age_rating){
14161391
htsmsg_add_u32(out, "ageRating", e->age_rating);
14171392
}
1418-
//To not risk breaking older clients, only
1419-
//provide the 'rating label' & 'rating icon' via HTSP if the requested
1420-
//version if greater than 36.
1421-
//Because this is the EPG, do not restrict the ageRating based on version,
1422-
//that field was added in a very early version.
1423-
if (htsp->htsp_version > 36)
1424-
{
1425-
//If we are processing parental labels
1426-
if(epggrab_conf.epgdb_processparentallabels)
1427-
{
1428-
//If this event had a label pointer that is not null
1429-
if (e->rating_label)
1430-
{
1431-
//If there is a 'display label'
1432-
//Do not fall-back to the 'label' because the 'display label'
1433-
//may be intentionally null.
1434-
if(e->rating_label->rl_display_label){
1435-
htsmsg_add_str(out, "ratingLabel", e->rating_label->rl_display_label);
1436-
}
1437-
//If the rating icon is not null.
1438-
if(e->rating_label->rl_icon){
1439-
str = e->rating_label->rl_icon;
1440-
if (!strempty(str)) {
1441-
str = imagecache_get_propstr(str, buf, sizeof(buf));
1442-
if (str)
1443-
htsmsg_add_str(out, "ratingIcon", str);
1444-
}//END got an imagecache location
1445-
}//END icon not null
14461393

1447-
if (htsp->htsp_version > 40){
1448-
if(e->rating_label->rl_authority){
1449-
htsmsg_add_str(out, "ratingAuthority", e->rating_label->rl_authority);
1450-
}//END authority saved not null
1451-
1452-
if(e->rating_label->rl_country){
1453-
htsmsg_add_str(out, "ratingCountry", e->rating_label->rl_country);
1454-
}//END country saved not null
1455-
}
1456-
}//END rating label not null
1457-
}//END parental labels enabled.
1458-
}//END HTSP version check
1394+
//If processing parental labels is enabled
1395+
if(epggrab_conf.epgdb_processparentallabels)
1396+
{
1397+
//If this event had a label pointer that is not null
1398+
if (e->rating_label)
1399+
{
1400+
//If there is a 'display label'
1401+
//Do not fall-back to the 'label' because the 'display label'
1402+
//may be intentionally null.
1403+
if(e->rating_label->rl_display_label){
1404+
htsmsg_add_str(out, "ratingLabel", e->rating_label->rl_display_label);
1405+
}
1406+
//If the rating icon is not null.
1407+
if(e->rating_label->rl_icon){
1408+
str = e->rating_label->rl_icon;
1409+
if (!strempty(str)) {
1410+
str = imagecache_get_propstr(str, buf, sizeof(buf));
1411+
if (str)
1412+
htsmsg_add_str(out, "ratingIcon", str);
1413+
}//END got an imagecache location
1414+
}//END icon not null
1415+
1416+
if(e->rating_label->rl_authority){
1417+
htsmsg_add_str(out, "ratingAuthority", e->rating_label->rl_authority);
1418+
}//END authority saved not null
1419+
1420+
if(e->rating_label->rl_country){
1421+
htsmsg_add_str(out, "ratingCountry", e->rating_label->rl_country);
1422+
}//END country saved not null
1423+
1424+
}//END rating label not null
1425+
}//END parental labels enabled.
14591426

14601427
if (e->star_rating)
14611428
htsmsg_add_u32(out, "starRating", e->star_rating);

0 commit comments

Comments
 (0)