Feature #1908 » user_map.diff
eepg.c | ||
---|---|---|
}
|
||
void load_sky_genre_user_map (void)
|
||
{
|
||
char Buffer[1024];
|
||
char *Line;
|
||
FILE *File;
|
||
LogD (0, prep("start "));
|
||
DIR *dp = opendir(cSetupEEPG::getInstance()->getConfDir());
|
||
if(!dp) {
|
||
LogE (0, prep("Can't read configuration folder '%s'"), cSetupEEPG::getInstance()->getConfDir());
|
||
return;
|
||
}
|
||
closedir(dp);
|
||
for (int table = 0; table < 2; table++) {
|
||
LogD (0, prep("table %d "), table);
|
||
if (skyGenreDict[table].size() > 0)
|
||
skyGenreDict[table].clear();
|
||
string fname = string(cSetupEEPG::getInstance()->getConfDir()) + (table ? "/sky_uk.genres" : "/sky_it.genres");
|
||
LogD (0, prep("file %s "), fname.c_str());
|
||
|
||
File = fopen (fname.c_str(), "r");
|
||
if (!File) continue;
|
||
LogD (0, prep("found "));
|
||
LogD(3, prep("Found user Genre Mapping '%s'."), fname.c_str());
|
||
memset (Buffer, 0, sizeof (Buffer));
|
||
uchar origGenr = 0;
|
||
uchar userGenr = 0;
|
||
while ((Line = fgets (Buffer, sizeof (Buffer), File)) != NULL) {
|
||
Line = compactspace (skipspace (stripspace (Line)));
|
||
//Skip empty and commented lines
|
||
if (isempty (Line) || Line[0] == '#' || Line[0] == ';') continue;
|
||
if (sscanf (Line, "%hhx=%hhx%*[^\n]\n", &origGenr, &userGenr) == 2) {
|
||
if (!skyGenreDict[table].count(origGenr)) {
|
||
skyGenreDict[table].insert(pair<uchar,uchar>(origGenr, userGenr));
|
||
LogD(4, prep("Original '%x' user mapping to '%x'."), origGenr, userGenr);
|
||
}
|
||
} //if scanf
|
||
} //while
|
||
fclose (File);
|
||
LogD(3, prep("Loaded %i user mappings from %s."), skyGenreDict[table].size(), fname.c_str());
|
||
LogD(4, prep("Original <-> User Mapping"));
|
||
map<uchar,uchar>::iterator it;
|
||
for ( it=skyGenreDict[table].begin() ; it != skyGenreDict[table].end(); it++ )
|
||
LogD(4, prep("%x <-> %x"), (*it).first, it->second);
|
||
}
|
||
}
|
||
/** \brief Decode an EPG string as necessary
|
||
*
|
||
* \param src - Possibly encoded string
|
||
... | ... | |
free(tmp);
|
||
}
|
||
#if APIVERSNUM > 10711
|
||
uchar Contents[MaxEventContents] = { 0 };
|
||
map<uchar,uchar>::iterator it;
|
||
if ((Format == SKY_UK || Format == SKY_IT)
|
||
&& (it = skyGenreDict[Format == SKY_IT ? 0 : 1].find(ThemeId)) != skyGenreDict[0].end()) {
|
||
Contents[0] = it->second;
|
||
Event->SetContents(Contents);
|
||
}
|
||
#endif
|
||
if (SummText) {
|
||
WrittenSummary = true;
|
||
CleanString ((uchar *) SummText);
|
||
... | ... | |
}
|
||
index++;
|
||
if ((StartTime + T->Duration) < too_old) {
|
||
if ((StartTime + (int)T->Duration) < too_old) {
|
||
LogD(3, prep("Skipping old event '%s', start time:%s"), T->Text, ctime (&StartTime));
|
||
OldEvents++;
|
||
continue;
|
||
... | ... | |
// esyslog("EEPG Error: lost sync at title %d, summary %d.",i,j);
|
||
} else if (j == (remembersummary - 1) || SummIndex !=-1) { //the last summary to be checked has failed also
|
||
//esyslog ("EEPG Error: could not find summary for summary-available Title %d.", i);
|
||
if ((T->StartTime + T->Duration) < too_old) {
|
||
if ((T->StartTime + T->Duration) < (uint)too_old) {
|
||
LogD(3, prep("Skipping old event '%s' without summary, start time:%s"), T->Text, ctime ((time_t*)&T->StartTime));
|
||
OldEvents++;
|
||
} else {
|
||
... | ... | |
CheckCreateFile("freesat.t1", FreesatT1);
|
||
CheckCreateFile("freesat.t2", FreesatT2);
|
||
load_theme_dictionaries();
|
||
load_sky_genre_user_map();
|
||
sky_tables[0] = NULL;
|
||
sky_tables[1] = NULL;
|
util.c | ||
---|---|---|
struct hufftab *tables[2][128];
|
||
int table_size[2][128];
|
||
map<string,string> tableDict;
|
||
map<uchar,uchar> skyGenreDict[2];
|
||
cEquivHandler* EquivHandler;
|
||
util.h | ||
---|---|---|
extern int table_size[2][128];
|
||
//static sNodeH* sky_tables[2];
|
||
extern std::map<std::string,std::string> tableDict;
|
||
extern std::map<unsigned char,unsigned char> skyGenreDict[2];
|
||
class cCharsetFixer
|
- « Previous
- 1
- 2
- Next »