Permalink
Browse files

[libcmyth] Rename proginfo_prodyear to proginfo_year and change type …

…to match upstream and mythbackend.
  • Loading branch information...
1 parent b874967 commit 9ee7a18f8d98d48d99d5a8d0c7d987f80f1c9a88 David Teirney committed Jul 2, 2012
View
2 lib/cmyth/Win32/libcmyth.def
@@ -137,7 +137,7 @@ EXPORTS
cmyth_proginfo_host
cmyth_proginfo_card_id
cmyth_proginfo_recgroup
- cmyth_proginfo_prodyear
+ cmyth_proginfo_year
cmyth_get_delete_list
cmyth_proglist_create
cmyth_proglist_get_item
View
4 lib/cmyth/include/cmyth/cmyth.h
@@ -965,9 +965,9 @@ extern char *cmyth_proginfo_chanicon(cmyth_proginfo_t prog);
/**
* Retrieve the production year for this program info
* \param prog proginfo handle
- * \return null-terminated string
+ * \return production year
*/
-extern char *cmyth_proginfo_prodyear(cmyth_proginfo_t prog);
+extern unsigned short cmyth_proginfo_year(cmyth_proginfo_t prog);
/*
* -----------------------------------------------------------------
View
2 lib/cmyth/libcmyth/cmyth_local.h
@@ -256,7 +256,7 @@ struct cmyth_proginfo {
unsigned long proginfo_audioproperties; /* new in v35 */
unsigned long proginfo_videoproperties; /* new in v35 */
unsigned long proginfo_subtitletype; /* new in v35 */
- char *proginfo_prodyear; /* new in v41 */
+ unsigned short proginfo_year; /* new in v43 */
};
struct cmyth_proglist {
View
37 lib/cmyth/libcmyth/proginfo.c
@@ -151,9 +151,6 @@ cmyth_proginfo_destroy(cmyth_proginfo_t p)
if (p->proginfo_recpriority_2) {
ref_release(p->proginfo_recpriority_2);
}
- if (p->proginfo_prodyear) {
- ref_release(p->proginfo_prodyear);
- }
cmyth_dbg(CMYTH_DBG_DEBUG, "%s }\n", __FUNCTION__);
}
@@ -265,7 +262,7 @@ cmyth_proginfo_create(void)
ret->proginfo_audioproperties = 0;
ret->proginfo_videoproperties = 0;
ret->proginfo_subtitletype = 0;
- ret->proginfo_prodyear = NULL;
+ ret->proginfo_year = 0;
cmyth_dbg(CMYTH_DBG_DEBUG, "%s }\n", __FUNCTION__);
return ret;
@@ -358,7 +355,7 @@ cmyth_proginfo_dup(cmyth_proginfo_t p)
ret->proginfo_audioproperties = p->proginfo_audioproperties;
ret->proginfo_videoproperties = p->proginfo_videoproperties;
ret->proginfo_subtitletype = p->proginfo_subtitletype;
- ret->proginfo_prodyear = ref_hold(p->proginfo_prodyear);
+ ret->proginfo_year = p->proginfo_year;
cmyth_dbg(CMYTH_DBG_DEBUG, "%s }\n", __FUNCTION__);
return ret;
}
@@ -428,7 +425,6 @@ delete_command(cmyth_conn_t control, cmyth_proginfo_t prog, char *cmd)
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) {
@@ -546,8 +542,8 @@ delete_command(cmyth_conn_t control, cmyth_proginfo_t prog, char *cmd)
sprintf(buf + strlen(buf), "%ld[]:[]", prog->proginfo_videoproperties);
sprintf(buf + strlen(buf), "%ld[]:[]", prog->proginfo_subtitletype);
}
- if (control->conn_version >= 41) {
- sprintf(buf + strlen(buf), "%s[]:[]", S(prog->proginfo_prodyear));
+ if (control->conn_version >= 43) {
+ sprintf(buf + strlen(buf), "%d[]:[]", prog->proginfo_year);
}
#undef S
@@ -1272,33 +1268,29 @@ cmyth_proginfo_flags(cmyth_proginfo_t prog)
}
/*
- * cmyth_proginfo_prodyear(cmyth_proginfo_t prog)
+ * cmyth_proginfo_year(cmyth_proginfo_t prog)
*
*
* Scope: PUBLIC
*
* Description
*
- * Retrieves the 'proginfo_prodyear' field of a program info
+ * Retrieves the 'proginfo_year' field of a program info
* structure.
*
- * The returned string is a pointer to the string within the program
- * info structure, so it should not be modified by the caller. The
- * return value is a 'char *' for this reason.
- *
* Return Value:
*
- * Success: A pointer to a 'char *' pointing to the field.
+ * Success: the production year for the program
*
- * Failure: NULL
+ * Failure: 0
*/
-char *
-cmyth_proginfo_prodyear(cmyth_proginfo_t prog)
+unsigned short
+cmyth_proginfo_year(cmyth_proginfo_t prog)
{
if (!prog) {
- return NULL;
+ return 0;
}
- return ref_hold(prog->proginfo_prodyear);
+ return prog->proginfo_year;
}
static int
@@ -1340,7 +1332,6 @@ fill_command(cmyth_conn_t control, cmyth_proginfo_t prog, char *cmd)
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) {
@@ -1458,8 +1449,8 @@ fill_command(cmyth_conn_t control, cmyth_proginfo_t prog, char *cmd)
sprintf(buf + strlen(buf), "%ld[]:[]", prog->proginfo_videoproperties);
sprintf(buf + strlen(buf), "%ld[]:[]", prog->proginfo_subtitletype);
}
- if (control->conn_version >= 41) {
- sprintf(buf + strlen(buf), "%s[]:[]", S(prog->proginfo_prodyear));
+ if (control->conn_version >= 43) {
+ sprintf(buf + strlen(buf), "%d[]:[]", prog->proginfo_year);
}
#undef S
View
23 lib/cmyth/libcmyth/socket.c
@@ -2345,23 +2345,22 @@ cmyth_rcv_proginfo(cmyth_conn_t conn, int *err, cmyth_proginfo_t buf,
failed = "cmyth_rcv_ulong subtitletype";
goto fail;
}
- }
- if (buf->proginfo_version >= 41) {
- /*
- * Get proginfo_prodyear (string)
- */
- consumed = cmyth_rcv_string(conn, err,
- tmp_str, sizeof(tmp_str) - 1, count);
+ }
+
+ /*
+ * Get Year
+ */
+ if (buf->proginfo_version >= 43) {
+ consumed = cmyth_rcv_ushort(conn, err, &buf->proginfo_year,
+ count);
count -= consumed;
total += consumed;
if (*err) {
- failed = "cmyth_rcv_string";
+ failed = "cmyth_rcv_ushort proginfo_year";
goto fail;
}
- if (buf->proginfo_prodyear)
- ref_release(buf->proginfo_prodyear);
- buf->proginfo_prodyear = ref_strdup(tmp_str);
- }
+ }
+
cmyth_dbg(CMYTH_DBG_INFO, "%s: got recording info\n", __FUNCTION__);
cmyth_proginfo_parse_url(buf);
View
6 xbmc/filesystem/DllLibCMyth.h
@@ -106,7 +106,7 @@ class DllLibCMythInterface
virtual cmyth_timestamp_t proginfo_rec_start (cmyth_proginfo_t prog)=0;
virtual cmyth_timestamp_t proginfo_rec_end (cmyth_proginfo_t prog)=0;
virtual cmyth_proginfo_rec_status_t proginfo_rec_status(cmyth_proginfo_t prog)=0;
- virtual char* proginfo_prodyear (cmyth_proginfo_t prog)=0;
+ virtual unsigned short proginfo_year (cmyth_proginfo_t prog)=0;
virtual cmyth_proginfo_t proginfo_get_from_basename (cmyth_conn_t control, const char* basename)=0;
virtual int proginfo_delete_recording(cmyth_conn_t control, cmyth_proginfo_t prog)=0;
virtual int proginfo_stop_recording(cmyth_conn_t control, cmyth_proginfo_t prog)=0;
@@ -207,7 +207,7 @@ class DllLibCMyth : public DllDynamic, DllLibCMythInterface
DEFINE_METHOD1(cmyth_timestamp_t, proginfo_rec_end, (cmyth_proginfo_t p1))
DEFINE_METHOD1(cmyth_proginfo_rec_status_t, proginfo_rec_status, (cmyth_proginfo_t p1))
DEFINE_METHOD1(unsigned long, proginfo_flags, (cmyth_proginfo_t p1))
- DEFINE_METHOD1(char*, proginfo_prodyear, (cmyth_proginfo_t p1))
+ DEFINE_METHOD1(unsigned short, proginfo_year, (cmyth_proginfo_t p1))
DEFINE_METHOD2(cmyth_proginfo_t, proginfo_get_from_basename, (cmyth_conn_t p1, const char* p2))
DEFINE_METHOD2(int, proginfo_delete_recording, (cmyth_conn_t p1, cmyth_proginfo_t p2))
DEFINE_METHOD2(int, proginfo_stop_recording, (cmyth_conn_t p1, cmyth_proginfo_t p2))
@@ -302,7 +302,7 @@ class DllLibCMyth : public DllDynamic, DllLibCMythInterface
RESOLVE_METHOD_RENAME(cmyth_proginfo_rec_end, proginfo_rec_end)
RESOLVE_METHOD_RENAME(cmyth_proginfo_rec_status, proginfo_rec_status)
RESOLVE_METHOD_RENAME(cmyth_proginfo_flags, proginfo_flags)
- RESOLVE_METHOD_RENAME(cmyth_proginfo_prodyear, proginfo_prodyear)
+ RESOLVE_METHOD_RENAME(cmyth_proginfo_year, proginfo_year)
RESOLVE_METHOD_RENAME(cmyth_proginfo_get_from_basename, proginfo_get_from_basename)
RESOLVE_METHOD_RENAME(cmyth_proginfo_delete_recording, proginfo_delete_recording)
RESOLVE_METHOD_RENAME(cmyth_proginfo_stop_recording, proginfo_stop_recording)
View
6 xbmc/filesystem/MythDirectory.cpp
@@ -309,9 +309,9 @@ bool CMythDirectory::GetRecordings(const CStdString& base, CFileItemList &items,
* lookups.
*/
CStdString label(item->m_strTitle);
- CStdString prodyear = GetValue(m_dll->proginfo_prodyear(program));
- if (!prodyear.IsEmpty())
- label += " (" + prodyear + ")";
+ unsigned short year = m_dll->proginfo_year(program);
+ if (year > 0)
+ label.AppendFormat(" (%d)", year);
item->SetLabel(label);
item->SetLabelPreformated(true);
}

0 comments on commit 9ee7a18

Please sign in to comment.