mirror of
https://github.com/vdr-projects/vdr.git
synced 2025-03-01 10:50:46 +00:00
- Fixed updating the "Info" button in the "Timers" menu. - Reduced the number of events to actually check when setting events to timers. - cMenuEditIntItem now checks the given value and forces it to be between the given min and max limits. - The status changes of EPG events are now logged for all channels that have timers. - Removed the log message "deleting plugin: ..." when shutting down VDR (thanks to Christoph Haubrich for reporting that this is irritating when calling "vdr --help"). - Fixed cReadLine::Read() for lines that end with the infamous "\r\n" (thanks to Rolf Ahrenberg). - Fixed cDvbDevice::SetAudioBypass() in case setTransferModeForDolbyDigital is false (thanks to Werner Fink). - Updated 'sources.conf' (thanks to Oleg Roitburd). - Fixed the shutdown timeout (thanks to Alexander Wenzel). - Only calling RemoveEmptyVideoDirectories() once in case a recording has been deleted (reported by Hardy Flor). - Fixed deleting recordings that have been removed externally when running out of disk space (reported by Jan Lenz). - Fixed handling repeating VPS timers (they stopped recording too early). - Timer log messages now show "VPS" if this is a VPS timer. - Fixed getting the present EPG event in case none is currently 'running' (it then returns the one that just ended). - Fixed calling a plugin's main menu function while a message is being displayed (reported by Helmut Auer). - Updated the Russian OSD texts (thanks to Oleg Roitburd). - Made cMenuRecordings::GetRecording() 'protected' (suggested by Marius Heidenstecker). - Speeded up cRemux::ScanVideoPacket() (thanks to Reinhard Nissl). - Enhanced logging EPG event data. - Fixed format string handling (thanks to Darren Salt). - The new function cDevice::ForceTransferMode() can be used to force the primary device into transfer mode (thanks to Reinhard Nissl). - The 'version' of EPG events is now ignored when reading EPG data from 'epg.data' or via SVDRP/PUTE to avoid problems with double EPG events. - The 'running status' of EPG events is now only set to SI::RunningStatusNotRunning for events before the present event. - Fixed some #include sequences. - Single shot VPS timers are now only considered 'expired' if their associated EPG event has been explicitly set to SI::RunningStatusNotRunning. - The check for timers to be deleted is now done only every 30 seconds.
126 lines
4.1 KiB
C++
126 lines
4.1 KiB
C++
/*
|
|
* timers.h: Timer handling
|
|
*
|
|
* See the main source file 'vdr.c' for copyright information and
|
|
* how to reach the author.
|
|
*
|
|
* $Id: timers.h 1.27 2006/03/26 10:44:01 kls Exp $
|
|
*/
|
|
|
|
#ifndef __TIMERS_H
|
|
#define __TIMERS_H
|
|
|
|
#include "channels.h"
|
|
#include "config.h"
|
|
#include "epg.h"
|
|
#include "tools.h"
|
|
|
|
enum eTimerFlags { tfNone = 0x0000,
|
|
tfActive = 0x0001,
|
|
tfInstant = 0x0002,
|
|
tfVps = 0x0004,
|
|
tfRecording = 0x0008,
|
|
tfAll = 0xFFFF,
|
|
};
|
|
enum eTimerMatch { tmNone, tmPartial, tmFull };
|
|
|
|
class cTimer : public cListObject {
|
|
friend class cMenuEditTimer;
|
|
private:
|
|
mutable time_t startTime, stopTime;
|
|
time_t lastSetEvent;
|
|
bool recording, pending, inVpsMargin;
|
|
uint flags;
|
|
cChannel *channel;
|
|
mutable time_t day; ///< midnight of the day this timer shall hit, or of the first day it shall hit in case of a repeating timer
|
|
int weekdays; ///< bitmask, lowest bits: SSFTWTM (the 'M' is the LSB)
|
|
int start;
|
|
int stop;
|
|
int priority;
|
|
int lifetime;
|
|
char file[MaxFileName];
|
|
char *aux;
|
|
const cEvent *event;
|
|
public:
|
|
cTimer(bool Instant = false, bool Pause = false, cChannel *Channel = NULL);
|
|
cTimer(const cEvent *Event);
|
|
virtual ~cTimer();
|
|
cTimer& operator= (const cTimer &Timer);
|
|
virtual int Compare(const cListObject &ListObject) const;
|
|
bool Recording(void) const { return recording; }
|
|
bool Pending(void) const { return pending; }
|
|
bool InVpsMargin(void) const { return inVpsMargin; }
|
|
uint Flags(void) const { return flags; }
|
|
const cChannel *Channel(void) const { return channel; }
|
|
time_t Day(void) const { return day; }
|
|
int WeekDays(void) const { return weekdays; }
|
|
int Start(void) const { return start; }
|
|
int Stop(void) const { return stop; }
|
|
int Priority(void) const { return priority; }
|
|
int Lifetime(void) const { return lifetime; }
|
|
const char *File(void) const { return file; }
|
|
time_t FirstDay(void) const { return weekdays ? day : 0; }
|
|
const char *Aux(void) const { return aux; }
|
|
cString ToText(bool UseChannelID = false);
|
|
cString ToDescr(void) const;
|
|
const cEvent *Event(void) const { return event; }
|
|
bool Parse(const char *s);
|
|
bool Save(FILE *f);
|
|
bool IsSingleEvent(void) const;
|
|
static int GetMDay(time_t t);
|
|
static int GetWDay(time_t t);
|
|
bool DayMatches(time_t t) const;
|
|
static time_t IncDay(time_t t, int Days);
|
|
static time_t SetTime(time_t t, int SecondsFromMidnight);
|
|
char *SetFile(const char *File);
|
|
bool Matches(time_t t = 0, bool Directly = false) const;
|
|
int Matches(const cEvent *Event, int *Overlap = NULL) const;
|
|
bool Expired(void) const;
|
|
time_t StartTime(void) const;
|
|
time_t StopTime(void) const;
|
|
void SetEventFromSchedule(const cSchedules *Schedules = NULL);
|
|
void SetEvent(const cEvent *Event);
|
|
void SetRecording(bool Recording);
|
|
void SetPending(bool Pending);
|
|
void SetInVpsMargin(bool InVpsMargin);
|
|
void SetPriority(int Priority);
|
|
void SetFlags(uint Flags);
|
|
void ClrFlags(uint Flags);
|
|
void InvFlags(uint Flags);
|
|
bool HasFlags(uint Flags) const;
|
|
void Skip(void);
|
|
void OnOff(void);
|
|
cString PrintFirstDay(void) const;
|
|
static int TimeToInt(int t);
|
|
static bool ParseDay(const char *s, time_t &Day, int &WeekDays);
|
|
static cString PrintDay(time_t Day, int WeekDays);
|
|
};
|
|
|
|
class cTimers : public cConfig<cTimer> {
|
|
private:
|
|
int state;
|
|
int beingEdited;
|
|
time_t lastSetEvents;
|
|
time_t lastDeleteExpired;
|
|
public:
|
|
cTimers(void);
|
|
cTimer *GetTimer(cTimer *Timer);
|
|
cTimer *GetMatch(time_t t);
|
|
cTimer *GetMatch(const cEvent *Event, int *Match = NULL);
|
|
cTimer *GetNextActiveTimer(void);
|
|
int BeingEdited(void) { return beingEdited; }
|
|
void IncBeingEdited(void) { beingEdited++; }
|
|
void DecBeingEdited(void) { if (!--beingEdited) lastSetEvents = 0; }
|
|
void SetModified(void);
|
|
bool Modified(int &State);
|
|
///< Returns true if any of the timers have been modified, which
|
|
///< is detected by State being different than the internal state.
|
|
///< Upon return the internal state will be stored in State.
|
|
void SetEvents(void);
|
|
void DeleteExpired(void);
|
|
};
|
|
|
|
extern cTimers Timers;
|
|
|
|
#endif //__TIMERS_H
|