From dcf23f7259d7a73c2690edf099e7e322f70517ba Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Sun, 29 Sep 2019 17:13:27 +0100 Subject: [PATCH] Add recording 'Mark as new' functionality --- recording.cc | 7 ++++++- recording.h | 3 ++- vdr.cc | 19 +++++++++++++++++-- vdr.h | 3 ++- vdrcommand.h | 3 ++- vrecording.cc | 9 ++++++++- vrecording.h | 4 ++-- 7 files changed, 39 insertions(+), 9 deletions(-) diff --git a/recording.cc b/recording.cc index 374f3ff..c50aed2 100644 --- a/recording.cc +++ b/recording.cc @@ -1,5 +1,5 @@ /* - Copyright 2004-2005 Chris Tallon + Copyright 2004-2019 Chris Tallon This file is part of VOMP. @@ -260,3 +260,8 @@ MarkList* Recording::getMarkList() { return markList; } + +void Recording::resetResume() +{ + vdr->deleteRecResume(fileName); +} diff --git a/recording.h b/recording.h index 745d7a0..ba6d1a8 100644 --- a/recording.h +++ b/recording.h @@ -1,5 +1,5 @@ /* - Copyright 2004-2005 Chris Tallon + Copyright 2004-2019 Chris Tallon This file is part of VOMP. @@ -49,6 +49,7 @@ class Recording void dropRecInfo(); bool getNew() { return isNew; } + void resetResume(); bool isRadio(bool &h264); bool IsPesRecording; diff --git a/vdr.cc b/vdr.cc index 611e457..a9bb49b 100644 --- a/vdr.cc +++ b/vdr.cc @@ -1,5 +1,5 @@ /* - Copyright 2004-2008 Chris Tallon + Copyright 2004-2019 Chris Tallon This file is part of VOMP. @@ -45,7 +45,7 @@ #include "tvmedia.h" #include -#define VOMP_PROTOCOLL_VERSION 0x00000400 +#define VOMP_PROTOCOLL_VERSION 0x00000401 VDR* VDR::instance = NULL; #ifdef VOMP_MEDIAPLAYER @@ -833,6 +833,21 @@ int VDR::deleteRecording(char* fileName) return toReturn; } +int VDR::deleteRecResume(char* fileName) +{ + VDR_RequestPacket vrp; + if (!vrp.init(VDR_DELETERECRESUME, true, strlen(fileName) + 1)) return 0; + if (!vrp.addString(fileName)) return 0; + + VDR_ResponsePacket* vresp = RequestResponse(&vrp); + if (vresp->noResponse()) { delete vresp; return 0; } + + int toReturn = (int)vresp->extractULONG(); + delete vresp; + + return toReturn; +} + char* VDR::moveRecording(char* fileName, char* newPath) { VDR_RequestPacket vrp; diff --git a/vdr.h b/vdr.h index 6a7c072..0994cb0 100644 --- a/vdr.h +++ b/vdr.h @@ -1,5 +1,5 @@ /* - Copyright 2004-2005 Chris Tallon + Copyright 2004-2019 Chris Tallon This file is part of VOMP. @@ -177,6 +177,7 @@ public ExternLogger bool getRecordingsList(RecMan* recman); RecInfo* getRecInfo(char* fileName); int deleteRecording(char* fileName); + int deleteRecResume(char* fileName); char* moveRecording(char* fileName, char* newPath); ULLONG streamRecording(char* fileName, ULONG* lengthFrames, bool* IsPesRecording); ULLONG positionFromFrameNumber(ULONG frameNumber); diff --git a/vdrcommand.h b/vdrcommand.h index 28b5492..b7208ae 100644 --- a/vdrcommand.h +++ b/vdrcommand.h @@ -1,5 +1,5 @@ /* - Copyright 2004-2005 Chris Tallon, Andreas Vogel + Copyright 2004-2019 Chris Tallon, Andreas Vogel This file is part of VOMP. @@ -42,6 +42,7 @@ const static ULONG VDR_RESPONSE_FLAG =0x1000000; const static ULONG VDR_LOGIN = 1; const static ULONG VDR_GETRECORDINGLIST = 2; const static ULONG VDR_DELETERECORDING = 3; +const static ULONG VDR_DELETERECRESUME = 4; const static ULONG VDR_GETCHANNELLIST = 5; const static ULONG VDR_STREAMCHANNEL = 6; const static ULONG VDR_GETBLOCK = 7; diff --git a/vrecording.cc b/vrecording.cc index 5f99d8a..837478c 100644 --- a/vrecording.cc +++ b/vrecording.cc @@ -1,5 +1,5 @@ /* - Copyright 2004-2008 Chris Tallon + Copyright 2004-2019 Chris Tallon This file is part of VOMP. @@ -129,6 +129,7 @@ VRecording::VRecording(RecMan* trecman, Recording* trec) button[PLAY].setText(tr("Play")); button[RESUME].setText(tr("Resume")); + button[MARKASNEW].setText(tr("Mark as new")); button[MOVE].setText(tr("Move")); button[A_DELETE].setText(tr("Delete")); @@ -240,6 +241,12 @@ int VRecording::handleCommand(int command) return 4; } + if (selected == MARKASNEW) + { + rec->resetResume(); + return 2; + } + if (selected == MOVE) { VRecMove* vrm = new VRecMove(recman); diff --git a/vrecording.h b/vrecording.h index ca5eac1..faf8d0d 100644 --- a/vrecording.h +++ b/vrecording.h @@ -1,5 +1,5 @@ /* - Copyright 2004-2008 Chris Tallon + Copyright 2004-2019 Chris Tallon This file is part of VOMP. @@ -52,7 +52,7 @@ class VRecording : public TBBoxx Recording* rec; WTabBar tabbar; - enum Action { PLAY=0, RESUME, MOVE, A_DELETE, last }; + enum Action { PLAY=0, RESUME, MARKASNEW, MOVE, A_DELETE, last }; WButton button[last]; // WButton buttonPlay; // 1 // WButton buttonResume; // 2 -- 2.39.5