From acc1b24d3bb0a1cc15a52bb068e41e06a04996f6 Mon Sep 17 00:00:00 2001
From: Karl Dietz <dekarl@mythtv.org>
Date: Tue, 4 Aug 2015 22:27:01 +0200
Subject: [PATCH] Add utility function to clear all bookmarks.
Clears the mythical bookmark around the start of the programme,
the last playback position and manually set bookmarks.
Its intended use case is cleanup when the recording file has changed in
a way that makes the bookmarks useless.
Refs #11713
---
mythtv/programs/mythutil/commandlineparser.cpp | 5 +++++
mythtv/programs/mythutil/markuputils.cpp | 20 ++++++++++++++++++++
2 files changed, 25 insertions(+)
diff --git a/mythtv/programs/mythutil/commandlineparser.cpp b/mythtv/programs/mythutil/commandlineparser.cpp
index 931372b..b5cd4c7 100644
a
|
b
|
void MythUtilCommandLineParser::LoadArguments(void) |
73 | 73 | "Clear the seek table.", "") |
74 | 74 | ->SetGroup("Recording Markup") |
75 | 75 | ->SetParentOf(ChanidStartimeVideo) |
| 76 | << add("--clearbookmarks", "clearbookmarks", false, |
| 77 | "Clear all bookmarks.", "This command will reset the playback " |
| 78 | "start to the very beginning of the recording file.") |
| 79 | ->SetGroup("Recording Markup") |
| 80 | ->SetParentOf(ChanidStartimeVideo) |
76 | 81 | << add("--getmarkup", "getmarkup", "", |
77 | 82 | "Write markup data to the specified local file.", "") |
78 | 83 | ->SetGroup("Recording Markup") |
diff --git a/mythtv/programs/mythutil/markuputils.cpp b/mythtv/programs/mythutil/markuputils.cpp
index 9295aeb..4a2ac89 100644
a
|
b
|
static int ClearSeekTable(const MythUtilCommandLineParser &cmdline) |
196 | 196 | return GENERIC_EXIT_OK; |
197 | 197 | } |
198 | 198 | |
| 199 | static int ClearBookmarks(const MythUtilCommandLineParser &cmdline) |
| 200 | { |
| 201 | ProgramInfo pginfo; |
| 202 | if (!GetProgramInfo(cmdline, pginfo)) |
| 203 | return GENERIC_EXIT_NO_RECORDING_DATA; |
| 204 | |
| 205 | cout << "Clearing bookmarks\n"; |
| 206 | LOG(VB_GENERAL, LOG_NOTICE, pginfo.IsVideo() ? |
| 207 | QString("Clearing bookmarks for video %1").arg(pginfo.GetPathname()) : |
| 208 | QString("Clearing bookmarks for channel id %1 @ %2") |
| 209 | .arg(pginfo.GetChanID()) |
| 210 | .arg(pginfo.GetScheduledStartTime().toString())); |
| 211 | pginfo.ClearMarkupFlag(MARK_BOOKMARK); |
| 212 | pginfo.ClearMarkupFlag(MARK_UTIL_PROGSTART); |
| 213 | pginfo.ClearMarkupFlag(MARK_UTIL_LASTPLAYPOS); |
| 214 | |
| 215 | return GENERIC_EXIT_OK; |
| 216 | } |
| 217 | |
199 | 218 | static int GetMarkup(const MythUtilCommandLineParser &cmdline) |
200 | 219 | { |
201 | 220 | ProgramInfo pginfo; |
… |
… |
void registerMarkupUtils(UtilMap &utilMap) |
352 | 371 | utilMap["setskiplist"] = &SetSkipList; |
353 | 372 | utilMap["clearskiplist"] = &ClearSkipList; |
354 | 373 | utilMap["clearseektable"] = &ClearSeekTable; |
| 374 | utilMap["clearbookmarks"] = &ClearBookmarks; |
355 | 375 | utilMap["getmarkup"] = &GetMarkup; |
356 | 376 | utilMap["setmarkup"] = &SetMarkup; |
357 | 377 | } |