Skip to content

Commit

Permalink
added changes for the new cVideoDirectory API that comes with vdr-2.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Saman-VDR committed Aug 22, 2014
1 parent 820a113 commit 517f1c9
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tools.cpp
Expand Up @@ -624,7 +624,11 @@ cEvent* VdrExtension::getCurrentEventOnChannel(cChannel* channel)
string VdrExtension::getVideoDiskSpace()
{
int FreeMB, UsedMB;
#if APIVERSNUM < 20102
int Percent = VideoDiskSpace(&FreeMB, &UsedMB);
#else
int Percent = cVideoDirectory::VideoDiskSpace(&FreeMB, &UsedMB);
#endif
ostringstream str;
str << FreeMB + UsedMB << "MB " << FreeMB << "MB " << Percent << "%";
return str.str();
Expand Down Expand Up @@ -672,7 +676,11 @@ bool VdrExtension::MoveDirectory(std::string const & sourceDir, std::string cons
stat(source.c_str(), &st1);
stat(target.c_str(),&st2);
if (!copy && (st1.st_dev == st2.st_dev)) {
#if APIVERSNUM < 20102
if (!RenameVideoFile(source.c_str(), target.c_str())) {
#else
if (!cVideoDirectory::RenameVideoFile(source.c_str(), target.c_str())) {
#endif
esyslog("[Restfulapi]: rename failed from %s to %s", source.c_str(), target.c_str());
return false;
}
Expand Down Expand Up @@ -768,7 +776,11 @@ bool VdrExtension::MoveDirectory(std::string const & sourceDir, std::string cons
size_t found = source.find_last_of(delim);
if (found != std::string::npos) {
source = source.substr(0, found);
#if APIVERSNUM < 20102
while (source != VideoDirectory) {
#else
while (source != cVideoDirectory::Name()) {
#endif
found = source.find_last_of(delim);
if (found == std::string::npos)
break;
Expand All @@ -785,7 +797,11 @@ bool VdrExtension::MoveDirectory(std::string const & sourceDir, std::string cons
size_t found = target.find_last_of(delim);
if (found != std::string::npos) {
target = target.substr(0, found);
#if APIVERSNUM < 20102
while (target != VideoDirectory) {
#else
while (target != cVideoDirectory::Name()) {
#endif
found = target.find_last_of(delim);
if (found == std::string::npos)
break;
Expand Down Expand Up @@ -813,7 +829,11 @@ string VdrExtension::MoveRecording(cRecording const * recording, string const &
if (found == string::npos)
return "";

#if APIVERSNUM < 20102
string newname = string(VideoDirectory) + "/" + name + oldname.substr(found);
#else
string newname = string(cVideoDirectory::Name()) + "/" + name + oldname.substr(found);
#endif

if (!MoveDirectory(oldname.c_str(), newname.c_str(), copy)) {
esyslog("[Restfulapi]: renaming failed from '%s' to '%s'", oldname.c_str(), newname.c_str());
Expand Down

0 comments on commit 517f1c9

Please sign in to comment.