From 5457327f8b6bb47a04a37da05af4614a155f70cf Mon Sep 17 00:00:00 2001 From: pops64 Date: Fri, 29 Nov 2024 15:29:06 -0500 Subject: [PATCH] Clean UP --- pkg/config/scraper_list.go | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/pkg/config/scraper_list.go b/pkg/config/scraper_list.go index 59b0f686b..bc3c58b91 100644 --- a/pkg/config/scraper_list.go +++ b/pkg/config/scraper_list.go @@ -191,8 +191,6 @@ func MigrateFromOfficalToCustom(id string, url string, name string, company stri // Data taken from offical scraper list scraper := ScraperConfig{URL: url, Name: name, Company: company, AvatarUrl: avatarUrl} - exists := false - // Update any alt sites that is using the old id to the new id updateMasterSite := func(sites []ScraperConfig) { for idx, site := range sites { @@ -207,25 +205,23 @@ func MigrateFromOfficalToCustom(id string, url string, name string, company stri updateMasterSite(scraperConfig.CustomScrapers.VrpornScrapers) updateMasterSite(scraperConfig.CustomScrapers.VrphubScrapers) - if exists == false { - // Append our scraper to the the Custom Scraper list unless its new id already exists - switch customId { - case "slr": - if CheckMatchingSite(scraper, scraperConfig.CustomScrapers.SlrScrapers) == false { - scraperConfig.CustomScrapers.SlrScrapers = append(scraperConfig.CustomScrapers.SlrScrapers, scraper) - } - case "povr": - if CheckMatchingSite(scraper, scraperConfig.CustomScrapers.PovrScrapers) == false { - scraperConfig.CustomScrapers.PovrScrapers = append(scraperConfig.CustomScrapers.PovrScrapers, scraper) - } - case "vrporn": - if CheckMatchingSite(scraper, scraperConfig.CustomScrapers.VrpornScrapers) == false { - scraperConfig.CustomScrapers.VrpornScrapers = append(scraperConfig.CustomScrapers.VrpornScrapers, scraper) - } - case "vrphub": - if CheckMatchingSite(scraper, scraperConfig.CustomScrapers.VrphubScrapers) == false { - scraperConfig.CustomScrapers.VrphubScrapers = append(scraperConfig.CustomScrapers.VrphubScrapers, scraper) - } + // Append our scraper to the the Custom Scraper list unless its new id already exists + switch customId { + case "slr": + if CheckMatchingSite(scraper, scraperConfig.CustomScrapers.SlrScrapers) == false { + scraperConfig.CustomScrapers.SlrScrapers = append(scraperConfig.CustomScrapers.SlrScrapers, scraper) + } + case "povr": + if CheckMatchingSite(scraper, scraperConfig.CustomScrapers.PovrScrapers) == false { + scraperConfig.CustomScrapers.PovrScrapers = append(scraperConfig.CustomScrapers.PovrScrapers, scraper) + } + case "vrporn": + if CheckMatchingSite(scraper, scraperConfig.CustomScrapers.VrpornScrapers) == false { + scraperConfig.CustomScrapers.VrpornScrapers = append(scraperConfig.CustomScrapers.VrpornScrapers, scraper) + } + case "vrphub": + if CheckMatchingSite(scraper, scraperConfig.CustomScrapers.VrphubScrapers) == false { + scraperConfig.CustomScrapers.VrphubScrapers = append(scraperConfig.CustomScrapers.VrphubScrapers, scraper) } }