Skip to content

Commit e40f623

Browse files
update translations
1 parent 1d4af0e commit e40f623

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1276
-212
lines changed

MediaBrowser.Common.Implementations/Updates/InstallationManager.cs

+17-7
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ private void OnPluginUninstalled(IPlugin plugin)
6868
/// <param name="newVersion">The new version.</param>
6969
private void OnPluginUpdated(IPlugin plugin, PackageVersionInfo newVersion)
7070
{
71-
_logger.Info("Plugin updated: {0} {1} {2}", newVersion.name, newVersion.version, newVersion.classification);
71+
_logger.Info("Plugin updated: {0} {1} {2}", newVersion.name, newVersion.versionStr ?? string.Empty, newVersion.classification);
7272

7373
EventHelper.FireEventIfNotNull(PluginUpdated, this, new GenericEventArgs<Tuple<IPlugin, PackageVersionInfo>> { Argument = new Tuple<IPlugin, PackageVersionInfo>(plugin, newVersion) }, _logger);
7474

@@ -87,7 +87,7 @@ private void OnPluginUpdated(IPlugin plugin, PackageVersionInfo newVersion)
8787
/// <param name="package">The package.</param>
8888
private void OnPluginInstalled(PackageVersionInfo package)
8989
{
90-
_logger.Info("New plugin installed: {0} {1} {2}", package.name, package.version, package.classification);
90+
_logger.Info("New plugin installed: {0} {1} {2}", package.name, package.versionStr ?? string.Empty, package.classification);
9191

9292
EventHelper.FireEventIfNotNull(PluginInstalled, this, new GenericEventArgs<PackageVersionInfo> { Argument = package }, _logger);
9393

@@ -133,6 +133,16 @@ public InstallationManager(ILogger logger, IApplicationHost appHost, IApplicatio
133133
_logger = logger;
134134
}
135135

136+
private Version GetPackageVersion(PackageVersionInfo version)
137+
{
138+
return new Version(ValueOrDefault(version.versionStr, "0.0.0.1"));
139+
}
140+
141+
private static string ValueOrDefault(string str, string def)
142+
{
143+
return string.IsNullOrEmpty(str) ? def : str;
144+
}
145+
136146
/// <summary>
137147
/// Gets all available packages.
138148
/// </summary>
@@ -197,7 +207,7 @@ protected IEnumerable<PackageInfo> FilterPackages(List<PackageInfo> packages)
197207
foreach (var package in packages)
198208
{
199209
package.versions = package.versions.Where(v => !string.IsNullOrWhiteSpace(v.sourceUrl))
200-
.OrderByDescending(v => v.version).ToList();
210+
.OrderByDescending(GetPackageVersion).ToList();
201211
}
202212

203213
// Remove packages with no versions
@@ -211,7 +221,7 @@ protected IEnumerable<PackageInfo> FilterPackages(List<PackageInfo> packages, Pa
211221
foreach (var package in packages)
212222
{
213223
package.versions = package.versions.Where(v => !string.IsNullOrWhiteSpace(v.sourceUrl))
214-
.OrderByDescending(v => v.version).ToList();
224+
.OrderByDescending(GetPackageVersion).ToList();
215225
}
216226

217227
if (packageType.HasValue)
@@ -272,7 +282,7 @@ public async Task<PackageVersionInfo> GetPackage(string name, string guid, Packa
272282
return null;
273283
}
274284

275-
return package.versions.FirstOrDefault(v => v.version.Equals(version) && v.classification == classification);
285+
return package.versions.FirstOrDefault(v => GetPackageVersion(v).Equals(version) && v.classification == classification);
276286
}
277287

278288
/// <summary>
@@ -309,7 +319,7 @@ public PackageVersionInfo GetLatestCompatibleVersion(IEnumerable<PackageInfo> av
309319
}
310320

311321
return package.versions
312-
.OrderByDescending(v => v.version)
322+
.OrderByDescending(GetPackageVersion)
313323
.FirstOrDefault(v => v.classification <= classification && IsPackageVersionUpToDate(v, currentServerVersion));
314324
}
315325

@@ -338,7 +348,7 @@ public async Task<IEnumerable<PackageVersionInfo>> GetAvailablePluginUpdates(Ver
338348
{
339349
var latestPluginInfo = GetLatestCompatibleVersion(catalog, p.Name, p.Id.ToString(), applicationVersion, _config.CommonConfiguration.SystemUpdateLevel);
340350

341-
return latestPluginInfo != null && latestPluginInfo.version != null && latestPluginInfo.version > p.Version ? latestPluginInfo : null;
351+
return latestPluginInfo != null && GetPackageVersion(latestPluginInfo) > p.Version ? latestPluginInfo : null;
342352

343353
}).Where(i => i != null).ToList();
344354

MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs

+1
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ public AlbumInfo GetLookupInfo()
194194
}
195195
}
196196

197+
[Obsolete]
197198
public class MusicAlbumDisc : Folder
198199
{
199200

MediaBrowser.Model/Dlna/Filter.cs MediaBrowser.Dlna/Didl/Filter.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
using MediaBrowser.Model.Extensions;
22
using System;
33
using System.Collections.Generic;
4+
using System.Linq;
45

5-
namespace MediaBrowser.Model.Dlna
6+
namespace MediaBrowser.Dlna.Didl
67
{
78
public class Filter
89
{
@@ -19,9 +20,8 @@ public Filter(string filter)
1920
{
2021
_all = StringHelper.EqualsIgnoreCase(filter, "*");
2122

22-
List<string> list = new List<string>();
23-
foreach (string s in (filter ?? string.Empty).Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries))
24-
list.Add(s);
23+
var list = (filter ?? string.Empty).Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries).ToList();
24+
2525
_fields = list;
2626
}
2727

MediaBrowser.Model/Dlna/EventSubscription.cs MediaBrowser.Dlna/Eventing/EventSubscription.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System;
22

3-
namespace MediaBrowser.Model.Dlna
3+
namespace MediaBrowser.Dlna.Eventing
44
{
55
public class EventSubscription
66
{

MediaBrowser.Dlna/MediaBrowser.Dlna.csproj

+2
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,11 @@
5656
<Compile Include="ConnectionManager\ConnectionManagerXmlBuilder.cs" />
5757
<Compile Include="ConnectionManager\ControlHandler.cs" />
5858
<Compile Include="ConnectionManager\ServiceActionListBuilder.cs" />
59+
<Compile Include="Didl\Filter.cs" />
5960
<Compile Include="DlnaManager.cs" />
6061
<Compile Include="Common\Argument.cs" />
6162
<Compile Include="Eventing\EventManager.cs" />
63+
<Compile Include="Eventing\EventSubscription.cs" />
6264
<Compile Include="Main\DlnaEntryPoint.cs" />
6365
<Compile Include="PlayTo\CurrentIdEventArgs.cs" />
6466
<Compile Include="PlayTo\Device.cs">

MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj

+3-6
Original file line numberDiff line numberDiff line change
@@ -212,12 +212,6 @@
212212
<Compile Include="..\MediaBrowser.Model\Dlna\DlnaProfileType.cs">
213213
<Link>Dlna\DlnaProfileType.cs</Link>
214214
</Compile>
215-
<Compile Include="..\MediaBrowser.Model\Dlna\EventSubscription.cs">
216-
<Link>Dlna\EventSubscription.cs</Link>
217-
</Compile>
218-
<Compile Include="..\MediaBrowser.Model\Dlna\Filter.cs">
219-
<Link>Dlna\Filter.cs</Link>
220-
</Compile>
221215
<Compile Include="..\MediaBrowser.Model\Dlna\HeaderMatchType.cs">
222216
<Link>Dlna\HeaderMatchType.cs</Link>
223217
</Compile>
@@ -443,6 +437,9 @@
443437
<Compile Include="..\MediaBrowser.Model\Extensions\DoubleHelper.cs">
444438
<Link>Extensions\DoubleHelper.cs</Link>
445439
</Compile>
440+
<Compile Include="..\MediaBrowser.Model\Extensions\IHasPropertyChangedEvent.cs">
441+
<Link>Extensions\IHasPropertyChangedEvent.cs</Link>
442+
</Compile>
446443
<Compile Include="..\MediaBrowser.Model\Extensions\IntHelper.cs">
447444
<Link>Extensions\IntHelper.cs</Link>
448445
</Compile>

MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj

+3-6
Original file line numberDiff line numberDiff line change
@@ -199,12 +199,6 @@
199199
<Compile Include="..\MediaBrowser.Model\Dlna\DlnaProfileType.cs">
200200
<Link>Dlna\DlnaProfileType.cs</Link>
201201
</Compile>
202-
<Compile Include="..\MediaBrowser.Model\Dlna\EventSubscription.cs">
203-
<Link>Dlna\EventSubscription.cs</Link>
204-
</Compile>
205-
<Compile Include="..\MediaBrowser.Model\Dlna\Filter.cs">
206-
<Link>Dlna\Filter.cs</Link>
207-
</Compile>
208202
<Compile Include="..\MediaBrowser.Model\Dlna\HeaderMatchType.cs">
209203
<Link>Dlna\HeaderMatchType.cs</Link>
210204
</Compile>
@@ -430,6 +424,9 @@
430424
<Compile Include="..\MediaBrowser.Model\Extensions\DoubleHelper.cs">
431425
<Link>Extensions\DoubleHelper.cs</Link>
432426
</Compile>
427+
<Compile Include="..\MediaBrowser.Model\Extensions\IHasPropertyChangedEvent.cs">
428+
<Link>Extensions\IHasPropertyChangedEvent.cs</Link>
429+
</Compile>
433430
<Compile Include="..\MediaBrowser.Model\Extensions\IntHelper.cs">
434431
<Link>Extensions\IntHelper.cs</Link>
435432
</Compile>

MediaBrowser.Model/Configuration/ServerConfiguration.cs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using MediaBrowser.Model.Weather;
22
using System;
3-
using System.Collections.Generic;
43

54
namespace MediaBrowser.Model.Configuration
65
{
@@ -275,14 +274,13 @@ public ServerConfiguration()
275274

276275
UICulture = "en-us";
277276

278-
MetadataOptions = new List<MetadataOptions>
277+
MetadataOptions = new[]
279278
{
280279
new MetadataOptions(1, 1280) {ItemType = "Book"},
281280
new MetadataOptions(1, 1280) {ItemType = "MusicAlbum"},
282281
new MetadataOptions(1, 1280) {ItemType = "MusicArtist"},
283282
new MetadataOptions(0, 1280) {ItemType = "Season"}
284-
285-
}.ToArray();
283+
};
286284

287285
NotificationOptions = new NotificationOptions();
288286

MediaBrowser.Model/Dlna/ConditionProcessor.cs

+29
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,35 @@ private bool IsConditionSatisfied(ProfileCondition condition, bool? currentValue
175175

176176
return false;
177177
}
178+
179+
private bool IsConditionSatisfied(ProfileCondition condition, float? currentValue)
180+
{
181+
if (!currentValue.HasValue)
182+
{
183+
// If the value is unknown, it satisfies if not marked as required
184+
return !condition.IsRequired;
185+
}
186+
187+
float expected;
188+
if (FloatHelper.TryParseCultureInvariant(condition.Value, out expected))
189+
{
190+
switch (condition.Condition)
191+
{
192+
case ProfileConditionType.Equals:
193+
return currentValue.Value.Equals(expected);
194+
case ProfileConditionType.GreaterThanEqual:
195+
return currentValue.Value >= expected;
196+
case ProfileConditionType.LessThanEqual:
197+
return currentValue.Value <= expected;
198+
case ProfileConditionType.NotEquals:
199+
return !currentValue.Value.Equals(expected);
200+
default:
201+
throw new InvalidOperationException("Unexpected ProfileConditionType");
202+
}
203+
}
204+
205+
return false;
206+
}
178207

179208
private bool IsConditionSatisfied(ProfileCondition condition, double? currentValue)
180209
{

MediaBrowser.Model/Dto/BaseItemDto.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace MediaBrowser.Model.Dto
1515
/// This holds information about a BaseItem in a format that is convenient for the client.
1616
/// </summary>
1717
[DebuggerDisplay("Name = {Name}, ID = {Id}, Type = {Type}")]
18-
public class BaseItemDto : IHasProviderIds, INotifyPropertyChanged, IItemDto
18+
public class BaseItemDto : IHasProviderIds, IHasPropertyChangedEvent, IItemDto
1919
{
2020
/// <summary>
2121
/// Gets or sets the name.
@@ -844,7 +844,7 @@ public bool HasMenuImage
844844
[IgnoreDataMember]
845845
public bool IsVideo
846846
{
847-
get { return StringHelper.EqualsIgnoreCase(MediaType, Entities.MediaType.Video); }
847+
get { return StringHelper.EqualsIgnoreCase(MediaType, MediaBrowser.Model.Entities.MediaType.Video); }
848848
}
849849

850850
/// <summary>
@@ -854,7 +854,7 @@ public bool IsVideo
854854
[IgnoreDataMember]
855855
public bool IsAudio
856856
{
857-
get { return StringHelper.EqualsIgnoreCase(MediaType, Entities.MediaType.Audio); }
857+
get { return StringHelper.EqualsIgnoreCase(MediaType, MediaBrowser.Model.Entities.MediaType.Audio); }
858858
}
859859

860860
/// <summary>
@@ -864,7 +864,7 @@ public bool IsAudio
864864
[IgnoreDataMember]
865865
public bool IsGame
866866
{
867-
get { return StringHelper.EqualsIgnoreCase(MediaType, Entities.MediaType.Game); }
867+
get { return StringHelper.EqualsIgnoreCase(MediaType, MediaBrowser.Model.Entities.MediaType.Game); }
868868
}
869869

870870
/// <summary>

MediaBrowser.Model/Dto/BaseItemPerson.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
using System.ComponentModel;
22
using System.Diagnostics;
33
using System.Runtime.Serialization;
4+
using MediaBrowser.Model.Extensions;
45

56
namespace MediaBrowser.Model.Dto
67
{
78
/// <summary>
89
/// This is used by the api to get information about a Person within a BaseItem
910
/// </summary>
1011
[DebuggerDisplay("Name = {Name}, Role = {Role}, Type = {Type}")]
11-
public class BaseItemPerson : INotifyPropertyChanged
12+
public class BaseItemPerson : IHasPropertyChangedEvent
1213
{
1314
/// <summary>
1415
/// Gets or sets the name.

MediaBrowser.Model/Dto/ChapterInfoDto.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
using System.ComponentModel;
22
using System.Diagnostics;
33
using System.Runtime.Serialization;
4+
using MediaBrowser.Model.Extensions;
45

56
namespace MediaBrowser.Model.Dto
67
{
78
/// <summary>
89
/// Class ChapterInfo
910
/// </summary>
1011
[DebuggerDisplay("Name = {Name}")]
11-
public class ChapterInfoDto : INotifyPropertyChanged
12+
public class ChapterInfoDto : IHasPropertyChangedEvent
1213
{
1314
/// <summary>
1415
/// Gets or sets the start position ticks.

MediaBrowser.Model/Dto/UserDto.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33
using System.ComponentModel;
44
using System.Diagnostics;
55
using System.Runtime.Serialization;
6+
using MediaBrowser.Model.Extensions;
67

78
namespace MediaBrowser.Model.Dto
89
{
910
/// <summary>
1011
/// Class UserDto
1112
/// </summary>
1213
[DebuggerDisplay("Name = {Name}, ID = {Id}, HasPassword = {HasPassword}")]
13-
public class UserDto : INotifyPropertyChanged, IItemDto
14+
public class UserDto : IHasPropertyChangedEvent, IItemDto
1415
{
1516
/// <summary>
1617
/// Gets or sets the name.

MediaBrowser.Model/Dto/UserItemDataDto.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
using System;
22
using System.ComponentModel;
3+
using MediaBrowser.Model.Extensions;
34

45
namespace MediaBrowser.Model.Dto
56
{
67
/// <summary>
78
/// Class UserItemDataDto
89
/// </summary>
9-
public class UserItemDataDto : INotifyPropertyChanged
10+
public class UserItemDataDto : IHasPropertyChangedEvent
1011
{
1112
/// <summary>
1213
/// Gets or sets the rating.

MediaBrowser.Model/Entities/DisplayPreferences.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
using System;
33
using System.Collections.Generic;
44
using System.ComponentModel;
5+
using MediaBrowser.Model.Extensions;
56

67
namespace MediaBrowser.Model.Entities
78
{
89
/// <summary>
910
/// Defines the display preferences for any item that supports them (usually Folders)
1011
/// </summary>
11-
public class DisplayPreferences : INotifyPropertyChanged
12+
public class DisplayPreferences : IHasPropertyChangedEvent
1213
{
1314
/// <summary>
1415
/// Occurs when [property changed].

MediaBrowser.Model/Entities/MediaStream.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public bool IsTextSubtitleStream
136136
{
137137
if (Type != MediaStreamType.Subtitle) return false;
138138

139-
var codec = Codec ?? string.Empty;
139+
string codec = Codec ?? string.Empty;
140140

141141
return StringHelper.IndexOfIgnoreCase(codec, "pgs") == -1 &&
142142
StringHelper.IndexOfIgnoreCase(codec, "dvd") == -1;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
using System.ComponentModel;
2+
3+
namespace MediaBrowser.Model.Extensions
4+
{
5+
public interface IHasPropertyChangedEvent : INotifyPropertyChanged
6+
{
7+
}
8+
}

MediaBrowser.Model/Extensions/ListHelper.cs

+10-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,16 @@ namespace MediaBrowser.Model.Extensions
66
{
77
public static class ListHelper
88
{
9-
public static bool ContainsIgnoreCase(IEnumerable<string> list, string value)
9+
public static bool ContainsIgnoreCase(List<string> list, string value)
10+
{
11+
if (value == null)
12+
{
13+
throw new ArgumentNullException("value");
14+
}
15+
16+
return list.Contains(value, StringComparer.OrdinalIgnoreCase);
17+
}
18+
public static bool ContainsIgnoreCase(string[] list, string value)
1019
{
1120
if (value == null)
1221
{

0 commit comments

Comments
 (0)