Skip to content

Commit

Permalink
Merge pull request #3242 from MediaBrowser/dev
Browse files Browse the repository at this point in the history
update translations
  • Loading branch information
LukePulverenti authored Apr 22, 2018
2 parents 364370f + 1863407 commit 5888e02
Show file tree
Hide file tree
Showing 133 changed files with 1,472 additions and 2,286 deletions.
5 changes: 3 additions & 2 deletions Emby.Dlna/Common/StateVariable.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;

namespace Emby.Dlna.Common
{
Expand All @@ -10,7 +11,7 @@ public class StateVariable

public bool SendsEvents { get; set; }

public List<string> AllowedValues { get; set; }
public string[] AllowedValues { get; set; }

public override string ToString()
{
Expand All @@ -19,7 +20,7 @@ public override string ToString()

public StateVariable()
{
AllowedValues = new List<string>();
AllowedValues = Array.Empty<string>();
}
}
}
2 changes: 1 addition & 1 deletion Emby.Dlna/ConfigurationExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class DlnaConfigurationFactory : IConfigurationFactory
{
public IEnumerable<ConfigurationStore> GetConfigurations()
{
return new List<ConfigurationStore>
return new ConfigurationStore[]
{
new ConfigurationStore
{
Expand Down
4 changes: 2 additions & 2 deletions Emby.Dlna/ConnectionManager/ConnectionManagerXmlBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ private IEnumerable<StateVariable> GetStateVariables()
DataType = "string",
SendsEvents = false,

AllowedValues = new List<string>
AllowedValues = new string[]
{
"OK",
"ContentFormatMismatch",
Expand All @@ -65,7 +65,7 @@ private IEnumerable<StateVariable> GetStateVariables()
DataType = "string",
SendsEvents = false,

AllowedValues = new List<string>
AllowedValues = new string[]
{
"Output",
"Input"
Expand Down
2 changes: 1 addition & 1 deletion Emby.Dlna/ContentDirectory/ContentDirectoryXmlBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ private IEnumerable<StateVariable> GetStateVariables()
DataType = "string",
SendsEvents = false,

AllowedValues = new List<string>
AllowedValues = new string[]
{
"BrowseMetadata",
"BrowseDirectChildren"
Expand Down
16 changes: 8 additions & 8 deletions Emby.Dlna/ContentDirectory/ControlHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ private IEnumerable<KeyValuePair<string, string>> HandleBrowse(IDictionary<strin

var resXML = builder.ToString();

return new List<KeyValuePair<string, string>>
return new []
{
new KeyValuePair<string,string>("Result", resXML),
new KeyValuePair<string,string>("NumberReturned", provided.ToString(_usCulture)),
Expand Down Expand Up @@ -1135,7 +1135,7 @@ private QueryResult<ServerItem> GetMusicLatest(BaseItem parent, User user, Inter
ParentId = parent == null ? null : parent.Id.ToString("N"),
GroupItems = true

}, query.DtoOptions).Select(i => i.Item1 ?? i.Item2.FirstOrDefault()).Where(i => i != null).ToList();
}, query.DtoOptions).Select(i => i.Item1 ?? i.Item2.FirstOrDefault()).Where(i => i != null).ToArray();

return ToResult(items);
}
Expand All @@ -1150,7 +1150,7 @@ private QueryResult<ServerItem> GetNextUp(BaseItem parent, User user, InternalIt
StartIndex = query.StartIndex,
UserId = query.User.Id.ToString("N")

}, new List<BaseItem> { parent }, query.DtoOptions);
}, new [] { parent }, query.DtoOptions);

return ToResult(result);
}
Expand All @@ -1167,7 +1167,7 @@ private QueryResult<ServerItem> GetTvLatest(BaseItem parent, User user, Internal
ParentId = parent == null ? null : parent.Id.ToString("N"),
GroupItems = false

}, query.DtoOptions).Select(i => i.Item1 ?? i.Item2.FirstOrDefault()).Where(i => i != null).ToList();
}, query.DtoOptions).Select(i => i.Item1 ?? i.Item2.FirstOrDefault()).Where(i => i != null).ToArray();

return ToResult(items);
}
Expand All @@ -1184,7 +1184,7 @@ private QueryResult<ServerItem> GetMovieLatest(BaseItem parent, User user, Inter
ParentId = parent == null ? null : parent.Id.ToString("N"),
GroupItems = true

}, query.DtoOptions).Select(i => i.Item1 ?? i.Item2.FirstOrDefault()).Where(i => i != null).ToList();
}, query.DtoOptions).Select(i => i.Item1 ?? i.Item2.FirstOrDefault()).Where(i => i != null).ToArray();

return ToResult(items);
}
Expand Down Expand Up @@ -1249,15 +1249,15 @@ private QueryResult<ServerItem> GetMusicGenreItems(BaseItem item, Guid? parentId
return ToResult(result);
}

private QueryResult<ServerItem> ToResult(List<BaseItem> result)
private QueryResult<ServerItem> ToResult(BaseItem[] result)
{
var serverItems = result
.Select(i => new ServerItem(i))
.ToArray(result.Count);
.ToArray(result.Length);

return new QueryResult<ServerItem>
{
TotalRecordCount = result.Count,
TotalRecordCount = result.Length,
Items = serverItems
};
}
Expand Down
4 changes: 1 addition & 3 deletions Emby.Dlna/ContentDirectory/ServiceActionListBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class ServiceActionListBuilder
{
public IEnumerable<ServiceAction> GetActions()
{
var list = new List<ServiceAction>
return new []
{
GetSearchCapabilitiesAction(),
GetSortCapabilitiesAction(),
Expand All @@ -18,8 +18,6 @@ public IEnumerable<ServiceAction> GetActions()
GetXSetBookmarkAction(),
GetBrowseByLetterAction()
};

return list;
}

private ServiceAction GetGetSystemUpdateIDAction()
Expand Down
2 changes: 1 addition & 1 deletion Emby.Dlna/Main/DlnaEntryPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ private async Task RegisterServerEndpoints()
SetProperies(device, fullService);
_Publisher.AddDevice(device);

var embeddedDevices = new List<string>
var embeddedDevices = new []
{
"urn:schemas-upnp-org:service:ContentDirectory:1",
"urn:schemas-upnp-org:service:ConnectionManager:1",
Expand Down
4 changes: 1 addition & 3 deletions Emby.Dlna/MediaReceiverRegistrar/ServiceActionListBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class ServiceActionListBuilder
{
public IEnumerable<ServiceAction> GetActions()
{
var list = new List<ServiceAction>
return new []
{
GetIsValidated(),
GetIsAuthorized(),
Expand All @@ -17,8 +17,6 @@ public IEnumerable<ServiceAction> GetActions()
GetGetValidationRevokedUpdateID(),
GetGetValidationSucceededUpdateID()
};

return list;
}

private ServiceAction GetIsValidated()
Expand Down
2 changes: 1 addition & 1 deletion Emby.Dlna/PlayTo/Device.cs
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ private Task SetPlay(TransportCommands avCommands, CancellationToken cancellatio
{
var command = avCommands.ServiceActions.FirstOrDefault(c => c.Name == "Play");
if (command == null)
return Task.FromResult(true);
return Task.CompletedTask;

var service = GetAvTransportService();

Expand Down
2 changes: 1 addition & 1 deletion Emby.Dlna/PlayTo/TransportCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ private static StateVariable FromXml(XElement container)
{
Name = container.GetValue(uPnpNamespaces.svc + "name"),
DataType = container.GetValue(uPnpNamespaces.svc + "dataType"),
AllowedValues = allowedValues
AllowedValues = allowedValues.ToArray()
};
}

Expand Down
2 changes: 1 addition & 1 deletion Emby.Dlna/Service/ServiceXmlBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private void AppendServiceStateTable(StringBuilder builder, IEnumerable<StateVar
builder.Append("<name>" + DescriptionXmlBuilder.Escape(item.Name ?? string.Empty) + "</name>");
builder.Append("<dataType>" + DescriptionXmlBuilder.Escape(item.DataType ?? string.Empty) + "</dataType>");

if (item.AllowedValues.Count > 0)
if (item.AllowedValues.Length > 0)
{
builder.Append("<allowedValueList>");
foreach (var allowedValue in item.AllowedValues)
Expand Down
25 changes: 15 additions & 10 deletions Emby.Drawing/ImageProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public async Task<Tuple<string, string, DateTime>> ProcessImage(ImageProcessingO
dateModified = supportedImageInfo.Item2;
var requiresTransparency = TransparentImageTypes.Contains(Path.GetExtension(originalImagePath) ?? string.Empty);

if (options.Enhancers.Count > 0)
if (options.Enhancers.Length > 0)
{
if (item == null)
{
Expand Down Expand Up @@ -541,7 +541,7 @@ public string GetImageCacheTag(BaseItem item, ItemImageInfo image)
/// <param name="imageEnhancers">The image enhancers.</param>
/// <returns>Guid.</returns>
/// <exception cref="System.ArgumentNullException">item</exception>
public string GetImageCacheTag(BaseItem item, ItemImageInfo image, List<IImageEnhancer> imageEnhancers)
public string GetImageCacheTag(BaseItem item, ItemImageInfo image, IImageEnhancer[] imageEnhancers)
{
if (item == null)
{
Expand All @@ -563,7 +563,7 @@ public string GetImageCacheTag(BaseItem item, ItemImageInfo image, List<IImageEn
var imageType = image.Type;

// Optimization
if (imageEnhancers.Count == 0)
if (imageEnhancers.Length == 0)
{
return (originalImagePath + dateModified.Ticks).GetMD5().ToString("N");
}
Expand Down Expand Up @@ -642,7 +642,7 @@ private async Task<Tuple<string, DateTime, bool>> GetEnhancedImage(ItemImageInfo
bool inputImageSupportsTransparency,
BaseItem item,
int imageIndex,
List<IImageEnhancer> enhancers,
IImageEnhancer[] enhancers,
CancellationToken cancellationToken)
{
var originalImagePath = image.Path;
Expand Down Expand Up @@ -693,7 +693,7 @@ private async Task<Tuple<string, bool>> GetEnhancedImageInternal(string original
BaseItem item,
ImageType imageType,
int imageIndex,
List<IImageEnhancer> supportedEnhancers,
IImageEnhancer[] supportedEnhancers,
string cacheGuid,
CancellationToken cancellationToken)
{
Expand All @@ -717,8 +717,8 @@ private async Task<Tuple<string, bool>> GetEnhancedImageInternal(string original
}

// All enhanced images are saved as png to allow transparency
var cacheExtension = _imageEncoder.SupportedOutputFormats.Contains(ImageFormat.Webp) ?
".webp" :
var cacheExtension = _imageEncoder.SupportedOutputFormats.Contains(ImageFormat.Webp) ?
".webp" :
(treatmentRequiresTransparency ? ".png" : ".jpg");

var enhancedImagePath = GetCachePath(EnhancedImageCachePath, cacheGuid + cacheExtension);
Expand Down Expand Up @@ -842,16 +842,20 @@ public void CreateImageCollage(ImageCollageOptions options)
_logger.Info("Completed creation of image collage and saved to {0}", options.OutputPath);
}

public List<IImageEnhancer> GetSupportedEnhancers(BaseItem item, ImageType imageType)
public IImageEnhancer[] GetSupportedEnhancers(BaseItem item, ImageType imageType)
{
var list = new List<IImageEnhancer>();
List<IImageEnhancer> list = null;

foreach (var i in ImageEnhancers)
{
try
{
if (i.Supports(item, imageType))
{
if (list == null)
{
list = new List<IImageEnhancer>();
}
list.Add(i);
}
}
Expand All @@ -860,7 +864,8 @@ public List<IImageEnhancer> GetSupportedEnhancers(BaseItem item, ImageType image
_logger.ErrorException("Error in image enhancer: {0}", ex, i.GetType().Name);
}
}
return list;

return list == null ? new IImageEnhancer[] { } : list.ToArray();
}

private Dictionary<string, LockInfo> _locks = new Dictionary<string, LockInfo>();
Expand Down
4 changes: 1 addition & 3 deletions Emby.Server.Implementations/ApplicationHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1552,9 +1552,7 @@ protected List<Tuple<Type, string>> GetTypes(Tuple<Assembly, string> assemblyInf

private IEnumerable<string> GetUrlPrefixes()
{
var hosts = new List<string>();

hosts.Add("+");
var hosts = new[] { "+" };

return hosts.SelectMany(i =>
{
Expand Down
2 changes: 1 addition & 1 deletion Emby.Server.Implementations/Channels/ChannelManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1065,7 +1065,7 @@ private BaseItem GetChannelItemEntity(ChannelItemInfo info, IChannel channelProv
_logger.Debug("Forcing update due to TrailerTypes {0}", item.Name);
forceUpdate = true;
}
trailer.TrailerTypes = info.TrailerTypes;
trailer.TrailerTypes = info.TrailerTypes.ToArray();
}

if (info.DateModified > item.DateModified)
Expand Down
22 changes: 2 additions & 20 deletions Emby.Server.Implementations/Data/SqliteItemRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,7 @@ private void SaveItem(BaseItem item, BaseItem topParent, string userDataKey, ISt
}

var trailer = item as Trailer;
if (trailer != null && trailer.TrailerTypes.Count > 0)
if (trailer != null && trailer.TrailerTypes.Length > 0)
{
saveItemStatement.TryBind("@TrailerTypes", string.Join("|", trailer.TrailerTypes.Select(i => i.ToString()).ToArray()));
}
Expand Down Expand Up @@ -1748,7 +1748,7 @@ private BaseItem GetItem(IReadOnlyList<IResultSetValue> reader, InternalItemsQue
}
return (TrailerType?)null;

}).Where(i => i.HasValue).Select(i => i.Value).ToList();
}).Where(i => i.HasValue).Select(i => i.Value).ToArray();
}
}
index++;
Expand Down Expand Up @@ -2017,24 +2017,6 @@ private Guid[] SplitToGuids(string value)
return result;
}

/// <summary>
/// Gets the critic reviews.
/// </summary>
/// <param name="itemId">The item id.</param>
public List<ItemReview> GetCriticReviews(Guid itemId)
{
return new List<ItemReview>();
}

/// <summary>
/// Saves the critic reviews.
/// </summary>
/// <param name="itemId">The item id.</param>
/// <param name="criticReviews">The critic reviews.</param>
public void SaveCriticReviews(Guid itemId, IEnumerable<ItemReview> criticReviews)
{
}

/// <summary>
/// Gets chapters for an item
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion Emby.Server.Implementations/Devices/DeviceManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ public class DevicesConfigStore : IConfigurationFactory
{
public IEnumerable<ConfigurationStore> GetConfigurations()
{
return new List<ConfigurationStore>
return new ConfigurationStore[]
{
new ConfigurationStore
{
Expand Down
6 changes: 3 additions & 3 deletions Emby.Server.Implementations/Dto/DtoService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ private BaseItemDto GetBaseItemDtoInternal(BaseItem item, DtoOptions options, Li
{
if (fields.Contains(ItemFields.MediaSources))
{
dto.MediaSources = _mediaSourceManager().GetStaticMediaSources(item, true, user);
dto.MediaSources = _mediaSourceManager().GetStaticMediaSources(item, true, user).ToArray();

NormalizeMediaSourceContainers(dto);
}
Expand Down Expand Up @@ -1190,7 +1190,7 @@ private void AttachBasicFields(BaseItemDto dto, BaseItem item, BaseItem owner, D
{
MediaStream[] mediaStreams;

if (dto.MediaSources != null && dto.MediaSources.Count > 0)
if (dto.MediaSources != null && dto.MediaSources.Length > 0)
{
if (item.SourceType == SourceType.Channel)
{
Expand Down Expand Up @@ -1515,7 +1515,7 @@ public void AttachPrimaryImageAspectRatio(IItemDto dto, BaseItem item)

if (defaultAspectRatio.HasValue)
{
if (supportedEnhancers.Count == 0)
if (supportedEnhancers.Length == 0)
{
return defaultAspectRatio.Value;
}
Expand Down
2 changes: 1 addition & 1 deletion Emby.Server.Implementations/Library/LibraryManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2596,7 +2596,7 @@ public IEnumerable<Video> FindTrailers(BaseItem owner, List<FileSystemMetadata>
// item is new
video.ExtraType = ExtraType.Trailer;
}
video.TrailerTypes = new List<TrailerType> { TrailerType.LocalTrailer };
video.TrailerTypes = new [] { TrailerType.LocalTrailer };

return video;

Expand Down
Loading

0 comments on commit 5888e02

Please sign in to comment.