Skip to content

Commit

Permalink
Merge commit 'c3de3edf38660d5e3cd8a2bfa96784fa81488699' into fanart-test
Browse files Browse the repository at this point in the history
Conflicts:
	addons/skin.confluence/720p/ViewsPVR.xml
	xbmc/pvr/recordings/PVRRecording.cpp
	xbmc/pvr/recordings/PVRRecordings.cpp
	xbmc/pvrclients/mythtv-cmyth/thread.cpp
	xbmc/pvrclients/mythtv-cmyth/tools.cpp
  • Loading branch information
tsp committed Apr 9, 2012
2 parents e6dfd2c + c3de3ed commit 3eedd06
Show file tree
Hide file tree
Showing 33 changed files with 1,027 additions and 43 deletions.
11 changes: 11 additions & 0 deletions addons/skin.confluence/720p/IncludesBackgroundBuilding.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,17 @@
<randomize>true</randomize>
<fadetime>1000</fadetime>
</control>
<control type="image">
<posx>0</posx>
<posy>0</posy>
<width>1280</width>
<height>720</height>
<texture background="true">$INFO[ListItem.Property(Fanart_Image)]</texture>
<include>backgroundfade</include>
<fadetime>FanartCrossfadeTime</fadetime>
<visible>!Skin.HasSetting(HideBackGroundFanart) + !IsEmpty(ListItem.Property(Fanart_Image))</visible>
<include>Window_OpenClose_Animation</include>
</control>
</include>
<include name="CommonMusicBackground">
<control type="multiimage">
Expand Down
22 changes: 11 additions & 11 deletions addons/skin.confluence/720p/ViewsPVR.xml
Original file line number Diff line number Diff line change
Expand Up @@ -664,11 +664,11 @@
<label>$INFO[ListItem.Date]</label>
</control>
<control type="image">
<posx>730</posx>
<posy>14</posy>
<width>20</width>
<height>16</height>
<texture>$INFO[ListItem.Overlay]</texture>
<posx>730</posx>
<posy>14</posy>
<width>20</width>
<height>16</height>
<texture>$INFO[ListItem.Overlay]</texture>
</control>
</itemlayout>
<focusedlayout height="40" width="760">
Expand Down Expand Up @@ -730,12 +730,12 @@
<label>$INFO[ListItem.Date]</label>
</control>
<control type="image">
<posx>730</posx>
<posy>14</posy>
<width>20</width>
<height>16</height>
<texture>$INFO[ListItem.Overlay]</texture>
</control>
<posx>730</posx>
<posy>14</posy>
<width>20</width>
<height>16</height>
<texture>$INFO[ListItem.Overlay]</texture>
</control>
</focusedlayout>
</control>
<control type="scrollbar" id="72">
Expand Down
8 changes: 7 additions & 1 deletion lib/cmyth/Win32/libcmyth.def
Original file line number Diff line number Diff line change
Expand Up @@ -268,4 +268,10 @@ EXPORTS
cmyth_mysql_get_playgroups
cmyth_mysql_get_recprofiles
cmyth_mysql_get_cardtype
cmyth_channel_callsign
cmyth_channel_callsign
cmyth_get_watched_status_mysql
cmyth_set_watched_status_mysql
cmyth_file_position
cmyth_update_file_length
cmyth_storagegroup_filelist

11 changes: 10 additions & 1 deletion lib/cmyth/include/cmyth/cmyth.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ extern cmyth_file_t cmyth_conn_connect_file(cmyth_proginfo_t prog,
* \return file handle
*/
extern cmyth_file_t cmyth_conn_connect_path(char* path, cmyth_conn_t control,
unsigned buflen, int tcp_rcvbuf);
unsigned buflen, int tcp_rcvbuf,char* sgToGetFrom);

/**
* Create a ring buffer connection to a recorder.
Expand Down Expand Up @@ -599,6 +599,9 @@ extern int cmyth_database_set_user(cmyth_database_t db, char *user);
extern int cmyth_database_set_pass(cmyth_database_t db, char *pass);
extern int cmyth_database_set_name(cmyth_database_t db, char *name);

extern int cmyth_get_watched_status_mysql(cmyth_database_t db, int recordid);
extern int cmyth_set_watched_status_mysql(cmyth_database_t db, int recordid, int watchedStat);

/*
* -----------------------------------------------------------------
* Ring Buffer Operations
Expand Down Expand Up @@ -1002,6 +1005,10 @@ extern unsigned long long cmyth_file_start(cmyth_file_t file);

extern unsigned long long cmyth_file_length(cmyth_file_t file);

extern unsigned long long cmyth_file_position(cmyth_file_t file);

extern int cmyth_update_file_length(cmyth_file_t file, unsigned long long newLength);

extern int cmyth_file_get_block(cmyth_file_t file, char *buf,
unsigned long len);

Expand Down Expand Up @@ -1205,6 +1212,8 @@ extern int cmyth_mysql_get_recprofiles(cmyth_database_t db, cmyth_recprofile_t**

extern char* cmyth_mysql_get_cardtype(cmyth_database_t db, int chanid);

// Get a storage group file list
extern int cmyth_storagegroup_filelist(cmyth_conn_t control, char** *sgFilelist, char* sg2List, char* mythostname);


#endif /* __CMYTH_H */
19 changes: 13 additions & 6 deletions lib/cmyth/libcmyth/connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ cmyth_conn_connect_file(cmyth_proginfo_t prog, cmyth_conn_t control,
*/
cmyth_file_t
cmyth_conn_connect_path(char* path, cmyth_conn_t control,
unsigned buflen, int tcp_rcvbuf)
unsigned buflen, int tcp_rcvbuf, char* sgToGetFrom)
{
cmyth_conn_t conn = NULL;
char *announcement = NULL;
Expand Down Expand Up @@ -717,18 +717,25 @@ cmyth_conn_connect_path(char* path, cmyth_conn_t control,
__FUNCTION__, host, port, buflen);
goto shut;
}
ann_size += strlen(path) + strlen(my_hostname);

ann_size += strlen(path) + strlen(my_hostname) + strlen(sgToGetFrom) + 6;
announcement = malloc(ann_size);
if (!announcement) {
cmyth_dbg(CMYTH_DBG_ERROR,
"%s: malloc(%d) failed for announcement\n",
__FUNCTION__, ann_size);
goto shut;
}
if (control->conn_version >= 44) {
sprintf(announcement, "ANN FileTransfer %s[]:[]%s[]:[]",
my_hostname, path);
}
if (control->conn_version >= 44) { /*TSP: from version 44 according to the source code*/
if (strlen(sgToGetFrom) > 1) {
sprintf(announcement, "ANN FileTransfer %s 0 0 0[]:[]%s[]:[]%s",
my_hostname, path, sgToGetFrom);
}
else {
sprintf(announcement, "ANN FileTransfer %s[]:[]%s[]:[]",
my_hostname, path);
}
}
else {
sprintf(announcement, "ANN FileTransfer %s[]:[]%s",
my_hostname, path);
Expand Down
50 changes: 50 additions & 0 deletions lib/cmyth/libcmyth/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,56 @@ cmyth_file_length(cmyth_file_t file)
return file->file_length;
}

/*
* cmyth_update_file_length(cmyth_file_t file, unsigned long long newLength)
*
* Scope: PUBLIC
*
* Description
*
* Updates a files length, with a value returned from a UPDATE_FILE_SIZE event
*
* Return Value:
*
* Sucess: a int value >= 0
*
* Failure: a int containing -errno
*/
int
cmyth_update_file_length(cmyth_file_t file, unsigned long long newLength)
{
if (!file) {
return -EINVAL;
}
file->file_length = newLength;
return 0;
}

/*
* cmyth_file_position(cmyth_file_t p)
*
* Scope: PUBLIC
*
* Description
*
* Obtain the position in the data of a file.
*
* Return Value:
*
* Sucess: a long long value >= 0
*
* Failure: a long long containing -errno
*/
unsigned long long
cmyth_file_position(cmyth_file_t file)
{
if (!file) {
return -EINVAL;
}
return file->file_pos;
}


/*
* cmyth_file_get_block(cmyth_file_t file, char *buf, unsigned long len)
*
Expand Down
66 changes: 66 additions & 0 deletions lib/cmyth/libcmyth/mythtv_mysql.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,72 @@ cmyth_get_offset_mysql(cmyth_database_t db, int type, char *recordid, int chanid
}
}

int
cmyth_get_watched_status_mysql(cmyth_database_t db, int recordid)
{

MYSQL_RES *res= NULL;
MYSQL_ROW row;
const char *query_str = "SELECT watched FROM recorded WHERE recordid=?";
int retval = 0;
cmyth_mysql_query_t * query;

query = cmyth_mysql_query_create(db,query_str);

if (cmyth_mysql_query_param_long(query,recordid) < 0)
{
cmyth_dbg(CMYTH_DBG_ERROR,"%s, binding of query parameters failed! Maybe we're out of memory?\n", __FUNCTION__);
ref_release(query);
return -1;
}
res = cmyth_mysql_query_result(query);
ref_release(query);
if(res == NULL)
{
cmyth_dbg(CMYTH_DBG_ERROR,"%s, finalisation/execution of query failed!\n", __FUNCTION__);
return -1;
}


if (row = mysql_fetch_row(res)) {
retval = safe_atoi(row[0]);
mysql_free_result(res);
return retval;
}
else
return 0;
}

int
cmyth_set_watched_status_mysql(cmyth_database_t db, int recordid, int watchedStat)
{
cmyth_mysql_query_t * query;

if (watchedStat > 1) watchedStat = 1;
if (watchedStat < 0) watchedStat = 0;

query = cmyth_mysql_query_create(db,"UPDATE recorded SET watched = ? WHERE recordid = ?");

if(cmyth_mysql_query_param_long(query,watchedStat) < 0
|| cmyth_mysql_query_param_long(query,recordid) < 0
)
{
cmyth_dbg(CMYTH_DBG_ERROR,"%s, binding of query parameters failed! Maybe we're out of memory?\n", __FUNCTION__);
ref_release(query);
return -1;
}

if(cmyth_mysql_query(query) < 0)
{
cmyth_dbg(CMYTH_DBG_ERROR,"%s, finalisation/execution of query failed!\n", __FUNCTION__);
ref_release(query);
return -1;
}
ref_release(query);
return 0;

}

char *
cmyth_get_recordid_mysql(cmyth_database_t db, int chanid, char *title, char *subtitle, char *description, char *seriesid, char *programid)
{
Expand Down
79 changes: 79 additions & 0 deletions lib/cmyth/libcmyth/proglist.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,85 @@
#include <string.h>
#include <cmyth_local.h>

extern void destroy_char_array2(void* p)
{
char** ptr = (char**)p;
if(!ptr)
return;
while (*ptr)
{
ref_release(*ptr);
ptr++;
}
}

int cmyth_storagegroup_filelist(cmyth_conn_t control, char** *sgFilelist, char* sg2List, char* mythostname)
{

char msg[256];
int res=0;
int count;
int err = 0;
int i = 0;
char **ret;
int consumed; /* = profiles;*/
char tmp_str[32768];

if (!control) {
cmyth_dbg(CMYTH_DBG_ERROR, "%s: no connection\n", __FUNCTION__);
return 0;
}

pthread_mutex_lock(&mutex);

snprintf(msg, sizeof(msg), "QUERY_SG_GETFILELIST[]:[]%s[]:[]%s[]:[][]:[]1", mythostname, sg2List);

err = cmyth_send_message(control, msg);
if (err < 0) {
cmyth_dbg(CMYTH_DBG_ERROR, "%s: cmyth_send_message() failed (%d)\n", __FUNCTION__, err);
res = 0;
goto out;
}

count = cmyth_rcv_length(control);
if (count < 0) {
cmyth_dbg(CMYTH_DBG_ERROR, "%s: cmyth_rcv_length() failed (%d)\n", __FUNCTION__, count);
res = 0;
goto out;
}

ret = (char**)ref_alloc( sizeof( char*) * (count + 1 ) );/*count + 1 ??*/
if (!ret) {
cmyth_dbg(CMYTH_DBG_ERROR, "%s: alloc() failed for list\n", __FUNCTION__);
res = 0;
goto out;
}

ref_set_destroy((void*)ret,destroy_char_array2);

while (i < count) {
consumed = cmyth_rcv_string(control, &err, tmp_str, sizeof(tmp_str) - 1, count);
count -= consumed;
if (err) {
cmyth_dbg(CMYTH_DBG_ERROR, "%s: cmyth_rcv_string() failed (%d)\n", __FUNCTION__, count);
res = 0;
goto out;
}
ret[res] = ref_strdup(tmp_str);
res++;
}

ret[res] = NULL;

cmyth_dbg(CMYTH_DBG_ERROR, "%s: results= %d\n", __FUNCTION__, res);
*sgFilelist=ret;

out:
pthread_mutex_unlock(&mutex);
return res;

}

/*
* cmyth_proglist_destroy(void)
*
Expand Down
9 changes: 9 additions & 0 deletions xbmc/FileItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,15 @@ CFileItem::CFileItem(const CPVRRecording& record)
*GetPVRRecordingInfoTag() = record;
SetLabel(record.m_strTitle);
m_strLabel2 = record.m_strPlot;
if (!record.m_defualt_icon.IsEmpty())
{
SetIconImage(record.m_defualt_icon.c_str());
}
if (!record.m_fanart_image.IsEmpty())
{
SetProperty("Fanart_Image",record.m_fanart_image.c_str());
}

}

CFileItem::CFileItem(const CPVRTimerInfoTag& timer)
Expand Down
2 changes: 2 additions & 0 deletions xbmc/addons/include/xbmc_pvr_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,8 @@ extern "C" {
int iLifetime; /*!< @brief (optional) life time in days of this recording */
int iGenreType; /*!< @brief (optional) genre type */
int iGenreSubType; /*!< @brief (optional) genre sub type */
const char * strIconPath; /*!< @brief (optional) icon path */
const char * strDefFanart; /*!< @brief (optional) fanart path */
} ATTRIBUTE_PACKED PVR_RECORDING;

/*!
Expand Down
2 changes: 2 additions & 0 deletions xbmc/pvr/addons/PVRClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ inline void PVRWriteClientRecordingInfo(const CPVRRecording &xbmcRecording, PVR_
addonRecording.iLifetime = xbmcRecording.m_iLifetime;
addonRecording.strDirectory = xbmcRecording.m_strDirectory.c_str();
addonRecording.strStreamURL = xbmcRecording.m_strStreamURL.c_str();
addonRecording.strIconPath = xbmcRecording.m_defualt_icon.c_str();

}

/*!
Expand Down
Loading

0 comments on commit 3eedd06

Please sign in to comment.