mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-31 17:31:20 +02:00
-add replace_char to ZapitTools
git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@943 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
@@ -586,13 +586,8 @@ printf("Record channel_id: " PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS " epg: %llx
|
||||
if (!(ext_channel_name.empty()))
|
||||
{
|
||||
strcpy(&(filename[pos]), UTF8_TO_FILESYSTEM_ENCODING(ext_channel_name.c_str()));
|
||||
char * p_act = &(filename[pos]);
|
||||
do {
|
||||
p_act += strcspn(p_act, "/ \"%&-\t`'<27>!,:;");
|
||||
if (*p_act) {
|
||||
*p_act++ = '_';
|
||||
}
|
||||
} while (*p_act);
|
||||
ZapitTools::replace_char(&filename[pos]);
|
||||
|
||||
if (!autoshift && g_settings.recording_save_in_channeldir) {
|
||||
struct stat statInfo;
|
||||
int res = stat(filename,&statInfo);
|
||||
@@ -628,24 +623,12 @@ printf("Record channel_id: " PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS " epg: %llx
|
||||
if (!(epgdata.title.empty()))
|
||||
{
|
||||
strcpy(&(filename[pos]), epgdata.title.c_str());
|
||||
char * p_act = &(filename[pos]);
|
||||
do {
|
||||
p_act += strcspn(p_act, "/ \"%&-\t`'~<>!,:;?^<5E>$\\=*#@<40>|");
|
||||
if (*p_act) {
|
||||
*p_act++ = '_';
|
||||
}
|
||||
} while (*p_act);
|
||||
ZapitTools::replace_char(&filename[pos]);
|
||||
}
|
||||
}
|
||||
} else if (!epgTitle.empty()) {
|
||||
strcpy(&(filename[pos]), epgTitle.c_str());
|
||||
char * p_act = &(filename[pos]);
|
||||
do {
|
||||
p_act += strcspn(p_act, "/ \"%&-\t`'~<>!,:;?^<5E>$\\=*#@<40>|");
|
||||
if (*p_act) {
|
||||
*p_act++ = '_';
|
||||
}
|
||||
} while (*p_act);
|
||||
ZapitTools::replace_char(&filename[pos]);
|
||||
}
|
||||
}
|
||||
#if 1
|
||||
@@ -700,13 +683,7 @@ void CVCRControl::Screenshot(const t_channel_id channel_id, char * fname)
|
||||
channel_name = g_Zapit->getChannelName(channel_id);
|
||||
if (!(channel_name.empty())) {
|
||||
strcpy(&(filename[pos]), UTF8_TO_FILESYSTEM_ENCODING(channel_name.c_str()));
|
||||
char * p_act = &(filename[pos]);
|
||||
do {
|
||||
p_act += strcspn(p_act, "/ \"%&-\t`'<27>!,:;");
|
||||
if (*p_act) {
|
||||
*p_act++ = '_';
|
||||
}
|
||||
} while (*p_act);
|
||||
ZapitTools::replace_char(&filename[pos]);
|
||||
strcat(filename, "_");
|
||||
}
|
||||
pos = strlen(filename);
|
||||
@@ -721,13 +698,7 @@ void CVCRControl::Screenshot(const t_channel_id channel_id, char * fname)
|
||||
if(sectionsd_getEPGidShort(epgid, &epgdata)) {
|
||||
if (!(epgdata.title.empty())) {
|
||||
strcpy(&(filename[pos]), epgdata.title.c_str());
|
||||
char * p_act = &(filename[pos]);
|
||||
do {
|
||||
p_act += strcspn(p_act, "/ \"%&-\t`'~<>!,:;?^<5E>$\\=*#@<40>|");
|
||||
if (*p_act) {
|
||||
*p_act++ = '_';
|
||||
}
|
||||
} while (*p_act);
|
||||
ZapitTools::replace_char(&filename[pos]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -31,6 +31,7 @@ namespace ZapitTools
|
||||
std::string UTF8_to_Latin1 (const char *);
|
||||
std::string UTF8_to_UTF8XML(const char *);
|
||||
std::string Latin1_to_UTF8 (const char *);
|
||||
void replace_char(char * p_act);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -22,6 +22,7 @@
|
||||
*/
|
||||
|
||||
#include <zapit/client/zapittools.h>
|
||||
#include <string.h>
|
||||
|
||||
namespace ZapitTools {
|
||||
|
||||
@@ -120,4 +121,16 @@ namespace ZapitTools {
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
void replace_char(char * p_act)
|
||||
{
|
||||
const char repchars[]="/ \"%&-\t`'~<>!,:;?^<5E>$\\=*#@<40>|";
|
||||
do {
|
||||
p_act += strcspn(p_act, repchars );
|
||||
if (*p_act) {
|
||||
*p_act++ = '_';
|
||||
}
|
||||
} while (*p_act);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user