normalize strm file contents

This commit is contained in:
Luke Pulverenti
2017-11-01 15:50:16 -04:00
parent 5fa007d04e
commit 0a0303ca64
12 changed files with 72 additions and 71 deletions

View File

@@ -195,52 +195,55 @@ namespace Emby.Server.Implementations.Configuration
}
}
public void DisableMetadataService(string service)
public bool SetOptimalValues()
{
DisableMetadataService(typeof(Movie), Configuration, service);
DisableMetadataService(typeof(Episode), Configuration, service);
DisableMetadataService(typeof(Series), Configuration, service);
DisableMetadataService(typeof(Season), Configuration, service);
DisableMetadataService(typeof(MusicArtist), Configuration, service);
DisableMetadataService(typeof(MusicAlbum), Configuration, service);
DisableMetadataService(typeof(MusicVideo), Configuration, service);
DisableMetadataService(typeof(Video), Configuration, service);
}
var config = Configuration;
private void DisableMetadataService(Type type, ServerConfiguration config, string service)
{
var options = GetMetadataOptions(type, config);
var changed = false;
if (!options.DisabledMetadataSavers.Contains(service, StringComparer.OrdinalIgnoreCase))
if (!config.EnableCaseSensitiveItemIds)
{
var list = options.DisabledMetadataSavers.ToList();
list.Add(service);
options.DisabledMetadataSavers = list.ToArray(list.Count);
}
}
private MetadataOptions GetMetadataOptions(Type type, ServerConfiguration config)
{
var options = config.MetadataOptions
.FirstOrDefault(i => string.Equals(i.ItemType, type.Name, StringComparison.OrdinalIgnoreCase));
if (options == null)
{
var list = config.MetadataOptions.ToList();
options = new MetadataOptions
{
ItemType = type.Name
};
list.Add(options);
config.MetadataOptions = list.ToArray(list.Count);
config.EnableCaseSensitiveItemIds = true;
changed = true;
}
return options;
if (!config.SkipDeserializationForBasicTypes)
{
config.SkipDeserializationForBasicTypes = true;
changed = true;
}
if (!config.EnableSimpleArtistDetection)
{
config.EnableSimpleArtistDetection = true;
changed = true;
}
if (!config.EnableNormalizedItemByNameIds)
{
config.EnableNormalizedItemByNameIds = true;
changed = true;
}
if (!config.DisableLiveTvChannelUserDataName)
{
config.DisableLiveTvChannelUserDataName = true;
changed = true;
}
if (!config.EnableNewOmdbSupport)
{
config.EnableNewOmdbSupport = true;
changed = true;
}
if (!config.EnableLocalizedGuids)
{
config.EnableLocalizedGuids = true;
changed = true;
}
return changed;
}
}
}

View File

@@ -5298,7 +5298,8 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
OfficialRatings = query.OfficialRatings,
GenreIds = query.GenreIds,
Genres = query.Genres,
Years = query.Years
Years = query.Years,
NameContains = query.NameContains
};
var outerWhereClauses = GetWhereClauses(outerQuery, null);

View File

@@ -506,7 +506,7 @@ namespace Emby.Server.Implementations.Library
throw new ArgumentNullException("type");
}
if (key.StartsWith(ConfigurationManager.ApplicationPaths.ProgramDataPath))
if (ConfigurationManager.Configuration.EnableLocalizedGuids && key.StartsWith(ConfigurationManager.ApplicationPaths.ProgramDataPath))
{
// Try to normalize paths located underneath program-data in an attempt to make them more portable
key = key.Substring(ConfigurationManager.ApplicationPaths.ProgramDataPath.Length)

View File

@@ -308,6 +308,19 @@ namespace Emby.Server.Implementations.Localization
return value == null ? (int?)null : value.Value;
}
public bool HasUnicodeCategory(string value, UnicodeCategory category)
{
foreach (var chr in value)
{
if (char.GetUnicodeCategory(chr) == category)
{
return true;
}
}
return false;
}
public string GetLocalizedString(string phrase)
{
return GetLocalizedString(phrase, _configurationManager.Configuration.UICulture);