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); var config = Configuration;
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);
}
private void DisableMetadataService(Type type, ServerConfiguration config, string service) var changed = false;
{
var options = GetMetadataOptions(type, config);
if (!options.DisabledMetadataSavers.Contains(service, StringComparer.OrdinalIgnoreCase)) if (!config.EnableCaseSensitiveItemIds)
{ {
var list = options.DisabledMetadataSavers.ToList(); config.EnableCaseSensitiveItemIds = true;
changed = true;
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);
} }
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, OfficialRatings = query.OfficialRatings,
GenreIds = query.GenreIds, GenreIds = query.GenreIds,
Genres = query.Genres, Genres = query.Genres,
Years = query.Years Years = query.Years,
NameContains = query.NameContains
}; };
var outerWhereClauses = GetWhereClauses(outerQuery, null); var outerWhereClauses = GetWhereClauses(outerQuery, null);

View File

@ -506,7 +506,7 @@ namespace Emby.Server.Implementations.Library
throw new ArgumentNullException("type"); 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 // Try to normalize paths located underneath program-data in an attempt to make them more portable
key = key.Substring(ConfigurationManager.ApplicationPaths.ProgramDataPath.Length) 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; 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) public string GetLocalizedString(string phrase)
{ {
return GetLocalizedString(phrase, _configurationManager.Configuration.UICulture); return GetLocalizedString(phrase, _configurationManager.Configuration.UICulture);

View File

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

View File

@ -63,7 +63,7 @@ namespace MediaBrowser.Api
public void Post(ReportStartupWizardComplete request) public void Post(ReportStartupWizardComplete request)
{ {
_config.Configuration.IsStartupWizardCompleted = true; _config.Configuration.IsStartupWizardCompleted = true;
SetWizardFinishValues(_config.Configuration); _config.SetOptimalValues();
_config.SaveConfiguration(); _config.SaveConfiguration();
} }
@ -87,16 +87,6 @@ namespace MediaBrowser.Api
return result; 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) public void Post(UpdateStartupConfiguration request)
{ {
_config.Configuration.UICulture = request.UICulture; _config.Configuration.UICulture = request.UICulture;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -163,7 +163,11 @@ namespace MediaBrowser.Providers.MediaInfo
private void FetchShortcutInfo(Video video) 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) public Task<ItemUpdateType> FetchAudioInfo<T>(T item, CancellationToken cancellationToken)