diff options
author | monty35 <videosrc@vdr.muc.bieringer.de> | 2008-12-20 09:09:06 +0100 |
---|---|---|
committer | monty35 <videosrc@vdr.muc.bieringer.de> | 2008-12-20 09:09:06 +0100 |
commit | 2a237889fdc45c83e04d36ed7b54b9c250462b18 (patch) | |
tree | 034e5af90960dcb03ff2c7c46c4a1c18d69d70b9 | |
parent | 0e5dff067bb4d810514ae2c57a5ba75036bb6abd (diff) | |
download | vdr-plugin-tvtv-2a237889fdc45c83e04d36ed7b54b9c250462b18.tar.gz vdr-plugin-tvtv-2a237889fdc45c83e04d36ed7b54b9c250462b18.tar.bz2 |
Import patch to 0.3.3p4
-rw-r--r-- | HISTORY | 11 | ||||
-rw-r--r-- | config.c | 2 | ||||
-rw-r--r-- | config.h | 20 | ||||
-rw-r--r-- | i18n.c | 62 | ||||
-rw-r--r-- | tvtv.c | 28 | ||||
-rw-r--r-- | tvtv_channelmap.conf_DVB_C_Mch | 57 | ||||
-rw-r--r-- | update.c | 63 |
7 files changed, 215 insertions, 28 deletions
@@ -1,6 +1,17 @@ VDR Plugin 'tvtv' Revision History ----------------------------------- +2008-06-08: Version 0.3.3ff +- Minor change to be compatible to 1.6.0 +- Fix segfault after manual update +- The time shift bugfix is now extended, option "auto" detects current + used timezone automatically and takes care (this covers daylight + saving time switches) (thx to monty35) +- Add option to define the format of the filename, Nature(Genre) and + Format can be included now (thx to monty35) + Note: existing timers would not be updated after a change (needs to be + impemented)! + 2007-02-06: Version 0.3.3 - The plugin needed to be restarted if username or password were changed since the "Packed String" (contains username and password) was only @@ -15,7 +15,7 @@ cTVTVConfig::cTVTVConfig(void) { strn0cpy(password, "", sizeof(password)); autoupdate=0; updatetime=30; - usegenre=1; + FormatRecordName = eRecordName_FormatNatureTitle; usestation=1; show_in_mainmenu=1; useproxy=0; @@ -14,6 +14,24 @@ #include <vdr/tools.h> #include <vdr/status.h> +enum eRecordName +{ + eRecordName_Title, + eRecordName_NatureTitle, + eRecordName_TitleNature, + eRecordName_FormatNatureTitle, + eRecordName_FormatTitleNature, + eRecordName_MAX +}; + +enum eTimeShiftBugfix +{ + eTimeShiftBugfixOff, + eTimeShiftBugfixAuto, + eTimeShiftBugfixManual, + eTimeShiftBugfixMAX +}; + struct cTVTVConfig { public: @@ -24,7 +42,7 @@ public: char password[30]; int updatetime; int autoupdate; - int usegenre; + int FormatRecordName; int usestation; int show_in_mainmenu; int useproxy; @@ -180,8 +180,8 @@ const tI18nPhrase Phrases[] = { #endif #endif }, - { "Use Nature within File Name", // English - "Genre im Dateinamen verwenden", // Deutsch + { "Format of File Name", // English + "Format des Dateinamens", // Deutsch "", // Slovenski "", // Italiano "", // Nederlands @@ -499,6 +499,64 @@ const tI18nPhrase Phrases[] = { #endif #endif }, + { "manual", // English + "manuell", // Deutsch + "", // Slovenski + "", // Italiano + "", // Nederlands + "", // Português + "", // Français + "", // Norsk + "", // Suomi + "", // Polski + "", // Español + "", // Greek + "", // Svenska + "", // Romaneste + "", // Magyar + "", // Català +#if VDRVERSNUM > 10302 + "", // Russian +#if VDRVERSNUM > 10307 + "", // Hrvatski +#if VDRVERSNUM > 10313 + "", // Eesti +#if VDRVERSNUM > 10316 + "", // Dansk +#endif +#endif +#endif +#endif + }, + { "auto (Timezone)", // English + "auto (Zeitzone)", // Deutsch + "", // Slovenski + "", // Italiano + "", // Nederlands + "", // Português + "", // Français + "", // Norsk + "", // Suomi + "", // Polski + "", // Español + "", // Greek + "", // Svenska + "", // Romaneste + "", // Magyar + "", // Català +#if VDRVERSNUM > 10302 + "", // Russian +#if VDRVERSNUM > 10307 + "", // Hrvatski +#if VDRVERSNUM > 10313 + "", // Eesti +#if VDRVERSNUM > 10316 + "", // Dansk +#endif +#endif +#endif +#endif + }, { "Reload ChannelMap", // English "ChannelMap neu laden", // Deutsch "", // Slovenski @@ -10,7 +10,7 @@ #include "update.h" -static const char *VERSION = "0.3.3"; +static const char *VERSION = "0.3.3p4"; static const char *DESCRIPTION = "TVTV Timers update"; static const char *MAINMENUENTRY = "TVTV"; @@ -46,6 +46,8 @@ class cMenuSetupTVTV : public cMenuSetupPage { private: cTVTVConfig data; virtual void Setup(void); + const char *cRecordNames[eRecordName_MAX]; + const char *timeshiftbugfixmodes[eTimeShiftBugfixMAX]; protected: virtual eOSState ProcessKey(eKeys Key); virtual void Store(void); @@ -63,6 +65,16 @@ void cMenuSetupTVTV::Setup(void) { Clear(); + cRecordNames[eRecordName_Title] = tr("Title"); + cRecordNames[eRecordName_NatureTitle] = tr("Nature/Title"); + cRecordNames[eRecordName_TitleNature] = tr("Title/Nature"); + cRecordNames[eRecordName_FormatNatureTitle] = tr("Format/Nature/Title"); + cRecordNames[eRecordName_FormatTitleNature] = tr("Format/Title/Nature"); + + timeshiftbugfixmodes[eTimeShiftBugfixOff] = tr("off"); + timeshiftbugfixmodes[eTimeShiftBugfixAuto] = tr("auto (Timezone)"); + timeshiftbugfixmodes[eTimeShiftBugfixManual] = tr("manual"); + Add(new cMenuEditStraItem( tr("TVTV Server"), &data.tvtv_server, TVTVSRV_CNT, TVTV_SERVERS)); Add(new cMenuEditStrItem( tr("TVTV User Name"), data.username, sizeof(data.username), tr(FileNameChars))); Add(new cMenuEditStrItem( tr("TVTV Password"), data.password, sizeof(data.password), tr(FileNameChars))); @@ -78,7 +90,7 @@ void cMenuSetupTVTV::Setup(void) { Add(new cMenuEditBoolItem( tr("Use VPS"), &data.usevps)); #endif - Add(new cMenuEditBoolItem( tr("Use Nature within File Name"), &data.usegenre)); + Add(new cMenuEditStraItem( tr("Format of File Name"), &data.FormatRecordName, eRecordName_MAX, cRecordNames)); Add(new cMenuEditBoolItem( tr("Use Station Name within File Name"), &data.usestation)); // Starting with VDR 1.3.44, the description of a recording is @@ -88,9 +100,9 @@ void cMenuSetupTVTV::Setup(void) { Add(new cMenuEditBoolItem( tr("Use TVTV description in info.vdr"), &data.usetvtvdescr)); #endif - Add(new cMenuEditBoolItem( tr("Time shift bugfix"), &data.tvtv_bugfix)); - if (data.tvtv_bugfix) - Add(new cMenuEditIntItem( tr(" Time shift (hrs)"), &data.tvtv_bugfix_hrs, 1, 4)); + Add(new cMenuEditStraItem( tr("Time shift bugfix"), &data.tvtv_bugfix, eTimeShiftBugfixMAX, timeshiftbugfixmodes)); + if (data.tvtv_bugfix == eTimeShiftBugfixManual) + Add(new cMenuEditIntItem( tr(" Time shift (hrs)"), &data.tvtv_bugfix_hrs, -23, 23)); Add(new cOsdItem(tr("Reload ChannelMap"),osUser9)); @@ -140,7 +152,7 @@ void cMenuSetupTVTV::Store(void) SetupStore("HTTPProxy", TVTVConfig.httpproxy); SetupStore("AutoUpdate", TVTVConfig.autoupdate); SetupStore("UpdateTime", TVTVConfig.updatetime); - SetupStore("UseGenreInFName", TVTVConfig.usegenre); + SetupStore("FormatRecordName", TVTVConfig.FormatRecordName); SetupStore("UseStationInFName", TVTVConfig.usestation); SetupStore("ShowInMainMenu", TVTVConfig.show_in_mainmenu); @@ -192,8 +204,8 @@ void cPluginTVTV::DisplayMessage(const char *s) { cStatus::MsgOsdStatusMessage(s); Interface->Wait(0); if (displayMessage) { - delete displayMessage; displayMessage = NULL; + delete displayMessage; cStatus::MsgOsdClear(); } else { @@ -284,7 +296,7 @@ bool cPluginTVTV::SetupParse(const char *Name, const char *Value) else if (!strcasecmp(Name, "HTTPProxy")) strcpy(TVTVConfig.httpproxy, Value); else if (!strcasecmp(Name, "AutoUpdate")) TVTVConfig.autoupdate = atoi(Value); else if (!strcasecmp(Name, "UpdateTime")) TVTVConfig.updatetime = atoi(Value); - else if (!strcasecmp(Name, "UseGenreInFName")) TVTVConfig.usegenre = atoi(Value); + else if (!strcasecmp(Name, "FormatRecordName")) TVTVConfig.FormatRecordName = atoi(Value); else if (!strcasecmp(Name, "UseStationInFName")) TVTVConfig.usestation = atoi(Value); else if (!strcasecmp(Name, "ShowInMainMenu")) TVTVConfig.show_in_mainmenu = atoi(Value); // VPS was introduced with VDR 1.3.5 diff --git a/tvtv_channelmap.conf_DVB_C_Mch b/tvtv_channelmap.conf_DVB_C_Mch new file mode 100644 index 0000000..4735c60 --- /dev/null +++ b/tvtv_channelmap.conf_DVB_C_Mch @@ -0,0 +1,57 @@ +////////////////////////////////////////////////////////////// +// ChannelMap for TVTV-Plugin +////////////////////////////////////////////////////////////// +// +// TVTV ChannelID = VDR ChannelID (Src-NID-TID-SID) +// +//// Kabelfernsehen Muenchen ab 8. Juni 2008 +// + +// 113 MHz +57 = C-1-1093-28487 // BR-alpha +31 = C-1-1073-28486 // SR Fernsehen + +// 394 MHz +2 = C-1-1079-28006 // ZDF +118 = C-1-1079-28007 // 3sat +963 = C-1-1079-28011 // ZDF infokanal +960 = C-1-1079-28014 // ZDF dokukanal +961 = C-1-1079-28016 // ZDF theaterkanal +63 = C-1-1079-28008 // KiKa + +// 410 MHz +1 = C-1-1101-28106 // ARD +17 = C-1-1101-28111 // WDR Köln +26 = C-1-1101-28108 // HR +18 = C-1-1101-28107 // BR3 +29 = C-1-1101-28113 // SWR BW + +// 426 MHz +35 = C-1-1073-28206 // rbb Berlin +30 = C-1-1073-28231 // SWR RP +//19 = C-1-1073-28224 // NDR FS MV +19 = C-1-1073-28225 // NDR FS HH +//19 = C-1-1073-28226 // NDR FS NDS +//19 = C-1-1073-28227 // NDR FS SH +33 = C-1-1073-28228 // MDR SACHSEN +//33 = C-1-1073-28229 // MDR S-ANHALT +//33 = C-1-1073-28230 // MDR THÜRINGEN + +// 466 MHz +206 = C-1-1051-28725 // Phoenix +10 = C-1-1051-28724 // ARTE +962 = C-1-1051-28721 // Eins Extra +955 = C-1-1051-28722 // Eins Festival +956 = C-1-1051-28723 // EinsPlus + +// 434 MHz +5 = C-1-1107-17500 // SAT.1 +6 = C-1-1107-17501 // ProSieben +8 = C-1-1107-17502 // Kabel eins +953 = C-1-1107-17503 // N24 + +// 442 MHz +4 = C-1-1089-12003 // RTL +9 = C-1-1089-12020 // RTL2 +11 = C-1-1089-12061 // VOX +179 = C-1-1089-12040 // Super RTL @@ -391,7 +391,7 @@ void cUpdate::ProcessImportedFile(const char *sBuffer) unsigned int p=0; size_t rp=0; bool vps = false; - tChannelID vdrch; + tChannelID vdrch, channelID; bool timer_update=false; #if VDRVERSNUM < 10336 unsigned int max_desc_len=0; @@ -400,6 +400,10 @@ void cUpdate::ProcessImportedFile(const char *sBuffer) time_t tStartTime, tVpsTime, tEndTime; struct tm tStart, tVps, tEnd; int StartTZ, VpsTZ, EndTZ; + + int tvtv_bugfix_secs = 0; /* seconds of TVTV bugfix (sends sometimes UTC instead of local time) */ + struct tm *timelocal; + time_t tloc; cTimer *oTimer = NULL; cTimer *ti = NULL; @@ -425,7 +429,7 @@ void cUpdate::ProcessImportedFile(const char *sBuffer) dsyslog("TVTV: Start reading timer jobs"); sLine = read_line_from_buffer(sBuffer, &p); while (!sLine->empty()) { - dsyslog("TVTV: Received '%s...'", sLine->substr(0,80).c_str()); + dsyslog("TVTV: Received '%s...'", sLine->substr(0,130).c_str()); tvtvjob=split_csv(sLine->c_str(), field_cnt); if (tvtvjob != NULL) { for (int i=0; i<field_cnt; i++) { @@ -491,22 +495,35 @@ void cUpdate::ProcessImportedFile(const char *sBuffer) localtime_r(&tStartTime, &tStart); localtime_r(&tVpsTime, &tVps); localtime_r(&tEndTime, &tEnd); - - // Adding Genre and Station Name to File Name to make it more unique - if (TVTVConfig.usegenre && ! tvtv_timer[DEF_TVTV_SCHEDULE_NAT].empty()) - s = tvtv_timer[DEF_TVTV_SCHEDULE_NAT] + "~"; - else - s = ""; + s = ""; // start + + // Adding optional Station Name to File Name to make it more unique if (TVTVConfig.usestation) #if VDRVERSNUM >= 10315 s = s + oTVTVChannel->ShortName(true) + "~"; #else s = s + oTVTVChannel->Name() + "~"; #endif - s += tvtv_timer[DEF_TVTV_SCHEDULE_TIT]; - - + + // Format as 1st + if (((TVTVConfig.FormatRecordName == eRecordName_FormatNatureTitle) || (TVTVConfig.FormatRecordName == eRecordName_FormatTitleNature)) && ! tvtv_timer[DEF_TVTV_SCHEDULE_FRM].empty()) { + s = tvtv_timer[DEF_TVTV_SCHEDULE_FRM] + "~"; + }; + + // Nature as 1st or 2nd before title + if (((TVTVConfig.FormatRecordName == eRecordName_NatureTitle) || (TVTVConfig.FormatRecordName == eRecordName_FormatNatureTitle)) && ! tvtv_timer[DEF_TVTV_SCHEDULE_NAT].empty()) { + s = tvtv_timer[DEF_TVTV_SCHEDULE_NAT] + "~"; + }; + + // Add Title to File Name + s += tvtv_timer[DEF_TVTV_SCHEDULE_TIT]; + + // Nature after title + if (((TVTVConfig.FormatRecordName == eRecordName_TitleNature) || (TVTVConfig.FormatRecordName == eRecordName_FormatTitleNature)) && ! tvtv_timer[DEF_TVTV_SCHEDULE_NAT].empty()) { + s = "~" + tvtv_timer[DEF_TVTV_SCHEDULE_NAT]; + }; + // Colons should be replaced by '|' in title rp = s.find(':',0 ); while (rp != string::npos) { s.replace(rp, 1, 1, '|'); rp = s.find(':',0 ); } @@ -519,7 +536,9 @@ void cUpdate::ProcessImportedFile(const char *sBuffer) #else oss << "1:"; #endif - oss << oTVTVChannel->GetChannelID().ToString() << ":"; + channelID = oTVTVChannel->GetChannelID(); + oss << *channelID.ToString(); + oss << ":"; // Starting with VDR 1.3.23 timer entries support a full date in ISO notation. #if VDRVERSNUM >= 10323 @@ -621,10 +640,22 @@ void cUpdate::ProcessImportedFile(const char *sBuffer) if (timer_update) { // Timer exists if (tvtv_timer[DEF_TVTV_SCHEDULE_ACT] == "rec") { - // avoid Timer updates if Timer is shifted exactly 1 or 2 hours earlier (TVTV Problem) - if (TVTVConfig.tvtv_bugfix && ((((ti->StartTime() - tStartTime) == TVTVConfig.tvtv_bugfix_hrs*3600) && - ((ti->StopTime() - tEndTime) == TVTVConfig.tvtv_bugfix_hrs*3600)) || - (vps && ((ti->StopTime() - tEndTime) == TVTVConfig.tvtv_bugfix_hrs*3600)) )) { + // avoid Timer updates if Timer is shifted (TVTV UTC Problem) + if (TVTVConfig.tvtv_bugfix == eTimeShiftBugfixManual) { + // exactly configured hours + dsyslog("TVTV: manual configured timezone shift: %d hrs", TVTVConfig.tvtv_bugfix_hrs); + tvtv_bugfix_secs = TVTVConfig.tvtv_bugfix_hrs * 3600; + } else if (TVTVConfig.tvtv_bugfix == eTimeShiftBugfixAuto) { + // autodetect time zone distance + time(&tloc); + timelocal = localtime(&tloc); + dsyslog("TVTV: autodetected timezone: %s, shift: %d hrs", timelocal->tm_zone, (int) (timelocal->tm_gmtoff / 3600)); + tvtv_bugfix_secs = timelocal->tm_gmtoff; + }; + + if ((TVTVConfig.tvtv_bugfix != eTimeShiftBugfixOff) && ((((ti->StartTime() - tStartTime) == tvtv_bugfix_secs) && + ((ti->StopTime() - tEndTime) == tvtv_bugfix_secs)) || + (vps && ((ti->StopTime() - tEndTime) == tvtv_bugfix_secs)) )) { isyslog("TVTV: timer %d update rejected (%s) [%s/%s/%d/%04d-%04d/%s]", ti->Index() + 1, ti->File(), tvtv_timer[DEF_TVTV_SCHEDULE_UID].c_str(), |