Skip to content

Commit

Permalink
add %i for channel id in formatted xmltvid string. refs #1
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Speith committed Nov 1, 2010
1 parent 840672f commit a13d939
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
12 changes: 9 additions & 3 deletions src/chanid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,13 @@ const char *dvbxmltvid(int chanid) {
* For Sky, the string is "sid,skynumber" which is unique
* If the key is not found then return a manufactured channel id
*/
const char *formattedxmltvid(int channelnumber, int sid, char *shortname,
char *providername) {
const char *formattedxmltvid(
int channelnumber,
int channelid,
int sid,
char *shortname,
char *providername)
{
char *chanid;
char *returnstring;
const char *c;
Expand Down Expand Up @@ -109,7 +114,7 @@ const char *formattedxmltvid(int channelnumber, int sid, char *shortname,
return NULL;
}
}
int maxlen = 10+10 + strlen(xmltvidformat);
int maxlen = 10+10+10 + strlen(xmltvidformat);
if (providername != NULL)
maxlen += strlen(providername);
if (shortname != NULL)
Expand All @@ -129,6 +134,7 @@ const char *formattedxmltvid(int channelnumber, int sid, char *shortname,
case '%': *d++ = c; break;
case 's': d += sprintf(d, "%d", sid); break;
case 'c': d += sprintf(d, "%d", channelnumber); break;
case 'i': d += sprintf(d, "%d", channelid); break;
case 'n': if (shortname) { d += sprintf(d, "%s", shortname); } break;
case 'N': if (shortname) { for(const char*s=shortname;s && *s;) *d++ = tolower(*s++); } break;
case 'p': if (providername) { d += sprintf(d, "%s", providername); } break;
Expand Down
2 changes: 1 addition & 1 deletion src/chanid.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

extern int load_channel_table(char *chanidfile);
extern const char *dvbxmltvid(int chanid);
extern const char *formattedxmltvid(int skynumber, int sid, char *shortname,
extern const char *formattedxmltvid(int skynumber, int channelid, int sid, char *shortname,
char *provider);

#endif
1 change: 1 addition & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ static void usage() {
"\t-X (--xmltvidformat) specify xmltvid format as format string, specifiers:\n"
"\t %%s - sid\n"
"\t %%c - channel number\n"
"\t %%i - channel id\n"
"\t %%n - channel name\n"
"\t %%p - provider name\n"
"\t %%N - lowercase channel name\n"
Expand Down
2 changes: 1 addition & 1 deletion src/sky_epg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,7 @@ const char *get_channelident(sChannel * C) {
if (providername == NULL) {
providername = (char*)"SKY";
}
return formattedxmltvid(C->SkyNumber, C->Sid, C->shortname, providername);
return formattedxmltvid(C->SkyNumber, C->ChannelId, C->Sid, C->shortname, providername);
}
}

Expand Down

0 comments on commit a13d939

Please sign in to comment.