4 Commits

Author SHA1 Message Date
kamel5
9044e092f8 Version 1.2.17 2020-02-17 16:08:14 +01:00
kamel5
b96f800240 Add episode to manual timer 2020-02-17 16:05:43 +01:00
kamel5
5d9ed1439a Fixed a remote timer problem 2020-02-17 15:51:51 +01:00
kamel5
66a0c15aea Final fix for utf8 CutText 2020-02-17 15:51:47 +01:00
18 changed files with 213 additions and 53 deletions

View File

@@ -250,3 +250,9 @@ Version 1.2.16
- Optimize display "REC" sign in epgview
- Separate "displayTime" for horizontal and vertical view
- RecMenu "Timer Timeline" displays now sorted active timer
Version 1.2.17
- Final fix for utf8 CutText
- Fixed a remote timer problem
- Add episode to manual timer

View File

@@ -34,6 +34,7 @@ cTVGuideConfig::cTVGuideConfig() {
channelJumpMode = eNumJump;
jumpChannels = 0;
blueKeyMode = 2;
addSubtitleToTimer = 1;
closeOnSwitch = 1;
numkeyMode = 0;
useRemoteTimers = 0;
@@ -295,6 +296,7 @@ bool cTVGuideConfig::SetupParse(const char *Name, const char *Value) {
else if (strcmp(Name, "footerHeightPercent") == 0) footerHeightPercent = atoi(Value);
else if (strcmp(Name, "instRecFolderMode") == 0) instRecFolderMode = atoi(Value);
else if (strcmp(Name, "instRecFixedFolder") == 0) instRecFixedFolder = Value;
else if (strcmp(Name, "addSubtitleToTimer") == 0) addSubtitleToTimer = atoi(Value);
else if (strcmp(Name, "favWhatsOnNow") == 0) favWhatsOnNow = atoi(Value);
else if (strcmp(Name, "favWhatsOnNext") == 0) favWhatsOnNext = atoi(Value);
else if (strcmp(Name, "favUseTime1") == 0) favUseTime1 = atoi(Value);

View File

@@ -43,6 +43,12 @@ enum eInstRecFolderMode {
eFolderFixed
};
typedef enum {
addSubtitleNever = 0,
addSubtitleSmart,
addSubtitleAlways
} addSubtitleToTimerMode;
class cTVGuideConfig {
private:
cString checkSlashAtEnd(std::string path);
@@ -82,6 +88,7 @@ class cTVGuideConfig {
int channelJumpMode;
int jumpChannels;
int blueKeyMode;
int addSubtitleToTimer;
int closeOnSwitch;
int numkeyMode;
int useRemoteTimers;

View File

@@ -3,7 +3,7 @@ msgid ""
msgstr ""
"Project-Id-Version: vdr-tvguide 0.0.1\n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2020-01-06 14:31+0100\n"
"POT-Creation-Date: 2020-02-17 14:30+0100\n"
"PO-Revision-Date: 2013-09-21 17:49+0200\n"
"Last-Translator: My friend <Sampep> Thanks David <Gabychan> <gbonich@gmail.com>\n"
"Language-Team: \n"
@@ -57,6 +57,9 @@ msgstr ""
msgid "images"
msgstr ""
msgid "tvguide: RemoteTimerModifications failed"
msgstr ""
msgid "root video folder"
msgstr "Directori principal per a vídeo"
@@ -888,15 +891,27 @@ msgstr ""
msgid "Use fixed folder"
msgstr ""
msgid "smart"
msgstr ""
msgid "Instant recording:"
msgstr ""
msgid "Folder for instant Recordings"
msgstr ""
msgid "Folder"
msgstr ""
msgid "Add episode to manual timers"
msgstr ""
msgid "Use Remotetimers"
msgstr "Utilitza temporitzadors remots"
msgid "Favorites:"
msgstr ""
msgid "Limit channels in favorites"
msgstr ""

View File

@@ -3,7 +3,7 @@ msgid ""
msgstr ""
"Project-Id-Version: vdr-tvguide 0.0.1\n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2020-01-06 14:31+0100\n"
"POT-Creation-Date: 2020-02-17 14:30+0100\n"
"PO-Revision-Date: 2012-08-25 17:49+0200\n"
"Last-Translator: Horst\n"
"Language-Team: \n"
@@ -54,6 +54,9 @@ msgstr "Favoriten"
msgid "images"
msgstr "Bilder"
msgid "tvguide: RemoteTimerModifications failed"
msgstr ""
msgid "root video folder"
msgstr "Video Hauptverzeichnis"
@@ -885,15 +888,27 @@ msgstr "Verzeichnis aus Liste auswählen"
msgid "Use fixed folder"
msgstr "Festes Verzeichnis benutzen"
msgid "smart"
msgstr "intelligent"
msgid "Instant recording:"
msgstr "Sofortaufnahmen:"
msgid "Folder for instant Recordings"
msgstr "Verzeichnis für Sofortaufnahmen"
msgid "Folder"
msgstr "Verzeichnis"
msgid "Add episode to manual timers"
msgstr "Untertitel in manuellen Timern"
msgid "Use Remotetimers"
msgstr "RemoteTimers benutzen"
msgid "Favorites:"
msgstr "Favoriten:"
msgid "Limit channels in favorites"
msgstr "Kanäle in Favoriten beschränken"

View File

@@ -3,7 +3,7 @@ msgid ""
msgstr ""
"Project-Id-Version: vdr-tvguide 0.0.1\n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2020-01-06 14:31+0100\n"
"POT-Creation-Date: 2020-02-17 14:30+0100\n"
"PO-Revision-Date: 2012-08-25 17:49+0200\n"
"Last-Translator: fiveten_59\n"
"Language-Team: \n"
@@ -54,6 +54,9 @@ msgstr "Favoriti"
msgid "images"
msgstr "Immagini"
msgid "tvguide: RemoteTimerModifications failed"
msgstr ""
msgid "root video folder"
msgstr "cartella video di root"
@@ -885,15 +888,27 @@ msgstr "Scegli dall'elenco cartelle"
msgid "Use fixed folder"
msgstr "Usa cartella fissa"
msgid "smart"
msgstr "intelligente"
msgid "Instant recording:"
msgstr ""
msgid "Folder for instant Recordings"
msgstr "Cartella per la registrazione immediata"
msgid "Folder"
msgstr "Cartella"
msgid "Add episode to manual timers"
msgstr "Aggiungi episodi ai timer manuali"
msgid "Use Remotetimers"
msgstr "Usa Remotetimers"
msgid "Favorites:"
msgstr ""
msgid "Limit channels in favorites"
msgstr "Limite dei canali nei favoriti"

View File

@@ -3,7 +3,7 @@ msgid ""
msgstr ""
"Project-Id-Version: vdr-tvguide 1.0.0\n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2020-01-06 14:31+0100\n"
"POT-Creation-Date: 2020-02-17 14:30+0100\n"
"PO-Revision-Date: 2013-09-25 17:49+0400\n"
"Last-Translator: AmiD, ilya\n"
"Language-Team: Russia-Cherepovets(wm.amid@gmail.com)\n"
@@ -54,6 +54,9 @@ msgstr ""
msgid "images"
msgstr ""
msgid "tvguide: RemoteTimerModifications failed"
msgstr ""
msgid "root video folder"
msgstr "Главная видео директория"
@@ -885,15 +888,27 @@ msgstr ""
msgid "Use fixed folder"
msgstr ""
msgid "smart"
msgstr ""
msgid "Instant recording:"
msgstr ""
msgid "Folder for instant Recordings"
msgstr ""
msgid "Folder"
msgstr ""
msgid "Add episode to manual timers"
msgstr ""
msgid "Use Remotetimers"
msgstr "RemoteTimers benutzen"
msgid "Favorites:"
msgstr ""
msgid "Limit channels in favorites"
msgstr ""

View File

@@ -3,7 +3,7 @@ msgid ""
msgstr ""
"Project-Id-Version: vdr-tvguide 1.1.0\n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2020-01-06 14:31+0100\n"
"POT-Creation-Date: 2020-02-17 14:30+0100\n"
"PO-Revision-Date: 2013-09-15 00:12+0100\n"
"Last-Translator: Milan Hrala <hrala.milan@gmail.com>\n"
"Language-Team: \n"
@@ -54,6 +54,9 @@ msgstr ""
msgid "images"
msgstr ""
msgid "tvguide: RemoteTimerModifications failed"
msgstr ""
msgid "root video folder"
msgstr "Hlavn<76> video adres<65>r"
@@ -885,15 +888,27 @@ msgstr ""
msgid "Use fixed folder"
msgstr ""
msgid "smart"
msgstr "chytr<74>"
msgid "Instant recording:"
msgstr ""
msgid "Folder for instant Recordings"
msgstr ""
msgid "Folder"
msgstr ""
msgid "Add episode to manual timers"
msgstr "Prida<64> epiz<69>dy do ru<72>n<EFBFBD>ho <20>asova<76>a"
msgid "Use Remotetimers"
msgstr "Pou<6F>i<EFBFBD> vzdialen<65> pl<70>nova<76>"
msgid "Favorites:"
msgstr ""
msgid "Limit channels in favorites"
msgstr ""

View File

@@ -96,10 +96,11 @@ cTimer *cRecManager::createTimer(const cEvent *event, std::string path) {
cTimer *cRecManager::createLocalTimer(const cEvent *event, std::string path) {
cTimer *timer = new cTimer(event);
#if VDRVERSNUM >= 20301
if (Setup.SVDRPPeering && *Setup.SVDRPDefaultHost)
((cTimer*)timer)->SetRemote(Setup.SVDRPDefaultHost);
LOCK_TIMERS_WRITE;
cTimers* timers = Timers;
timers->SetExplicitModify();
if (Setup.SVDRPPeering && *Setup.SVDRPDefaultHost)
timer->SetRemote(Setup.SVDRPDefaultHost);
#else
cTimers* timers = &Timers;
#endif
@@ -115,11 +116,20 @@ cTimer *cRecManager::createLocalTimer(const cEvent *event, std::string path) {
timer = t;
isyslog("timer %s reactivated", *t->ToDescr());
} else {
SetTimerPath(timer, event, path);
timers->Add(timer);
timers->SetModified();
#if VDRVERSNUM >= 20301
if (!HandleRemoteTimerModifications(timer)) {
timers->Del(timer);
esyslog(tr("tvguide: RemoteTimerModifications failed"));
} else {
isyslog("timer %s added (active)", *timer->ToDescr());
}
#else
isyslog("timer %s added (active)", *timer->ToDescr());
#endif
}
SetTimerPath(timer, event, path);
timers->SetModified();
return timer;
}
@@ -165,12 +175,25 @@ void cRecManager::SetTimerPath(cTimer *timer, const cEvent *event, std::string p
return;
}
//Set choosen path
bool addSubtitle = false;
if (!isempty(event->ShortText())) { // add subtitle if present
addSubtitle = (config.addSubtitleToTimer != addSubtitleNever);
if (config.addSubtitleToTimer == addSubtitleSmart)
if (event->Duration() > 80 * 60)
addSubtitle = false;
}
cString newFileName;
if (path.size() > 0) {
std::replace(path.begin(), path.end(), '/', '~');
newFileName = cString::sprintf("%s~%s", path.c_str(), timer->File());
if (addSubtitle)
newFileName = cString::sprintf("%s~%s~%s", path.c_str(), event->Title(), event->ShortText());
else
newFileName = cString::sprintf("%s~%s", path.c_str(), timer->File());
} else {
newFileName = event->Title();
if (addSubtitle)
newFileName = cString::sprintf("%s~%s", event->Title(), event->ShortText());
else
newFileName = event->Title();
}
timer->SetFile(*newFileName);
}
@@ -204,6 +227,12 @@ void cRecManager::DeleteTimer(const cTimer *timer) {
#if VDRVERSNUM >= 20301
LOCK_TIMERS_WRITE;
cTimers* timers = Timers;
if (timer && timer->Remote() && !timer->Recording()) {
if (HandleRemoteTimerModifications(NULL, (cTimer*)timer)) {
timers->Del((cTimer*)timer);
}
timers->SetModified();
}
cTimer* t = timers->GetTimer(timer);
#else
cTimers* timers = &Timers;
@@ -238,24 +267,33 @@ void cRecManager::DeleteRemoteTimer(const cEvent *event) {
}
}
void cRecManager::SaveTimer(const cTimer *t, cTimer newTimerSettings) {
void cRecManager::SaveTimer(const cTimer *t, cTimer *newTimerSettings) {
if (!t)
return;
#if VDRVERSNUM >= 20301
LOCK_TIMERS_WRITE;
cTimer *timer = Timers->GetTimer(t);
cTimers* timers = Timers;
timers->SetExplicitModify();
if (t && t->Remote()) {
if (!HandleRemoteTimerModifications(newTimerSettings, (cTimer *)t)) {
esyslog(tr("tvguide: RemoteTimerModifications failed"));
}
}
#else
cTimer *timer = Timers.GetTimer((cTimer*)t);
cTimers* timers = &Timers;
#endif
bool active = newTimerSettings.HasFlags(tfActive);
int prio = newTimerSettings.Priority();
int lifetime = newTimerSettings.Lifetime();
time_t day = newTimerSettings.Day();
int start = newTimerSettings.Start();
int stop = newTimerSettings.Stop();
std::string fileName = newTimerSettings.File();
cTimer *timer = timers->GetTimer(t);
if (!timer) {
return;
}
bool active = newTimerSettings->HasFlags(tfActive);
int prio = newTimerSettings->Priority();
int lifetime = newTimerSettings->Lifetime();
time_t day = newTimerSettings->Day();
int start = newTimerSettings->Start();
int stop = newTimerSettings->Stop();
std::string fileName = newTimerSettings->File();
timer->SetDay(day);
timer->SetStart(start);
@@ -264,10 +302,10 @@ void cRecManager::SaveTimer(const cTimer *t, cTimer newTimerSettings) {
timer->SetLifetime(lifetime);
timer->SetFile(fileName.c_str());
if (timer->HasFlags(tfActive) && !active)
timer->ClrFlags(tfActive);
else if (!timer->HasFlags(tfActive) && active)
timer->SetFlags(tfActive);
if (active)
timer->SetFlags(tfActive);
else
timer->ClrFlags(tfActive);
#if VDRVERSNUM < 20300
timer->SetEventFromSchedule();
@@ -280,9 +318,9 @@ void cRecManager::SaveTimer(const cTimer *t, cTimer newTimerSettings) {
RefreshRemoteTimers();
} else {
#if VDRVERSNUM >= 20301
Timers->SetModified();
timers->SetModified();
#else
Timers.SetModified();
timers.SetModified();
#endif
}
}

View File

@@ -37,7 +37,7 @@ public:
void DeleteTimer(const cEvent *event);
void DeleteLocalTimer(const cEvent *event);
void DeleteRemoteTimer(const cEvent *event);
void SaveTimer(const cTimer *timer, cTimer newTimerSettings);
void SaveTimer(const cTimer *timer, cTimer *newTimerSettings);
bool IsRecorded(const cEvent *event);
cTVGuideTimerConflicts *CheckTimerConflict(void);
void CreateSeriesTimer(cTimer *seriesTimer);

View File

@@ -467,17 +467,17 @@ const cTimer *cRecMenuEditTimer::GetOriginalTimer(void) {
return originalTimer;
}
cTimer cRecMenuEditTimer::GetTimer(void) {
cTimer t;
cTimer *cRecMenuEditTimer::GetTimer(void) {
cTimer *t = (cTimer *)originalTimer;
if (timerActive)
t.SetFlags(tfActive);
t->SetFlags(tfActive);
else
t.SetFlags(tfNone);
t.SetDay(day);
t.SetStart(start);
t.SetStop(stop);
t.SetPriority(prio);
t.SetLifetime(lifetime);
t->ClrFlags(tfActive);
t->SetDay(day);
t->SetStart(start);
t->SetStop(stop);
t->SetPriority(prio);
t->SetLifetime(lifetime);
std::string newFolder(folder);
std::string newFile = originalTimer->File();
size_t found = newFile.find_last_of('~');
@@ -492,7 +492,7 @@ cTimer cRecMenuEditTimer::GetTimer(void) {
newFile = *cString::sprintf("%s~%s", newFolder.c_str(), newFile.c_str());
}
std::replace(newFile.begin(), newFile.end(), '/', '~');
t.SetFile(newFile.c_str());
t->SetFile(newFile.c_str());
return t;
}

View File

@@ -136,7 +136,7 @@ public:
cRecMenuEditTimer(const cTimer *timer, eRecMenuState nextState);
const cTimer *GetOriginalTimer(void);
virtual ~cRecMenuEditTimer(void) {};
cTimer GetTimer(void);
cTimer *GetTimer(void);
};
/******************************************************************************************

View File

@@ -206,7 +206,7 @@ eOSState cRecMenuView::StateMachine(eRecMenuState nextState) {
case rmsSaveTimer: {
//caller: cRecMenuEditTimer
//save timer for active event
cTimer timerModified;
cTimer *timerModified;
const cTimer *originalTimer;
if (cRecMenuEditTimer *menu = dynamic_cast<cRecMenuEditTimer*>(activeMenu)) {
timerModified = menu->GetTimer();
@@ -290,7 +290,7 @@ eOSState cRecMenuView::StateMachine(eRecMenuState nextState) {
case rmsSaveTimerConflictMenu: {
//caller: cRecMenuEditTimer
//save timer from current timer conflict
cTimer timerModified;
cTimer *timerModified;
const cTimer *originalTimer;
if (cRecMenuEditTimer *menu = dynamic_cast<cRecMenuEditTimer*>(activeMenu)) {
timerModified = menu->GetTimer();
@@ -749,7 +749,7 @@ eOSState cRecMenuView::StateMachine(eRecMenuState nextState) {
}
break;}
case rmsTimelineTimerSave: {
cTimer timerModified;
cTimer *timerModified;
const cTimer *originalTimer;
if (cRecMenuEditTimer *menu = dynamic_cast<cRecMenuEditTimer*>(activeMenu)) {
timerModified = menu->GetTimer();

10
setup.c
View File

@@ -108,6 +108,7 @@ void cTvguideSetup::Store(void) {
SetupStore("footerHeightPercent", config.footerHeightPercent);
SetupStore("instRecFolderMode", config.instRecFolderMode);
SetupStore("instRecFixedFolder", config.instRecFixedFolder.c_str());
SetupStore("AddSubtitleToTimerMode", config.addSubtitleToTimer);
SetupStore("favWhatsOnNow", config.favWhatsOnNow);
SetupStore("favWhatsOnNext", config.favWhatsOnNext);
SetupStore("favUseTime1", config.favUseTime1);
@@ -410,6 +411,9 @@ cMenuSetupFavorites::cMenuSetupFavorites(cTVGuideConfig* data) : cMenuSetupSubM
recFolderMode[1] = tr("Select from folder list");
recFolderMode[2] = tr("Use fixed folder");
strn0cpy(fixedFolder, data->instRecFixedFolder.c_str(), sizeof(fixedFolder));
addSubtitleMode[0] = tr("never");
addSubtitleMode[1] = tr("smart");
addSubtitleMode[2] = tr("always");
switchModeItems[0] = (tr("switch"));
switchModeItems[1] = (tr("announce only"));
switchModeItems[2] = (tr("ask for switch"));
@@ -420,13 +424,15 @@ void cMenuSetupFavorites::Set(void) {
int currentItem = Current();
Clear();
Add(new cMenuEditStraItem(tr("Folder for instant Recordings"), &tmpConfig->instRecFolderMode, 3, recFolderMode));
Add(new cOsdItem(tr("Instant recording:"), osUnknown, false));
Add(new cMenuEditStraItem(tr("Folder for instant Recordings"), &tmpConfig->instRecFolderMode, 3, recFolderMode));
if (tmpConfig->instRecFolderMode == eFolderFixed) {
Add(new cMenuEditStrItem(cString::sprintf("%s%s", *indent, tr("Folder")), fixedFolder, sizeof(fixedFolder), trVDR(FileNameChars)));
}
Add(new cMenuEditStraItem(tr("Add episode to manual timers"), &tmpConfig->addSubtitleToTimer, 3, addSubtitleMode));
if (pRemoteTimers)
Add(new cMenuEditBoolItem(tr("Use Remotetimers"), &tmpConfig->useRemoteTimers));
Add(new cOsdItem(tr("Favorites:"), osUnknown, false));
Add(new cMenuEditBoolItem(tr("Limit channels in favorites"), &tmpConfig->favLimitChannels));
if (tmpConfig->favLimitChannels) {
Add(new cMenuEditChanItem(tr("Start Channel"), &tmpConfig->favStartChannel));

View File

@@ -70,6 +70,7 @@ class cMenuSetupFavorites : public cMenuSetupSubMenu {
char description3[256];
char description4[256];
const char * recFolderMode[3];
const char * addSubtitleMode[3];
const char * switchModeItems[3];
char fixedFolder[256];
void Set(void);

38
tools.c
View File

@@ -23,22 +23,47 @@ cPlugin *GetScraperPlugin(void) {
/****************************************************************************************
* CUTTEXT
****************************************************************************************/
std::string utf8_substr(const std::string& str, unsigned int start, long unsigned int leng) {
if (leng==0) { return ""; }
unsigned int c, i, ix, q;
long unsigned int min=std::string::npos, max=std::string::npos;
for (q=0, i=0, ix=str.length(); i < ix; i++, q++) {
if (q==start){ min=i; }
if (q<=start+leng || leng==std::string::npos){ max=i; }
c = (unsigned char) str[i];
if (c>=0 && c<=127) i+=0;
else if ((c & 0xE0) == 0xC0) i+=1;
else if ((c & 0xF0) == 0xE0) i+=2;
else if ((c & 0xF8) == 0xF0) i+=3;
//else if (($c & 0xFC) == 0xF8) i+=4; // 111110bb //byte 5, unnecessary in 4 byte UTF-8
//else if (($c & 0xFE) == 0xFC) i+=5; // 1111110b //byte 6, unnecessary in 4 byte UTF-8
else return "";//invalid utf8
}
if (q<=start+leng || leng==std::string::npos){ max=i; }
if (min==std::string::npos || max==std::string::npos) { return ""; }
return str.substr(min,max);
}
std::string CutText(std::string text, int width, const cFont *font) {
int actWidth = font->Width(text.c_str());
if (actWidth <= width) {
return text.c_str();
} else {
int i = std::max((actWidth - width) / font->Size(), 1);
int i = std::max(width / font->Size(), 1) - 1;
std::string cuttext, oldtext;
cuttext = utf8_substr(text, 0, i);
do {
text = text.substr(0, text.length() - i);
oldtext = cuttext;
i++;
cuttext = utf8_substr(text, 0, i);
std::stringstream sstrText;
sstrText << text << "....";
sstrText << cuttext << "...";
actWidth = font->Width(sstrText.str().c_str());
i = 1;
}
while ((actWidth > width) && (text.length() > 0));
while (actWidth < width);
std::stringstream sstrText2;
sstrText2 << text << "...";
sstrText2 << oldtext << "...";
return sstrText2.str();
}
}
@@ -105,7 +130,6 @@ void ReadRecordingDirectories(std::vector<std::string> *folders, cList<cNestedIt
}
}
/****************************************************************************************
* DrawRoundedCorners
****************************************************************************************/

View File

@@ -9,6 +9,7 @@
cPlugin *GetScraperPlugin(void);
std::string utf8_substr(const std::string& str, unsigned int start=0, long unsigned int leng=std::string::npos);
std::string CutText(std::string text, int width, const cFont *font);
std::string StrToLowerCase(std::string str);
std::string GetDirectoryFromTimer(std::string file);

View File

@@ -27,7 +27,7 @@
#error "VDR-2.0.0 API version or greater is required!"
#endif
static const char *VERSION = "1.2.16";
static const char *VERSION = "1.2.17";
static const char *DESCRIPTION = tr("A fancy 2d EPG Viewer");
static const char *MAINMENUENTRY = "Tvguide";