From 45c26fb5f4c5aec43ffbfb1d3aa4578a2ac6fa83 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Sun, 21 May 2006 22:18:24 +0000 Subject: [PATCH] Completion of move recording code. Fixes for dir counts, other bugs. --- directory.cc | 7 ++++++- recman.cc | 10 +++++++--- vdr.cc | 10 ++++++++-- vdr.h | 2 +- vvideorec.cc | 1 + 5 files changed, 23 insertions(+), 7 deletions(-) diff --git a/directory.cc b/directory.cc index b96f458..13ce2d3 100644 --- a/directory.cc +++ b/directory.cc @@ -61,7 +61,12 @@ Directory* Directory::getDirByName(char* dirName) ULONG Directory::getNumRecordings() { - return recList.size(); + ULONG total = recList.size(); + for(UINT i = 0; i < dirList.size(); i++) + { + total += dirList[i]->getNumRecordings(); + } + return total; } void Directory::sort() diff --git a/recman.cc b/recman.cc index 1850ffe..11afd4d 100644 --- a/recman.cc +++ b/recman.cc @@ -169,10 +169,14 @@ int RecMan::moveRecording(Recording* toMove, Directory* toDir) { if (*i == toMove) { - success = VDR::getInstance()->moveRecording(toMove->getFileName(), newPath); - //success = 1; - if (success == 1) + char* newFileName = VDR::getInstance()->moveRecording(toMove->getFileName(), newPath); + if (newFileName) { + success = 1; + + toMove->setFileName(newFileName); + delete[] newFileName; + currentDir->recList.erase(i); toDir->recList.push_back(toMove); toDir->sort(); diff --git a/vdr.cc b/vdr.cc index 0efd189..179e807 100644 --- a/vdr.cc +++ b/vdr.cc @@ -413,7 +413,7 @@ int VDR::deleteRecording(char* fileName) return toReturn; } -int VDR::moveRecording(char* fileName, char* newPath) +char* VDR::moveRecording(char* fileName, char* newPath) { unsigned long totalLength = 8 + strlen(fileName) + 1 + strlen(newPath) + 1; UCHAR* buffer = new UCHAR[totalLength]; @@ -442,7 +442,13 @@ int VDR::moveRecording(char* fileName, char* newPath) return 0; } - int toReturn = (int)extractULONG(); + char* toReturn = NULL; + int success = (int)extractULONG(); + if (success == 1) + { + toReturn = extractString(); + } + freePacket(); MUTEX_UNLOCK(&mutex); diff --git a/vdr.h b/vdr.h index c1aa880..5f63793 100644 --- a/vdr.h +++ b/vdr.h @@ -116,7 +116,7 @@ class VDR bool getRecordingsList(RecMan* recman); char* getRecordingSummary(char* fileName); int deleteRecording(char* fileName); - int moveRecording(char* fileName, char* newPath); + char* moveRecording(char* fileName, char* newPath); ULLONG streamRecording(char* fileName); ULLONG rescanRecording(); ULLONG positionFromFrameNumber(ULONG frameNumber); diff --git a/vvideorec.cc b/vvideorec.cc index a21cd8b..819aec9 100644 --- a/vvideorec.cc +++ b/vvideorec.cc @@ -95,6 +95,7 @@ void VVideoRec::draw() void VVideoRec::go(ULLONG startPosition) { + Log::getInstance()->log("VVideoRec", Log::DEBUG, "Starting stream: %s", myRec->getFileName()); ULLONG recLength = vdr->streamRecording(myRec->getFileName()); if (recLength) { -- 2.39.5