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

#include <recording.h>

Public Member Functions

 cRecordings (bool Deleted=false)
 
virtual ~cRecordings ()
 
bool Load (void)
 
bool Update (bool Wait=false)
 
void TouchUpdate (void)
 
bool NeedsUpdate (void)
 
void ChangeState (void)
 
bool StateChanged (int &State)
 
void ResetResume (const char *ResumeFileName=NULL)
 
void ClearSortNames (void)
 
cRecordingGetByName (const char *FileName)
 
void AddByName (const char *FileName, bool TriggerUpdate=true)
 
void DelByName (const char *FileName)
 
void UpdateByName (const char *FileName)
 
int TotalFileSizeMB (void)
 
double MBperMinute (void)
 
int PathIsInUse (const char *Path)
 
int GetNumRecordingsInPath (const char *Path)
 
bool MoveRecordings (const char *OldPath, const char *NewPath)
 
- Public Member Functions inherited from cList< cRecording >
cRecordingGet (int Index) const
 
cRecordingFirst (void) const
 
cRecordingLast (void) const
 
cRecordingPrev (const cRecording *object) const
 
cRecordingNext (const cRecording *object) const
 
- Public Member Functions inherited from cListBase
virtual ~cListBase ()
 
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)
 
cListObjectGet (int Index) const
 
int Count (void) const
 
void Sort (void)
 
- Public Member Functions inherited from cThread
 cThread (const char *Description=NULL, bool LowPriority=false)
 
virtual ~cThread ()
 
void SetDescription (const char *Description,...) __attribute__((format(printf
 
void bool Start (void)
 
bool Active (void)
 

Protected Member Functions

void Action (void)
 
- Protected Member Functions inherited from cListBase
 cListBase (void)
 
- Protected Member Functions inherited from cThread
void SetPriority (int Priority)
 
void SetIOPriority (int Priority)
 
void Lock (void)
 
void Unlock (void)
 
bool Running (void)
 
void Cancel (int WaitSeconds=0)
 

Private Member Functions

const char * UpdateFileName (void)
 
void Refresh (bool Foreground=false)
 
bool ScanVideoDir (const char *DirName, bool Foreground=false, int LinkLevel=0, int DirLevel=0)
 

Private Attributes

bool deleted
 
bool initial
 
time_t lastUpdate
 
int state
 

Static Private Attributes

static char * updateFileName = NULL
 

Additional Inherited Members

- Static Public Member Functions inherited from cThread
static tThreadId ThreadId (void)
 
static tThreadId IsMainThread (void)
 
static void SetMainThreadId (void)
 
- Protected Attributes inherited from cListBase
cListObjectobjects
 
cListObjectlastObject
 
int count
 

Detailed Description

Definition at line 219 of file recording.h.

Constructor & Destructor Documentation

cRecordings::cRecordings ( bool  Deleted = false)

Definition at line 1369 of file recording.c.

References deleted, initial, lastUpdate, and state.

cRecordings::~cRecordings ( )
virtual

Definition at line 1378 of file recording.c.

References cThread::Cancel().

Member Function Documentation

void cRecordings::Action ( void  )
protectedvirtual

A derived cThread class must implement the code it wants to execute as a separate thread in this function.

If this is a loop, it must check Running() repeatedly to see whether it's time to stop.

Implements cThread.

Definition at line 1383 of file recording.c.

References Refresh().

void cRecordings::AddByName ( const char *  FileName,
bool  TriggerUpdate = true 
)
void cRecordings::ChangeState ( void  )
inline
void cRecordings::ClearSortNames ( void  )
void cRecordings::DelByName ( const char *  FileName)
cRecording * cRecordings::GetByName ( const char *  FileName)
int cRecordings::GetNumRecordingsInPath ( const char *  Path)

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 1611 of file recording.c.

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

Referenced by cMenuPathEdit::ApplyChanges().

bool cRecordings::Load ( void  )
inline

Loads the current list of recordings and returns true if there is anything in it (for compatibility with older plugins - use Update(true) instead).

Definition at line 234 of file recording.h.

Referenced by cMenuTimers::Commands().

double cRecordings::MBperMinute ( void  )

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

Definition at line 1578 of file recording.c.

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

Referenced by cVideoDiskUsage::HasChanged().

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 1622 of file recording.c.

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

Referenced by cMenuPathEdit::ApplyChanges().

bool cRecordings::NeedsUpdate ( void  )

Definition at line 1490 of file recording.c.

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

Referenced by main(), and TouchUpdate().

int cRecordings::PathIsInUse ( const char *  Path)

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 1600 of file recording.c.

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

Referenced by cMenuPathEdit::cMenuPathEdit().

void cRecordings::Refresh ( bool  Foreground = false)
private
void cRecordings::ResetResume ( const char *  ResumeFileName = NULL)
bool cRecordings::ScanVideoDir ( const char *  DirName,
bool  Foreground = false,
int  LinkLevel = 0,
int  DirLevel = 0 
)
private
bool cRecordings::StateChanged ( int &  State)
int cRecordings::TotalFileSizeMB ( void  )
void cRecordings::TouchUpdate ( void  )

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 1482 of file recording.c.

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

Referenced by cCuttingThread::Action(), cRecordingsHandlerEntry::Active(), AddByName(), cRecording::ChangeName(), cRecording::ChangePriorityLifetime(), and DelByName().

bool cRecordings::Update ( bool  Wait = false)

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. Returns true if Wait is true and there is anything in the list of recordings, false otherwise.

Definition at line 1498 of file recording.c.

References cListBase::Count(), Refresh(), and cThread::Start().

Referenced by AssertFreeDiskSpace(), cSVDRP::CmdLSTR(), cSVDRP::CmdUPDR(), and main().

void cRecordings::UpdateByName ( const char *  FileName)

Definition at line 1558 of file recording.c.

References GetByName(), LOCK_THREAD, and cRecording::ReadInfo().

Referenced by cRecorder::Action(), and cIndexFileGenerator::Action().

const char * cRecordings::UpdateFileName ( void  )
private

Definition at line 1388 of file recording.c.

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

Referenced by NeedsUpdate(), and TouchUpdate().

Member Data Documentation

bool cRecordings::deleted
private

Definition at line 222 of file recording.h.

Referenced by cRecordings(), cRecording::Deleted(), Refresh(), and ScanVideoDir().

bool cRecordings::initial
private

Definition at line 223 of file recording.h.

Referenced by cRecordings(), Refresh(), and ScanVideoDir().

time_t cRecordings::lastUpdate
private

Definition at line 224 of file recording.h.

Referenced by cRecordings(), NeedsUpdate(), Refresh(), and TouchUpdate().

int cRecordings::state
private

Definition at line 225 of file recording.h.

Referenced by cRecordings(), and StateChanged().

char * cRecordings::updateFileName = NULL
staticprivate

Definition at line 221 of file recording.h.

Referenced by UpdateFileName().


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