mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-15 18:08:53 -07:00
Add migration task to "disable-by-default" OmdbEpisodeProvider for existing installations
This commit is contained in:
parent
9fbb304c47
commit
c18b472e37
@ -370,6 +370,7 @@ namespace MediaBrowser.Server.Startup.Common
|
||||
{
|
||||
var migrations = new List<IVersionMigration>
|
||||
{
|
||||
new OmdbEpisodeProviderMigration(ServerConfigurationManager),
|
||||
new DbMigration(ServerConfigurationManager, TaskManager)
|
||||
};
|
||||
|
||||
|
@ -73,6 +73,7 @@
|
||||
<Compile Include="MbLinkShortcutHandler.cs" />
|
||||
<Compile Include="Migrations\IVersionMigration.cs" />
|
||||
<Compile Include="Migrations\DbMigration.cs" />
|
||||
<Compile Include="Migrations\OmdbEpisodeProviderMigration.cs" />
|
||||
<Compile Include="Migrations\RenameXmlOptions.cs" />
|
||||
<Compile Include="NativeEnvironment.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
|
@ -0,0 +1,47 @@
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Server.Startup.Common.Migrations
|
||||
{
|
||||
class OmdbEpisodeProviderMigration : IVersionMigration
|
||||
{
|
||||
private readonly IServerConfigurationManager _config;
|
||||
private const string _providerName = "The Open Movie Database";
|
||||
|
||||
public OmdbEpisodeProviderMigration(IServerConfigurationManager config)
|
||||
{
|
||||
_config = config;
|
||||
}
|
||||
|
||||
public void Run()
|
||||
{
|
||||
var migrationKey = this.GetType().FullName;
|
||||
var migrationKeyList = _config.Configuration.Migrations.ToList();
|
||||
|
||||
if (!migrationKeyList.Contains(migrationKey))
|
||||
{
|
||||
foreach (var metaDataOption in _config.Configuration.MetadataOptions)
|
||||
{
|
||||
if (metaDataOption.ItemType == "Episode")
|
||||
{
|
||||
var disabledFetchers = metaDataOption.DisabledMetadataFetchers.ToList();
|
||||
if (!disabledFetchers.Contains(_providerName))
|
||||
{
|
||||
disabledFetchers.Add(_providerName);
|
||||
metaDataOption.DisabledMetadataFetchers = disabledFetchers.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
migrationKeyList.Add(migrationKey);
|
||||
_config.Configuration.Migrations = migrationKeyList.ToArray();
|
||||
_config.SaveConfiguration();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user