From 7ff7d9f7c530ae3fc2378f05050491d185f23d55 Mon Sep 17 00:00:00 2001 From: SansGuidon Date: Fri, 24 Jan 2025 23:36:08 +0000 Subject: [PATCH] feat(autotag) prefix titles with [video] if it's youtube link --- auto_tag_plugin/auto_tag_plugin.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/auto_tag_plugin/auto_tag_plugin.php b/auto_tag_plugin/auto_tag_plugin.php index 3ff5dcf..afd7543 100644 --- a/auto_tag_plugin/auto_tag_plugin.php +++ b/auto_tag_plugin/auto_tag_plugin.php @@ -231,6 +231,15 @@ function apply_auto_tags(array $data, ConfigManager $conf): array return $data; } + if (stripos($data['link']['url'], 'youtube.com') !== false || stripos($data['link']['url'], 'youtu.be') !== false) { + $title = $data['link']['title'] ?? ''; + + // Ajoute le tag [Video] au début du titre s'il n'est pas déjà présent + if (stripos($title, '[Video]') !== 0) { + $data['link']['title'] = '[Video] ' . $title; + } + } + $keywordsToTags = $conf->get('plugins.AUTO_TAG_KEYWORDS', []); $pageContent = fetch_page_content($data['link']['url']);