normalize strm file contents

pull/1154/head
Luke Pulverenti 7 years ago
parent 5fa007d04e
commit 0a0303ca64

@ -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);
config.EnableCaseSensitiveItemIds = true;
changed = true;
}
options.DisabledMetadataSavers = list.ToArray(list.Count);
if (!config.SkipDeserializationForBasicTypes)
{
config.SkipDeserializationForBasicTypes = true;
changed = true;
}
}
private MetadataOptions GetMetadataOptions(Type type, ServerConfiguration config)
{
var options = config.MetadataOptions
.FirstOrDefault(i => string.Equals(i.ItemType, type.Name, StringComparison.OrdinalIgnoreCase));
if (!config.EnableSimpleArtistDetection)
{
config.EnableSimpleArtistDetection = true;
changed = true;
}
if (options == null)
if (!config.EnableNormalizedItemByNameIds)
{
var list = config.MetadataOptions.ToList();
config.EnableNormalizedItemByNameIds = true;
changed = true;
}
options = new MetadataOptions
{
ItemType = type.Name
};
if (!config.DisableLiveTvChannelUserDataName)
{
config.DisableLiveTvChannelUserDataName = true;
changed = true;
}
list.Add(options);
if (!config.EnableNewOmdbSupport)
{
config.EnableNewOmdbSupport = true;
changed = true;
}
config.MetadataOptions = list.ToArray(list.Count);
if (!config.EnableLocalizedGuids)
{
config.EnableLocalizedGuids = true;
changed = true;
}
return options;
return changed;
}
}
}

@ -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);

@ -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)

@ -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);

@ -134,8 +134,6 @@ namespace MediaBrowser.Api
public void Post(AutoSetMetadataOptions request)
{
_configurationManager.DisableMetadataService("Emby Xml");
_configurationManager.SaveConfiguration();
}
/// <summary>

@ -63,7 +63,7 @@ namespace MediaBrowser.Api
public void Post(ReportStartupWizardComplete request)
{
_config.Configuration.IsStartupWizardCompleted = true;
SetWizardFinishValues(_config.Configuration);
_config.SetOptimalValues();
_config.SaveConfiguration();
}
@ -87,16 +87,6 @@ namespace MediaBrowser.Api
return result;
}
private void SetWizardFinishValues(ServerConfiguration config)
{
config.EnableCaseSensitiveItemIds = true;
config.SkipDeserializationForBasicTypes = true;
config.EnableSimpleArtistDetection = true;
config.EnableNormalizedItemByNameIds = true;
config.DisableLiveTvChannelUserDataName = true;
config.EnableNewOmdbSupport = true;
}
public void Post(UpdateStartupConfiguration request)
{
_config.Configuration.UICulture = request.UICulture;

@ -20,10 +20,6 @@ namespace MediaBrowser.Controller.Configuration
/// <value>The configuration.</value>
ServerConfiguration Configuration { get; }
/// <summary>
/// Sets the preferred metadata service.
/// </summary>
/// <param name="service">The service.</param>
void DisableMetadataService(string service);
bool SetOptimalValues();
}
}

@ -189,6 +189,8 @@ namespace MediaBrowser.Model.Configuration
public PathSubstitution[] PathSubstitutions { get; set; }
public bool EnableSimpleArtistDetection { get; set; }
public bool EnableLocalizedGuids { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="ServerConfiguration" /> class.
/// </summary>
@ -200,6 +202,7 @@ namespace MediaBrowser.Model.Configuration
PathSubstitutions = new PathSubstitution[] { };
EnableSimpleArtistDetection = true;
EnableLocalizedGuids = true;
DisplaySpecialsWithinSeasons = true;
EnableExternalContentInSuggestions = true;

@ -1,9 +0,0 @@
using System;
namespace MediaBrowser.Model.Dlna
{
public class PlaybackException : Exception
{
public PlaybackErrorCode ErrorCode { get; set;}
}
}

@ -1,5 +1,6 @@
using System.Collections.Generic;
using MediaBrowser.Model.Entities;
using System.Globalization;
namespace MediaBrowser.Model.Globalization
{
@ -54,5 +55,7 @@ namespace MediaBrowser.Model.Globalization
string RemoveDiacritics(string text);
string NormalizeFormKD(string text);
bool HasUnicodeCategory(string value, UnicodeCategory category);
}
}

@ -98,7 +98,6 @@
<Compile Include="Dlna\ResponseProfile.cs" />
<Compile Include="Dlna\StreamInfoSorter.cs" />
<Compile Include="Dlna\PlaybackErrorCode.cs" />
<Compile Include="Dlna\PlaybackException.cs" />
<Compile Include="Dlna\ResolutionConfiguration.cs" />
<Compile Include="Dlna\ResolutionNormalizer.cs" />
<Compile Include="Dlna\ResolutionOptions.cs" />

@ -163,7 +163,11 @@ namespace MediaBrowser.Providers.MediaInfo
private void FetchShortcutInfo(Video video)
{
video.ShortcutPath = _fileSystem.ReadAllText(video.Path);
video.ShortcutPath = _fileSystem.ReadAllText(video.Path)
.Replace("\t", string.Empty)
.Replace("\r", string.Empty)
.Replace("\n", string.Empty)
.Trim();
}
public Task<ItemUpdateType> FetchAudioInfo<T>(T item, CancellationToken cancellationToken)

Loading…
Cancel
Save