summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlado <herrlado@gmail.com>2012-05-09 10:00:18 +0200
committerlado <herrlado@gmail.com>2012-05-09 10:00:18 +0200
commite762d0ef720ad99d0bb1814e7ef26cb7610f8182 (patch)
tree008800f1653c3787971c92cbd53ef2cb2dc2aacd
parent6ebd20d29f225163875617edcc9464060926bcb6 (diff)
downloadvdr-manager-e762d0ef720ad99d0bb1814e7ef26cb7610f8182.tar.gz
vdr-manager-e762d0ef720ad99d0bb1814e7ef26cb7610f8182.tar.bz2
Feature #870
-rw-r--r--vdr-vdrmanager/helpers.cpp41
1 files changed, 25 insertions, 16 deletions
diff --git a/vdr-vdrmanager/helpers.cpp b/vdr-vdrmanager/helpers.cpp
index 8dd7706..4a09ed7 100644
--- a/vdr-vdrmanager/helpers.cpp
+++ b/vdr-vdrmanager/helpers.cpp
@@ -178,16 +178,14 @@ string cHelpers::SetChannelIntern(const string args) {
return "!ERROR:SetChannel;Unable to find channel " + args + "\r\n";
}
- string result;
ostringstream outStream;
if (!cDevice::PrimaryDevice()->SwitchChannel(channel, true)) {
outStream << channel->Number();
- result = "!ERROR:SetChannel;Error switching to channel " + outStream.str() + "\r\n";
- return result;
+ return "!ERROR:SetChannel;Error switching to channel " + outStream.str() + "\r\n";
}
-
- return "START\r\n"+channel->GetChannelID()+"\r\nEND\r\n";
+
+ return "START\r\n" + MapSpecialChars(channel->GetChannelID().ToString()) + "\r\nEND\r\n";
}
string cHelpers::GetAudioTracks(const cChannel* channel) {
@@ -909,16 +907,29 @@ int nf = -1;
nf = recording->NumFrames();
#endif
-#if APIVERSNUM == 10720
- nf = cIndexFile::Length(recording->FileName(), recording->IsPesRecording());
+#if APIVERSNUM <= 10720
+ struct tIndexTs {
+ uint64_t offset:40;
+ int reserved:7;
+ int independent:1;
+ uint16_t number:16;
+ tIndexTs(off_t Offset, bool Independent, uint16_t Number) {
+ offset = Offset;
+ reserved = 0;
+ independent = Independent;
+ number = Number;
+ }
+ };
+
+ struct stat buf;
+#if APIVERSNUM >= 10703
+ cString fullname = cString::sprintf("%s%s", recording->FileName(), recording->IsPesRecording() ? "/index" ".vdr" : "/index");
+#else
+ cString fullname = cString::sprintf("%s%s", recording->FileName(), "/index" ".vdr");
#endif
-
-#if APIVERSNUM < 10720
- //TODO find out
- //esyslog("[vdrmanager] length of record %s: %d", recording->FileName(), length);
- //if (length >= 0)
- // return int(length / SecondsToFrames(60, recording->FramesPerSecond()));
- nf = -1;
+
+ if (recording->FileName() && *fullname && access(fullname, R_OK) == 0 && stat(fullname, &buf) == 0)
+ nf = buf.st_size ? (buf.st_size - 1) / sizeof(tIndexTs) + 1 : 0;
#endif
if(nf == -1){
@@ -1084,5 +1095,3 @@ int cHelpers::ConvertWeekdays(std::string v) {
res += 1;
return res;
}
-
-