From caeed845faefeb2ba78a59619d1475262b6e7df4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20O=2E=20V=C3=A1zquez?= Date: Thu, 21 Nov 2024 12:53:44 -0700 Subject: [PATCH] Remove id from title if present --- src/main/java/moviescraper/doctord/model/Movie.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/moviescraper/doctord/model/Movie.java b/src/main/java/moviescraper/doctord/model/Movie.java index 5351848b..d4440792 100644 --- a/src/main/java/moviescraper/doctord/model/Movie.java +++ b/src/main/java/moviescraper/doctord/model/Movie.java @@ -206,8 +206,11 @@ private void setAllDataItemSources(SiteParsingProfile siteToScrapeFrom) { * If the appropriate preference is set, add the ID number to the end of the title field */ private void appendIDToStartOfTitle() { - if (MoviescraperPreferences.getInstance().getAppendIDToStartOfTitle() && id != null && id.getId() != null && id.getId().trim().length() > 0 && hasValidTitle()) { - title.setTitle(id.getId() + " - " + title.getTitle()); + if(id != null && id.getId() != null && id.getId().trim().length() > 0 && hasValidTitle()) { + if (MoviescraperPreferences.getInstance().getAppendIDToStartOfTitle()) + title.setTitle(id.getId() + " - " + title.getTitle()); + else + title.setTitle(title.getTitle().replace(id.getId(), "")); } }