Idea and Patch: Compensate start time on cutting
Commit Message
Hi list,
I usually record with lots of margin before and after. I also cut
everything after detecting commercial breaks. This however has two small
side effects. First, the start margin time will be taken for the
recording name, so its a bit off, like 20:55 instead of 21:00. Second,
after cutting, its not possible to see the actual start time of the
recording any more. (This is sometimes useful to know to adjust the
margins of repeated timers.)
Recently I had the idea, when cutting why not shift the recording start
time to the time of the beginning cut mark? This would even have another
positive side effect: That way its easy to cut a recording into two
parts, because they would have different start times.
Well, why not, so today I tried and the result is attached as patch.
Unfortunately, a small API change is necessary, so plugins should be
re-compiled. I don't expect this to go into VDR soon, but maybe when
development cycle starts again.
Cheers,
Udo
Comments
Hi,
Am Sonntag, den 14.05.2006, 18:57 +0200 schrieb Udo Richter:
> I usually record with lots of margin before and after. I also cut
> everything after detecting commercial breaks. This however has two small
> side effects. First, the start margin time will be taken for the
> recording name, so its a bit off, like 20:55 instead of 21:00.
Nice, i like that! I also missed that feature.
So I vote for merge in vdr.
Thanks for that patch, its work fine.
Andreas
@@ -86,6 +86,7 @@
const char *FileName(void) const;
const char *Title(char Delimiter = ' ', bool NewIndicator = false, int Level = -1) const;
const cRecordingInfo *Info(void) const { return info; }
+ void SetStartTime(time_t Start);
const char *PrefixFileName(char Prefix);
int HierarchyLevels(void) const;
void ResetResume(void) const;
@@ -754,6 +754,15 @@
return titleBuffer;
}
+void cRecording::SetStartTime(time_t Start)
+{
+ start=Start;
+ if (fileName) {
+ free(fileName);
+ fileName = NULL;
+ }
+}
+
const char *cRecording::PrefixFileName(char Prefix)
{
cString p = PrefixVideoFileName(FileName(), Prefix);
@@ -189,6 +189,12 @@
error = false;
ended = false;
cRecording Recording(FileName);
+
+ cMarks FromMarks;
+ FromMarks.Load(FileName);
+ cMark *First=FromMarks.First();
+ if (First) Recording.SetStartTime(Recording.start+((First->position/FRAMESPERSEC+30)/60)*60);
+
const char *evn = Recording.PrefixFileName('%');
if (evn && RemoveVideoFile(evn) && MakeDirs(evn, true)) {
// XXX this can be removed once RenameVideoFile() follows symlinks (see videodir.c)