Skip to content

Commit c6a2844

Browse files
* exclude default.ext from photo libraries; use wmc naming conventions for recordings with dates in file names; Improve performance of grouping movies into collections
1 parent 66e4d9c commit c6a2844

File tree

26 files changed

+87
-119
lines changed

26 files changed

+87
-119
lines changed

Emby.Server.Implementations/ApplicationHost.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1936,7 +1936,7 @@ public bool EnableHttps
19361936
{
19371937
get
19381938
{
1939-
return SupportsHttps && (ServerConfigurationManager.Configuration.EnableHttps || ServerConfigurationManager.Configuration.RequireHttps);
1939+
return SupportsHttps && ServerConfigurationManager.Configuration.EnableHttps;
19401940
}
19411941
}
19421942

Emby.Server.Implementations/Collections/CollectionManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ public IEnumerable<BaseItem> CollapseItemsWithinBoxSets(IEnumerable<BaseItem> it
294294
var itemId = item.Id;
295295

296296
var currentBoxSets = allBoxsets
297-
.Where(i => i.GetLinkedChildren().Any(j => j.Id == itemId))
297+
.Where(i => i.ContainsLinkedChildByItemId(itemId))
298298
.ToList();
299299

300300
if (currentBoxSets.Count > 0)

Emby.Server.Implementations/Data/SqliteUserDataRepository.cs

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,6 @@ public void Initialize(ReaderWriterLockSlim writeLock, ManagedConnection managed
7878
AddColumn(db, "userdata", "AudioStreamIndex", "int", existingColumnNames);
7979
AddColumn(db, "userdata", "SubtitleStreamIndex", "int", existingColumnNames);
8080
}, TransactionMode);
81-
82-
try
83-
{
84-
ImportUserDataIfNeeded(connection);
85-
}
86-
catch (Exception ex)
87-
{
88-
Logger.ErrorException("Error in ImportUserDataIfNeeded", ex);
89-
}
9081
}
9182
}
9283

@@ -98,45 +89,6 @@ protected override bool EnableTempStoreMemory
9889
}
9990
}
10091

101-
private void ImportUserDataIfNeeded(ManagedConnection connection)
102-
{
103-
if (!_fileSystem.FileExists(_importFile))
104-
{
105-
return;
106-
}
107-
108-
var fileToImport = _importFile;
109-
var isImported = connection.Query("select IsUserDataImported from DataSettings").SelectScalarBool().FirstOrDefault();
110-
111-
if (isImported)
112-
{
113-
return;
114-
}
115-
116-
ImportUserData(connection, fileToImport);
117-
118-
connection.RunInTransaction(db =>
119-
{
120-
using (var statement = db.PrepareStatement("replace into DataSettings (IsUserDataImported) values (@IsUserDataImported)"))
121-
{
122-
statement.TryBind("@IsUserDataImported", true);
123-
statement.MoveNext();
124-
}
125-
}, TransactionMode);
126-
}
127-
128-
private void ImportUserData(ManagedConnection connection, string file)
129-
{
130-
SqliteExtensions.Attach(connection, file, "UserDataBackup");
131-
132-
var columns = "key, userId, rating, played, playCount, isFavorite, playbackPositionTicks, lastPlayedDate, AudioStreamIndex, SubtitleStreamIndex";
133-
134-
connection.RunInTransaction(db =>
135-
{
136-
db.Execute("REPLACE INTO userdata(" + columns + ") SELECT " + columns + " FROM UserDataBackup.userdata;");
137-
}, TransactionMode);
138-
}
139-
14092
/// <summary>
14193
/// Saves the user data.
14294
/// </summary>

Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ private string GetConfigIdentifier()
5656
values.Add(config.PublicPort.ToString(CultureInfo.InvariantCulture));
5757
values.Add(_appHost.HttpPort.ToString(CultureInfo.InvariantCulture));
5858
values.Add(_appHost.HttpsPort.ToString(CultureInfo.InvariantCulture));
59-
values.Add((config.EnableHttps || config.RequireHttps).ToString());
6059
values.Add(_appHost.EnableHttps.ToString());
6160
values.Add((config.EnableRemoteAccess).ToString());
6261

Emby.Server.Implementations/HttpServer/HttpListenerHost.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ private bool ValidateRequest(string remoteIp, bool isLocal)
466466

467467
private bool ValidateSsl(string remoteIp, string urlString)
468468
{
469-
if (_config.Configuration.RequireHttps && _appHost.EnableHttps)
469+
if (_config.Configuration.RequireHttps && _appHost.EnableHttps && !_config.Configuration.IsBehindProxy)
470470
{
471471
if (urlString.IndexOf("https://", StringComparison.OrdinalIgnoreCase) == -1)
472472
{

Emby.Server.Implementations/Library/Resolvers/PhotoResolver.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ internal static bool IsOwnedByResolvedMedia(ILibraryManager libraryManager, Libr
9494
"backdrop",
9595
"poster",
9696
"cover",
97-
"logo"
97+
"logo",
98+
"default"
9899
};
99100

100101
internal static bool IsImageFile(string path, IImageProcessor imageProcessor)

Emby.Server.Implementations/LiveTv/EmbyTV/RecordingHelper.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public static string GetRecordingName(TimerInfo info)
3030
}
3131
else
3232
{
33-
name += " " + DateTime.Now.ToString("yyyy-MM-dd");
33+
name += " " + GetDateString(info.StartDate);
3434
}
3535

3636
if (!string.IsNullOrWhiteSpace(info.EpisodeTitle))
@@ -50,10 +50,22 @@ public static string GetRecordingName(TimerInfo info)
5050
}
5151
else
5252
{
53-
name += " " + info.StartDate.ToString("yyyy-MM-dd");
53+
name += " " + GetDateString(info.StartDate);
5454
}
5555

5656
return name;
5757
}
58+
59+
private static string GetDateString(DateTime date)
60+
{
61+
return string.Format("{0}_{1}_{2}_{3}_{4}_{5}",
62+
date.Year.ToString("0000", CultureInfo.InvariantCulture),
63+
date.Month.ToString("00", CultureInfo.InvariantCulture),
64+
date.Day.ToString("00", CultureInfo.InvariantCulture),
65+
date.Hour.ToString("00", CultureInfo.InvariantCulture),
66+
date.Minute.ToString("00", CultureInfo.InvariantCulture),
67+
date.Second.ToString("00", CultureInfo.InvariantCulture)
68+
);
69+
}
5870
}
5971
}

Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ private ProgramInfo GetProgram(string channelId, ScheduleDirect.Program programI
295295
EpisodeTitle = episodeTitle,
296296
Audio = audioType,
297297
//IsNew = programInfo.@new ?? false,
298-
IsRepeat = programInfo.repeat,
298+
IsRepeat = programInfo.@new == null,
299299
IsSeries = string.Equals(details.entityType, "episode", StringComparison.OrdinalIgnoreCase),
300300
ImageUrl = details.primaryImage,
301301
ThumbImageUrl = details.thumbImage,

Emby.Server.Implementations/Session/FirebaseSessionController.cs

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,20 +71,27 @@ public async Task SendMessage<T>(string name, string messageId, T data, ISession
7171
return;
7272
}
7373

74+
foreach (var controller in allControllers)
75+
{
76+
// Don't send if there's an active web socket connection
77+
if ((controller is WebSocketController) && controller.IsSessionActive)
78+
{
79+
return;
80+
}
81+
}
82+
7483
var msg = new WebSocketMessage<T>
7584
{
7685
Data = data,
7786
MessageType = name,
78-
MessageId = messageId
87+
MessageId = messageId,
88+
ServerId = _appHost.SystemId
7989
};
8090

81-
var req = new FirebaseBody
91+
var req = new FirebaseBody<T>
8292
{
8393
to = _token,
84-
data = new FirebaseData
85-
{
86-
msgdata = _json.SerializeToString(data)
87-
}
94+
data = msg
8895
};
8996

9097
var byteArray = Encoding.UTF8.GetBytes(_json.SerializeToString(req));
@@ -116,13 +123,9 @@ public async Task SendMessage<T>(string name, string messageId, T data, ISession
116123
}
117124
}
118125

119-
internal class FirebaseBody
126+
internal class FirebaseBody<T>
120127
{
121128
public string to { get; set; }
122-
public FirebaseData data { get; set; }
123-
}
124-
internal class FirebaseData
125-
{
126-
public string msgdata { get; set; }
129+
public WebSocketMessage<T> data { get; set; }
127130
}
128131
}

Emby.Server.Implementations/Session/HttpSessionController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ private Task SendPlaystateCommand(PlaystateRequest command, string messageId, Ca
126126
return SendMessage(command.Command.ToString(), messageId, args, cancellationToken);
127127
}
128128

129-
private string[] _supportedMessages = new string[] { "LibraryChanged", "ServerRestarting", "ServerShuttingDown", "RestartRequired" };
129+
private string[] _supportedMessages = new string[] { };
130130
public Task SendMessage<T>(string name, string messageId, T data, ISessionController[] allControllers, CancellationToken cancellationToken)
131131
{
132132
if (!IsSessionActive)

MediaBrowser.Api/Images/ImageService.cs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -682,15 +682,8 @@ private ImageFormat[] GetClientSupportedFormats()
682682
formats.Add(ImageFormat.Webp);
683683
}
684684

685-
if (SupportsFormat(supportedFormats, acceptParam, "jpg", true))
686-
{
687-
formats.Add(ImageFormat.Jpg);
688-
}
689-
690-
if (SupportsFormat(supportedFormats, acceptParam, "png", true))
691-
{
692-
formats.Add(ImageFormat.Png);
693-
}
685+
formats.Add(ImageFormat.Jpg);
686+
formats.Add(ImageFormat.Png);
694687

695688
if (SupportsFormat(supportedFormats, acceptParam, "gif", true))
696689
{

MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,6 @@ protected BaseItemsRequest()
103103
[ApiMember(Name = "HasTvdbId", Description = "Optional filter by items that have a tvdb id or not.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]
104104
public bool? HasTvdbId { get; set; }
105105

106-
[ApiMember(Name = "IsInBoxSet", Description = "Optional filter by items that are in boxsets, or not.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]
107-
public bool? IsInBoxSet { get; set; }
108-
109106
public string ExcludeItemIds { get; set; }
110107

111108
public bool EnableTotalRecordCount { get; set; }

MediaBrowser.Api/UserLibrary/ItemsService.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,6 @@ private InternalItemsQuery GetItemsQuery(GetItems request, DtoOptions dtoOptions
272272
HasImdbId = request.HasImdbId,
273273
IsPlaceHolder = request.IsPlaceHolder,
274274
IsLocked = request.IsLocked,
275-
IsInBoxSet = request.IsInBoxSet,
276275
IsHD = request.IsHD,
277276
Is3D = request.Is3D,
278277
HasTvdbId = request.HasTvdbId,

MediaBrowser.Common/Net/HttpRequestOptions.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ public string UserAgent
106106
public bool EnableDefaultUserAgent { get; set; }
107107

108108
public bool AppendCharsetToMimeType { get; set; }
109+
public string DownloadFilePath { get; set; }
109110

110111
private string GetHeaderValue(string name)
111112
{

MediaBrowser.Controller/Entities/Folder.cs

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -818,12 +818,6 @@ private bool RequiresPostFiltering(InternalItemsQuery query)
818818
}
819819
}
820820

821-
if (query.IsInBoxSet.HasValue)
822-
{
823-
Logger.Debug("Query requires post-filtering due to IsInBoxSet");
824-
return true;
825-
}
826-
827821
// Filter by Video3DFormat
828822
if (query.Is3D.HasValue)
829823
{
@@ -1187,11 +1181,6 @@ private static bool AllowBoxSetCollapsing(InternalItemsQuery request)
11871181
return false;
11881182
}
11891183

1190-
if (request.IsInBoxSet.HasValue)
1191-
{
1192-
return false;
1193-
}
1194-
11951184
if (request.IsLocked.HasValue)
11961185
{
11971186
return false;
@@ -1458,6 +1447,26 @@ protected virtual bool FilterLinkedChildrenPerUser
14581447
}
14591448
}
14601449

1450+
public bool ContainsLinkedChildByItemId(Guid itemId)
1451+
{
1452+
var linkedChildren = LinkedChildren;
1453+
foreach (var i in linkedChildren)
1454+
{
1455+
if (i.ItemId.HasValue && i.ItemId.Value == itemId)
1456+
{
1457+
return true;
1458+
}
1459+
1460+
var child = GetLinkedChild(i);
1461+
1462+
if (child != null && child.Id == itemId)
1463+
{
1464+
return true;
1465+
}
1466+
}
1467+
return false;
1468+
}
1469+
14611470
public List<BaseItem> GetLinkedChildren(User user)
14621471
{
14631472
if (!FilterLinkedChildrenPerUser || user == null)

MediaBrowser.Controller/Entities/InternalItemsQuery.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ public class InternalItemsQuery
6060

6161
public bool? Is3D { get; set; }
6262
public bool? IsHD { get; set; }
63-
public bool? IsInBoxSet { get; set; }
6463
public bool? IsLocked { get; set; }
6564
public bool? IsPlaceHolder { get; set; }
6665

MediaBrowser.Controller/Entities/UserViewBuilder.cs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ private QueryResult<BaseItem> GetMovieFolders(Folder parent, User user, Internal
134134

135135
if (query.IncludeItemTypes.Length == 0)
136136
{
137-
query.IncludeItemTypes = new[] { typeof(Movie).Name, typeof(BoxSet).Name };
137+
query.IncludeItemTypes = new[] { typeof(Movie).Name };
138138
}
139139

140140
return parent.QueryRecursive(query);
@@ -563,15 +563,6 @@ public static bool Filter(BaseItem item, User user, InternalItemsQuery query, IU
563563
}
564564
}
565565

566-
if (query.IsInBoxSet.HasValue)
567-
{
568-
var val = query.IsInBoxSet.Value;
569-
if (item.GetParents().OfType<BoxSet>().Any() != val)
570-
{
571-
return false;
572-
}
573-
}
574-
575566
// Filter by Video3DFormat
576567
if (query.Is3D.HasValue)
577568
{

MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -668,18 +668,18 @@ public string GetVideoQualityParam(EncodingJobInfo state, string videoEncoder, E
668668
// h264 (h264_qsv)
669669
else if (string.Equals(videoEncoder, "h264_qsv", StringComparison.OrdinalIgnoreCase))
670670
{
671-
string[] valid_h264_qsv = new string [] {"veryslow", "slower", "slow", "medium", "fast", "faster", "veryfast" };
672-
673-
if(Array.IndexOf(valid_h264_qsv,encodingOptions.H264Preset.ToLower()) != -1)
674-
{
675-
param += "-preset " + encodingOptions.H264Preset;
676-
}
677-
else
678-
{
679-
param += "-preset 7";
680-
}
681-
682-
param += " -look_ahead 0";
671+
string[] valid_h264_qsv = new string[] { "veryslow", "slower", "slow", "medium", "fast", "faster", "veryfast" };
672+
673+
if (valid_h264_qsv.Contains(encodingOptions.H264Preset, StringComparer.OrdinalIgnoreCase))
674+
{
675+
param += "-preset " + encodingOptions.H264Preset;
676+
}
677+
else
678+
{
679+
param += "-preset 7";
680+
}
681+
682+
param += " -look_ahead 0";
683683

684684
}
685685

@@ -2460,4 +2460,4 @@ public string GetProgressiveAudioFullCommandLine(EncodingJobInfo state, Encoding
24602460
}
24612461

24622462
}
2463-
}
2463+
}

MediaBrowser.Model/Configuration/ServerConfiguration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ public ServerConfiguration()
214214
PublicHttpsPort = DefaultHttpsPort;
215215
HttpServerPortNumber = DefaultHttpPort;
216216
HttpsPortNumber = DefaultHttpsPort;
217-
EnableHttps = false;
217+
EnableHttps = true;
218218
EnableDashboardResponseCaching = true;
219219
EnableAnonymousUsageReporting = true;
220220
EnableCaseSensitiveItemIds = true;

MediaBrowser.Model/Net/WebSocketMessage.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public class WebSocketMessage<T>
1313
/// <value>The type of the message.</value>
1414
public string MessageType { get; set; }
1515
public string MessageId { get; set; }
16+
public string ServerId { get; set; }
1617
/// <summary>
1718
/// Gets or sets the data.
1819
/// </summary>

0 commit comments

Comments
 (0)