summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Eskola <timo@tolleri.net>2015-09-08 10:16:20 +0300
committerTimo Eskola <timo@tolleri.net>2015-09-08 10:16:20 +0300
commit2769fb304faf240f2be085f87ca7067bbd4c5824 (patch)
treec78cf22ecb587e0ca63567906b72a8cd0378f1dd
parent5dbd7f50b1466e6628663a100f39cdda32b5e412 (diff)
downloadvdr-plugin-duplicates-2769fb304faf240f2be085f87ca7067bbd4c5824.tar.gz
vdr-plugin-duplicates-2769fb304faf240f2be085f87ca7067bbd4c5824.tar.bz2
Version 0.0.3:
- Improved comparison algorithm. - Added German translations provided by flex0r.
-rw-r--r--HISTORY5
-rw-r--r--README17
-rw-r--r--duplicates.c2
-rw-r--r--menu.c58
-rw-r--r--po/de_DE.po36
5 files changed, 97 insertions, 21 deletions
diff --git a/HISTORY b/HISTORY
index b03d144..f4bf044 100644
--- a/HISTORY
+++ b/HISTORY
@@ -1,6 +1,11 @@
VDR Plugin 'duplicates' Revision History
----------------------------------------
+2011-12-12: Version 0.0.3
+
+- Improved comparison algorithm.
+- Added German translations provided by flex0r.
+
2011-09-12: Version 0.0.2
- Added Italian translations provided by Diego Pierotto.
diff --git a/README b/README
index a3dcbf1..13cfdae 100644
--- a/README
+++ b/README
@@ -15,3 +15,20 @@ See the file COPYING for more information.
Description:
Shows duplicate recordings.
+
+Detection method:
+
+The detection method is based on recording information.
+
+Recordings without a description or a short description are not
+included in the comparison and are shown at the botton of the
+duplicate recordings list.
+
+Recorings are not considered duplicate if shorter title in not
+included in the other title. '@' and '%' characters are removed
+in front of the title before the comparison.
+
+The short description and the description are concatenated to a
+string. Spaces and '|' characters are removed from the string.
+Recordings are considered duplicate if the shorter string is
+included in the other string.
diff --git a/duplicates.c b/duplicates.c
index e649c6a..6f58b23 100644
--- a/duplicates.c
+++ b/duplicates.c
@@ -10,7 +10,7 @@
#include <vdr/plugin.h>
#include "menu.h"
-static const char *VERSION = "0.0.2";
+static const char *VERSION = "0.0.3";
static const char *DESCRIPTION = trNOOP("Shows duplicate recordings");
static const char *MAINMENUENTRY = trNOOP("Duplicate recordings");
diff --git a/menu.c b/menu.c
index c812f6d..763d2c2 100644
--- a/menu.c
+++ b/menu.c
@@ -13,6 +13,8 @@
#include <vdr/status.h>
#include <vdr/interface.h>
#include <string>
+#include <sstream>
+#include <vector>
static inline cOsdItem *SeparatorItem(const char *Label)
{
@@ -108,13 +110,13 @@ private:
const cRecording *recording;
bool checked;
protected:
- std::string haystack;
- std::string needle;
+ std::string title;
+ std::string description;
public:
cDuplicateRecording(const cRecording *Recording);
~cDuplicateRecording();
const cRecording *Recording(void);
- bool HasDescription(void) const { return ! haystack.empty() && ! needle.empty(); }
+ bool HasDescription(void) const { return ! description.empty(); }
bool IsDuplicate(const cDuplicateRecording *DuplicateRecording);
void SetChecked(bool chkd = true) { checked = chkd; }
bool Checked() { return checked; }
@@ -124,28 +126,37 @@ cDuplicateRecording::cDuplicateRecording(const cRecording *Recording)
{
recording = Recording;
checked = false;
- if (recording->Info()->Description())
- {
- haystack = std::string(recording->Info()->Description());
- size_t length = haystack.size() * 0.7f;
- needle = std::string(length > 0 ? haystack.substr(0, length) : haystack);
- }
- else if(recording->Info()->ShortText())
+ if (recording->Info()->Title())
{
- needle = std::string(recording->Info()->ShortText());
- haystack = std::string(recording->Info()->ShortText());
+ title = std::string(recording->Info()->Title());
+ if (title.length() > 1 && (title[0] == '@' || title[0] == '%'))
+ title = title.substr(1);
}
else
- {
- needle = std::string();
- haystack = std::string();
+ title = std::string();
+ std::stringstream desc;
+ if (recording->Info()->ShortText())
+ desc << std::string(recording->Info()->ShortText());
+ if (recording->Info()->Description())
+ desc << std::string(recording->Info()->Description());
+ description = desc.str();
+ while(true) {
+ size_t found = description.find("|");
+ if (found == std::string::npos)
+ break;
+ description.replace(found, 1, "");
+ }
+ while(true) {
+ size_t found = description.find(" ");
+ if (found == std::string::npos)
+ break;
+ description.replace(found, 1, "");
}
}
cDuplicateRecording::~cDuplicateRecording()
{
- haystack.clear();
- needle.clear();
+ description.clear();
}
const cRecording *cDuplicateRecording::Recording(void)
@@ -155,13 +166,20 @@ const cRecording *cDuplicateRecording::Recording(void)
bool cDuplicateRecording::IsDuplicate(const cDuplicateRecording *DuplicateRecording)
{
- if (!HasDescription())
+ if (!HasDescription() || !DuplicateRecording->HasDescription())
return false;
- if (!DuplicateRecording->HasDescription())
+
+ size_t found;
+ found = title.size() > DuplicateRecording->title.size() ?
+ title.find(DuplicateRecording->title) : DuplicateRecording->title.find(title);
+ if (found == std::string::npos)
return false;
- size_t found = haystack.size() > DuplicateRecording->haystack.size() ? haystack.find(DuplicateRecording->needle) : DuplicateRecording->haystack.find(needle);
+
+ found = description.size() > DuplicateRecording->description.size() ?
+ description.find(DuplicateRecording->description) : DuplicateRecording->description.find(description);
if (found != std::string::npos)
return true;
+
return false;
}
diff --git a/po/de_DE.po b/po/de_DE.po
new file mode 100644
index 0000000..d99ee13
--- /dev/null
+++ b/po/de_DE.po
@@ -0,0 +1,36 @@
+# German translations for PACKAGE package
+# Copyright (C) 2011 THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# Timo Eskola <timo@tolleri.net>, 2011.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: vdr-duplicates 0.0.1\n"
+"Report-Msgid-Bugs-To: <see README>\n"
+"POT-Creation-Date: 2011-06-02 19:48+0300\n"
+"PO-Revision-Date: 2011-06-05 23:37+0100\n"
+"Last-Translator: Reiner Paulus <flex0r@gmx.net>\n"
+"Language-Team: \n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"X-Poedit-Language: German\n"
+"X-Poedit-Country: GERMANY\n"
+"X-Poedit-SourceCharset: utf-8\n"
+
+msgid "Shows duplicate recordings"
+msgstr "Zeigt doppelte Aufnahmen an"
+
+msgid "Duplicate recordings"
+msgstr "Doppelte Aufnahmen anzeigen"
+
+#, c-format
+msgid "%d duplicate recordings"
+msgstr "%d doppelte Aufnahmen"
+
+#, c-format
+msgid "%d recordings without description"
+msgstr "%d Aufnahmen ohne Beschreibung"
+