summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Mair <amair.sob@googlemail.com>2015-09-20 16:02:04 (GMT)
committerAndreas Mair <amair.sob@googlemail.com>2015-09-20 16:02:04 (GMT)
commitbcd6790df6e680fed067b6f1c237aec9a6c03e52 (patch)
treed3b0aa41a9c3b59be58d2dc6daa4defd7bd22ac2
parentc10ed8ab9894bc3e601091f005f24338c525939d (diff)
downloadvdr-plugin-extrecmenu-bcd6790df6e680fed067b6f1c237aec9a6c03e52.tar.gz
vdr-plugin-extrecmenu-bcd6790df6e680fed067b6f1c237aec9a6c03e52.tar.bz2
Compile under VDR 2.3.1.
-rw-r--r--HISTORY3
-rw-r--r--extrecmenu.c2
-rw-r--r--mymenueditrecording.c32
-rw-r--r--mymenurecordings.c74
-rw-r--r--tools.c39
-rw-r--r--tools.h4
6 files changed, 147 insertions, 7 deletions
diff --git a/HISTORY b/HISTORY
index 72c1dd4..6c830f1 100644
--- a/HISTORY
+++ b/HISTORY
@@ -1,6 +1,9 @@
VDR Plugin 'extrecmenu' Revision History
----------------------------------------
+2015-xx-xx: Version 1.2.5
+- [amair] Compile under VDR 2.3.1.
+
2014-08-20: Version 1.2.4
- [amair] Reduced delay when opening the recordings menu if "menu category" feature is used.
diff --git a/extrecmenu.c b/extrecmenu.c
index f72f550..272b001 100644
--- a/extrecmenu.c
+++ b/extrecmenu.c
@@ -20,7 +20,7 @@
using namespace std;
-static const char *VERSION = "1.2.4";
+static const char *VERSION = "1.2.5-git";
static const char *DESCRIPTION = tr("Extended recordings menu");
static const char *MAINMENUENTRY = "ExtRecMenu";
diff --git a/mymenueditrecording.c b/mymenueditrecording.c
index d166d0f..78b957d 100644
--- a/mymenueditrecording.c
+++ b/mymenueditrecording.c
@@ -177,7 +177,11 @@ class myMenuMoveRecordingItem:public cOsdItem
char *title;
public:
myMenuMoveRecordingItem(const char *Title,int Level);
+#if VDRVERSNUM >= 20301
+ myMenuMoveRecordingItem(const cRecording *Recording,int Level);
+#else
myMenuMoveRecordingItem(cRecording *Recording,int Level);
+#endif
int Level(){return level;}
void SetLevel(int _Level){level=_Level;}
};
@@ -189,7 +193,11 @@ myMenuMoveRecordingItem::myMenuMoveRecordingItem(const char *Title,int _Level)
SetText(title);
}
+#if VDRVERSNUM >= 20301
+myMenuMoveRecordingItem::myMenuMoveRecordingItem(const cRecording *Recording,int _Level)
+#else
myMenuMoveRecordingItem::myMenuMoveRecordingItem(cRecording *Recording,int _Level)
+#endif
{
level=0;
@@ -247,12 +255,21 @@ void myMenuMoveRecording::Set()
if(level==0)
Add(new myMenuMoveRecordingItem(tr("[base dir]"),0));
+#if VDRVERSNUM >= 20301
+ LOCK_RECORDINGS_WRITE
+ Recordings->Sort();
+#else
cThreadLock RecordingsLock(&Recordings);
Recordings.Sort();
+#endif
char *lastitemtext=NULL;
myMenuMoveRecordingItem *lastitem=NULL;
+#if VDRVERSNUM >= 20301
+ for(const cRecording *_recording=Recordings->First();_recording;_recording=Recordings->Next(_recording))
+#else
for(cRecording *_recording=Recordings.First();_recording;_recording=Recordings.Next(_recording))
+#endif
{
if(!base||(strstr(_recording->Name(),base)==_recording->Name()&&_recording->Name()[strlen(base)]=='~'))
{
@@ -427,8 +444,13 @@ eOSState myMenuMoveRecording::MoveRec()
Skins.Message(mtError,tr("Moving into own sub-directory not allowed!"));
else
{
+#if VDRVERSNUM >= 20301
+ LOCK_RECORDINGS_READ
+ for(const cRecording *rec=Recordings->First();rec;rec=Recordings->Next(rec))
+#else
cThreadLock RecordingsLock(&Recordings);
for(cRecording *rec=Recordings.First();rec;rec=Recordings.Next(rec))
+#endif
{
if(!strncmp(oldname,rec->FileName(),strlen(oldname)))
recmb+=DirSizeMB(rec->FileName());
@@ -436,7 +458,11 @@ eOSState myMenuMoveRecording::MoveRec()
if(freemb-recmb > 0 || Interface->Confirm(tr("Target filesystem filled - try anyway?")))
{
+#if VDRVERSNUM >= 20301
+ for(const cRecording *rec=Recordings->First();rec;rec=Recordings->Next(rec))
+#else
for(cRecording *rec=Recordings.First();rec;rec=Recordings.Next(rec))
+#endif
{
if(!strncmp(oldname,rec->FileName(),strlen(oldname)))
{
@@ -572,8 +598,14 @@ eOSState myMenuRecordingDetails::ProcessKey(eKeys Key)
if(ModifyInfo(recording,*buffer))
{
cString fileName = recording->FileName();
+#if VDRVERSNUM >= 20301
+ LOCK_RECORDINGS_WRITE
+ Recordings->Del(recording);
+ Recordings->AddByName(*fileName);
+#else
Recordings.Del(recording);
Recordings.AddByName(*fileName);
+#endif
state=osBack;
}
else
diff --git a/mymenurecordings.c b/mymenurecordings.c
index 165baf9..6166983 100644
--- a/mymenurecordings.c
+++ b/mymenurecordings.c
@@ -96,9 +96,14 @@ void myMenuRecordingInfo::Display(void)
else
text << tr("Name") << ": " << recname << "\n";
- cChannel *chan=Channels.GetByChannelID(((cRecordingInfo*)recording->Info())->ChannelID());
- if(chan)
- text << tr("Channel") << ": " << *ChannelString(chan,0) << "\n";
+#if VDRVERSNUM >= 20301
+ LOCK_CHANNELS_READ
+ const cChannel *channel=Channels->GetByChannelID(((cRecordingInfo*)recording->Info())->ChannelID());
+#else
+ cChannel *channel=Channels.GetByChannelID(((cRecordingInfo*)recording->Info())->ChannelID());
+#endif
+ if(channel)
+ text << tr("Channel") << ": " << *ChannelString(channel,0) << "\n";
int recmb=DirSizeMB(recording->FileName());
if(recmb<0)
@@ -125,7 +130,7 @@ void myMenuRecordingInfo::Display(void)
eOSState myMenuRecordingInfo::ProcessKey(eKeys Key)
{
- switch(Key)
+ switch((int)Key)
{
case kUp|k_Repeat:
case kUp:
@@ -562,7 +567,11 @@ myMenuRecordings::myMenuRecordings(const char *Base,int Level):cOsdMenu("")
helpkeys=-1;
base=Base?strdup(Base):NULL;
+#if VDRVERSNUM >= 20301
+ //TODO???
+#else
Recordings.StateChanged(recordingsstate);
+#endif
//Display();
@@ -649,7 +658,12 @@ int myMenuRecordings::FreeMB()
{
freediskspace=int((double)fsstat.f_bavail/(double)(1024.0*1024.0/fsstat.f_bsize));
+#if VDRVERSNUM >= 20301
+ LOCK_DELETEDRECORDINGS_READ
+ for(const cRecording *rec=DeletedRecordings->First();rec;rec=DeletedRecordings->Next(rec))
+#else
for(cRecording *rec=DeletedRecordings.First();rec;rec=DeletedRecordings.Next(rec))
+#endif
{
if(!stat(rec->FileName(),&statdir))
{
@@ -719,7 +733,12 @@ void myMenuRecordings::Title()
#endif
int freemb=FreeMB();
#if VDRVERSNUM >= 10727
+# if VDRVERSNUM >= 20301
+ LOCK_RECORDINGS_READ
+ double MBperMinute = Recordings->MBperMinute();
+# else
double MBperMinute = Recordings.MBperMinute();
+# endif
int minutes=int(double(freemb)/(MBperMinute>0?MBperMinute:MB_PER_MINUTE));
#else
int minutes=int(double(freemb)/MB_PER_MINUTE);
@@ -794,14 +813,22 @@ void myMenuRecordings::Set(bool Refresh)
{
const char *lastreplayed=myReplayControl::LastReplayed();
+#if VDRVERSNUM >= 20301
+ LOCK_RECORDINGS_READ
+#else
cThreadLock RecordingsLock(&Recordings);
+#endif
if(Refresh)
{
fsid=0;
myMenuRecordingsItem *item=(myMenuRecordingsItem*)Get(Current());
if(item)
{
+#if VDRVERSNUM >= 20301
+ const cRecording *recording=Recordings->GetByName(item->FileName());
+#else
cRecording *recording=Recordings.GetByName(item->FileName());
+#endif
if(recording)
lastreplayed=recording->FileName();
}
@@ -811,7 +838,11 @@ void myMenuRecordings::Set(bool Refresh)
// create my own recordings list from VDR's
myRecList *list=new myRecList();
+#if VDRVERSNUM >= 20301
+ for(const cRecording *recording=Recordings->First();recording;recording=Recordings->Next(recording))
+#else
for(cRecording *recording=Recordings.First();recording;recording=Recordings.Next(recording))
+#endif
list->Add(new myRecListItem(recording));
// sort my recordings list
#if APIVERSNUM > 20101
@@ -908,7 +939,12 @@ void myMenuRecordings::Set(bool Refresh)
// returns the corresponding recording to an item
cRecording *myMenuRecordings::GetRecording(myMenuRecordingsItem *Item)
{
+#if VDRVERSNUM >= 20301
+ LOCK_RECORDINGS_READ
+ cRecording *recording=(cRecording *)Recordings->GetByName(Item->FileName());
+#else
cRecording *recording=Recordings.GetByName(Item->FileName());
+#endif
if(!recording)
Skins.Message(mtError,trVDR("Error while accessing recording!"));
return recording;
@@ -1175,13 +1211,26 @@ eOSState myMenuRecordings::Delete()
if(timer)
{
timer->Skip();
+#if VDRVERSNUM >= 20301
+ LOCK_TIMERS_WRITE
+ cRecordControls::Process(Timers,time(NULL));
+#else
cRecordControls::Process(time(NULL));
+#endif
if(timer->IsSingleEvent())
{
isyslog("deleting timer %s",*timer->ToDescr());
+#if VDRVERSNUM >= 20301
+ Timers->Del(timer);
+#else
Timers.Del(timer);
+#endif
}
+#if VDRVERSNUM >= 20301
+ Timers->SetModified();
+#else
Timers.SetModified();
+#endif
}
}
else
@@ -1194,7 +1243,12 @@ eOSState myMenuRecordings::Delete()
{
cRecordingUserCommand::InvokeCommand("delete",item->FileName());
myReplayControl::ClearLastReplayed(item->FileName());
+#if VDRVERSNUM >= 20301
+ LOCK_RECORDINGS_WRITE
+ Recordings->DelByName(item->FileName());
+#else
Recordings.DelByName(item->FileName());
+#endif
cOsdMenu::Del(Current());
SetHelpKeys();
ForceFreeMbUpdate();
@@ -1423,7 +1477,12 @@ eOSState myMenuRecordings::ProcessKey(eKeys Key)
if(Interface->Confirm(tr("Cancel moving?")))
{
+#if VDRVERSNUM >= 20301
+ LOCK_RECORDINGS_READ
+ for(const cRecording *rec=Recordings->First();rec;rec=Recordings->Next(rec))
+#else
for(cRecording *rec=Recordings.First();rec;rec=Recordings.Next(rec))
+#endif
{
if(!strncmp(path.c_str(),rec->Name(),path.length()))
MoveCutterThread->CancelMove(rec->FileName());
@@ -1480,14 +1539,21 @@ eOSState myMenuRecordings::ProcessKey(eKeys Key)
default: break;
}
}
+#if VDRVERSNUM >= 20301
+ //TODO???
+ Set(true);
+#else
bool stateChanged = Recordings.StateChanged(recordingsstate);
if(stateChanged || MoveCutterThread->IsCutterQueueEmpty())
Set(true);
+#endif
if(!Count() && level>0)
state=osBack;
+#if VDRVERSNUM < 20301
if((!HasSubMenu() && Key!=kNone) || stateChanged)
+#endif
SetHelpKeys();
}
return state;
diff --git a/tools.c b/tools.c
index ea6e8e2..caf4cd1 100644
--- a/tools.c
+++ b/tools.c
@@ -116,9 +116,15 @@ bool MoveRename(const char *OldName,const char *NewName,cRecording *Recording,bo
return false;
}
+#if VDRVERSNUM >= 20301
+ LOCK_RECORDINGS_WRITE
+ Recordings->DelByName(OldName);
+ Recordings->AddByName(NewName);
+#else
cThreadLock RecordingsLock(&Recordings);
Recordings.DelByName(OldName);
Recordings.AddByName(NewName);
+#endif
// set user command for '-r'-option of VDR
if(-1!=asprintf(&buf,"%s \"%s\"",Move?"move":"rename",*strescape(OldName,"'\\\"$")))
@@ -144,7 +150,12 @@ bool MoveRename(const char *OldName,const char *NewName,cRecording *Recording,bo
buf=NULL;
myRecList *list=new myRecList();
+#if VDRVERSNUM >= 20301
+ LOCK_RECORDINGS_READ
+ for(const cRecording *recording=Recordings->First();recording;recording=Recordings->Next(recording))
+#else
for(cRecording *recording=Recordings.First();recording;recording=Recordings.Next(recording))
+#endif
list->Add(new myRecListItem(recording));
myRecListItem *item=list->First();
@@ -195,9 +206,9 @@ bool MoveRename(const char *OldName,const char *NewName,cRecording *Recording,bo
// --- myRecListItem ----------------------------------------------------------
bool myRecListItem::SortByName=false;
-myRecListItem::myRecListItem(cRecording *Recording)
+myRecListItem::myRecListItem(const cRecording *Recording)
{
- recording=Recording;
+ recording=(cRecording *)Recording;
filename=strdup(recording->FileName());
sortBufferName = sortBufferTime = NULL;
}
@@ -359,7 +370,11 @@ void WorkerThread::Action()
#endif
CutterQueue->Del(cutteritem);
+#if VDRVERSNUM >= 20301
+ //TODO???
+#else
Recordings.ChangeState();
+#endif
}
if((moveitem=MoveBetweenFileSystemsList->First())!=NULL)
@@ -371,7 +386,11 @@ void WorkerThread::Action()
// error occured -> empty move queue
MoveBetweenFileSystemsList->Clear();
+#if VDRVERSNUM >= 20301
+ //TODO???
+#else
Recordings.ChangeState();
+#endif
}
sleep(1);
@@ -659,7 +678,11 @@ void WorkerThread::CancelMove(string Path)
void WorkerThread::AddToMoveList(string From,string To)
{
MoveBetweenFileSystemsList->Add(new MoveListItem(From,To));
+#if VDRVERSNUM >= 20301
+ //TODO???
+#else
Recordings.ChangeState();
+#endif
}
bool WorkerThread::Move(string From,string To)
@@ -762,18 +785,30 @@ bool WorkerThread::Move(string From,string To)
{
closedir(dir);
+#if VDRVERSNUM >= 20301
+ LOCK_RECORDINGS_WRITE
+ cRecording rec(From.c_str());
+ rec.Delete();
+ Recordings->DelByName(From.c_str());
+ Recordings->AddByName(To.c_str());
+#else
cThreadLock RecordingsLock(&Recordings);
cRecording rec(From.c_str());
rec.Delete();
Recordings.DelByName(From.c_str());
Recordings.AddByName(To.c_str());
+#endif
string cmdstring="move \"";
cmdstring+=myStrEscape(From,"'\\\"$");
cmdstring+="\"";
cRecordingUserCommand::InvokeCommand(cmdstring.c_str(),To.c_str());
+#if VDRVERSNUM >= 20301
+ Recordings->TouchUpdate();
+#else
Recordings.TouchUpdate();
+#endif
return true;
}
diff --git a/tools.h b/tools.h
index b075b64..b2c129a 100644
--- a/tools.h
+++ b/tools.h
@@ -38,7 +38,11 @@ class myRecListItem:public cListObject
static char *StripEpisodeName(char *s);
char *SortName(void) const;
public:
+#if VDRVERSNUM >= 20301
+ myRecListItem(const cRecording *Recording);
+#else
myRecListItem(cRecording *Recording);
+#endif
~myRecListItem();
virtual int Compare(const cListObject &ListObject)const;
cRecording *recording;