From 63527e89753d3992314d1737e2a6cb4ba71b2d0a Mon Sep 17 00:00:00 2001 From: AF-1 <> Date: Sun, 18 Aug 2024 16:59:06 +0200 Subject: [PATCH] make CTI compatible with CBM --- CustomTagImporter/Common.pm | 1 + CustomTagImporter/Plugin.pm | 33 ++++++++++++++++++++------------- CustomTagImporter/install.xml | 2 +- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/CustomTagImporter/Common.pm b/CustomTagImporter/Common.pm index ebd7ebd..bfea0e1 100644 --- a/CustomTagImporter/Common.pm +++ b/CustomTagImporter/Common.pm @@ -446,6 +446,7 @@ sub exitScan { main::INFOLOG && $log->is_info && $log->info('Rescan completed (with errors) after '.(time()-($scanningContext->{'scanStartTime'})).' seconds.'); } else { $prefs->set('scanResult', 1); + Slim::Control::Request::notifyFromArray(undef, ['customtagimporter', 'changedstatus', 1]) unless $scanningContext->{'importerCall'}; main::INFOLOG && $log->is_info && $log->info('Rescan completed after '.(time()-($scanningContext->{'scanStartTime'})).' seconds.'); } diff --git a/CustomTagImporter/Plugin.pm b/CustomTagImporter/Plugin.pm index aab836b..6890df6 100644 --- a/CustomTagImporter/Plugin.pm +++ b/CustomTagImporter/Plugin.pm @@ -57,6 +57,7 @@ sub initPlugin { initPrefs(); Slim::Control::Request::subscribe(\&_setRefreshCBTimer, [['rescan'], ['done']]); + Slim::Control::Request::addDispatch(['customtagimporter', 'changedstatus','_status'],[0, 0, 0, undef]); if (main::WEBUI) { require Plugins::CustomTagImporter::Settings::Basic; @@ -93,36 +94,42 @@ sub initPrefs { }, 'customtagconfigmatrix'); } +sub getCustomBrowseMenusTemplates { + return getCustomBrowseTemplates(@_); +} sub getCustomBrowseTemplates { - my $client = shift; - my $pluginVersion = shift; - + my ($client, $pluginVersion) = @_; my $CBversion = Slim::Utils::PluginManager->isEnabled('Plugins::CustomBrowseMenus::Plugin') ? 'CustomBrowseMenus' : 'CustomBrowse'; return Plugins::CustomTagImporter::CBTemplateReader::getTemplates($client, 'CustomTagImporter', $pluginVersion, 'PluginCache/'.$CBversion, 'CBMenuTemplates', 'xml'); } -sub getCustomBrowseTemplateData { - my $client = shift; - my $templateItem = shift; - my $parameterValues = shift; +sub getCustomBrowseMenusTemplateData { + return getCustomBrowseTemplateData(@_); +} +sub getCustomBrowseTemplateData { + my ($client, $templateItem, $parameterValues) = @_; my $data = Plugins::CustomTagImporter::CBTemplateReader::readTemplateData('CustomTagImporter', 'CBMenuTemplates', $templateItem->{'id'}); return $data; } +sub getCustomBrowseMenusContextTemplates { + return getCustomBrowseContextTemplates(@_); +} + sub getCustomBrowseContextTemplates { - my $client = shift; - my $pluginVersion = shift; + my ($client, $pluginVersion) = @_; my $CBversion = Slim::Utils::PluginManager->isEnabled('Plugins::CustomBrowseMenus::Plugin') ? 'CustomBrowseMenus' : 'CustomBrowse'; return Plugins::CustomTagImporter::CBTemplateReader::getTemplates($client, 'CustomTagImporter', $pluginVersion, 'PluginCache/'.$CBversion, 'CBContextMenuTemplates', 'xml'); } -sub getCustomBrowseContextTemplateData { - my $client = shift; - my $templateItem = shift; - my $parameterValues = shift; +sub getCustomBrowseMenusContextTemplateData { + return getCustomBrowseContextTemplateData(@_); +} +sub getCustomBrowseContextTemplateData { + my ($client, $templateItem, $parameterValues) = @_; my $data = Plugins::CustomTagImporter::CBTemplateReader::readTemplateData('CustomTagImporter', 'CBContextMenuTemplates', $templateItem->{'id'}); return $data; } diff --git a/CustomTagImporter/install.xml b/CustomTagImporter/install.xml index 2600709..229e87f 100644 --- a/CustomTagImporter/install.xml +++ b/CustomTagImporter/install.xml @@ -3,7 +3,7 @@ afac7b8e-07fd-7c77-b8af-e6e996e8c140 PLUGIN_CUSTOMTAGIMPORTER Plugins::CustomTagImporter::Plugin - 1.2.3 + 1.2.4 PLUGIN_CUSTOMTAGIMPORTER_DESC AF Plugins::CustomTagImporter::Importer