infosatepg-0.0.12/0000755000175000001440000000000012045655010013140 5ustar martinusersinfosatepg-0.0.12/filter.h0000644000175000001440000000166212034066603014605 0ustar martinusers/* * filter.cpp: A plugin for the Video Disk Recorder * * See the README file for copyright information and how to reach the author. * * $Id$ */ #ifndef __filter_h_ #define __filter_h_ #include #include #include #include "global.h" struct infosathdr { u_short technisatId; u_char tableId; u_char tablesubId; u_char day; u_char month; u_char res6; u_char res7; u_short pktnr; u_short pktcnt; }; // --- cFilterInfosatepg class cFilterInfosatepg : public cFilter { private: cGlobalInfosatepg *global; u_long do_sum(u_long sum, u_char *buf, int nBytes); u_short foldsum(u_long sum); u_short IPChecksum(ip *ipHeader); u_short UDPChecksum(ip *ipHeader, udphdr *udpHeader); protected: virtual void Process(u_short Pid, u_char Tid, const u_char *Data, int Length); public: cFilterInfosatepg(cGlobalInfosatepg *Global); }; #endif infosatepg-0.0.12/po/0000755000175000001440000000000012045646602013565 5ustar martinusersinfosatepg-0.0.12/po/de_DE.po0000644000175000001440000001614212034066603015064 0ustar martinusers# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the infosatepg package. # Jochen Dolze , 2008 # msgid "" msgstr "" "Project-Id-Version: vdr-1.6.0\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2009-03-12 13:00+0100\n" "PO-Revision-Date: 2008-05-02 16:20+0200\n" "Last-Translator: Jochen Dolze \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" msgid "Infosat plugin still working" msgstr "Infosat Plugin ist noch nicht fertig" msgid "Menu$infosatepg" msgstr "Infosatepg" msgid "Content$Movie/Drama" msgstr "Spielfilm/Drama" msgid "Content$News/Current Affairs" msgstr "Nachrichten" msgid "Content$Show/Game Show" msgstr "Show/Gameshow" msgid "Content$Sports" msgstr "Sport" msgid "Content$Children's/Youth Programmes" msgstr "Kinder/Jugendprogramm" msgid "Content$Music/Ballet/Dance" msgstr "Musik/Ballet/Tanz" msgid "Content$Arts/Culture" msgstr "Kunst/Kultur" msgid "Content$Social/Political/Economics" msgstr "Soziales/Politikereignisse/Wirtschaft" msgid "Content$Education/Science/Factual" msgstr "Dokumentation/Magazin" msgid "Content$Leisure/Hobbies" msgstr "Reise/Freizeit" msgid "Content$Special" msgstr "Spezial" msgid "Content$Userdefined" msgstr "benutzerdefiniert" msgid "Content$Detective/Thriller" msgstr "Kriminalfilm/Thriller" msgid "Content$Adventure/Western/War" msgstr "Abenteuerfilm/Western/Kriegsfilm" msgid "Content$Science Fiction/Fantasy/Horror" msgstr "Science-Fiction/Fantasy/Horror" msgid "Content$Comedy" msgstr "Comedy" msgid "Content$Soap/Melodrama/Folkloric" msgstr "Soap/Melodram/Folklore" msgid "Content$Romance" msgstr "Romantik" msgid "Content$Serious/Classical/Religious/Historical Movie/Drama" msgstr "Anspuchsvoller/klassischer/religiöser/historischer Spielfilm/Drama" msgid "Content$Adult Movie/Drama" msgstr "XXX Spielfilm/Drama" msgid "Content$News/Weather Report" msgstr "Nachrichten/Wetter" msgid "Content$News Magazine" msgstr "Nachrichtenmagazin" msgid "Content$Documentary" msgstr "Dokumentation" msgid "Content$Discussion/Inverview/Debate" msgstr "Diskussion/Interview/Debatte" msgid "Content$Game Show/Quiz/Contest" msgstr "Show/Gameshow" msgid "Content$Variety Show" msgstr "Verietee" msgid "Content$Talk Show" msgstr "Talkshow" msgid "Content$Special Event" msgstr "Besonderes Ereignis" msgid "Content$Sport Magazine" msgstr "Sportmagazin" msgid "Content$Football" msgstr "Fußball" msgid "Content$Tennis/Squash" msgstr "Tennis/Sqash" msgid "Content$Team Sports" msgstr "Mannschaftssport" msgid "Content$Athletics" msgstr "Leichtathletik" msgid "Content$Motor Sport" msgstr "Motorsport" msgid "Content$Water Sport" msgstr "Wassersport" msgid "Content$Winter Sports" msgstr "Wintersport" msgid "Content$Equestrian" msgstr "Reitsport" msgid "Content$Martial Sports" msgstr "Kampfsport" msgid "Content$Pre-school Children's Programmes" msgstr "Programm für Vorschulkinder" msgid "Content$Entertainment Programmes for 6 to 14" msgstr "Unterhaltungsprogramm für 6 bis 14-Jährige" msgid "Content$Entertainment Programmes for 10 to 16" msgstr "Unterhaltungsprogramm für 10 bis 16-Jährige" msgid "Content$Informational/Educational/School Programme" msgstr "Informations- und Bildungsprogramm" msgid "Content$Cartoons/Puppets" msgstr "Trickfilm" msgid "Content$Rock/Pop" msgstr "Rock/Pop" msgid "Content$Serious/Classical Music" msgstr "Klassische Musik" msgid "Content$Folk/Tradional Music" msgstr "Volksmusik/traditionelle Musik" msgid "Content$Jazz" msgstr "Jazz" msgid "Content$Musical/Opera" msgstr "Musical/Oper" msgid "Content$Ballet" msgstr "Ballett" msgid "Content$Performing Arts" msgstr "Darstellende Künste" msgid "Content$Fine Arts" msgstr "Kunstwissenschaft" msgid "Content$Religion" msgstr "Religion" msgid "Content$Popular Culture/Traditional Arts" msgstr "Volkskunst" msgid "Content$Literature" msgstr "Literatur" msgid "Content$Film/Cinema" msgstr "Film/Kino" msgid "Content$Experimental Film/Video" msgstr "Experimentalfilm/Video" msgid "Content$Broadcasting/Press" msgstr "Rundfunk/Presse" msgid "Content$New Media" msgstr "Neue Medien" msgid "Content$Arts/Culture Magazines" msgstr "Kunstmagazin/Kulturmagazin" msgid "Content$Fashion" msgstr "Mode" msgid "Content$Magazines/Reports/Documentary" msgstr "Magazin/Report/Dokumentation" msgid "Content$Economics/Social Advisory" msgstr "Wirtschaft/Soziales" msgid "Content$Remarkable People" msgstr "Persönlichkeiten" msgid "Content$Nature/Animals/Environment" msgstr "Natur/Tiere/Umwelt" msgid "Content$Technology/Natural Sciences" msgstr "Technik/Naturwissenschaft" msgid "Content$Medicine/Physiology/Psychology" msgstr "Medizin/Physiologie/Psychologie" msgid "Content$Foreign Countries/Expeditions" msgstr "Ausland/Forschungsreisen" msgid "Content$Social/Spiritual Sciences" msgstr "Sozial- und Geisteswissenschaften" msgid "Content$Further Education" msgstr "Weiterbildung" msgid "Content$Languages" msgstr "Sprachen" msgid "Content$Tourism/Travel" msgstr "Tourismus/Reise" msgid "Content$Handicraft" msgstr "Handwerk" msgid "Content$Motoring" msgstr "Kraftfahrzeuge" msgid "Content$Fitness & Health" msgstr "Fitness und Gesundheit" msgid "Content$Cooking" msgstr "Kochen" msgid "Content$Advertisement/Shopping" msgstr "Werbung/Einkauf" msgid "Content$Gardening" msgstr "Garten" msgid "Content$Original Language" msgstr "Originalton" msgid "Content$Black & White" msgstr "Schwarz & Weiss" msgid "Content$Unpublished" msgstr "Unveröffentlicht" msgid "Content$Live Broadcast" msgstr "Livesendung" msgid "Content$Special Characteristics" msgstr "spezielle Eigenschaften" msgid "Content$Drama" msgstr "Drama" msgid "Infosat channellist available" msgstr "Infosat Kanalliste verfügbar" msgid "Scan parameter" msgstr "Scan Parameter" msgid "Source" msgstr "Quelle" msgid "Frequency" msgstr "Frequenz" msgid "Polarization" msgstr "Polarisation" msgid "Srate" msgstr "Symbolrate" msgid "Pid" msgstr "Pid" msgid "Using channel" msgstr "Verwende Kanal" msgid "none" msgstr "keinen" msgid "Event options" msgstr "Ereignis Optionen" msgid "Wait time [s]" msgstr "Wartezeit [s]" msgid "General options" msgstr "Sonstige Optionen" msgid "Hide main menu" msgstr "Verstecke Hauptmenü" msgid "Prevent wakeup" msgstr "Verhindere autom. aufwachen" msgid "Prevent deferred shutdown" msgstr "Verhindere verzögertes abschalten" msgid "Infosat channels" msgstr "Infosat Kanäle" msgid "used" msgstr "ausgewählt" msgid "Button$Reset" msgstr "Reset" msgid "Button$Copy" msgstr "Kopieren" msgid "Days in advance" msgstr "Anzahl Tage" msgid "Short text" msgstr "Kurztext" msgid "Long text" msgstr "Langtext" msgid "Merge long texts" msgstr "Langtexte zusammenführen" msgid "Extended EPG" msgstr "Erweiterte EPG Infos" msgid "Append non existing events" msgstr "Erstelle neue Ereignisse" msgid "Reset all channel settings?" msgstr "Alle Kanäle zurücksetzen?" msgid "Copy settings to all channels?" msgstr "Einstellungen auf alle Kanäle kopieren?" msgid "Read EPG info from infosat" msgstr "Liest EPG infos von Infosat" infosatepg-0.0.12/po/it_IT.po0000644000175000001440000001654312034066603015141 0ustar martinusers# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the infosatepg package. # Jochen Dolze , 2008 # msgid "" msgstr "" "Project-Id-Version: vdr-1.6.0\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2009-03-12 13:00+0100\n" "PO-Revision-Date: 2009-07-15 23:26+0100\n" "Last-Translator: Diego Pierotto \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Poedit-Language: Italian\n" "X-Poedit-Country: ITALY\n" "X-Poedit-SourceCharset: utf-8\n" msgid "Infosat plugin still working" msgstr "Il plugin Infosat è ancora in funzione" msgid "Menu$infosatepg" msgstr "Infosatepg" msgid "Content$Movie/Drama" msgstr "Film/Dramma" msgid "Content$News/Current Affairs" msgstr "Notizie/Ultima ora" msgid "Content$Show/Game Show" msgstr "Spettacolo/Gioco a premi" msgid "Content$Sports" msgstr "Sport" msgid "Content$Children's/Youth Programmes" msgstr "Programmi per ragazzi/giovani" msgid "Content$Music/Ballet/Dance" msgstr "Musica/Balletto/Danza" msgid "Content$Arts/Culture" msgstr "Arte/Cultura" msgid "Content$Social/Political/Economics" msgstr "Società/Politica/Economia" msgid "Content$Education/Science/Factual" msgstr "Educazione/Scienza/Fatti" msgid "Content$Leisure/Hobbies" msgstr "Tempo libero/Hobby" msgid "Content$Special" msgstr "Evento speciale" msgid "Content$Userdefined" msgstr "Linguaggio preferito per il contenuto:" msgid "Content$Detective/Thriller" msgstr "Investigativo/Giallo" msgid "Content$Adventure/Western/War" msgstr "Avventura/Western/Guerra" msgid "Content$Science Fiction/Fantasy/Horror" msgstr "Finzione/Fantasia/Horror" msgid "Content$Comedy" msgstr "Commedia" msgid "Content$Soap/Melodrama/Folkloric" msgstr "Telenovella/Melodramma/Folcloristico" msgid "Content$Romance" msgstr "Romanzo" msgid "Content$Serious/Classical/Religious/Historical Movie/Drama" msgstr "Serio/Classico/Religioso/Film storico/Dramma" msgid "Content$Adult Movie/Drama" msgstr "Film per adulti/Dramma" msgid "Content$News/Weather Report" msgstr "Notizie/Previsioni meteo" msgid "Content$News Magazine" msgstr "Rivista di notizie" msgid "Content$Documentary" msgstr "Documentario" msgid "Content$Discussion/Inverview/Debate" msgstr "Discussione/Intervista/Dibattito" msgid "Content$Game Show/Quiz/Contest" msgstr "Gioco a premi/Quiz/Gara" msgid "Content$Variety Show" msgstr "Spettacolo di varietà" msgid "Content$Talk Show" msgstr "Talk Show" msgid "Content$Special Event" msgstr "Evento speciale" msgid "Content$Sport Magazine" msgstr "Rivista di sport" msgid "Content$Football" msgstr "Calcio" msgid "Content$Tennis/Squash" msgstr "Tennis/Squash" msgid "Content$Team Sports" msgstr "Sport di squadra" msgid "Content$Athletics" msgstr "Atletica" msgid "Content$Motor Sport" msgstr "Sport motoristici" msgid "Content$Water Sport" msgstr "Sport acquatici" msgid "Content$Winter Sports" msgstr "Sport invernali" msgid "Content$Equestrian" msgstr "Equitazione" msgid "Content$Martial Sports" msgstr "Arti marziali" msgid "Content$Pre-school Children's Programmes" msgstr "Programmi per ragazzi prescolastici" msgid "Content$Entertainment Programmes for 6 to 14" msgstr "Programmi di intrattenimento da 6 a 14" msgid "Content$Entertainment Programmes for 10 to 16" msgstr "Programmi di intrattenimento da 10 a 16" msgid "Content$Informational/Educational/School Programme" msgstr "Informativo/Educativo/Programma scolastico" msgid "Content$Cartoons/Puppets" msgstr "Cartoni/Pupazzi" msgid "Content$Rock/Pop" msgstr "Rock/Pop" msgid "Content$Serious/Classical Music" msgstr "Serio/Musica classica" msgid "Content$Folk/Tradional Music" msgstr "Folclore/Musica tradizionale" msgid "Content$Jazz" msgstr "Jazz" msgid "Content$Musical/Opera" msgstr "Musical/Opera" msgid "Content$Ballet" msgstr "Balletto" msgid "Content$Performing Arts" msgstr "Arti di rendimento" msgid "Content$Fine Arts" msgstr "Arti fine" msgid "Content$Religion" msgstr "Religione" msgid "Content$Popular Culture/Traditional Arts" msgstr "Cultura popolare/Arti tradizionali" msgid "Content$Literature" msgstr "Letteratura" msgid "Content$Film/Cinema" msgstr "Film/Cinema" msgid "Content$Experimental Film/Video" msgstr "Film esperimentale/Video" msgid "Content$Broadcasting/Press" msgstr "Trasmissione/Stampa" msgid "Content$New Media" msgstr "Nuovo programma" msgid "Content$Arts/Culture Magazines" msgstr "Arte/Riviste di cultura" msgid "Content$Fashion" msgstr "Moda" msgid "Content$Magazines/Reports/Documentary" msgstr "Riviste/Reportage/Documentari" msgid "Content$Economics/Social Advisory" msgstr "Economia/Consulenza sociale" msgid "Content$Remarkable People" msgstr "Personaggi importanti" msgid "Content$Nature/Animals/Environment" msgstr "Natura/Animali/Ambiente" msgid "Content$Technology/Natural Sciences" msgstr "Tecnologia/Scienze naturali" msgid "Content$Medicine/Physiology/Psychology" msgstr "Medicina/Filosofia/Psicologia" msgid "Content$Foreign Countries/Expeditions" msgstr "Paesi esteri/Spedizioni" msgid "Content$Social/Spiritual Sciences" msgstr "Società/Scienze spirituali" msgid "Content$Further Education" msgstr "Altra educazione" msgid "Content$Languages" msgstr "Lingue" msgid "Content$Tourism/Travel" msgstr "Turismo/Viaggi" msgid "Content$Handicraft" msgstr "Artigianato" msgid "Content$Motoring" msgstr "Motori" msgid "Content$Fitness & Health" msgstr "Culturismo & Salute" msgid "Content$Cooking" msgstr "Cucina" msgid "Content$Advertisement/Shopping" msgstr "Pubblicità/Acquisti" msgid "Content$Gardening" msgstr "Giardinaggio" msgid "Content$Original Language" msgstr "Lingua madre" msgid "Content$Black & White" msgstr "Bianco & Nero" msgid "Content$Unpublished" msgstr "Non pubblicato" msgid "Content$Live Broadcast" msgstr "Trasmissione dal vivo" msgid "Content$Special Characteristics" msgstr "Caratteristiche speciali" msgid "Content$Drama" msgstr "Dramma" msgid "Infosat channellist available" msgstr "Lista canale Infosat disponibile" msgid "Scan parameter" msgstr "Parametri scansione" msgid "Source" msgstr "Sorgente" msgid "Frequency" msgstr "Frequenza" msgid "Polarization" msgstr "Polarizzazione" msgid "Srate" msgstr "SymbolRate" msgid "Pid" msgstr "PID" msgid "Using channel" msgstr "Canale usato" msgid "none" msgstr "nessuno" msgid "Event options" msgstr "Opzioni evento" msgid "Wait time [s]" msgstr "Tempo di attesa [s]" msgid "General options" msgstr "Opzioni generali" msgid "Hide main menu" msgstr "Nascondi voce menu principale" msgid "Prevent wakeup" msgstr "Evita riaccensione" msgid "Prevent deferred shutdown" msgstr "Evita spegnimento differito" msgid "Infosat channels" msgstr "Canali Infosat" msgid "used" msgstr "utilizzato" msgid "Button$Reset" msgstr "Reimposta" msgid "Button$Copy" msgstr "Copia" msgid "Days in advance" msgstr "Giorni successivi" msgid "Short text" msgstr "Testo breve" msgid "Long text" msgstr "Testo lungo" msgid "Merge long texts" msgstr "Unisci testi lunghi" msgid "Extended EPG" msgstr "EPG esteso" msgid "Append non existing events" msgstr "Aggiungi eventi non esistenti" msgid "Reset all channel settings?" msgstr "Reimpostare tutte le impostazioni dei canali?" msgid "Copy settings to all channels?" msgstr "Copiare impostazioni nei canali?" msgid "Read EPG info from infosat" msgstr "Legge info EPG da Infosat" infosatepg-0.0.12/global.h0000644000175000001440000001113412034066603014553 0ustar martinusers/* * global.h: A plugin for the Video Disk Recorder * * See the README file for copyright information and how to reach the author. * * $Id$ */ #ifndef __global_h_ #define __global_h_ #include #include #include #include #include #include #include #define MIN_WAITTIME 10 // s #define MAX_WAITTIME 120 // s class cGlobalInfosatdata { #define _GetByte(ptr, bitnum) ((((char*)ptr)+bitnum/8)) #define _GetBit(ptr, bitnum) ((*_GetByte(ptr, bitnum) >> (bitnum%8)) & 1) #define _SetBit(ptr, bitnum, val) (val ? \ (*_GetByte(ptr, bitnum) |= (1<<(bitnum%8))) : \ (*_GetByte(ptr, bitnum) &= ~(1<<(bitnum%8)))) private: bool receivedall; int receivedpercent; int lastpkt; int missed; u_char day; u_char month; u_short pktcnt; u_char bitfield[8192]; char file[1024]; public: cGlobalInfosatdata(); bool Processed; int Unlocated; // unlocated events int Missed() { return missed; } bool ReceivedAll() { return receivedall; } void ResetReceivedAll() { Init(file,0,0,0); } bool CheckReceivedAll(); void CheckMissed(int ActualPacket); void SetLastPkt(int ActualPacket) { lastpkt = ActualPacket; } int ReceivedPercent() { return receivedpercent; } int Day() { return day; } int Month() { return month; } bool GetBit (int Bitnumber) { return _GetBit (bitfield,Bitnumber); } void SetBit (int Bitnumber,bool Value) { _SetBit (bitfield,Bitnumber,Value); } const char *GetFile() const // used in process.cpp { return (char *) &file; } bool NeverSeen (int Day, int Month, int Packetcount); void Init (char *File, int Day, int Month, int Packetcount); int Load (int fd); int Save (int fd); #ifdef INFOSATEPG_DEBUG void Debug (const char *Directory); #endif }; class cGlobalInfosatepg { // Usage field definition // Bit 0-15 USE_ flags // Bit 16-19 DAYS in advance // Bit 20-30 reserved for future used // Bit 31 always zero #define USE_SHORTTEXT 1 #define USE_LONGTEXT 2 #define USE_EXTEPG 4 #define USE_MERGELONGTEXT 8 #define USE_APPEND 16 #define USE_NOTHING 0 struct infosatchannels { tChannelID ChannelID; int Days; int Usage; }; #define EPG_FIRST_DAY_MAC 1 #define EPG_LAST_DAY_MAC 7 #define EPG_DAYS 7 private: const char *directory; u_char MAC[5]; time_t timer; bool switched; int this_day; int this_month; int numinfosatchannels; time_t wakeuptime; struct infosatchannels *infosatchannels; int channel; public: cGlobalInfosatepg(); ~cGlobalInfosatepg(); cGlobalInfosatdata Infosatdata[EPG_DAYS+1]; void SetWakeupTime(time_t Time) { if (Time==(time_t) -1) return; if ((Time>wakeuptime) && (wakeuptime!=(time_t) -1)) return; // already set wakeuptime=Time; isyslog("infosatepg: wakeup set to %s", ctime(&wakeuptime)); } bool NoWakeup; bool NoDeferredShutdown; time_t WakeupTime() { return wakeuptime; } int LastCurrentChannel; int Channel() { return channel; } bool FindReceiverChannel(); int Frequency; char Polarization; int Srate; int Pid; int WaitTime; const char *Directory() { return directory; } bool SetDirectory (const char *Directory); bool CheckMAC (ether_header *eth_hdr); void SetWaitTimer() { timer=time (NULL); } bool WaitOk() { return (time (NULL) > (timer+ (time_t) WaitTime)); } void SetSwitched (bool Value) { switched=Value; } bool Switched() { return switched; } int Load(); int Save(); bool ProcessedAll(); void ResetProcessed (void); void ResetReceivedAll(void); bool ReceivedAll (int *Day, int *Month); bool ReceivedAll() { return ReceivedAll (NULL,NULL); } void AddChannel (tChannelID ChannelID,int Usage, int Days); void RemoveChannel(int Index); tChannelID GetChannelID (int Index); bool SetChannelOptions(int Index,int Usage,int Days); int GetChannelUsage(int Index); int GetChannelDays(int Index); bool ChannelExists (tChannelID ChannelID,int *Index); int InfosatChannels() { return numinfosatchannels; } int ActualMac; bool HideMainMenu; }; #endif infosatepg-0.0.12/status.h0000644000175000001440000000133412034217737014645 0ustar martinusers/* * status.h: A plugin for the Video Disk Recorder * * See the README file for copyright information and how to reach the author. * * $Id$ */ #ifndef __status_h_ #define __status_h_ #include #include "filter.h" #include "global.h" // --- cStatusInfosatepg class cStatusInfosatepg : public cStatus { private: cFilterInfosatepg *myFilter; cDevice *myFilterDevice; cGlobalInfosatepg *global; protected: #if APIVERSNUM >= 10726 virtual void ChannelSwitch(const cDevice *Device, int ChannelNumber, bool LiveView); #else virtual void ChannelSwitch(const cDevice *Device, int ChannelNumber); #endif public: cStatusInfosatepg(cGlobalInfosatepg *Global); virtual ~cStatusInfosatepg(void); }; #endif infosatepg-0.0.12/filter.cpp0000644000175000001440000001242212034066603015134 0ustar martinusers/* * filter.cpp: A plugin for the Video Disk Recorder * * See the README file for copyright information and how to reach the author. * * $Id$ */ #include #include #include #include #include #include "filter.h" #undef WRITE_RAW #if __GNUC__ > 3 #define UNUSED(v) UNUSED_ ## v __attribute__((unused)) #else #define UNUSED(x) x #endif cFilterInfosatepg::cFilterInfosatepg(cGlobalInfosatepg *Global) { global = Global; Set(global->Pid,0,0); } u_long cFilterInfosatepg::do_sum(u_long sum, u_char *buf, int nBytes) { int nleft=nBytes; u_short *w = (u_short*)buf; while (nleft > 1) { sum += *w++; nleft -= 2; } if (nleft == 1) { u_short answer = 0; *(u_char*)(&answer) = *(u_char*)w; sum += answer; } return sum; } u_short cFilterInfosatepg::foldsum(u_long sum) { while (sum>>16) sum = (sum >> 16) + (sum & 0xFFFF); return ((u_short) ~sum); } u_short cFilterInfosatepg::IPChecksum(ip *ipHeader) { return foldsum(do_sum(0, (u_char*) ipHeader, sizeof(ip))); } /* IpChecksum() */ u_short cFilterInfosatepg::UDPChecksum(ip *ipHeader, udphdr *udpHeader) { u_long sum = 0; // Ip-Pseudo-Header sum = do_sum(sum, (u_char*)(&ipHeader->ip_src), sizeof(ipHeader->ip_src)); sum = do_sum(sum, (u_char*)(&ipHeader->ip_dst), sizeof(ipHeader->ip_dst)); #ifdef __linux__ sum += udpHeader->len; #else sum += udpHeader->uh_ulen; #endif sum += ipHeader->ip_p<<8; #ifdef __linux__ sum = do_sum(sum, (u_char*)udpHeader, ntohs(udpHeader->len)); #else sum = do_sum(sum, (u_char*)udpHeader, ntohs(udpHeader->uh_ulen)); #endif return foldsum(sum); } void cFilterInfosatepg::Process(u_short UNUSED(Pid), u_char UNUSED(Tid), const u_char *Data, int Length) { #define SECT_IP_HDR_START 12 #define SECT_UDP_HDR_START 32 #define SECT_IS_HDR_START 40 #define SECT_IS_DATA_START 52 if (Data[0]!=0x3E) return; struct ether_header eth_hdr; memset(ð_hdr,0,sizeof(struct ether_header)); eth_hdr.ether_dhost[0]=Data[11]; eth_hdr.ether_dhost[1]=Data[10]; eth_hdr.ether_dhost[2]=Data[9]; eth_hdr.ether_dhost[3]=Data[8]; eth_hdr.ether_dhost[4]=Data[4]; eth_hdr.ether_dhost[5]=Data[3]; // check mac and range if (!global->CheckMAC(ð_hdr)) return; int mac = eth_hdr.ether_dhost[5]; global->ActualMac=mac; struct ip *ip_hdr = (ip *) &Data[SECT_IP_HDR_START]; struct udphdr *udp_hdr = (udphdr *) &Data[SECT_UDP_HDR_START]; // Only IPv4 if (ip_hdr->ip_v!=4) return; // Check IP checksum if (IPChecksum(ip_hdr)!=0) { esyslog("infosatepg: ip checksum error"); return; } // Only UDP if (ip_hdr->ip_p!=17) return; // Check UDP checksum if (UDPChecksum(ip_hdr,udp_hdr)!=0) { esyslog("infosatepg: udp checksum error"); return; } struct infosathdr *ishdr = (struct infosathdr*) &Data[SECT_IS_HDR_START]; if (ntohs(ishdr->technisatId)!=0x0001) return; int pktnr = ntohs(ishdr->pktnr); int pktcnt = ntohs(ishdr->pktcnt); const u_char *infosatdata = &Data[SECT_IS_DATA_START]; int len = Length - SECT_IS_DATA_START-4; char file[1024]; snprintf(file,sizeof(file),"%s/infosatepg%02i%02i_%03i.dat",global->Directory(),ishdr->day,ishdr->month, pktcnt); if (global->Infosatdata[mac].NeverSeen(ishdr->day,ishdr->month,pktcnt)) { // never seen such a packet -> init structure global->Infosatdata[mac].Init(file,ishdr->day,ishdr->month,pktcnt); } // Check if we missed a packet global->Infosatdata[mac].CheckMissed(pktnr); // Check if we already have this packet if (global->Infosatdata[mac].GetBit(pktnr)) { global->Infosatdata[mac].SetLastPkt(pktnr); return; } #ifdef VDRDEBUG dsyslog("infosatepg: mac=%02x-%02x-%02x-%02x-%02x-%02x",eth_hdr.ether_dhost[0],eth_hdr.ether_dhost[1], eth_hdr.ether_dhost[2],eth_hdr.ether_dhost[3],eth_hdr.ether_dhost[4],eth_hdr.ether_dhost[5] ); dsyslog("infosatepg: tid=%04i tbl=%04i stbl=%04i day=%02i month=%02i pktnr=%03i pktcnt=%03i len=%i", ntohs(ishdr->technisatId),ishdr->tableId,ishdr->tablesubId,ishdr->day, ishdr->month, pktnr, pktcnt, len); dsyslog("infosatepg: save to %s", file); #endif int f=open(file,O_RDWR|O_CREAT,0664); if (f==-1) { if (errno!=ENOSPC) { esyslog("infosatepg: unable to create file '%s'", file); } return; } off_t offset = (off_t) (pktnr*1400); if (lseek(f,offset,SEEK_SET)!=(off_t) -1) { #ifdef VDRDEBUG dsyslog("infosatepg: writing to %li",offset); #endif if (write(f,infosatdata,len)==len) { // set bit in Infosatdata bitfield global->Infosatdata[mac].SetBit(pktnr,true); } } close(f); #ifdef WRITE_RAW sprintf(file,"%s/%03i.dat",dir,pktnr); f=open(file,O_RDWR|O_CREAT,0664); if (f==-1) return; write(f,Data,Length); close(f); #endif // check if we have all packets if (global->Infosatdata[mac].CheckReceivedAll()) { // we have all packets isyslog("infosatepg: day=%02i month=%02i fully received", ishdr->day,ishdr->month); } } infosatepg-0.0.12/readline.h0000644000175000001440000000060212034066603015074 0ustar martinusers/* * readline.h: A plugin for the Video Disk Recorder * * See the README file for copyright information and how to reach the author. * * $Id$ */ #ifndef __readline_h_ #define __readline_h_ #include class cReadLineInfosatepg { private: char *buffer; public: cReadLineInfosatepg(void); ~cReadLineInfosatepg(); char *Read(FILE *f,size_t *size); }; #endif infosatepg-0.0.12/HISTORY0000644000175000001440000000307712045653104014235 0ustar martinusersVDR Plugin 'infosatepg' Revision History ---------------------------------------- 2012-10-07: Version 0.0.12 - Added support for VDR >= 1.7.26 provided by debian patch, thx to Tobias Grimm - Added patch for BSD from nox - Added compatibility for GCC3.x - Added missing ctype header - Added italian translation from Diego Pierotto 2010-06-06: Version 0.0.11 - Added support for VDR >= 1.7.14 2009-12-22: Version 0.0.10 - Changed wakeup and reset of received data 2009-07-12: Version 0.0.9 - Added patch from Jowi24 (channel not available) - Added processing for some special cases (Pilot, Start der X. Staffel) - Set wakeup to 3:00am if wakeup isn't set 2009-02-16: Version 0.0.8 - Fixed wakeuptime-handling bug 2009-02-15: Version 0.0.7 - Added patch from Keine_Ahnung - Extended status - Added content handling - Changed setup channel option - Added extended EPG - Improved device chooser - Changed wakeup (now set automatically) 2008-12-21: Version 0.0.6 - Added WakeupTime - Added shutdown message 2008-12-17: Version 0.0.5 - Changed channel setup - Changed algorithm to find a free device - Added SVDRP state 2008-11-11: Version 0.0.4 - Added fix from LiamHD 2008-06-18: Version 0.0.3 - Changed function to find event - Added setup value usePrimary - Lock filter after complete reception - Delete old data files 2008-06-15: Version 0.0.2 - Changed function to find event - Setup value WaitTime wasn't used - Added setup value EventTimeDiff - Fixed some bugs in process.cpp - Minor changes to Makefile 2008-05-01: Version 0.0.1 - Initial revision. infosatepg-0.0.12/COPYING0000644000175000001440000004313112034066603014177 0ustar martinusers GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. infosatepg-0.0.12/setup.cpp0000644000175000001440000001775212034066603015022 0ustar martinusers/* * setup.cpp: A plugin for the Video Disk Recorder * * See the README file for copyright information and how to reach the author. * * $Id$ */ #include "setup.h" // --- cMenuSetupInfosatepg cMenuSetupInfosatepg::cMenuSetupInfosatepg (cGlobalInfosatepg *Global) { global=Global; newFrequency = global->Frequency; newPolarization = global->Polarization; newSrate = global->Srate; newPid = global->Pid; newWaitTime = global->WaitTime; newNoWakeup=global->NoWakeup; newNoDeferredShutdown=global->NoDeferredShutdown; newHideMainMenu=global->HideMainMenu; Add (NewTitle (tr ("Scan parameter"))); cString buffer = cString::sprintf("%s:\t%s",tr("Source"), "S19.2E"); // just for info Add (new cOsdItem (buffer,osUnknown,false)); cOsdItem *firstItem = new cMenuEditIntItem (tr ("Frequency"), &newFrequency); Add (firstItem); Add (new cMenuEditChrItem (tr ("Polarization"), &newPolarization,"hlvr")); Add (new cMenuEditIntItem (tr ("Srate"), &newSrate)); Add (new cMenuEditIntItem (tr ("Pid"), &newPid,1,8191)); if (global->Channel()>0) { buffer = cString::sprintf("-> %s:\t%i",tr("Using channel"), global->Channel()); } else { buffer = cString::sprintf("-> %s:\t%s",tr("Using channel"),tr("none")); } Add (new cOsdItem (buffer,osUnknown,false)); Add (NewTitle (tr ("Event options"))); Add (new cMenuEditIntItem (tr ("Wait time [s]"), &newWaitTime,MIN_WAITTIME,MAX_WAITTIME)); Add (NewTitle (tr ("General options"))); Add (new cMenuEditBoolItem(tr("Hide main menu"),&newHideMainMenu)); Add (new cMenuEditBoolItem(tr("Prevent wakeup"),&newNoWakeup)); Add (new cMenuEditBoolItem(tr("Prevent deferred shutdown"),&newNoDeferredShutdown)); if (global->InfosatChannels()) { Add (NewTitle (tr ("Infosat channels")),true); chanCurrent=Current() +1; SetCurrent (firstItem); for (int i=0; iInfosatChannels(); i++) { cChannel *chan = Channels.GetByChannelID (global->GetChannelID (i)); if (!chan) continue; int chanuse=global->GetChannelUsage(i); cString buffer = cString::sprintf ("%s:\t%s",chan->Name(),chanuse ? tr ("used") : ""); Add (new cOsdItem (buffer)); } } } cOsdItem *cMenuSetupInfosatepg::NewTitle (const char *s) { cString buffer = cString::sprintf("---- %s ----", s); return new cOsdItem (buffer,osUnknown,false); } void cMenuSetupInfosatepg::Store (void) { bool bResetReceivedAll=false; if ((global->Frequency!=newFrequency) || (global->Polarization!=newPolarization) || (global->Srate!=newSrate) || (global->Pid!=newPid)) { bResetReceivedAll=true; } SetupStore ("Frequency", global->Frequency = newFrequency); SetupStore ("Polarization", global->Polarization = newPolarization); SetupStore ("Srate", global->Srate = newSrate); SetupStore ("Pid", global->Pid = newPid); SetupStore ("WaitTime", global->WaitTime = newWaitTime); SetupStore ("NoWakeup",global->NoWakeup=newNoWakeup); SetupStore ("NoDeferredShutdown",global->NoDeferredShutdown=newNoDeferredShutdown); SetupStore ("HideMainMenu",global->HideMainMenu=newHideMainMenu); if (bResetReceivedAll) { if (global->FindReceiverChannel()) { dsyslog ("infosatepg: receive files again"); global->ResetReceivedAll(); } else { esyslog("infosatepg: found no channel to receive, check setup"); } } } eOSState cMenuSetupInfosatepg::Edit() { if (HasSubMenu() || Count() ==0) return osUnknown; if (Current() >=chanCurrent) { int chanIndex=Current()-chanCurrent; if (chanIndexInfosatChannels()) { eOSState state=AddSubMenu (new cMenuSetupChannelMenu (global,chanIndex)); cChannel *chan = Channels.GetByChannelID (global->GetChannelID (chanIndex)); if (chan) { int chanuse=global->GetChannelUsage(chanIndex); cString buffer = cString::sprintf ("%s:\t%s",chan->Name(),chanuse ? tr ("used") : ""); cOsdItem *osd=Get(Current()); osd->SetText(buffer); } return state; } else { return osUnknown; } } else return osUnknown; } eOSState cMenuSetupInfosatepg::ProcessKey (eKeys Key) { eOSState state = cOsdMenu::ProcessKey (Key); switch (state) { default: if (state==osUnknown) { switch (Key) { case kOk: state=Edit(); if (state==osUnknown) { Store(); state=osBack; } break; default: break; } } } return state; } cMenuSetupChannelMenu::cMenuSetupChannelMenu (cGlobalInfosatepg *Global, int Index) { SetPlugin (cPluginManager::GetPlugin (PLUGIN_NAME_I18N)); global=Global; index=Index; newChannelUse=global->GetChannelUsage(index); if (newChannelUse<0) newChannelUse=USE_NOTHING; // to be safe! newDays=global->GetChannelDays(index); if (newDays<=0) newDays=1; cChannel *channel = Channels.GetByChannelID (global->GetChannelID (index)); if (!channel) return; SetHelp(tr("Button$Reset"),tr("Button$Copy")); cString buffer = cString::sprintf("---- %s ----", channel->Name()); Add (new cOsdItem (buffer,osUnknown,false)); Add(new cMenuEditIntItem(tr("Days in advance"),&newDays,1,EPG_DAYS)); Add(new cMenuEditBitItem(tr("Short text"),(uint *) &newChannelUse,USE_SHORTTEXT)); Add(new cMenuEditBitItem(tr("Long text"),(uint *) &newChannelUse,USE_LONGTEXT)); if ((newChannelUse & USE_APPEND)!=USE_APPEND) Add(new cMenuEditBitItem(tr("Merge long texts"),(uint *) &newChannelUse,USE_MERGELONGTEXT)); Add(new cMenuEditBitItem(tr("Extended EPG"),(uint *) &newChannelUse,USE_EXTEPG)); Add(new cMenuEditBitItem(tr("Append non existing events"),(uint *) &newChannelUse,USE_APPEND)); } void cMenuSetupChannelMenu::Store (void) { bool bReprocess=false; cChannel *channel = Channels.GetByChannelID (global->GetChannelID (index)); if (!channel) return; cString ChannelID = channel->GetChannelID().ToString(); cString name = cString::sprintf("Channel-%s",*ChannelID); if (!*name) return; if (global->SetChannelOptions(index,newChannelUse,newDays)) bReprocess=true; int setupval=newChannelUse+(newDays<<16); SetupStore (name,setupval); if (bReprocess) { dsyslog ("infosatepg: reprocess files (later)"); global->ResetProcessed(); } } eOSState cMenuSetupChannelMenu::ProcessKey (eKeys Key) { eOSState state = cOsdMenu::ProcessKey (Key); switch (state) { default: if (state==osUnknown) { switch (Key) { case kRed: if (Skins.Message(mtInfo,tr("Reset all channel settings?"))==kOk) { newDays=1; newChannelUse=USE_NOTHING; int oldindex=index; for (index=0; indexInfosatChannels(); index++) Store(); index=oldindex; state=osBack; } else { state=osContinue; } break; case kGreen: if (Skins.Message(mtInfo,tr("Copy settings to all channels?"))==kOk) { int oldindex=index; for (index=0; indexInfosatChannels(); index++) Store(); index=oldindex; } state=osContinue; break; case kOk: Store(); state=osBack; break; default: break; } } } return state; } infosatepg-0.0.12/process.h0000644000175000001440000001056412034066603014777 0ustar martinusers/* * process.h: A plugin for the Video Disk Recorder * * See the README file for copyright information and how to reach the author. * * $Id$ */ #ifndef __process_h_ #define __process_h_ #include "global.h" // --- cInfosatevent class cInfosatevent { #define EVCONTENTMASK_MOVIEDRAMA 0x10 #define EVCONTENTMASK_NEWSCURRENTAFFAIRS 0x20 #define EVCONTENTMASK_SHOW 0x30 #define EVCONTENTMASK_SPORTS 0x40 #define EVCONTENTMASK_CHILDRENYOUTH 0x50 #define EVCONTENTMASK_MUSICBALLETDANCE 0x60 #define EVCONTENTMASK_ARTSCULTURE 0x70 #define EVCONTENTMASK_SOCIALPOLITICALECONOMICS 0x80 #define EVCONTENTMASK_EDUCATIONALSCIENCE 0x90 #define EVCONTENTMASK_LEISUREHOBBIES 0xA0 #define EVCONTENTMASK_SPECIAL 0xB0 #define EVCONTENTMASK_USERDEFINED 0xF0 private: int duration; time_t startTime; char *title; char *shorttext; char *description; char *announcement; char *country; char *genre; char *original; char *episode; char *category; char *extepg; char *addition; char *rating; int content; int fsk; int year; int usage; int days; tEventID eventID; public: cInfosatevent(); ~cInfosatevent(); void SetTitle(const char *Title); void SetShortText(const char *ShortText); void SetDescription(const char *Description); void SetStartTime(time_t StartTime) { startTime=StartTime; } void SetDuration(int Duration) { duration=Duration; } void SetEventUsage(int Usage) { usage=Usage; } void SetEventDays(int Days) { days=Days; } void SetYear(int Year) { year=Year; } void SetEventID(tEventID EventID) { eventID=EventID; } void SetContentDescriptor(int Content) { content=Content; } void SetFSK(int FSK) { fsk=FSK; } void SetRating(const char *Rating); void SetAnnouncement(const char *Announcement); void SetCountry(const char *Country); void SetCategory(const char *Category); void SetCategoryByID(int i); void SetGenre(const char *Genre); void SetGenreByID(int i); void SetOriginal(const char *Original); void SetEpisode(const char *Episode); void SetAddition(const char *Addition); const char *Description(void) const { return description; } const char *Title(void) const { return title; } const char *ShortText(void) const { return shorttext; } const char *Announcement(void) const { return announcement; } const char *Category(void) const { return category; } const char *Genre(void) const { return genre; } const char *Country(void) const { return country; } const char *Original(void) const { return original; } const char *Episode(void) const { return episode; } const char *Addition(void) const { return addition; } const char *Rating(void) const { return rating; } int Content(void) const { return content; } int Year(void) const { return year; } int Duration(void) const { return duration; } int FSK(void) const { return fsk; } time_t StartTime(void) const { return startTime; } int Usage() { return usage; } int Days() { return days; } tEventID EventID(void) const { return eventID; } const char *ExtEPG(void); }; // --- cProcessInfosatepg class cProcessInfosatepg : public cThread { private: cGlobalInfosatepg *global; int mac; bool AddInfosatEvent(cChannel *channel, cInfosatevent *iEvent); bool CheckOriginal_and_Episode(char **s,cInfosatevent *iEvent,cCharSetConv *conv); bool CheckAnnouncement(char *s,cInfosatevent *iEvent); bool ParseInfosatepg(FILE *f,time_t *firststarttime); cChannel *GetVDRChannel(int frequency, int sid); u_long DoSum(u_long sum, const char *buf, int nBytes); cEvent *SearchEvent(cSchedule* Schedule, cInfosatevent *iEvent); public: cProcessInfosatepg(); void SetInfo(int Mac, cGlobalInfosatepg *Global); void Stop() { Cancel(3); } virtual void Action(); }; #endif infosatepg-0.0.12/infosatepg.cpp0000644000175000001440000003162012034217737016015 0ustar martinusers/* * infosatepg.cpp: A plugin for the Video Disk Recorder * * See the README file for copyright information and how to reach the author. * * $Id$ */ #include #include #include #include #include #include #include #include "infosatepg.h" #include "setup.h" #include "process.h" #if __GNUC__ > 3 #define UNUSED(v) UNUSED_ ## v __attribute__((unused)) #else #define UNUSED(x) x #endif extern char *strcatrealloc(char *dest, const char *src); // --- cPluginInfosatepg cPluginInfosatepg::cPluginInfosatepg(void) { // Initialize any member variables here. // DON'T DO ANYTHING ELSE THAT MAY HAVE SIDE EFFECTS, REQUIRE GLOBAL // VDR OBJECTS TO EXIST OR PRODUCE ANY OUTPUT! statusMonitor=NULL; global=new cGlobalInfosatepg; process=new cProcessInfosatepg(); pmac=EPG_FIRST_DAY_MAC; } cPluginInfosatepg::~cPluginInfosatepg() { // Clean up after yourself! if (statusMonitor) delete statusMonitor; delete process; delete global; } const char *cPluginInfosatepg::CommandLineHelp(void) { // Return a string that describes all known command line options. return " -d DIR, --dir=DIR use DIR as infosat data directory\n" " (default: /tmp)\n"; } bool cPluginInfosatepg::ProcessArgs(int argc, char *argv[]) { // Command line argument processing static struct option long_options[] = { { "dir", required_argument, NULL, 'd' }, { 0,0,0,0 } }; int c; while ((c = getopt_long(argc, argv, "d:", long_options, NULL)) != -1) { switch (c) { case 'd': if (global->SetDirectory(optarg)) { isyslog("infosatepg: using directory '%s' for data",optarg); } else { fprintf(stderr,"infosatepg: can't access data directory: %s\n", optarg); return false; } break; default: return false; } } return true; } bool cPluginInfosatepg::Initialize(void) { // Initialize plugin - check channellist tChannelID ChannelID; for (int i=0; iInfosatChannels(); i++) { ChannelID=global->GetChannelID(i); if (!Channels.GetByChannelID(ChannelID)) { dsyslog("infosatepg: remove %s",*ChannelID.ToString()); global->RemoveChannel(i); // Removing entries from setup.conf is not possible! } } if (!global->FindReceiverChannel()) esyslog("infosatepg: found no channel to receive, check setup"); return true; } bool cPluginInfosatepg::Start(void) { // Start any background activities the plugin shall perform if (global->Load()==-1) { isyslog("infosatepg: failed to load plugin status"); } statusMonitor = new cStatusInfosatepg(global); return true; } void cPluginInfosatepg::Stop(void) { // Stop any background activities the plugin is performing. process->Stop(); if (global->Save()==-1) { isyslog("infosatepg: failed to save plugin status"); } } void cPluginInfosatepg::Housekeeping(void) { // Perform any cleanup or other regular tasks. } void cPluginInfosatepg::MainThreadHook(void) { // Perform actions in the context of the main program thread. if (!global->WaitOk()) return; if ((global->Infosatdata[pmac].ReceivedAll()) && (!global->ProcessedAll())) { if (!global->Infosatdata[pmac].Processed) { if (!process->Active()) { isyslog ("infosatepg: found data to be processed: day=%i month=%i", global->Infosatdata[pmac].Day(),global->Infosatdata[pmac].Month()); process->SetInfo(pmac,global); process->Start(); } } else { pmac++; } global->SetWaitTimer(); } else { pmac=EPG_FIRST_DAY_MAC; } if ((global->Switched()) || (global->ReceivedAll()) || (global->Channel()==-1)) return; cChannel *chan=Channels.GetByNumber(global->Channel()); if (!chan) return; if (ShutdownHandler.IsUserInactive()) { // only switch primary device if we are not recording if (!cDevice::PrimaryDevice()->Receiving()) { // first keep the current channel in "mind" if (global->LastCurrentChannel==-1) global->LastCurrentChannel= cDevice::PrimaryDevice()->CurrentChannel(); // we are idle -> try to use live device if we can if (cDevice::PrimaryDevice()->SwitchChannel(chan,true)) { global->SetWaitTimer(); return; } } } if (global->LastCurrentChannel!=-1) global->LastCurrentChannel=-1; // Cannot use live device try another (if possible) for (int i=0; iProvidesTransponder(chan)) continue; // device cannot provide transponder -> skip if (EITScanner.Active()) continue; // EITScanner is updating EPG -> skip if (dev->Receiving()) continue; // device is recording -> skip if (dev->IsPrimaryDevice()) continue; // device is primary -> skip if (cDevice::ActualDevice()->CardIndex()==i) continue; // device is live viewing -> skip if (dev->IsTunedToTransponder(chan)) { // we already have a device which is tuned (maybe switched manually?) // the filter will be added in status.cpp global->SetWaitTimer(); return; } // ok -> use this device dsyslog("infosatepg: found free device %i",dev->DeviceNumber()+1); dev->SwitchChannel(chan,false); global->SetWaitTimer(); return; } } } cString cPluginInfosatepg::Active(void) { // Returns a message string if we are not ready if (global->NoDeferredShutdown) return NULL; // if we cannot receive, we shouldn't wait if (global->Channel()==-1) return NULL; if (!global->ProcessedAll()) return tr("Infosat plugin still working"); // we are done if (global->LastCurrentChannel!=-1) { // we switched from users last channel if (cDevice::PrimaryDevice()->CurrentChannel()==global->Channel()) { // we are still on infosatepg channel cChannel *chan=Channels.GetByNumber(global->LastCurrentChannel); if (chan) { // switch back to users last viewed channel cDevice::PrimaryDevice()->SwitchChannel(chan,true); global->LastCurrentChannel=-1; } } } return NULL; } time_t cPluginInfosatepg::WakeupTime(void) { // Returns custom wakeup time for shutdown script if (global->NoWakeup) return 0; // user option set -> don't wake up if (global->Channel()==-1) return 0; // we cannot receive, so we don't need to wake up if (global->WakeupTime()==-1) { // no wakeup? set wakeup to 03:00 global->SetWakeupTime(cTimer::SetTime(time(NULL),cTimer::TimeToInt(300))); } time_t Now = time(NULL); time_t Time = global->WakeupTime(); if (difftime(Time,Now)<0) { // wakeup time is in the past -> add a day Time = cTimer::IncDay(Time,1); } return Time; } const char *cPluginInfosatepg::MainMenuEntry(void) { if (global->HideMainMenu) return NULL; double overall=0; for (int mac=EPG_FIRST_DAY_MAC; mac<=EPG_LAST_DAY_MAC; mac++) { overall+=global->Infosatdata[mac].ReceivedPercent()*0.9; if (global->Infosatdata[mac].Processed) overall+=10; } overall/=EPG_LAST_DAY_MAC; static char buffer[1024]; snprintf(buffer,sizeof(buffer)-1,"%s (%0.f%%)", tr("Menu$infosatepg"), overall); return buffer; } cOsdObject *cPluginInfosatepg::MainMenuAction(void) { // Perform the action when selected from the main VDR menu. return NULL; } cMenuSetupPage *cPluginInfosatepg::SetupMenu(void) { // Return the setup menu. return new cMenuSetupInfosatepg(global); } bool cPluginInfosatepg::SetupParse(const char *Name, const char *Value) { // Parse your own setup parameters and store their values. if (!strcasecmp(Name,"Pid")) global->Pid=atoi(Value); else if (!strcasecmp(Name,"Frequency")) global->Frequency=atoi(Value); else if (!strcasecmp(Name,"Polarization")) global->Polarization=atoi(Value); else if (!strcasecmp(Name,"Srate")) global->Srate=atoi(Value); else if (!strcasecmp(Name,"NoWakeup")) global->NoWakeup=atoi(Value); else if (!strcasecmp(Name,"NoDeferredShutdown")) global->NoDeferredShutdown=atoi(Value); else if (!strcasecmp(Name,"HideMainMenu")) global->HideMainMenu=atoi(Value); else if (!strcasecmp(Name,"WaitTime")) global->WaitTime=atoi(Value); else if (!strncasecmp(Name,"Channel",7)) { if (strlen(Name)<10) return false; tChannelID ChannelID=tChannelID::FromString(&Name[8]); if (ChannelID==tChannelID::InvalidID) return false; int val=atoi(Value); global->AddChannel(ChannelID,(val & 0xFFFF),(val & 0xF0000)>>16); } else return false; return true; } bool cPluginInfosatepg::Service(const char *UNUSED(Id), void *UNUSED(Data)) { // Handle custom service requests from other plugins return false; } const char **cPluginInfosatepg::SVDRPHelpPages(void) { // Returns help text for SVDRP static const char *HelpPages[] = { "STAT\n" " Return actual state of the plugin", "RESR\n" " Reset received all", "REPR\n" " Reprocess again", "SAVE\n", " Save state of plugin", NULL }; return HelpPages; } cString cPluginInfosatepg::SVDRPCommand(const char *Command, const char *UNUSED(Option), int &UNUSED(ReplyCode)) { // Process SVDRP commands cString output; if (!strcasecmp(Command,"RESR")) { global->ResetReceivedAll(); pmac=EPG_FIRST_DAY_MAC; output="Restarted receiver\n"; } if (!strcasecmp(Command,"REPR")) { global->ResetProcessed(); pmac=EPG_FIRST_DAY_MAC; output="Reprocess files\n"; } if (!strcasecmp(Command,"SAVE")) { global->Save(); output="State saved\n"; } if (!strcasecmp(Command,"STAT")) { int day,month; cString head=cString::sprintf("InfosatEPG state:\n Switched: %s",global->Switched() ? "yes" : "no"); cString lcc; if (global->LastCurrentChannel!=-1) { lcc=cString::sprintf(" Switchback to: %i\n", global->LastCurrentChannel); } else { lcc=" Switchback to: unset\n"; } cString rall; if (global->ReceivedAll(&day,&month)) rall=cString::sprintf(" Received all: yes (%02i.%02i.)",day,month); else rall=" Received all: no"; cString pall; pall=cString::sprintf(" Processed all: %s\n Prevent shutdown until ready: %s\n", global->ProcessedAll() ? "yes" : "no", global->NoDeferredShutdown ? "no" : "yes"); cString wut; if (global->WakeupTime()!=-1) { time_t wakeup = global->WakeupTime(); wut=cString::sprintf(" WakeupTime: %s %s",ctime(&wakeup),global->NoWakeup ? "(blocked)" : ""); } else { wut="%s WakeupTime: unset\n"; } cString head2; head2="\n" \ " | | missed | | | unlocated\n" \ " Day | Date | Packets | Received % | Processed | Events\n" \ "------+--------+---------+------------+------------+----------\n"; cString mstr; char *fmstr=NULL; for (int mac=EPG_FIRST_DAY_MAC; mac<=EPG_LAST_DAY_MAC; mac++) { mstr=cString::sprintf("%c %i | %02i.%02i. | %3i | %3i | %s | %3i\n", (global->ActualMac==mac) ? '*' : ' ', mac,global->Infosatdata[mac].Day(), global->Infosatdata[mac].Month(), global->Infosatdata[mac].Missed(), global->Infosatdata[mac].ReceivedPercent(), global->Infosatdata[mac].Processed ? "yes" : " no", global->Infosatdata[mac].Unlocated); fmstr=strcatrealloc(fmstr,mstr); } output=cString::sprintf("%s%s%s%s%s%s%s",*head,*lcc,*rall,*pall,*wut,*head2,fmstr); } return output; } VDRPLUGINCREATOR(cPluginInfosatepg); // Don't touch this! infosatepg-0.0.12/README0000644000175000001440000000122612045654076014034 0ustar martinusersThis is a "plugin" for the Video Disk Recorder (VDR). Written by: Jochen Dolze Project's homepage: http://projects.vdr-developer.org/projects/show/plg-infosatepg Latest version available at: http://projects.vdr-developer.org/projects/plg-infosatepg/files This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. See the file COPYING for more information. Description: Reads the contents of infosat and writes the data into the EPG. infosatepg-0.0.12/status.cpp0000644000175000001440000000357712034217737015213 0ustar martinusers/* * status.cpp: A plugin for the Video Disk Recorder * * See the README file for copyright information and how to reach the author. * * $Id$ */ #include "status.h" cStatusInfosatepg::cStatusInfosatepg(cGlobalInfosatepg *Global) { global = Global; myFilter=new cFilterInfosatepg(global); myFilterDevice=NULL; } cStatusInfosatepg::~cStatusInfosatepg(void) { if (myFilterDevice) myFilterDevice->Detach(myFilter); if (myFilter) delete myFilter; } #if APIVERSNUM >= 10726 void cStatusInfosatepg::ChannelSwitch(const cDevice *Device, int ChannelNumber, bool LiveView) #else void cStatusInfosatepg::ChannelSwitch(const cDevice *Device, int ChannelNumber) #endif { if (!ChannelNumber) return; if (!Device) return; // just to be safe bool bAddFilter=false; // just add filter if we aren't locked if (ChannelNumber==global->Channel()) { cChannel *chan=Channels.GetByNumber(global->Channel()); if (!chan) return; if (!Device->ProvidesTransponder(chan)) return; // ignore virtual devices if (Device==myFilterDevice) return; // already attached to this device if (!global->ReceivedAll()) bAddFilter=true; } if (bAddFilter) { if (myFilterDevice) return; // already attached to another device myFilterDevice = (cDevice *) Device; dsyslog("switching device %i to channel %i (infosatepg)", Device->DeviceNumber()+1,ChannelNumber); myFilterDevice->AttachFilter(myFilter); global->SetSwitched(true); } else { if (myFilterDevice) { if (Device==myFilterDevice) { dsyslog("infosatepg: detach filter"); myFilterDevice->Detach(myFilter); myFilterDevice=NULL; global->SetWaitTimer(); global->SetSwitched(false); } } } } infosatepg-0.0.12/Makefile0000644000175000001440000000563612045651766014630 0ustar martinusers# # Makefile for a Video Disk Recorder plugin # # $Id$ # The official name of this plugin. # This name will be used in the '-P...' option of VDR to load the plugin. # By default the main source file also carries this name. # IMPORTANT: the presence of this macro is important for the Make.config # file. So it must be defined, even if it is not used here! # PLUGIN = infosatepg ### The version number of this plugin (taken from the main source file): VERSION = $(shell grep 'static const char \*VERSION *=' $(PLUGIN).h | awk '{ print $$6 }' | sed -e 's/[";]//g') ### The C++ compiler and options: CXX ?= g++ CXXFLAGS ?= -fPIC -g -O2 -Wall -Wextra -Woverloaded-virtual -Wno-parentheses ### The directory environment: VDRDIR ?= ../../.. LIBDIR ?= ../../lib TMPDIR ?= /tmp ### Allow user defined options to overwrite defaults: -include $(VDRDIR)/Make.config ### The version number of VDR's plugin API (taken from VDR's "config.h"): APIVERSION = $(shell sed -ne '/define APIVERSION/s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h) ### The name of the distribution archive: ARCHIVE = $(PLUGIN)-$(VERSION) PACKAGE = vdr-$(ARCHIVE) ### Includes and Defines (add further entries here): INCLUDES += -I$(VDRDIR)/include DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"' ### The object files (add further files here): OBJS = $(PLUGIN).o global.o setup.o filter.o status.o readline.o process.o ### The main target: all: libvdr-$(PLUGIN).so i18n ### Implicit rules: %.o: %.cpp $(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) $< ### Dependencies: MAKEDEP = $(CXX) -MM -MG DEPFILE = .dependencies $(DEPFILE): Makefile @$(MAKEDEP) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.cpp) > $@ -include $(DEPFILE) ### Internationalization (I18N): PODIR = po LOCALEDIR = $(VDRDIR)/locale I18Npo = $(wildcard $(PODIR)/*.po) I18Nmsgs = $(addprefix $(LOCALEDIR)/, $(addsuffix /LC_MESSAGES/vdr-$(PLUGIN).mo, $(notdir $(foreach file, $(I18Npo), $(basename $(file)))))) I18Npot = $(PODIR)/$(PLUGIN).pot %.mo: %.po msgfmt -c -o $@ $< $(I18Npot): $(wildcard *.cpp *.h) xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --msgid-bugs-address='' -o $@ $^ %.po: $(I18Npot) msgmerge -U --no-wrap --no-location --backup=none -q $@ $< @touch $@ $(I18Nmsgs): $(LOCALEDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo @mkdir -p $(dir $@) cp $< $@ .PHONY: i18n i18n: $(I18Nmsgs) $(I18Npot) ### Targets: libvdr-$(PLUGIN).so: $(OBJS) $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) -o $@ @cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION) dist: clean @-rm -rf $(TMPDIR)/$(ARCHIVE) @mkdir $(TMPDIR)/$(ARCHIVE) @cp -a *.cpp *.h $(TMPDIR)/$(ARCHIVE) @cp -a po COPYING HISTORY README Makefile $(TMPDIR)/$(ARCHIVE) @tar czf $(PACKAGE).tgz -C $(TMPDIR) $(ARCHIVE) @-rm -rf $(TMPDIR)/$(ARCHIVE) @echo Distribution package created as $(PACKAGE).tgz clean: @-rm -f $(OBJS) $(DEPFILE) *.so* *.tgz core* *~ $(PODIR)/*.mo $(PODIR)/*.pot infosatepg-0.0.12/setup.h0000644000175000001440000000205712034066603014457 0ustar martinusers/* * setup.h: A plugin for the Video Disk Recorder * * See the README file for copyright information and how to reach the author. * * $Id$ */ #ifndef __setup_h_ #define __setup_h_ #include #include #include "global.h" class cMenuSetupInfosatepg : public cMenuSetupPage { private: cGlobalInfosatepg *global; //int newChannel; int newWaitTime; int newFrequency; char newPolarization; int newSrate; int newPid; int newNoWakeup; int newNoDeferredShutdown; int chanCurrent; int newHideMainMenu; protected: virtual void Store(void); private: cOsdItem *NewTitle(const char *s); eOSState Edit(void); public: cMenuSetupInfosatepg(cGlobalInfosatepg *Global); virtual eOSState ProcessKey(eKeys Key); }; class cMenuSetupChannelMenu : public cMenuSetupPage { private: cGlobalInfosatepg *global; int newDays; int newChannelUse; int index; protected: virtual void Store(void); public: cMenuSetupChannelMenu(cGlobalInfosatepg *Global, int Index); virtual eOSState ProcessKey(eKeys Key); }; #endif infosatepg-0.0.12/global.cpp0000644000175000001440000003427412034217320015112 0ustar martinusers#include #include #include "global.h" // --- cGlobalInfosatdata cGlobalInfosatdata::cGlobalInfosatdata() { file[0]=0; Init(NULL,0,0,0); } bool cGlobalInfosatdata::NeverSeen(int Day,int Month,int Packetcount) { if ((day!=Day) || (month!=Month) || (pktcnt!=Packetcount)) { return true; } else { return false; } } void cGlobalInfosatdata::Init(char *File,int Day,int Month,int Packetcount) { if (access(file,R_OK | W_OK)==0) { dsyslog("infosatepg: deleting old %s",file); unlink(file); } Processed=false; receivedall=false; missed=0; Unlocated=0; lastpkt=-1; receivedpercent=0; day=Day; month=Month; pktcnt=Packetcount; if (File) snprintf(file,sizeof(file),"%s",File); else file[0]=0; memset(bitfield,0,sizeof(bitfield)); } int cGlobalInfosatdata::Save(int fd) { if (fd==-1) return -1; ssize_t ret=write(fd,&receivedall,sizeof(receivedall)); if (ret!=sizeof(receivedall)) return -1; ret=write(fd,&receivedpercent,sizeof(receivedpercent)); if (ret!=sizeof(receivedpercent)) return -1; ret=write(fd,&Processed,sizeof(Processed)); if (ret!=sizeof(Processed)) return -1; ret=write (fd,&day,sizeof (day)); if (ret!=sizeof(day)) return -1; ret=write (fd,&month,sizeof (month)); if (ret!=sizeof (month)) return -1; ret=write (fd,&pktcnt,sizeof (pktcnt)); if (ret!=sizeof (pktcnt)) return -1; ret=write (fd,&missed,sizeof (missed)); if (ret!=sizeof (missed)) return -1; ret=write (fd,&Unlocated,sizeof (Unlocated)); if (ret!=sizeof (Unlocated)) return -1; ret=write (fd,&bitfield,sizeof (bitfield)); if (ret!=sizeof (bitfield)) return -1; ret=write (fd,&file,sizeof (file)); if (ret!=sizeof (file)) return -1; return ret; } int cGlobalInfosatdata::Load(int fd) { if (fd==-1) return -1; ssize_t ret=read (fd,&receivedall,sizeof (receivedall)); if (ret!=sizeof (receivedall)) return -1; ret=read (fd,&receivedpercent,sizeof(receivedpercent)); if (ret!=sizeof (receivedpercent)) return -1; ret=read (fd,&Processed,sizeof (Processed)); if (ret!=sizeof (Processed)) return -1; ret=read (fd,&day,sizeof (day)); if (ret!=sizeof (day)) return -1; ret=read (fd,&month,sizeof (month)); if (ret!=sizeof (month)) return -1; ret=read (fd,&pktcnt,sizeof (pktcnt)); if (ret!=sizeof (pktcnt)) return -1; ret=read (fd,&missed,sizeof (missed)); if (ret!=sizeof (missed)) return -1; ret=read (fd,&Unlocated,sizeof (Unlocated)); if (ret!=sizeof (Unlocated)) return -1; ret=read (fd,&bitfield,sizeof (bitfield)); if (ret!=sizeof (bitfield)) return -1; ret=read (fd,&file,sizeof (file)); if (ret!=sizeof (file)) return -1; // check file if (file[0]!=0) { if (access(file,R_OK | W_OK)==-1) { // file doesnt exist -> receive it again esyslog("infosatepg: cannot access %s",file); Init(file,day,month,pktcnt); } } return ret; } #ifdef INFOSATEPG_DEBUG void cGlobalInfosatdata::Debug(const char *Directory) { char file[1024]; snprintf (file,sizeof (file),"%s/infosatepg9999_999.dat",Directory); Init (file,99,99,999); ready=true; } #endif void cGlobalInfosatdata::CheckMissed(int ActualPacket) { if (receivedall) return; // count missed packets while receiving if ((ActualPacket!=(lastpkt+1)) && (lastpkt!=-1)) { missed++; } lastpkt=ActualPacket; } bool cGlobalInfosatdata::CheckReceivedAll() { int donecnt=0; receivedpercent=0; if (pktcnt==0) return false; bool retval=true; for (int i=0; iether_dhost[0]!=MAC[0]) return false; if (eth_hdr->ether_dhost[1]!=MAC[1]) return false; if (eth_hdr->ether_dhost[2]!=MAC[2]) return false; if (eth_hdr->ether_dhost[3]!=MAC[3]) return false; if (eth_hdr->ether_dhost[4]!=MAC[4]) return false; if (eth_hdr->ether_dhost[5]ether_dhost[5]>EPG_LAST_DAY_MAC) return false; return true; } void cGlobalInfosatepg::AddChannel(tChannelID ChannelID,int Usage,int Days) { infosatchannels= (struct infosatchannels *) realloc (infosatchannels, (numinfosatchannels+1) *sizeof (struct infosatchannels)); if (!infosatchannels) return; infosatchannels[numinfosatchannels].ChannelID=ChannelID; infosatchannels[numinfosatchannels].Usage=Usage & 0xFFFF; if (Days<=0) Days=1; if (Days>EPG_DAYS) Days=EPG_DAYS; infosatchannels[numinfosatchannels].Days=Days; numinfosatchannels++; } void cGlobalInfosatepg::RemoveChannel(int Index) { if ((Index<0) || (Index>numinfosatchannels)) return; int i; for (i=Index; i<(numinfosatchannels-1); i++) { infosatchannels[i].ChannelID=infosatchannels[i+1].ChannelID; infosatchannels[i].Usage=infosatchannels[i+1].Usage; } numinfosatchannels--; } tChannelID cGlobalInfosatepg::GetChannelID(int Index) { if (numinfosatchannels==0) return tChannelID::InvalidID; if ((Index<0) || (Index>numinfosatchannels-1)) return tChannelID::InvalidID; return infosatchannels[Index].ChannelID; } bool cGlobalInfosatepg::ChannelExists(tChannelID ChannelID,int *Index) { if (numinfosatchannels==0) return false; for (int i=0; inuminfosatchannels-1)) return false; bool ret=false; if ((infosatchannels[Index].Usage!=Usage) | (infosatchannels[Index].Days!=Days)) ret=true; infosatchannels[Index].Usage=Usage; infosatchannels[Index].Days=Days; return ret; } int cGlobalInfosatepg::GetChannelUsage(int Index) { if (numinfosatchannels==0) return USE_NOTHING; if ((Index<0) || (Index>numinfosatchannels-1)) return USE_NOTHING; return infosatchannels[Index].Usage; } int cGlobalInfosatepg::GetChannelDays(int Index) { if (numinfosatchannels==0) return 0; if ((Index<0) || (Index>numinfosatchannels-1)) return 0; return infosatchannels[Index].Days; } int cGlobalInfosatepg::Save() { char file[1024]; snprintf (file,sizeof (file),"%s/infosatepg.dat",directory); int f=open (file,O_RDWR|O_CREAT|O_TRUNC,0664); if (f==-1) { if (errno!=ENOSPC) { esyslog ("infosatepg: unable to create file '%s'", file); } return -1; } int ret; for (int mac=EPG_FIRST_DAY_MAC; mac<=EPG_LAST_DAY_MAC; mac++) { ret=Infosatdata[mac].Save (f); if (ret==-1) break; } if (ret!=-1) { ret=write (f,&this_day,sizeof(this_day)); if (ret!=sizeof (this_day)) ret=-1; } if (ret!=-1) { ret=write (f,&this_month,sizeof(this_month)); if (ret!=sizeof (this_month)) ret=-1; } if (ret!=-1) { ret=write (f,&wakeuptime,sizeof(wakeuptime)); if (ret!=sizeof (wakeuptime)) ret=-1; } close (f); if (ret==-1) unlink (file); return ret; } int cGlobalInfosatepg::Load() { char file[1024]; snprintf (file,sizeof (file),"%s/infosatepg.dat",directory); int f=open (file,O_RDONLY); if (f==-1) return 0; // it's ok if the file doesn't exist int ret; for (int mac=EPG_FIRST_DAY_MAC; mac<=EPG_LAST_DAY_MAC; mac++) { ret=Infosatdata[mac].Load (f); if (ret==-1) break; } if (ret!=-1) { ret=read (f,&this_day,sizeof (this_day)); if (ret!=sizeof (this_day)) ret=-1; } if (ret!=-1) { ret=read (f,&this_month,sizeof (this_month)); if (ret!=sizeof (this_month)) ret=-1; } if (ret!=-1) { ret=read (f,&wakeuptime,sizeof (wakeuptime)); if (ret!=sizeof (wakeuptime)) ret=-1; } close (f); if (ret==-1) { unlink (file); // but it's not ok if the read failed! ResetReceivedAll(); } return ret; } void cGlobalInfosatepg::ResetReceivedAll(void) { for (int mac=EPG_FIRST_DAY_MAC; mac<=EPG_LAST_DAY_MAC; mac++) { Infosatdata[mac].ResetReceivedAll(); } wakeuptime=-1; this_day=-1; this_month=-1; } void cGlobalInfosatepg::ResetProcessed (void) { for (int mac=EPG_FIRST_DAY_MAC; mac<=EPG_LAST_DAY_MAC; mac++) { Infosatdata[mac].Processed=false; } wakeuptime=-1; this_day=-1; this_month=-1; } bool cGlobalInfosatepg::ProcessedAll() { int numProcessed=0; for (int mac=EPG_FIRST_DAY_MAC; mac<=EPG_LAST_DAY_MAC; mac++) { if (Infosatdata[mac].Processed) numProcessed++; } // all days processed if (numProcessed==EPG_DAYS) return true; return false; } bool cGlobalInfosatepg::ReceivedAll(int *Day, int *Month) { bool res=false; time_t Now=time (NULL); struct tm tm; if (!localtime_r (&Now,&tm)) return false; // First check if we have received all data int numReceived=0; for (int mac=EPG_FIRST_DAY_MAC; mac<=EPG_LAST_DAY_MAC; mac++) { if (Infosatdata[mac].ReceivedAll()) numReceived++; } // All days fully received if (numReceived==EPG_DAYS) { if ((this_day==-1) && (this_month==-1)) { isyslog ("infosatepg: all data received"); this_day=tm.tm_mday; this_month=tm.tm_mon+1; } // From today? if ((this_day==tm.tm_mday) && (this_month==tm.tm_mon+1)) { res=true; } else { // New day, but new data is ready only after wakeup-time time_t Time=WakeupTime(); if (Time==-1) { // no wakeuptime set, just wait res=true; } else { Time-=300; if (Now>=Time) { // new day and new data should be available ResetReceivedAll(); res=false; } else { // wait till we are after wakeuptime res=true; } } } } if (Day) *Day=this_day; if (Month) *Month=this_month; return res; } bool cGlobalInfosatepg::FindReceiverChannel() { cChannel *chan; int source = cSource::FromString("S19.2E"); // only from astra 19.2E // Try to find a channel with the exact frequency for (int i=0; i<=Channels.MaxNumber(); i++) { chan = Channels.GetByNumber(i,0); if (chan) { if (chan->Source()!=source) continue; if (chan->Srate()!=Srate) continue; if (chan->Frequency()!=Frequency) continue; #if VDRVERSNUM < 10713 if (chan->Polarization()!=Polarization) continue; #else const char *polarization=strpbrk(chan->Parameters(),"HVLRhvlr"); if (!polarization) continue; if (toupper(*polarization)!=toupper(Polarization)) continue; #endif channel=i; return true; } } // None found? Then try to find a channel with frequency + 1 for (int i=0; i<=Channels.MaxNumber(); i++) { chan = Channels.GetByNumber(i,0); if (chan) { if (chan->Source()!=source) continue; if (chan->Srate()!=Srate) continue; if (chan->Frequency()!=(Frequency+1)) continue; #if VDRVERSNUM < 10713 if (chan->Polarization()!=Polarization) continue; #else const char *polarization=strpbrk(chan->Parameters(),"HVLRhvlr"); if (!polarization) continue; if (toupper(*polarization)!=toupper(Polarization)) continue; #endif channel=i; return true; } } // Still none found? Then try to find a channel with frequency - 1 for (int i=0; i<=Channels.MaxNumber(); i++) { chan = Channels.GetByNumber(i,0); if (chan) { if (chan->Source()!=source) continue; if (chan->Srate()!=Srate) continue; if (chan->Frequency()!=(Frequency-1)) continue; #if VDRVERSNUM < 10713 if (chan->Polarization()!=Polarization) continue; #else const char *polarization=strpbrk(chan->Parameters(),"HVLRhvlr"); if (!polarization) continue; if (toupper(*polarization)!=toupper(Polarization)) continue; #endif channel=i; return true; } } // No channel available channel=-1; return false; } infosatepg-0.0.12/infosatepg.h0000644000175000001440000000276312034223352015456 0ustar martinusers/* * infosatepg.h: A plugin for the Video Disk Recorder * * See the README file for copyright information and how to reach the author. * * $Id$ */ #ifndef __infosatepg_h_ #define __infosatepg_h_ #include "global.h" #include "status.h" #include "process.h" static const char *VERSION = "0.0.12"; static const char *DESCRIPTION = trNOOP("Read EPG info from infosat"); class cPluginInfosatepg : public cPlugin { private: // Add any member variables or functions you may need here. cGlobalInfosatepg *global; cStatusInfosatepg *statusMonitor; cProcessInfosatepg *process; int pmac; public: cPluginInfosatepg(void); virtual ~cPluginInfosatepg(); virtual const char *Version(void) { return VERSION; } virtual const char *Description(void) { return tr(DESCRIPTION); } virtual const char *CommandLineHelp(void); virtual bool ProcessArgs(int argc, char *argv[]); virtual bool Initialize(void); virtual bool Start(void); virtual void Stop(void); virtual void Housekeeping(void); virtual void MainThreadHook(void); virtual cString Active(void); virtual time_t WakeupTime(void); virtual const char *MainMenuEntry(void); virtual cOsdObject *MainMenuAction(void); virtual cMenuSetupPage *SetupMenu(void); virtual bool SetupParse(const char *Name, const char *Value); virtual bool Service(const char *Id, void *Data = NULL); virtual const char **SVDRPHelpPages(void); virtual cString SVDRPCommand(const char *Command, const char *Option, int &ReplyCode); }; #endif infosatepg-0.0.12/readline.cpp0000644000175000001440000000405312034066603015433 0ustar martinusers/* * readline.cpp: A plugin for the Video Disk Recorder * * See the README file for copyright information and how to reach the author. * * $Id$ */ #include #include #include "readline.h" #ifdef __FreeBSD__ #include #if __FreeBSD_version > 800000 #define HAVE_GETLINE #endif #else #define HAVE_GETLINE #endif extern char *strcatrealloc(char *dest, const char *src); // --- cReadLineInfosatepg --------------------------------------------------- cReadLineInfosatepg::cReadLineInfosatepg(void) { buffer = NULL; } cReadLineInfosatepg::~cReadLineInfosatepg() { if (buffer) free(buffer); } char *cReadLineInfosatepg::Read(FILE *f,size_t *size) { if (buffer) free(buffer); buffer=NULL; if ((!size) || (!f)) return NULL; bool ext=false; *size=0; char *tempbuffer=NULL; size_t tempsize=0; do { ext=false; #ifndef HAVE_GETLINE size_t n; if (!tempbuffer) { if (!(tempbuffer = (char *)malloc(tempsize = 4096))) return NULL; } if (!fgets(tempbuffer, tempsize, f)) { if (tempbuffer) free(tempbuffer); return buffer; } while ((n = strlen(tempbuffer)) >= tempsize - 1 && tempbuffer[n - 1] != '\n') { if (!(tempbuffer = (char *)realloc(tempbuffer, tempsize * 2))) return NULL; tempsize *= 2; if (!fgets(tempbuffer + n, tempsize - n, f)) break; } #else int n = getline(&tempbuffer, &tempsize, f); #endif if (n > 0) { if (tempbuffer[n-1] == '\n') { tempbuffer[--n] = 0; if (n > 0) { if (tempbuffer[n-1] == '\r') tempbuffer[--n] = 0; } } if (n>0) { if (tempbuffer[n-1] == '\\') { tempbuffer[--n]=0; ext=true; } } if (n>0) { buffer=strcatrealloc(buffer,tempbuffer); //tempbuffer[0]=0; *size+=n; } else { //tempbuffer[0]=0; ext=true; } } } while (ext==true); if (tempbuffer) free(tempbuffer); return buffer; } infosatepg-0.0.12/process.cpp0000644000175000001440000011225512034066603015332 0ustar martinusers/* * process.cpp: A plugin for the Video Disk Recorder * * See the README file for copyright information and how to reach the author. * * $Id$ */ #include #include #include #include "process.h" #include "readline.h" char *strcatrealloc(char *dest, const char *src) { if (!src || !*src) return dest; size_t l = (dest ? strlen(dest) : 0) + strlen(src) + 1; if (dest) { dest = (char *)realloc(dest, l); strcat(dest, src); } else { dest = (char*)malloc(l); strcpy(dest, src); } return dest; } // --- cInfosatevent cInfosatevent::cInfosatevent() { title=NULL; shorttext=NULL; description=NULL; announcement=NULL; country=NULL; genre=NULL; original=NULL; extepg=NULL; episode=NULL; category=NULL; addition=NULL; rating=NULL; year=-1; fsk=-1; content=0; startTime = 0; duration = 0; } cInfosatevent::~cInfosatevent() { free(title); free(shorttext); free(description); free(announcement); free(country); free(category); free(genre); free(original); free(extepg); free(episode); free(addition); free(rating); } void cInfosatevent::SetOriginal(const char *Original) { original = strcpyrealloc(original, Original); original = compactspace(original); } void cInfosatevent::SetGenre(const char *Genre) { genre = strcpyrealloc(genre, Genre); genre = compactspace(genre); } void cInfosatevent::SetCategory(const char *Category) { category = strcpyrealloc(category, Category); category = compactspace(category); } void cInfosatevent::SetCountry(const char *Country) { country = strcpyrealloc(country, Country); country = compactspace(country); } void cInfosatevent::SetAnnouncement(const char *Announcement) { announcement = strcpyrealloc(announcement, Announcement); announcement = compactspace(announcement); } void cInfosatevent::SetAddition(const char *Addition) { addition = strcpyrealloc(addition, Addition); addition = compactspace(addition); } void cInfosatevent::SetRating(const char *Rating) { rating = strcpyrealloc(rating, Rating); rating = compactspace(rating); } void cInfosatevent::SetTitle(const char *Title) { title = strcpyrealloc(title, Title); title = compactspace(title); } void cInfosatevent::SetEpisode(const char *Episode) { episode=strcpyrealloc(episode,Episode); episode=compactspace(episode); } void cInfosatevent::SetShortText(const char *ShortText) { shorttext=strcpyrealloc(shorttext,ShortText); shorttext=compactspace(shorttext); } void cInfosatevent::SetDescription(const char *Description) { description = strcpyrealloc(description, Description); description = compactspace(description); } void cInfosatevent::SetCategoryByID(int i) { i>>=4; switch (i & 0xF0) { case EVCONTENTMASK_MOVIEDRAMA: SetCategory(tr("Content$Movie/Drama")); break; case EVCONTENTMASK_NEWSCURRENTAFFAIRS: SetCategory(tr("Content$News/Current Affairs")); break; case EVCONTENTMASK_SHOW: SetCategory(tr("Content$Show/Game Show")); break; case EVCONTENTMASK_SPORTS: SetCategory(tr("Content$Sports")); break; case EVCONTENTMASK_CHILDRENYOUTH: SetCategory(tr("Content$Children's/Youth Programmes")); break; case EVCONTENTMASK_MUSICBALLETDANCE: SetCategory(tr("Content$Music/Ballet/Dance")); break; case EVCONTENTMASK_ARTSCULTURE: SetCategory(tr("Content$Arts/Culture")); break; case EVCONTENTMASK_SOCIALPOLITICALECONOMICS: SetCategory(tr("Content$Social/Political/Economics")); break; case EVCONTENTMASK_EDUCATIONALSCIENCE: SetCategory(tr("Content$Education/Science/Factual")); break; case EVCONTENTMASK_LEISUREHOBBIES: SetCategory(tr("Content$Leisure/Hobbies")); break; case EVCONTENTMASK_SPECIAL: SetCategory(tr("Content$Special")); break; case EVCONTENTMASK_USERDEFINED: SetCategory(tr("Content$Userdefined")); break; } } void cInfosatevent::SetGenreByID(int i) { i >>= 4; switch (i & 0xF0) { case EVCONTENTMASK_MOVIEDRAMA: switch (i & 0x0F) { default: case 0x00: SetGenre(tr("Content$Movie/Drama")); break; case 0x01: SetGenre(tr("Content$Detective/Thriller")); break; case 0x02: SetGenre(tr("Content$Adventure/Western/War")); break; case 0x03: SetGenre(tr("Content$Science Fiction/Fantasy/Horror")); break; case 0x04: SetGenre(tr("Content$Comedy")); break; case 0x05: SetGenre(tr("Content$Soap/Melodrama/Folkloric")); break; case 0x06: SetGenre(tr("Content$Romance")); break; case 0x07: SetGenre(tr("Content$Serious/Classical/Religious/Historical Movie/Drama")); break; case 0x08: SetGenre(tr("Content$Adult Movie/Drama")); break; } break; case EVCONTENTMASK_NEWSCURRENTAFFAIRS: switch (i & 0x0F) { default: case 0x00: SetGenre(tr("Content$News/Current Affairs")); break; case 0x01: SetGenre(tr("Content$News/Weather Report")); break; case 0x02: SetGenre(tr("Content$News Magazine")); break; case 0x03: SetGenre(tr("Content$Documentary")); break; case 0x04: SetGenre(tr("Content$Discussion/Inverview/Debate")); break; } break; case EVCONTENTMASK_SHOW: switch (i & 0x0F) { default: case 0x00: SetGenre(tr("Content$Show/Game Show")); break; case 0x01: SetGenre(tr("Content$Game Show/Quiz/Contest")); break; case 0x02: SetGenre(tr("Content$Variety Show")); break; case 0x03: SetGenre(tr("Content$Talk Show")); break; } break; case EVCONTENTMASK_SPORTS: switch (i & 0x0F) { default: case 0x00: SetGenre(tr("Content$Sports")); break; case 0x01: SetGenre(tr("Content$Special Event")); break; case 0x02: SetGenre(tr("Content$Sport Magazine")); break; case 0x03: SetGenre(tr("Content$Football")); break; case 0x04: SetGenre(tr("Content$Tennis/Squash")); break; case 0x05: SetGenre(tr("Content$Team Sports")); break; case 0x06: SetGenre(tr("Content$Athletics")); break; case 0x07: SetGenre(tr("Content$Motor Sport")); break; case 0x08: SetGenre(tr("Content$Water Sport")); break; case 0x09: SetGenre(tr("Content$Winter Sports")); break; case 0x0A: SetGenre(tr("Content$Equestrian")); break; case 0x0B: SetGenre(tr("Content$Martial Sports")); break; } break; case EVCONTENTMASK_CHILDRENYOUTH: switch (i & 0x0F) { default: case 0x00: SetGenre(tr("Content$Children's/Youth Programmes")); break; case 0x01: SetGenre(tr("Content$Pre-school Children's Programmes")); break; case 0x02: SetGenre(tr("Content$Entertainment Programmes for 6 to 14")); break; case 0x03: SetGenre(tr("Content$Entertainment Programmes for 10 to 16")); break; case 0x04: SetGenre(tr("Content$Informational/Educational/School Programme")); break; case 0x05: SetGenre(tr("Content$Cartoons/Puppets")); break; } break; case EVCONTENTMASK_MUSICBALLETDANCE: switch (i & 0x0F) { default: case 0x00: SetGenre(tr("Content$Music/Ballet/Dance")); break; case 0x01: SetGenre(tr("Content$Rock/Pop")); break; case 0x02: SetGenre(tr("Content$Serious/Classical Music")); break; case 0x03: SetGenre(tr("Content$Folk/Tradional Music")); break; case 0x04: SetGenre(tr("Content$Jazz")); break; case 0x05: SetGenre(tr("Content$Musical/Opera")); break; case 0x06: SetGenre(tr("Content$Ballet")); break; } break; case EVCONTENTMASK_ARTSCULTURE: switch (i & 0x0F) { default: case 0x00: SetGenre(tr("Content$Arts/Culture")); break; case 0x01: SetGenre(tr("Content$Performing Arts")); break; case 0x02: SetGenre(tr("Content$Fine Arts")); break; case 0x03: SetGenre(tr("Content$Religion")); break; case 0x04: SetGenre(tr("Content$Popular Culture/Traditional Arts")); break; case 0x05: SetGenre(tr("Content$Literature")); break; case 0x06: SetGenre(tr("Content$Film/Cinema")); break; case 0x07: SetGenre(tr("Content$Experimental Film/Video")); break; case 0x08: SetGenre(tr("Content$Broadcasting/Press")); break; case 0x09: SetGenre(tr("Content$New Media")); break; case 0x0A: SetGenre(tr("Content$Arts/Culture Magazines")); break; case 0x0B: SetGenre(tr("Content$Fashion")); break; } break; case EVCONTENTMASK_SOCIALPOLITICALECONOMICS: switch (i & 0x0F) { default: case 0x00: SetGenre(tr("Content$Social/Political/Economics")); break; case 0x01: SetGenre(tr("Content$Magazines/Reports/Documentary")); break; case 0x02: SetGenre(tr("Content$Economics/Social Advisory")); break; case 0x03: SetGenre(tr("Content$Remarkable People")); break; } break; case EVCONTENTMASK_EDUCATIONALSCIENCE: switch (i & 0x0F) { default: case 0x00: SetGenre(tr("Content$Education/Science/Factual")); break; case 0x01: SetGenre(tr("Content$Nature/Animals/Environment")); break; case 0x02: SetGenre(tr("Content$Technology/Natural Sciences")); break; case 0x03: SetGenre(tr("Content$Medicine/Physiology/Psychology")); break; case 0x04: SetGenre(tr("Content$Foreign Countries/Expeditions")); break; case 0x05: SetGenre(tr("Content$Social/Spiritual Sciences")); break; case 0x06: SetGenre(tr("Content$Further Education")); break; case 0x07: SetGenre(tr("Content$Languages")); break; } break; case EVCONTENTMASK_LEISUREHOBBIES: switch (i & 0x0F) { default: case 0x00: SetGenre(tr("Content$Leisure/Hobbies")); break; case 0x01: SetGenre(tr("Content$Tourism/Travel")); break; case 0x02: SetGenre(tr("Content$Handicraft")); break; case 0x03: SetGenre(tr("Content$Motoring")); break; case 0x04: SetGenre(tr("Content$Fitness & Health")); break; case 0x05: SetGenre(tr("Content$Cooking")); break; case 0x06: SetGenre(tr("Content$Advertisement/Shopping")); break; case 0x07: SetGenre(tr("Content$Gardening")); break; } break; case EVCONTENTMASK_SPECIAL: switch (i & 0x0F) { case 0x00: SetGenre(tr("Content$Original Language")); break; case 0x01: SetGenre(tr("Content$Black & White")); break; case 0x02: SetGenre(tr("Content$Unpublished")); break; case 0x03: SetGenre(tr("Content$Live Broadcast")); break; default: SetGenre(tr("Content$Special Characteristics")); break; } break; case EVCONTENTMASK_USERDEFINED: switch (i & 0x0F) { case 0x00: SetGenre(tr("Content$Drama")); // UK Freeview break; default: break; } break; default: break; } } const char *cInfosatevent::ExtEPG(void) { // Returns Category:, Genre:, Year:, Country:, Originaltitle:, FSK: , Rating: [if available] ... char fmt[100]; if (extepg) { free(extepg); extepg=NULL; } extepg=strcatrealloc(extepg,"\n"); if (content) { SetCategoryByID(content); SetGenreByID(content); } if (category) { extepg=strcatrealloc(extepg,"Category: "); extepg=strcatrealloc(extepg,category); extepg=strcatrealloc(extepg,"\n"); } if (genre) { extepg=strcatrealloc(extepg,"Genre: "); extepg=strcatrealloc(extepg,genre); extepg=strcatrealloc(extepg,"\n"); } if (year!=-1) { sprintf(fmt,"Year: %i\n",year); extepg=strcatrealloc(extepg,fmt); } if (country) { extepg=strcatrealloc(extepg,"Country: "); extepg=strcatrealloc(extepg,country); extepg=strcatrealloc(extepg,"\n"); } if (original) { extepg=strcatrealloc(extepg,"Originaltitle: "); extepg=strcatrealloc(extepg,original); extepg=strcatrealloc(extepg,"\n"); } if (fsk!=-1) { sprintf(fmt,"FSK: %i\n",fsk); extepg=strcatrealloc(extepg,fmt); } if (episode) { extepg=strcatrealloc(extepg,"Episode: "); extepg=strcatrealloc(extepg,episode); extepg=strcatrealloc(extepg,"\n"); } if (rating) { extepg=strcatrealloc(extepg,"Rating: "); extepg=strcatrealloc(extepg,rating); extepg=strcatrealloc(extepg,"\n"); } if (announcement) { extepg=strcatrealloc(extepg,"Announcement: "); extepg=strcatrealloc(extepg,announcement); extepg=strcatrealloc(extepg,"\n"); } if (addition) { extepg=strcatrealloc(extepg,"Addition: "); extepg=strcatrealloc(extepg,addition); extepg=strcatrealloc(extepg,"\n"); } int len=strlen(extepg); if (len<=1) { free(extepg); extepg=NULL; } else { extepg[len-1]=0; // cut of last linefeed } return (const char*) extepg; } // --- cProcessInfosatepg cProcessInfosatepg::cProcessInfosatepg() :cThread("infosatepg") { mac=-1; global=NULL; } void cProcessInfosatepg::SetInfo(int Mac, cGlobalInfosatepg *Global) { mac=Mac; global=Global; } void cProcessInfosatepg::Action() { if ((macEPG_LAST_DAY_MAC)) return; FILE *f; const char *file = global->Infosatdata[mac].GetFile(); f=fopen(file,"r"); if (f) { time_t firststarttime=-1; if (ParseInfosatepg(f,&firststarttime)) { if (firststarttime>time(NULL)) { global->SetWakeupTime(firststarttime); } else { isyslog("infosatepg: wakeuptime from infosat is in the past"); firststarttime=cTimer::SetTime(time(NULL),cTimer::TimeToInt(300)); firststarttime+=79200; // add 20 hours global->SetWakeupTime(firststarttime); } global->Infosatdata[mac].Processed=true; } else { esyslog("infosatepg: failed to get writelock while parsing %s",file); } fclose(f); } else { if (access(file,R_OK)==-1) { // cannot open file -> receive it again esyslog("infosatepg: cannot access %s",file); global->Infosatdata[mac].ResetReceivedAll(); } } } cEvent *cProcessInfosatepg::SearchEvent(cSchedule* Schedule, cInfosatevent *iEvent) { cEvent *f=NULL; int maxdiff=INT_MAX; int eventTimeDiff=iEvent->Duration()/4; if (eventTimeDiff<600) eventTimeDiff=600; for (cEvent *p = Schedule->Events()->First(); p; p = Schedule->Events()->Next(p)) { if (!strcmp(p->Title(),iEvent->Title())) { // found event with same title int diff=abs((int) difftime(p->StartTime(),iEvent->StartTime())); if (diff<=eventTimeDiff) { if (diff<=maxdiff) { f=p; maxdiff=diff; } } } } return f; } bool cProcessInfosatepg::AddInfosatEvent(cChannel *channel, cInfosatevent *iEvent) { if ((!channel) || (!iEvent)) return true; if (iEvent->Usage()==USE_NOTHING) return true; // this should never happen! if (iEvent->StartTime()StartTime()>(time(NULL)+(iEvent->Days()*86400))) return true; cSchedulesLock SchedulesLock(true,2000); // to be safe ;) const cSchedules *Schedules = cSchedules::Schedules(SchedulesLock); if (!Schedules) return false; // No write lock -> try later! bool sAdd=false; if ((iEvent->Usage() & USE_APPEND)==USE_APPEND) sAdd=true; cSchedule* Schedule = (cSchedule *) Schedules->GetSchedule(channel,sAdd); if (!Schedule) return true; // No schedule -> do nothing (is this ok?) time_t start=0; cEvent *Event=NULL; const cEvent *lastEvent=Schedule->Events()->Last(); if (iEvent->Duration()==0) { start=iEvent->StartTime(); isyslog("infosatepg: event %s [%li (%s)] without duration", iEvent->Title(),start,ctime(&start)); } if ((lastEvent) && (iEvent->StartTime()EndTime())) { // try to find, 1st with StartTime Event = (cEvent *) Schedule->GetEvent(iEvent->EventID(),iEvent->StartTime()); // 2nd with our own EventID if (!Event) Event = (cEvent *) Schedule->GetEvent(iEvent->EventID()); // 3rd with StartTime +/- WaitTime if (!Event) Event= (cEvent *) SearchEvent(Schedule,iEvent); if (!Event) { start=iEvent->StartTime(); dsyslog("infosatepg: failed to find event %s [%li (%s)]", iEvent->Title(),start,ctime(&start)); global->Infosatdata[mac].Unlocated++; return true; // just bail out with ok } start=Event->StartTime(); dsyslog("infosatepg: changing event %s [%li]", Event->Title(),start); // change existing event, prevent EIT EPG to update Event->SetTableID(0); Event->SetSeen(); // meaning of this? } else { // we are beyond the last event, just add (if we should) if ((iEvent->Usage() & USE_APPEND)!=USE_APPEND) return true; Event = new cEvent(iEvent->EventID()); if (!Event) return true; Event->SetStartTime(iEvent->StartTime()); Event->SetDuration(iEvent->Duration()); Event->SetTitle(iEvent->Title()); Event->SetVersion(0); start=iEvent->StartTime(); dsyslog("infosatepg: adding new event %s (%lu) [%li]",iEvent->Title(), (u_long) iEvent->EventID(),start); Schedule->AddEvent(Event); } if ((iEvent->Usage() & USE_SHORTTEXT) == USE_SHORTTEXT) { if (!iEvent->ShortText()) { // no short text if (iEvent->Original()) { // use original if it exists iEvent->SetShortText(iEvent->Original()); } } // if shorttext is the same as the title -> skip short text // this skips additional bug reporting in epg.c if (iEvent->ShortText() && iEvent->Title()) { if (!strcmp(iEvent->ShortText(),iEvent->Title())) { iEvent->SetShortText(NULL); } } // if shorttext is the same as the description -> skip short text if (iEvent->ShortText() && Event->Description()) { if (!strcmp(iEvent->ShortText(),Event->Description())) { iEvent->SetShortText(NULL); } } Event->SetShortText(iEvent->ShortText()); } if ((iEvent->Usage() & USE_LONGTEXT) == USE_LONGTEXT) { if ((iEvent->Usage() & USE_MERGELONGTEXT)==USE_MERGELONGTEXT) { // first check if we have a description const char *iDescr=iEvent->Description(); if (iDescr) { const char *oDescr=Event->Description(); if (oDescr) { // there is an "old" description if (strlen(iDescr)>strlen(oDescr)) { // more text in infosat Event->SetDescription(iEvent->Description()); } } else { // event has no description, just use infosat one Event->SetDescription(iEvent->Description()); } } } else { // just do it the easy way Event->SetDescription(iEvent->Description()); } } if ((iEvent->Usage() & USE_EXTEPG)==USE_EXTEPG) { const char *oDescr=Event->Description(); const char *extEPG=iEvent->ExtEPG(); if (extEPG) { // we have extended EPG info if (!oDescr) { // no old description -> just use extEPG Event->SetDescription(extEPG); } else { // add extEPG to description char *nDescr=strdup(oDescr); strreplace(nDescr,extEPG,""); nDescr=strcatrealloc(nDescr,extEPG); Event->SetDescription(nDescr); free(nDescr); } } } return true; } cChannel *cProcessInfosatepg::GetVDRChannel(int frequency, int sid) { cChannel *chan; int source = cSource::FromString("S19.2E"); // only from astra 19.2E for (int i=0; i<=Channels.MaxNumber(); i++) { chan = Channels.GetByNumber(i,0); if (chan) { if (chan->Source()!=source) continue; if (chan->Sid()!=sid) continue; if ((chan->Frequency()==frequency) || (chan->Frequency()+1==frequency) || (chan->Frequency()-1==frequency)) { return chan; } } } return NULL; } bool cProcessInfosatepg::CheckOriginal_and_Episode(char **s,cInfosatevent *iEvent,cCharSetConv *conv) { if (!strcmp(*s,"Blockbuster")) { iEvent->SetRating("Tipp"); (*s)+=11; return false; } if (!strcmp(*s,"LIVE")) { iEvent->SetAnnouncement("LIVE"); (*s)+=4; return false; } if (!strcmp(*s,"SAT.1-REIHE")) { // just ignore (*s)+=11; return false; } if (!strcmp(*s,"Sat.1 FilmFilm")) { // just ignore (*s)+=14; return false; } if (!strcmp(*s,"NIGHT ACTION")) { iEvent->SetAnnouncement("Action"); (*s)+=12; return false; } if (!strcmp(*s,"FILME DER FILMEMACHER")) { iEvent->SetAnnouncement("Filme der Filmemacher"); (*s)+=21; return false; } if (!strcmp(*s,"DIE BESTEN FILME ALLER ZEITEN")) { iEvent->SetRating("Tipp"); (*s)+=29; return false; } if (!strncmp(*s,"Folge ",6)) { (*s)+=6; char *episode=*s; // ok, overread Numbers and / while (isdigit(**s) | **s=='/') (*s)++; if (**s==0) { iEvent->SetEpisode(episode); return false; } (**s)=0; iEvent->SetEpisode(episode); (*s)++; // advance to subtitle if (**s=='-') (*s)++; // overread hyphen, if it exists while (**s==' ') (*s)++; // overread spaces } char *pOT,*pEOT; pOT=strchr(*s,'('); if (!pOT) return false; pEOT=strrchr(pOT,')'); if (!pEOT) return false; if (pEOT[1]!=0) return false; if (pEOT[-1]==')') { char *pTMP = strchr(&pOT[1],'('); if (pTMP) { pOT=pTMP; } } else { // just one brace if (isdigit(pOT[1])) return false; } *pOT=*pEOT=0; *pOT++; if (pOT[-1]==' ') pOT[-1]=0; // check some things if (!strcmp(pOT,"TM")) return false; if (!strcmp(pOT,"Pilot")) { iEvent->SetAnnouncement("Pilot"); return false; } // check for (number) char *endp=NULL; long int ret =strtol(pOT,&endp,10); if ((ret!=0) && (*endp==0)) return false; // with original title iEvent->SetOriginal(conv->Convert(pOT)); return true; } bool cProcessInfosatepg::CheckAnnouncement(char *s,cInfosatevent *iEvent) { bool ret=true; if ((strlen(s)==16) && (!strcmp(s,"Erstausstrahlung"))) { iEvent->SetAnnouncement("Erstausstrahlung"); } else if ((strlen(s)==20) && (!strcmp(s,"Deutschland-Premiere"))) { iEvent->SetAnnouncement("Deutschland-Premiere"); } else if ((strlen(s)>=16) && (!strncmp(s,"Free-TV-Premiere",16))) { iEvent->SetAnnouncement("Free-TV-Premiere!"); } else if ((strlen(s)>=9) && (!strncmp(s,"Highlight",9))) { iEvent->SetRating("Tipp"); } else if ((strlen(s)>=9) && (!strncmp(s,"TAGESTIPP",9))) { iEvent->SetRating("Tipp"); } else if ((strlen(s)>=10) && (!strncmp(s,"Tagestipp!",10))) { iEvent->SetRating("Tipp"); } else if ((strlen(s)>=10) && (!strncmp(s,"Start der ",10))) { // just ignore this } else if ((strlen(s)>=15) && (!strncmp(s,"CARTOON NETWORK",15))) { // just ignore this } else if ((strlen(s)>=11) && (!strncmp(s,"SAT.1-SERIE",11))) { // just ignore this } else if ((strlen(s)>=16) && (!strncmp(s,"kabel eins Trick",16))) { // just ignore this } else if ((strlen(s)>=5) && (!strncmp(s,"JETIX",5))) { // just ignore this } else if ((strlen(s)>=11) && (!strncmp(s,"DISNEY TIME",11))) { // just ignore this } else ret=false; return ret; } bool cProcessInfosatepg::ParseInfosatepg(FILE *f,time_t *firststarttime) { char *s,tag; int fields,index; size_t size; time_t oldstart=-1; bool ignore=true; bool abort=false; struct tm tm; int ieventnr=1; cChannel *chan=NULL; cInfosatevent *ievent=NULL; // XXX don't default to assuming UTF-8 on FreeBSD (that's what the NULL does), // its still often used without. #if VDRVERSNUM < 10701 || defined(__FreeBSD__) cCharSetConv *conv = new cCharSetConv("ISO-8859-1",cCharSetConv::SystemCharacterTable() ? cCharSetConv::SystemCharacterTable() : "UTF-8"); #else cCharSetConv *conv = new cCharSetConv("ISO-8859-1",NULL); #endif cReadLineInfosatepg ReadLine; while ((s=ReadLine.Read(f,&size))!=NULL) { if (size<3) continue; if (isdigit(s[0])) { if (ievent) { int fsk; unsigned int content_descr; fields=sscanf(s,"%x %d",&content_descr,&fsk); if (fields==1) ievent->SetContentDescriptor(content_descr); if (fields==2) { ievent->SetContentDescriptor(content_descr); ievent->SetFSK(fsk); } } continue; } s++; tag=*s; s+=2; switch (tag) { case 'P': // contains program (schedule) ignore=true; int frequency,sid,day,month,year,hour,minute; fields=sscanf(s,"%*[^(](%*[^,],%d,%d) %d.%d.%d %*s %*s %d:%d", &frequency,&sid,&day,&month,&year,&hour,&minute); if (fields==7) { // got all fields chan=GetVDRChannel(frequency,sid); if (chan) { if (!global->ChannelExists(chan->GetChannelID(),&index)) { if (!global->InfosatChannels()) { // Send message Skins.QueueMessage(mtInfo, tr("Infosat channellist available")); } // Channel is not in global list->add global->AddChannel(chan->GetChannelID(),USE_NOTHING,1); } else { if (global->GetChannelUsage(index)!=USE_NOTHING) { memset(&tm,0,sizeof(tm)); tm.tm_sec=0; tm.tm_min=minute; tm.tm_hour=hour; tm.tm_mday=day; tm.tm_mon=month-1; tm.tm_year=year-1900; tm.tm_isdst=-1; oldstart=mktime(&tm); dsyslog("infosatepg: using '%s'",s); dsyslog("infosatepg: start on %02i.%02i.%04i %02i:%02i (%s)", tm.tm_mday,tm.tm_mon+1,tm.tm_year+1900, tm.tm_hour,tm.tm_min,asctime(&tm)); ignore=false; ieventnr=1; } } } } break; case 'E': // contains event / title if (ignore) continue; if (ievent) { // There was an event without long description -> add if (!AddInfosatEvent(chan,ievent)) abort=true; delete ievent; // delete old event ievent =NULL; } int shour,sminute; char *title; #ifdef __FreeBSD__ title = (char *)malloc(strlen(s)); fields=0; if (title) fields=sscanf(s,"%d:%d %[^^]",&shour,&sminute,title); #else fields=sscanf(s,"%d:%d %a[^^]",&shour,&sminute,&title); #endif if (fields==3) { if (!ievent) ievent = new cInfosatevent; tm.tm_hour=shour; tm.tm_min=sminute; tm.tm_isdst=-1; time_t start=mktime(&tm); if ((oldstart!=(time_t) -1) && (difftime(start,oldstart)<0)) { // last ievent was yesterday tm.tm_isdst=-1; tm.tm_mday++; start=mktime(&tm); } if (*firststarttime==(time_t) -1) { *firststarttime=start+79200; // add 20 hours } oldstart=start; ievent->SetStartTime(start); ievent->SetTitle(conv->Convert(title)); free(title); ievent->SetEventUsage(global->GetChannelUsage(index)); ievent->SetEventDays(global->GetChannelDays(index)); ievent->SetEventID(DoSum(ieventnr++,ievent->Title(),strlen(ievent->Title()))); } else { dsyslog("infosatepg: ERROR sscanf failed, just %i fields [%s]", fields,s); } break; case 'S': if (ignore) continue; if (!ievent) continue; // contains: // short description (,maybe special announcement)<8A> // Genre (,maybe Country and Year), Duration (sometimes missing) char *p8A,*pSA; p8A=strchr(s,0x8A); if (p8A) { *p8A=0; // check for special announcements pSA=strrchr(s,','); if (pSA) { if (CheckAnnouncement(pSA+2,ievent)) { // announcement was added to short description *pSA=0; } CheckOriginal_and_Episode(&s,ievent,conv); ievent->SetShortText(conv->Convert(s)); } else { if (!CheckAnnouncement(s,ievent)) { CheckOriginal_and_Episode(&s,ievent,conv); ievent->SetShortText(conv->Convert(s)); } } s=++p8A; } char *pDU; pDU=strrchr(s,','); if (pDU) { *pDU=0; // with additional info if (CheckAnnouncement(s,ievent)) { char *tp8A; tp8A=strchr(s,0x8A); if (tp8A) s=++tp8A; } char *pCY; pCY=strchr(s,','); if (pCY) { // with country or year *pCY=0; pCY+=2; if (isdigit(*pCY)) { // just year (checked) ievent->SetYear(atoi(pCY)); } else { char *pSP; pSP=strrchr(pCY,' '); if (pSP) { *pSP=0; pSP++; // country and year (check!!) int year = atoi(pSP); if (year>1900) ievent->SetYear(year); ievent->SetCountry(conv->Convert(pCY)); } else { // just country ievent->SetCountry(conv->Convert(pCY)); } } } year=atoi(s); if (year>1900) { ievent->SetYear(year); } else { ievent->SetAddition(conv->Convert(s)); } s=++pDU; } int len; len=strlen(s); if ((s[len-1]=='.') && (s[len-2]=='n') && (s[len-3]=='i') && (s[len-4]=='M')) { // Duration ievent->SetDuration(60*atoi(s)); } break; case 'L': // contains description if (ignore) continue; if (!ievent) continue; strreplace(s,-118,'\n'); // 0x8a ievent->SetDescription(conv->Convert(s)); if (!AddInfosatEvent(chan,ievent)) abort=true; delete ievent; ievent=NULL; break; case 'Q': if (ignore) continue; if (!ievent) continue; if ((ievent->Duration()==0) && (ievent->StartTime()!=0)) { int ehour,eminute; fields=sscanf(s,"%d:%d",&ehour,&eminute); if (fields==2) { tm.tm_hour=ehour; tm.tm_min=eminute; tm.tm_isdst=-1; time_t end=mktime(&tm); if (difftime(end,ievent->StartTime())<0) { // last ievent was yesterday tm.tm_isdst=-1; tm.tm_mday++; end=mktime(&tm); } double duration=difftime(end,ievent->StartTime()); if (duration>0) { ievent->SetDuration((int) (duration+60)); } } } if (!AddInfosatEvent(chan,ievent)) abort=true; delete ievent; ievent=NULL; default: continue; } if (abort) break; } delete conv; return (!abort); } u_long cProcessInfosatepg::DoSum(u_long sum, const char *buf, int nBytes) { int nleft=nBytes; u_short *w = (u_short*)buf; while (nleft > 1) { sum += *w++; nleft -= 2; } if (nleft == 1) { u_short answer = 0; *(u_char*)(&answer) = *(u_char*)w; sum += answer; } return sum; }