vdr 2.6.1
Public Member Functions | Static Public Member Functions | Static Private Member Functions | Static Private Attributes | List of all members
cRecordings Class Reference

#include <recording.h>

Public Member Functions

 cRecordings (bool Deleted=false)
 
virtual ~cRecordings ()
 
void ResetResume (const char *ResumeFileName=NULL)
 
void ClearSortNames (void)
 
const cRecordingGetById (int Id) const
 
cRecordingGetById (int Id)
 
const cRecordingGetByName (const char *FileName) const
 
cRecordingGetByName (const char *FileName)
 
void Add (cRecording *Recording)
 
void AddByName (const char *FileName, bool TriggerUpdate=true)
 
void DelByName (const char *FileName)
 
void UpdateByName (const char *FileName)
 
int TotalFileSizeMB (void) const
 
double MBperMinute (void) const
 
int PathIsInUse (const char *Path) const
 
int GetNumRecordingsInPath (const char *Path) const
 
bool MoveRecordings (const char *OldPath, const char *NewPath)
 
 cRecordings (bool Deleted=false)
 
virtual ~cRecordings ()
 
void ResetResume (const char *ResumeFileName=NULL)
 
void ClearSortNames (void)
 
const cRecordingGetById (int Id) const
 
cRecordingGetById (int Id)
 
const cRecordingGetByName (const char *FileName) const
 
cRecordingGetByName (const char *FileName)
 
void Add (cRecording *Recording)
 
void AddByName (const char *FileName, bool TriggerUpdate=true)
 
void DelByName (const char *FileName)
 
void UpdateByName (const char *FileName)
 
int TotalFileSizeMB (void) const
 
double MBperMinute (void) const
 
int PathIsInUse (const char *Path) const
 
int GetNumRecordingsInPath (const char *Path) const
 
bool MoveRecordings (const char *OldPath, const char *NewPath)
 
- Public Member Functions inherited from cList< cRecording >
 cList (const char *NeedsLocking=NULL)
 
 cList (const char *NeedsLocking=NULL)
 
const cRecordingGet (int Index) const
 
cRecordingGet (int Index)
 
const cRecordingGet (int Index) const
 
cRecordingGet (int Index)
 
const cRecordingFirst (void) const
 
cRecordingFirst (void)
 
const cRecordingFirst (void) const
 
cRecordingFirst (void)
 
const cRecordingLast (void) const
 
cRecordingLast (void)
 
const cRecordingLast (void) const
 
cRecordingLast (void)
 
const cRecordingPrev (const cRecording *Object) const
 
cRecordingPrev (const cRecording *Object)
 
const cRecordingPrev (const cRecording *Object) const
 
cRecordingPrev (const cRecording *Object)
 
const cRecordingNext (const cRecording *Object) const
 
cRecordingNext (const cRecording *Object)
 
const cRecordingNext (const cRecording *Object) const
 
cRecordingNext (const cRecording *Object)
 
- Public Member Functions inherited from cListBase
virtual ~cListBase ()
 
bool Lock (cStateKey &StateKey, bool Write=false, int TimeoutMs=0) const
 
void SetSyncStateKey (cStateKey &StateKey)
 
void SetUseGarbageCollector (void)
 
void SetExplicitModify (void)
 
void SetModified (void)
 
void Add (cListObject *Object, cListObject *After=NULL)
 
void Ins (cListObject *Object, cListObject *Before=NULL)
 
void Del (cListObject *Object, bool DeleteObject=true)
 
virtual void Move (int From, int To)
 
void Move (cListObject *From, cListObject *To)
 
virtual void Clear (void)
 
bool Contains (const cListObject *Object) const
 
const cListObjectGet (int Index) const
 
cListObjectGet (int Index)
 
int Count (void) const
 
void Sort (void)
 
virtual ~cListBase ()
 
bool Lock (cStateKey &StateKey, bool Write=false, int TimeoutMs=0) const
 
void SetSyncStateKey (cStateKey &StateKey)
 
void SetUseGarbageCollector (void)
 
void SetExplicitModify (void)
 
void SetModified (void)
 
void Add (cListObject *Object, cListObject *After=NULL)
 
void Ins (cListObject *Object, cListObject *Before=NULL)
 
void Del (cListObject *Object, bool DeleteObject=true)
 
virtual void Move (int From, int To)
 
void Move (cListObject *From, cListObject *To)
 
virtual void Clear (void)
 
bool Contains (const cListObject *Object) const
 
const cListObjectGet (int Index) const
 
cListObjectGet (int Index)
 
int Count (void) const
 
void Sort (void)
 

Static Public Member Functions

static const cRecordingsGetRecordingsRead (cStateKey &StateKey, int TimeoutMs=0)
 
static cRecordingsGetRecordingsWrite (cStateKey &StateKey, int TimeoutMs=0)
 
static const cRecordingsGetDeletedRecordingsRead (cStateKey &StateKey, int TimeoutMs=0)
 
static cRecordingsGetDeletedRecordingsWrite (cStateKey &StateKey, int TimeoutMs=0)
 
static void Update (bool Wait=false)
 
static void TouchUpdate (void)
 
static bool NeedsUpdate (void)
 
static const cRecordingsGetRecordingsRead (cStateKey &StateKey, int TimeoutMs=0)
 
static cRecordingsGetRecordingsWrite (cStateKey &StateKey, int TimeoutMs=0)
 
static const cRecordingsGetDeletedRecordingsRead (cStateKey &StateKey, int TimeoutMs=0)
 
static cRecordingsGetDeletedRecordingsWrite (cStateKey &StateKey, int TimeoutMs=0)
 
static void Update (bool Wait=false)
 
static void TouchUpdate (void)
 
static bool NeedsUpdate (void)
 

Static Private Member Functions

static const char * UpdateFileName (void)
 
static const char * UpdateFileName (void)
 

Static Private Attributes

static cRecordings recordings
 
static cRecordings deletedRecordings
 
static int lastRecordingId = 0
 
static char * updateFileName = NULL
 
static time_t lastUpdate = 0
 
static cVideoDirectoryScannerThreadvideoDirectoryScannerThread = NULL
 

Additional Inherited Members

- Protected Member Functions inherited from cListBase
 cListBase (const char *NeedsLocking=NULL)
 
 cListBase (const char *NeedsLocking=NULL)
 
- Protected Attributes inherited from cListBase
cListObjectobjects
 
cListObjectlastObject
 
int count
 
cStateLock stateLock
 
const char * needsLocking
 
bool useGarbageCollector
 

Detailed Description

Definition at line 228 of file include/vdr/recording.h.

Constructor & Destructor Documentation

◆ cRecordings() [1/2]

cRecordings::cRecordings ( bool  Deleted = false)

Definition at line 1510 of file recording.c.

◆ ~cRecordings() [1/2]

cRecordings::~cRecordings ( )
virtual

Definition at line 1515 of file recording.c.

References videoDirectoryScannerThread.

◆ cRecordings() [2/2]

cRecordings::cRecordings ( bool  Deleted = false)

◆ ~cRecordings() [2/2]

virtual cRecordings::~cRecordings ( )
virtual

Member Function Documentation

◆ Add() [1/2]

void cRecordings::Add ( cRecording Recording)

◆ Add() [2/2]

void cRecordings::Add ( cRecording Recording)

◆ AddByName() [1/2]

void cRecordings::AddByName ( const char *  FileName,
bool  TriggerUpdate = true 
)

Definition at line 1583 of file recording.c.

References Add(), GetByName(), and TouchUpdate().

Referenced by cRecordingsHandlerEntry::Active(), and cRecordingsHandlerEntry::Cleanup().

◆ AddByName() [2/2]

void cRecordings::AddByName ( const char *  FileName,
bool  TriggerUpdate = true 
)

◆ ClearSortNames() [1/2]

void cRecordings::ClearSortNames ( void  )

Definition at line 1700 of file recording.c.

References cList< cRecording >::First(), and cList< cRecording >::Next().

◆ ClearSortNames() [2/2]

void cRecordings::ClearSortNames ( void  )

◆ DelByName() [1/2]

void cRecordings::DelByName ( const char *  FileName)

◆ DelByName() [2/2]

void cRecordings::DelByName ( const char *  FileName)

◆ GetById() [1/4]

cRecording * cRecordings::GetById ( int  Id)
inline

Definition at line 264 of file include/vdr/recording.h.

References GetById().

Referenced by GetById().

◆ GetById() [2/4]

cRecording * cRecordings::GetById ( int  Id)
inline

Definition at line 264 of file recording.h.

References GetById().

Referenced by GetById().

◆ GetById() [3/4]

const cRecording * cRecordings::GetById ( int  Id) const

Definition at line 1557 of file recording.c.

References cList< cRecording >::First(), and cList< cRecording >::Next().

◆ GetById() [4/4]

const cRecording * cRecordings::GetById ( int  Id) const

◆ GetByName() [1/4]

cRecording * cRecordings::GetByName ( const char *  FileName)
inline

Definition at line 266 of file include/vdr/recording.h.

References GetByName().

Referenced by GetByName().

◆ GetByName() [2/4]

cRecording * cRecordings::GetByName ( const char *  FileName)
inline

Definition at line 266 of file recording.h.

References GetByName().

Referenced by GetByName().

◆ GetByName() [3/4]

const cRecording * cRecordings::GetByName ( const char *  FileName) const

◆ GetByName() [4/4]

const cRecording * cRecordings::GetByName ( const char *  FileName) const

◆ GetDeletedRecordingsRead() [1/2]

static const cRecordings * cRecordings::GetDeletedRecordingsRead ( cStateKey StateKey,
int  TimeoutMs = 0 
)
inlinestatic

Gets the list of deleted recordings for read access.

See cTimers::GetTimersRead() for details.

Definition at line 246 of file include/vdr/recording.h.

References deletedRecordings, and cListBase::Lock().

◆ GetDeletedRecordingsRead() [2/2]

static const cRecordings * cRecordings::GetDeletedRecordingsRead ( cStateKey StateKey,
int  TimeoutMs = 0 
)
inlinestatic

Gets the list of deleted recordings for read access.

See cTimers::GetTimersRead() for details.

Definition at line 246 of file recording.h.

References deletedRecordings, and cListBase::Lock().

◆ GetDeletedRecordingsWrite() [1/2]

static cRecordings * cRecordings::GetDeletedRecordingsWrite ( cStateKey StateKey,
int  TimeoutMs = 0 
)
inlinestatic

Gets the list of deleted recordings for write access.

See cTimers::GetTimersWrite() for details.

Definition at line 249 of file include/vdr/recording.h.

References deletedRecordings, and cListBase::Lock().

◆ GetDeletedRecordingsWrite() [2/2]

static cRecordings * cRecordings::GetDeletedRecordingsWrite ( cStateKey StateKey,
int  TimeoutMs = 0 
)
inlinestatic

Gets the list of deleted recordings for write access.

See cTimers::GetTimersWrite() for details.

Definition at line 249 of file recording.h.

References deletedRecordings, and cListBase::Lock().

◆ GetNumRecordingsInPath() [1/2]

int cRecordings::GetNumRecordingsInPath ( const char *  Path) const

Returns the total number of recordings in the given Path, including all sub-folders of Path.

If Path is NULL or an empty string, the entire video directory is checked.

Definition at line 1662 of file recording.c.

References cList< cRecording >::First(), and cList< cRecording >::Next().

◆ GetNumRecordingsInPath() [2/2]

int cRecordings::GetNumRecordingsInPath ( const char *  Path) const

Returns the total number of recordings in the given Path, including all sub-folders of Path.

If Path is NULL or an empty string, the entire video directory is checked.

◆ GetRecordingsRead() [1/2]

static const cRecordings * cRecordings::GetRecordingsRead ( cStateKey StateKey,
int  TimeoutMs = 0 
)
inlinestatic

◆ GetRecordingsRead() [2/2]

static const cRecordings * cRecordings::GetRecordingsRead ( cStateKey StateKey,
int  TimeoutMs = 0 
)
inlinestatic

Gets the list of recordings for read access.

See cTimers::GetTimersRead() for details.

Definition at line 240 of file recording.h.

References cListBase::Lock(), and recordings.

◆ GetRecordingsWrite() [1/2]

static cRecordings * cRecordings::GetRecordingsWrite ( cStateKey StateKey,
int  TimeoutMs = 0 
)
inlinestatic

Gets the list of recordings for write access.

See cTimers::GetTimersWrite() for details.

Definition at line 243 of file include/vdr/recording.h.

References cListBase::Lock(), and recordings.

Referenced by cMenuRecordingEdit::ApplyChanges(), cMenuRecordings::Delete(), and cMenuRecordings::Set().

◆ GetRecordingsWrite() [2/2]

static cRecordings * cRecordings::GetRecordingsWrite ( cStateKey StateKey,
int  TimeoutMs = 0 
)
inlinestatic

Gets the list of recordings for write access.

See cTimers::GetTimersWrite() for details.

Definition at line 243 of file recording.h.

References cListBase::Lock(), and recordings.

◆ MBperMinute() [1/2]

double cRecordings::MBperMinute ( void  ) const

Returns the average data rate (in MB/min) of all recordings, or -1 if this value is unknown.

Definition at line 1631 of file recording.c.

References cList< cRecording >::First(), LIMIT_SECS_PER_MB_RADIO, and cList< cRecording >::Next().

◆ MBperMinute() [2/2]

double cRecordings::MBperMinute ( void  ) const

Returns the average data rate (in MB/min) of all recordings, or -1 if this value is unknown.

◆ MoveRecordings() [1/2]

bool cRecordings::MoveRecordings ( const char *  OldPath,
const char *  NewPath 
)

Moves all recordings in OldPath to NewPath.

Returns true if all recordings were successfully moved. As soon as the operation fails for one recording, the whole action is aborted and false will be returned. Any recordings that have been successfully moved thus far will keep their new name. If OldPath and NewPath are on different file systems, the recordings will be moved in a background process and this function returns true if all recordings have been successfully added to the RecordingsHandler.

Definition at line 1672 of file recording.c.

References dsyslog, cList< cRecording >::First(), cList< cRecording >::Next(), cString::sprintf(), and TouchUpdate().

◆ MoveRecordings() [2/2]

bool cRecordings::MoveRecordings ( const char *  OldPath,
const char *  NewPath 
)

Moves all recordings in OldPath to NewPath.

Returns true if all recordings were successfully moved. As soon as the operation fails for one recording, the whole action is aborted and false will be returned. Any recordings that have been successfully moved thus far will keep their new name. If OldPath and NewPath are on different file systems, the recordings will be moved in a background process and this function returns true if all recordings have been successfully added to the RecordingsHandler.

◆ NeedsUpdate() [1/2]

bool cRecordings::NeedsUpdate ( void  )
static

Definition at line 1537 of file recording.c.

References LastModifiedTime(), lastUpdate, and UpdateFileName().

Referenced by main(), and TouchUpdate().

◆ NeedsUpdate() [2/2]

static bool cRecordings::NeedsUpdate ( void  )
static

◆ PathIsInUse() [1/2]

int cRecordings::PathIsInUse ( const char *  Path) const

Checks whether any recording in the given Path is currently in use and therefore the whole Path shall not be tampered with.

Returns 0 (ruNone) if no recording is in use. See cRecording::IsInUse() for details about the possible non-zero return values. If several recordings in the Path are currently in use, the return value will be the combination of all individual recordings' flags. If Path is NULL or an empty string, the entire video directory is checked.

Definition at line 1652 of file recording.c.

References cList< cRecording >::First(), cList< cRecording >::Next(), and ruNone.

◆ PathIsInUse() [2/2]

int cRecordings::PathIsInUse ( const char *  Path) const

Checks whether any recording in the given Path is currently in use and therefore the whole Path shall not be tampered with.

Returns 0 (ruNone) if no recording is in use. See cRecording::IsInUse() for details about the possible non-zero return values. If several recordings in the Path are currently in use, the return value will be the combination of all individual recordings' flags. If Path is NULL or an empty string, the entire video directory is checked.

◆ ResetResume() [1/2]

void cRecordings::ResetResume ( const char *  ResumeFileName = NULL)

Definition at line 1692 of file recording.c.

References cList< cRecording >::First(), and cList< cRecording >::Next().

◆ ResetResume() [2/2]

void cRecordings::ResetResume ( const char *  ResumeFileName = NULL)

◆ TotalFileSizeMB() [1/2]

int cRecordings::TotalFileSizeMB ( void  ) const

Definition at line 1620 of file recording.c.

References cList< cRecording >::First(), and cList< cRecording >::Next().

◆ TotalFileSizeMB() [2/2]

int cRecordings::TotalFileSizeMB ( void  ) const

◆ TouchUpdate() [1/2]

void cRecordings::TouchUpdate ( void  )
static

Touches the '.update' file in the video directory, so that other instances of VDR that access the same video directory can be triggered to update their recordings list.

Definition at line 1529 of file recording.c.

References lastUpdate, NeedsUpdate(), TouchFile(), and UpdateFileName().

Referenced by cRemoveDeletedRecordingsThread::Action(), cRecordingsHandlerEntry::Active(), AddByName(), cMenuRecordingEdit::ApplyChanges(), DelByName(), and MoveRecordings().

◆ TouchUpdate() [2/2]

static void cRecordings::TouchUpdate ( void  )
static

Touches the '.update' file in the video directory, so that other instances of VDR that access the same video directory can be triggered to update their recordings list.

◆ Update() [1/2]

void cRecordings::Update ( bool  Wait = false)
static

Triggers an update of the list of recordings, which will run as a separate thread if Wait is false.

If Wait is true, the function returns only after the update has completed.

Definition at line 1545 of file recording.c.

References cThread::Active(), deletedRecordings, lastUpdate, recordings, cCondWait::SleepMs(), cThread::Start(), and videoDirectoryScannerThread.

Referenced by AssertFreeDiskSpace(), and main().

◆ Update() [2/2]

static void cRecordings::Update ( bool  Wait = false)
static

Triggers an update of the list of recordings, which will run as a separate thread if Wait is false.

If Wait is true, the function returns only after the update has completed.

◆ UpdateByName() [1/2]

void cRecordings::UpdateByName ( const char *  FileName)

Definition at line 1614 of file recording.c.

References GetByName().

◆ UpdateByName() [2/2]

void cRecordings::UpdateByName ( const char *  FileName)

◆ UpdateFileName() [1/2]

const char * cRecordings::UpdateFileName ( void  )
staticprivate

Definition at line 1522 of file recording.c.

References AddDirectory(), cVideoDirectory::Name(), and updateFileName.

Referenced by NeedsUpdate(), and TouchUpdate().

◆ UpdateFileName() [2/2]

static const char * cRecordings::UpdateFileName ( void  )
staticprivate

Member Data Documentation

◆ deletedRecordings

static cRecordings cRecordings::deletedRecordings
staticprivate

◆ lastRecordingId

static int cRecordings::lastRecordingId = 0
staticprivate

Definition at line 232 of file include/vdr/recording.h.

Referenced by Add().

◆ lastUpdate

static time_t cRecordings::lastUpdate = 0
staticprivate

Definition at line 234 of file include/vdr/recording.h.

Referenced by NeedsUpdate(), TouchUpdate(), and Update().

◆ recordings

static cRecordings cRecordings::recordings
staticprivate

Definition at line 230 of file include/vdr/recording.h.

Referenced by GetRecordingsRead(), GetRecordingsWrite(), and Update().

◆ updateFileName

static char * cRecordings::updateFileName = NULL
staticprivate

Definition at line 233 of file include/vdr/recording.h.

Referenced by UpdateFileName().

◆ videoDirectoryScannerThread

static cVideoDirectoryScannerThread * cRecordings::videoDirectoryScannerThread = NULL
staticprivate

Definition at line 235 of file include/vdr/recording.h.

Referenced by Update(), and ~cRecordings().


The documentation for this class was generated from the following files: