mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-09-03 10:51:12 +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()))
|
if (!(ext_channel_name.empty()))
|
||||||
{
|
{
|
||||||
strcpy(&(filename[pos]), UTF8_TO_FILESYSTEM_ENCODING(ext_channel_name.c_str()));
|
strcpy(&(filename[pos]), UTF8_TO_FILESYSTEM_ENCODING(ext_channel_name.c_str()));
|
||||||
char * p_act = &(filename[pos]);
|
ZapitTools::replace_char(&filename[pos]);
|
||||||
do {
|
|
||||||
p_act += strcspn(p_act, "/ \"%&-\t`'<27>!,:;");
|
|
||||||
if (*p_act) {
|
|
||||||
*p_act++ = '_';
|
|
||||||
}
|
|
||||||
} while (*p_act);
|
|
||||||
if (!autoshift && g_settings.recording_save_in_channeldir) {
|
if (!autoshift && g_settings.recording_save_in_channeldir) {
|
||||||
struct stat statInfo;
|
struct stat statInfo;
|
||||||
int res = stat(filename,&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()))
|
if (!(epgdata.title.empty()))
|
||||||
{
|
{
|
||||||
strcpy(&(filename[pos]), epgdata.title.c_str());
|
strcpy(&(filename[pos]), epgdata.title.c_str());
|
||||||
char * p_act = &(filename[pos]);
|
ZapitTools::replace_char(&filename[pos]);
|
||||||
do {
|
|
||||||
p_act += strcspn(p_act, "/ \"%&-\t`'~<>!,:;?^<5E>$\\=*#@<40>|");
|
|
||||||
if (*p_act) {
|
|
||||||
*p_act++ = '_';
|
|
||||||
}
|
|
||||||
} while (*p_act);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (!epgTitle.empty()) {
|
} else if (!epgTitle.empty()) {
|
||||||
strcpy(&(filename[pos]), epgTitle.c_str());
|
strcpy(&(filename[pos]), epgTitle.c_str());
|
||||||
char * p_act = &(filename[pos]);
|
ZapitTools::replace_char(&filename[pos]);
|
||||||
do {
|
|
||||||
p_act += strcspn(p_act, "/ \"%&-\t`'~<>!,:;?^<5E>$\\=*#@<40>|");
|
|
||||||
if (*p_act) {
|
|
||||||
*p_act++ = '_';
|
|
||||||
}
|
|
||||||
} while (*p_act);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if 1
|
#if 1
|
||||||
@@ -700,13 +683,7 @@ void CVCRControl::Screenshot(const t_channel_id channel_id, char * fname)
|
|||||||
channel_name = g_Zapit->getChannelName(channel_id);
|
channel_name = g_Zapit->getChannelName(channel_id);
|
||||||
if (!(channel_name.empty())) {
|
if (!(channel_name.empty())) {
|
||||||
strcpy(&(filename[pos]), UTF8_TO_FILESYSTEM_ENCODING(channel_name.c_str()));
|
strcpy(&(filename[pos]), UTF8_TO_FILESYSTEM_ENCODING(channel_name.c_str()));
|
||||||
char * p_act = &(filename[pos]);
|
ZapitTools::replace_char(&filename[pos]);
|
||||||
do {
|
|
||||||
p_act += strcspn(p_act, "/ \"%&-\t`'<27>!,:;");
|
|
||||||
if (*p_act) {
|
|
||||||
*p_act++ = '_';
|
|
||||||
}
|
|
||||||
} while (*p_act);
|
|
||||||
strcat(filename, "_");
|
strcat(filename, "_");
|
||||||
}
|
}
|
||||||
pos = strlen(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(sectionsd_getEPGidShort(epgid, &epgdata)) {
|
||||||
if (!(epgdata.title.empty())) {
|
if (!(epgdata.title.empty())) {
|
||||||
strcpy(&(filename[pos]), epgdata.title.c_str());
|
strcpy(&(filename[pos]), epgdata.title.c_str());
|
||||||
char * p_act = &(filename[pos]);
|
ZapitTools::replace_char(&filename[pos]);
|
||||||
do {
|
|
||||||
p_act += strcspn(p_act, "/ \"%&-\t`'~<>!,:;?^<5E>$\\=*#@<40>|");
|
|
||||||
if (*p_act) {
|
|
||||||
*p_act++ = '_';
|
|
||||||
}
|
|
||||||
} while (*p_act);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -31,6 +31,7 @@ namespace ZapitTools
|
|||||||
std::string UTF8_to_Latin1 (const char *);
|
std::string UTF8_to_Latin1 (const char *);
|
||||||
std::string UTF8_to_UTF8XML(const char *);
|
std::string UTF8_to_UTF8XML(const char *);
|
||||||
std::string Latin1_to_UTF8 (const char *);
|
std::string Latin1_to_UTF8 (const char *);
|
||||||
|
void replace_char(char * p_act);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -22,6 +22,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <zapit/client/zapittools.h>
|
#include <zapit/client/zapittools.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
namespace ZapitTools {
|
namespace ZapitTools {
|
||||||
|
|
||||||
@@ -120,4 +121,16 @@ namespace ZapitTools {
|
|||||||
}
|
}
|
||||||
return r;
|
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