Skip to content

Commit

Permalink
- add duplicate filter option
Browse files Browse the repository at this point in the history
  • Loading branch information
derreisende77 committed Oct 25, 2024
1 parent c1a02b9 commit c10970d
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
- **FEATURE:** Info-Datei kann nun per Kontextmenü für jeden Eintrag manuell erzeugt werden.
- **FEATURE:** Die Filmliste wird nun beim Laden zusätzlich auf Duplikate untersucht. Hierbei werden die Mediatheken der ARD und ZDF erst am Ende berücksichtigt um das Angebot der "kleineren" Sender nicht zu benachteiligen.
- **FEATURE:** Duplikate werden im Tab `Filme` farblich hervorgehoben. Die Farbe kann in den Einstellungen modifiziert werden. Es werden nur Filme als Duplikat markiert, deren normale und high-quality Film-URL identisch sind.
- **FEATURE:** Duplikate können im Filterpanel ausgeblendet werden.
- **FEATURE:** Im Tab `Filme` können über das Kontextmenü `Zusammengehörige Filme anzeigen...` bei einem markierten Duplikat alle zusammengehörigen Filme angezeigt werden.
- **FEATURE:** Mittels `Ansicht/Filmstatistik anzeigen` können nun für die vorhandenen Sender Informationen bzgl. Anzahl der Filme und der Duplikate angezeigt werden. Es wird hier nur die gesamte Filmliste ohne jegliche Filter abzüglich Livestreams berücksichtigt, so dass es zu Abweichungen zur Anzeige in der Statuszeile kommen kann.
- **FEATURE:** Mit der Lucene-Suche können mittels des `duplicate`-Boolean Parameters Filmduplikate berücksichtigt werden.
Expand Down
1 change: 1 addition & 0 deletions src/main/java/mediathek/gui/tabs/tab_film/GuiFilme.java
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,7 @@ private void setupActionListeners() {
filterActionPanel.dontShowTrailersProperty().addListener(reloadTableListener);
filterActionPanel.dontShowSignLanguageProperty().addListener(reloadTableListener);
filterActionPanel.dontShowAudioVersionsProperty().addListener(reloadTableListener);
filterActionPanel.dontShowDuplicatesProperty().addListener(reloadTableListener);
filterActionPanel.showLivestreamsOnlyProperty().addListener(reloadTableListener);
var filmLengthSlider = filterActionPanel.getFilmLengthSlider();
filmLengthSlider.lowValueChangingProperty().addListener(reloadTableListener2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ private void performTableFiltering() {
stream = stream.filter(film -> !film.isAudioVersion());
if (filterActionPanel.isDontShowAbos())
stream = stream.filter(film -> film.getAbo() == null);
if (filterActionPanel.isDontShowDuplicates()) {
stream = stream.filter(film -> !film.isDuplicate());
}
if (filterActionPanel.isShowSubtitlesOnly()) {
stream = stream.filter(this::subtitleCheck);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ && getFilterThema().isEmpty()
&& !filterActionPanel.isDontShowTrailers()
&& !filterActionPanel.isDontShowSignLanguage()
&& !filterActionPanel.isDontShowAudioVersions()
&& !filterActionPanel.isDontShowDuplicates()
&& filterActionPanel.zeitraumProperty().get().equalsIgnoreCase(ZeitraumSpinner.UNLIMITED_VALUE);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ private TModelFilm performTableFiltering() {
if (filterActionPanel.isDontShowSignLanguage()) {
addNoSignLanguageQuery(qb, analyzer);
}
if (filterActionPanel.isDontShowDuplicates()) {
addNoDuplicatesQuery(qb, analyzer);
}

if (filterActionPanel.isShowSubtitlesOnly()) {
addSubtitleOnlyQuery(qb, analyzer);
}
Expand Down Expand Up @@ -199,6 +203,11 @@ private void addSubtitleOnlyQuery(@NotNull BooleanQuery.Builder qb, @NotNull Sta
qb.add(q, BooleanClause.Occur.FILTER);
}

private void addNoDuplicatesQuery(@NotNull BooleanQuery.Builder qb, @NotNull StandardAnalyzer analyzer) throws ParseException {
var q = new QueryParser(LuceneIndexKeys.DUPLICATE, analyzer).parse("\"true\"");
qb.add(q, BooleanClause.Occur.MUST_NOT);
}

private void addNoSignLanguageQuery(@NotNull BooleanQuery.Builder qb, @NotNull StandardAnalyzer analyzer) throws ParseException {
var q = new QueryParser(LuceneIndexKeys.SIGN_LANGUAGE, analyzer).parse("\"true\"");
qb.add(q, BooleanClause.Occur.MUST_NOT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public class CommonViewSettingsPane extends VBox {
public final SenderBoxNode senderCheckList = new SenderBoxNode();
public final CheckBox cbDontShowAudioVersions = new CheckBox("Hörfassungen ausblenden");
public final CheckBox cbDontShowGebaerdensprache = new CheckBox("Gebärdensprache nicht anzeigen");
public final CheckBox cbDontShowDuplicates = new CheckBox("Duplikate nicht anzeigen");
public final CheckBox cbDontShowTrailers = new CheckBox("Trailer/Teaser/Vorschau nicht anzeigen");
public final CheckBox cbShowUnseenOnly = new CheckBox("Gesehene Filme nicht anzeigen");
public final CheckBox cbDontShowAbos = new CheckBox("Abos nicht anzeigen");
Expand Down Expand Up @@ -120,6 +121,7 @@ public CommonViewSettingsPane() {
cbDontShowGebaerdensprache,
cbDontShowTrailers,
cbDontShowAudioVersions,
cbDontShowDuplicates,
new Separator(),
createSenderList(),
new Separator(),
Expand Down Expand Up @@ -163,6 +165,7 @@ private void handleTableModelChangeEvent(TableModelChangeEvent evt) {
cbDontShowGebaerdensprache.setDisable(disable);
cbDontShowTrailers.setDisable(disable);
cbDontShowAudioVersions.setDisable(disable);
cbDontShowDuplicates.setDisable(disable);
senderCheckList.setDisable(disable);
themaComboBox.setDisable(disable);
filmLengthSliderNode.setDisable(disable);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public class FilterActionPanel {
private BooleanProperty dontShowSignLanguage;
private BooleanProperty dontShowTrailers;
private BooleanProperty dontShowAbos;
private BooleanProperty dontShowDuplicates;
private BooleanProperty showLivestreamsOnly;
private BooleanProperty showUnseenOnly;
private BooleanProperty showBookMarkedOnly;
Expand Down Expand Up @@ -127,6 +128,9 @@ public BooleanProperty dontShowAbosProperty() {
return dontShowAbos;
}

public BooleanProperty dontShowDuplicatesProperty() { return dontShowDuplicates;}
public boolean isDontShowDuplicates() { return dontShowDuplicates.get();}

public boolean isShowLivestreamsOnly() {
return showLivestreamsOnly.get();
}
Expand Down Expand Up @@ -303,6 +307,7 @@ private void setupViewSettingsPane() {
dontShowSignLanguage = viewSettingsPane.cbDontShowGebaerdensprache.selectedProperty();
dontShowTrailers = viewSettingsPane.cbDontShowTrailers.selectedProperty();
dontShowAudioVersions = viewSettingsPane.cbDontShowAudioVersions.selectedProperty();
dontShowDuplicates = viewSettingsPane.cbDontShowDuplicates.selectedProperty();

setupThemaComboBox();
viewSettingsPane.senderCheckList.getCheckModel().getCheckedItems().
Expand Down Expand Up @@ -336,6 +341,7 @@ private void restoreConfigSettings() {
dontShowTrailers.set(filterConfig.isDontShowTrailers());
dontShowSignLanguage.set(filterConfig.isDontShowSignLanguage());
dontShowAudioVersions.set(filterConfig.isDontShowAudioVersions());
dontShowDuplicates.set(filterConfig.isDontShowDuplicates());

try {
double loadedMin = filterConfig.getFilmLengthMin();
Expand Down Expand Up @@ -392,6 +398,8 @@ private void setupConfigListeners() {
((observable, oldValue, newValue) -> filterConfig.setDontShowSignLanguage(newValue)));
dontShowAudioVersions.addListener(
((observable, oldValue, newValue) -> filterConfig.setDontShowAudioVersions(newValue)));
dontShowDuplicates.addListener(
((observable, oldValue, newValue) -> filterConfig.setDontShowDuplicates(newValue)));

filmLengthSlider.lowValueProperty().addListener(
((observable, oldValue, newValue) -> filterConfig.setFilmLengthMin(newValue.doubleValue())));
Expand Down
18 changes: 17 additions & 1 deletion src/main/java/mediathek/tool/FilterConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,21 @@ public boolean isShowUnseenOnly() {
false);
}

public boolean isDontShowDuplicates() {
return configuration.getBoolean(
toFilterConfigNameWithCurrentFilter(
FilterConfigurationKeys.FILTER_PANEL_DONT_SHOW_DUPLICATES.getKey()),
false);
}

public FilterConfiguration setDontShowDuplicates(boolean dontShowDuplicates) {
configuration.setProperty(
toFilterConfigNameWithCurrentFilter(
FilterConfigurationKeys.FILTER_PANEL_DONT_SHOW_DUPLICATES.getKey()),
dontShowDuplicates);
return this;
}

public FilterConfiguration setShowUnseenOnly(boolean showUnseenOnly) {
configuration.setProperty(
toFilterConfigNameWithCurrentFilter(
Expand Down Expand Up @@ -495,7 +510,8 @@ protected enum FilterConfigurationKeys {
FILTER_PANEL_DONT_SHOW_AUDIO_VERSIONS("filter.filter_%s.dont_show.audio_versions"),
FILTER_PANEL_FILM_LENGTH_MIN("filter.filter_%s.film_length.min"),
FILTER_PANEL_FILM_LENGTH_MAX("filter.filter_%s.film_length.max"),
FILTER_PANEL_ZEITRAUM("filter.filter_%s.zeitraum");
FILTER_PANEL_ZEITRAUM("filter.filter_%s.zeitraum"),
FILTER_PANEL_DONT_SHOW_DUPLICATES("filter.filter_%s.dont_show_duplicates");

private final String key;

Expand Down

0 comments on commit c10970d

Please sign in to comment.