diff --git a/Plugin.php b/Plugin.php index 5b2d80d..ae1ff4a 100644 --- a/Plugin.php +++ b/Plugin.php @@ -226,7 +226,7 @@ private function processPlaylist(int $playlistId, PluginExecutionContext $contex $cache = $this->loadCache($cacheTtlDays); $cacheChanged = false; - $index = $this->fetchCountryIndex($countryCode, $countryFolder, $cache, $cacheChanged); + $index = $this->fetchCountryIndex($countryCode, $countryFolder, $cache, $cacheChanged, $ignoreCache); if ($index !== []) { $context->info(sprintf('Loaded index of %d known logos for %s.', count($index), $countryFolder)); @@ -304,7 +304,7 @@ private function processPlaylist(int $playlistId, PluginExecutionContext $contex $matched++; $batchMatched[$displayName] = $logoUrl; - if (! $isDryRun) { + if (! $isDryRun && ($channel->logo ?? '') !== $logoUrl) { Channel::where('id', $channel->id)->update(['logo' => $logoUrl]); } } else { @@ -584,11 +584,11 @@ private function compactIndexMatch(array $slugs, string $countryCode, string $co * @param array $cache * @return array */ - private function fetchCountryIndex(string $countryCode, string $countryFolder, array &$cache, bool &$cacheChanged): array + private function fetchCountryIndex(string $countryCode, string $countryFolder, array &$cache, bool &$cacheChanged, bool $ignoreCache = false): array { $cacheKey = "index:{$countryCode}"; - if (array_key_exists($cacheKey, $cache) && is_array($cache[$cacheKey])) { + if (! $ignoreCache && array_key_exists($cacheKey, $cache) && is_array($cache[$cacheKey])) { return $cache[$cacheKey]; } @@ -680,7 +680,8 @@ private function slugify(string $name, bool $stripQualityTags = true): string } // Strip common IPTV transport / source terms (always, regardless of quality tag stripping) - $name = preg_replace('/\b(cable|sat(?:ellite)?|terrestrial|dvb[tcsh]?|iptv|ott|fta|stream|linear)\b/iu', '', $name) ?? $name; + // Use negative lookahead so "sat" inside "SAT.1" is not stripped (sat followed by dot+digit). + $name = preg_replace('/\b(cable|sat(?:ellite)?(?![.\s]*\d)|terrestrial|dvb[tcsh]?|iptv|ott|fta|stream|linear)\b/iu', '', $name) ?? $name; // Remove content inside any bracket type $name = preg_replace('/[\(\[\{][^\)\]\}]*[\)\]\}]/', '', $name) ?? $name; @@ -841,8 +842,9 @@ private function normalizeChannelName(string $name, array $config): string } // 3. Strip common IPTV transport / source terms that are never part of a channel name + // Use negative lookahead so "Sat" inside "SAT.1" is not stripped (Sat followed by dot/space+digit). if ($config['strip_provider_info']) { - $name = (string) preg_replace('/\b(Cable|Sat|Satellite|Terrestrial|DVB[TCSH]?|IPTV|OTT|FTA|Stream|Linear)\b/iu', '', $name); + $name = (string) preg_replace('/\b(Cable|Sat(?:ellite)?(?![.\s]*\d)|Terrestrial|DVB[TCSH]?|IPTV|OTT|FTA|Stream|Linear)\b/iu', '', $name); } // 4. Strip user-configured provider terms (one term per line in settings) diff --git a/plugin.json b/plugin.json index 89c2c2b..0e95178 100644 --- a/plugin.json +++ b/plugin.json @@ -1,7 +1,7 @@ { "id": "tv-logos", "name": "TV Logos", - "version": "1.0.6", + "version": "1.0.7", "api_version": "1.0.0", "repository": "m3ue/tv-logos-plugin", "description": "Automatically enriches channel logos from the open-source tv-logo/tv-logos repository via the jsDelivr CDN.",