diff options
author | David Teirney <david@teirney.net> | 2012-04-17 21:12:02 +1200 |
---|---|---|
committer | David Teirney <david@teirney.net> | 2012-05-01 23:22:56 +1200 |
commit | bc11fbd0a29fc1265d0ef09d25154e8c39334880 (patch) | |
tree | ebea3a99596122e2691137bde654f6ba1e933021 /lib | |
parent | f0d16e9bfdb97a3653e7efcecfe77c21ff73d827 (diff) |
Added support for myth protocol 67.
Added new proginfo_season, proginfo_episode, proginfo_inetref properties and altered all of the places where the proginfo object is passed or received over the myth protocol.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/cmyth/include/cmyth/cmyth.h | 21 | ||||
-rw-r--r-- | lib/cmyth/libcmyth/cmyth_local.h | 3 | ||||
-rw-r--r-- | lib/cmyth/libcmyth/connection.c | 1 | ||||
-rw-r--r-- | lib/cmyth/libcmyth/proginfo.c | 63 | ||||
-rw-r--r-- | lib/cmyth/libcmyth/socket.c | 42 |
5 files changed, 127 insertions, 3 deletions
diff --git a/lib/cmyth/include/cmyth/cmyth.h b/lib/cmyth/include/cmyth/cmyth.h index 52f2f680b0..d8cb364adb 100644 --- a/lib/cmyth/include/cmyth/cmyth.h +++ b/lib/cmyth/include/cmyth/cmyth.h @@ -749,6 +749,20 @@ extern char *cmyth_proginfo_subtitle(cmyth_proginfo_t prog); extern char *cmyth_proginfo_description(cmyth_proginfo_t prog); /** + * Retrieve the season of a program. + * \param prog proginfo handle + * \return season + */ +extern unsigned short cmyth_proginfo_season(cmyth_proginfo_t prog); + +/** + * Retrieve the episode of a program. + * \param prog proginfo handle + * \return episode + */ +extern unsigned short cmyth_proginfo_episode(cmyth_proginfo_t prog); + +/** * Retrieve the category of a program. * \param prog proginfo handle * \return null-terminated string @@ -805,6 +819,13 @@ extern char *cmyth_proginfo_seriesid(cmyth_proginfo_t prog); extern char *cmyth_proginfo_programid(cmyth_proginfo_t prog); /** + * Retrieve the inetref of a program. + * \param prog proginfo handle + * \return null-terminated string + */ +extern char *cmyth_proginfo_inetref(cmyth_proginfo_t prog); + +/** * Retrieve the critics rating (number of stars) of a program. * \param prog proginfo handle * \return null-terminated string diff --git a/lib/cmyth/libcmyth/cmyth_local.h b/lib/cmyth/libcmyth/cmyth_local.h index 40bed11182..f7b85fb3ca 100644 --- a/lib/cmyth/libcmyth/cmyth_local.h +++ b/lib/cmyth/libcmyth/cmyth_local.h @@ -224,6 +224,8 @@ struct cmyth_proginfo { char *proginfo_title; char *proginfo_subtitle; char *proginfo_description; + unsigned short proginfo_season; /* new in V67 */ + unsigned short proginfo_episode; /* new in V67 */ char *proginfo_category; long proginfo_chanId; char *proginfo_chanstr; @@ -258,6 +260,7 @@ struct cmyth_proginfo { char *proginfo_chan_output_filters; /* new in V8 */ char *proginfo_seriesid; /* new in V8 */ char *proginfo_programid; /* new in V12 */ + char *proginfo_inetref; /* new in V67 */ cmyth_timestamp_t proginfo_lastmodified; /* new in V12 */ char *proginfo_stars; /* new in V12 */ cmyth_timestamp_t proginfo_originalairdate; /* new in V12 */ diff --git a/lib/cmyth/libcmyth/connection.c b/lib/cmyth/libcmyth/connection.c index 6585c6ed67..e2c6413700 100644 --- a/lib/cmyth/libcmyth/connection.c +++ b/lib/cmyth/libcmyth/connection.c @@ -58,6 +58,7 @@ static myth_protomap_t protomap[] = { {64, "8675309J"}, {65, "D2BB94C2"}, {66, "0C0FFEE0"}, + {67, "0G0G0G0"}, {0, 0} }; diff --git a/lib/cmyth/libcmyth/proginfo.c b/lib/cmyth/libcmyth/proginfo.c index b175637ca9..f6f93474ff 100644 --- a/lib/cmyth/libcmyth/proginfo.c +++ b/lib/cmyth/libcmyth/proginfo.c @@ -116,6 +116,9 @@ cmyth_proginfo_destroy(cmyth_proginfo_t p) if (p->proginfo_programid) { ref_release(p->proginfo_programid); } + if (p->proginfo_inetref) { + ref_release(p->proginfo_inetref); + } if (p->proginfo_stars) { ref_release(p->proginfo_stars); } @@ -217,6 +220,8 @@ cmyth_proginfo_create(void) ret->proginfo_title = NULL; ret->proginfo_subtitle = NULL; ret->proginfo_description = NULL; + ret->proginfo_season = 0; + ret->proginfo_episode = 0; ret->proginfo_category = NULL; ret->proginfo_chanId = 0; ret->proginfo_chanstr = NULL; @@ -250,6 +255,7 @@ cmyth_proginfo_create(void) ret->proginfo_chan_output_filters = NULL; ret->proginfo_seriesid = NULL; ret->proginfo_programid = NULL; + ret->proginfo_inetref = NULL; ret->proginfo_stars = NULL; ret->proginfo_version = 12; ret->proginfo_hasairdate = 0; @@ -307,6 +313,8 @@ cmyth_proginfo_dup(cmyth_proginfo_t p) ret->proginfo_title = ref_hold(p->proginfo_title); ret->proginfo_subtitle = ref_hold(p->proginfo_subtitle); ret->proginfo_description = ref_hold(p->proginfo_description); + ret->proginfo_season = p->proginfo_season; + ret->proginfo_episode = p->proginfo_episode; ret->proginfo_category = ref_hold(p->proginfo_category); ret->proginfo_chanId = p->proginfo_chanId; ret->proginfo_chanstr = ref_hold(p->proginfo_chanstr); @@ -340,6 +348,7 @@ cmyth_proginfo_dup(cmyth_proginfo_t p) ret->proginfo_chan_output_filters = ref_hold(p->proginfo_chan_output_filters); ret->proginfo_seriesid = ref_hold(p->proginfo_seriesid); ret->proginfo_programid = ref_hold(p->proginfo_programid); + ret->proginfo_inetref = ref_hold(p->proginfo_inetref); ret->proginfo_stars = ref_hold(p->proginfo_stars); ret->proginfo_version = p->proginfo_version; ret->proginfo_hasairdate = p->proginfo_hasairdate; @@ -386,7 +395,7 @@ delete_command(cmyth_conn_t control, cmyth_proginfo_t prog, char *cmd) char *buf; unsigned int len = ((2 * CMYTH_LONGLONG_LEN) + (6 * CMYTH_TIMESTAMP_LEN) + - (14 * CMYTH_LONG_LEN)); + (16 * CMYTH_LONG_LEN)); char start_ts[CMYTH_TIMESTAMP_LEN + 1]; char end_ts[CMYTH_TIMESTAMP_LEN + 1]; char rec_start_ts[CMYTH_TIMESTAMP_LEN + 1]; @@ -415,8 +424,12 @@ delete_command(cmyth_conn_t control, cmyth_proginfo_t prog, char *cmd) len += strlen(S(prog->proginfo_url)); len += strlen(S(prog->proginfo_hostname)); len += strlen(S(prog->proginfo_playgroup)); + len += strlen(S(prog->proginfo_seriesid)); + len += strlen(S(prog->proginfo_programid)); + len += strlen(S(prog->proginfo_inetref)); len += strlen(S(prog->proginfo_recpriority_2)); len += strlen(S(prog->proginfo_storagegroup)); + len += strlen(S(prog->proginfo_prodyear)); buf = alloca(len + 1+2048); if (!buf) { @@ -462,6 +475,10 @@ delete_command(cmyth_conn_t control, cmyth_proginfo_t prog, char *cmd) sprintf(buf + strlen(buf), "%s[]:[]", S(prog->proginfo_title)); sprintf(buf + strlen(buf), "%s[]:[]", S(prog->proginfo_subtitle)); sprintf(buf + strlen(buf), "%s[]:[]", S(prog->proginfo_description)); + if (control->conn_version >= 67) { + sprintf(buf + strlen(buf), "%u[]:[]", prog->proginfo_season); + sprintf(buf + strlen(buf), "%u[]:[]", prog->proginfo_episode); + } sprintf(buf + strlen(buf), "%s[]:[]", S(prog->proginfo_category)); sprintf(buf + strlen(buf), "%ld[]:[]", prog->proginfo_chanId); sprintf(buf + strlen(buf), "%s[]:[]", S(prog->proginfo_chanstr)); @@ -504,6 +521,9 @@ delete_command(cmyth_conn_t control, cmyth_proginfo_t prog, char *cmd) sprintf(buf + strlen(buf), "%s[]:[]", S(prog->proginfo_chan_output_filters)); sprintf(buf + strlen(buf), "%s[]:[]", S(prog->proginfo_seriesid)); sprintf(buf + strlen(buf), "%s[]:[]", S(prog->proginfo_programid)); + if (control->conn_version >= 67) { + sprintf(buf + strlen(buf), "%s[]:[]", S(prog->proginfo_inetref)); + } sprintf(buf + strlen(buf), "%s[]:[]", lastmodified); sprintf(buf + strlen(buf), "%s[]:[]", S(prog->proginfo_stars)); sprintf(buf + strlen(buf), "%s[]:[]", originalairdate); @@ -773,6 +793,24 @@ cmyth_proginfo_description(cmyth_proginfo_t prog) return ref_hold(prog->proginfo_description); } +unsigned short +cmyth_proginfo_season(cmyth_proginfo_t prog) +{ + if (!prog) { + return 0; + } + return prog->proginfo_season; +} + +unsigned short +cmyth_proginfo_episode(cmyth_proginfo_t prog) +{ + if (!prog) { + return 0; + } + return prog->proginfo_episode; +} + /* * cmyth_proginfo_category(cmyth_proginfo_t prog) * @@ -827,6 +865,17 @@ cmyth_proginfo_programid(cmyth_proginfo_t prog) } char * +cmyth_proginfo_inetref(cmyth_proginfo_t prog) +{ + if (!prog) { + cmyth_dbg(CMYTH_DBG_ERROR, "%s: NULL inetref\n", + __FUNCTION__); + return NULL; + } + return ref_hold(prog->proginfo_inetref); +} + +char * cmyth_proginfo_stars(cmyth_proginfo_t prog) { if (!prog) { @@ -1260,7 +1309,7 @@ fill_command(cmyth_conn_t control, cmyth_proginfo_t prog, char *cmd) char *buf; unsigned int len = ((2 * CMYTH_LONGLONG_LEN) + (6 * CMYTH_TIMESTAMP_LEN) + - (14 * CMYTH_LONG_LEN)); + (16 * CMYTH_LONG_LEN)); char start_ts[CMYTH_TIMESTAMP_LEN + 1]; char end_ts[CMYTH_TIMESTAMP_LEN + 1]; char rec_start_ts[CMYTH_TIMESTAMP_LEN + 1]; @@ -1288,6 +1337,9 @@ fill_command(cmyth_conn_t control, cmyth_proginfo_t prog, char *cmd) len += strlen(S(prog->proginfo_url)); len += strlen(S(prog->proginfo_hostname)); len += strlen(S(prog->proginfo_playgroup)); + len += strlen(S(prog->proginfo_seriesid)); + len += strlen(S(prog->proginfo_programid)); + len += strlen(S(prog->proginfo_inetref)); len += strlen(S(prog->proginfo_recpriority_2)); len += strlen(S(prog->proginfo_storagegroup)); len += strlen(S(prog->proginfo_prodyear)); @@ -1336,6 +1388,10 @@ fill_command(cmyth_conn_t control, cmyth_proginfo_t prog, char *cmd) sprintf(buf + strlen(buf), "%s[]:[]", S(prog->proginfo_title)); sprintf(buf + strlen(buf), "%s[]:[]", S(prog->proginfo_subtitle)); sprintf(buf + strlen(buf), "%s[]:[]", S(prog->proginfo_description)); + if (control->conn_version >= 67) { + sprintf(buf + strlen(buf), "%u[]:[]", prog->proginfo_season); + sprintf(buf + strlen(buf), "%u[]:[]", prog->proginfo_episode); + } sprintf(buf + strlen(buf), "%s[]:[]", S(prog->proginfo_category)); sprintf(buf + strlen(buf), "%ld[]:[]", prog->proginfo_chanId); sprintf(buf + strlen(buf), "%s[]:[]", S(prog->proginfo_chanstr)); @@ -1378,6 +1434,9 @@ fill_command(cmyth_conn_t control, cmyth_proginfo_t prog, char *cmd) sprintf(buf + strlen(buf), "%s[]:[]", S(prog->proginfo_chan_output_filters)); sprintf(buf + strlen(buf), "%s[]:[]", S(prog->proginfo_seriesid)); sprintf(buf + strlen(buf), "%s[]:[]", S(prog->proginfo_programid)); + if (control->conn_version >= 67) { + sprintf(buf + strlen(buf), "%s[]:[]", S(prog->proginfo_inetref)); + } sprintf(buf + strlen(buf), "%s[]:[]", lastmodified); sprintf(buf + strlen(buf), "%s[]:[]", S(prog->proginfo_stars)); sprintf(buf + strlen(buf), "%s[]:[]", originalairdate); diff --git a/lib/cmyth/libcmyth/socket.c b/lib/cmyth/libcmyth/socket.c index ab94237f18..552b88d696 100644 --- a/lib/cmyth/libcmyth/socket.c +++ b/lib/cmyth/libcmyth/socket.c @@ -1575,6 +1575,29 @@ cmyth_rcv_proginfo(cmyth_conn_t conn, int *err, cmyth_proginfo_t buf, ref_release(buf->proginfo_description); buf->proginfo_description = ref_strdup(tmp_str); + if (buf->proginfo_version >= 67) { + /* + * Get season and episode (unsigned int) + */ + consumed = cmyth_rcv_ushort(conn, err, + &buf->proginfo_season, count); + count -= consumed; + total += consumed; + if (*err) { + failed = "cmyth_rcv_ushort"; + goto fail; + } + + consumed = cmyth_rcv_ushort(conn, err, + &buf->proginfo_episode, count); + count -= consumed; + total += consumed; + if (*err) { + failed = "cmyth_rcv_ushort"; + goto fail; + } + } + /* * Get proginfo_category (string) */ @@ -2052,7 +2075,7 @@ cmyth_rcv_proginfo(cmyth_conn_t conn, int *err, cmyth_proginfo_t buf, count -= consumed; total += consumed; if (*err) { - failed = "cmyth_rcv_timestamp"; + failed = "cmyth_rcv_string"; goto fail; } if (buf->proginfo_programid) @@ -2060,6 +2083,23 @@ cmyth_rcv_proginfo(cmyth_conn_t conn, int *err, cmyth_proginfo_t buf, buf->proginfo_programid = ref_strdup(tmp_str); } + if (buf->proginfo_version >= 67) { + /* + * Get inetref (string) + */ + consumed = cmyth_rcv_string(conn, err, tmp_str, + sizeof(tmp_str) - 1, count); + count -= consumed; + total += consumed; + if (*err) { + failed = "cmyth_rcv_string"; + goto fail; + } + if (buf->proginfo_inetref) + ref_release(buf->proginfo_inetref); + buf->proginfo_inetref = ref_strdup(tmp_str); + } + if (buf->proginfo_version >= 12) { /* * Get lastmodified (string) |