Minor improvements

This commit is contained in:
Bond_009 2021-02-13 00:39:18 +01:00
parent 76d66e0dee
commit 65bab55ca0
20 changed files with 78 additions and 77 deletions

View File

@ -990,7 +990,7 @@ namespace Emby.Dlna.PlayTo
var deviceProperties = new DeviceInfo() var deviceProperties = new DeviceInfo()
{ {
Name = string.Join(" ", friendlyNames), Name = string.Join(' ', friendlyNames),
BaseUrl = string.Format(CultureInfo.InvariantCulture, "http://{0}:{1}", url.Host, url.Port) BaseUrl = string.Format(CultureInfo.InvariantCulture, "http://{0}:{1}", url.Host, url.Port)
}; };

View File

@ -73,7 +73,7 @@ namespace Emby.Naming.AudioBook
var haveChaptersOrPages = stackFiles.Any(x => x.ChapterNumber != null || x.PartNumber != null); var haveChaptersOrPages = stackFiles.Any(x => x.ChapterNumber != null || x.PartNumber != null);
var groupedBy = stackFiles.GroupBy(file => new { file.ChapterNumber, file.PartNumber }); var groupedBy = stackFiles.GroupBy(file => new { file.ChapterNumber, file.PartNumber });
var nameWithReplacedDots = nameParserResult.Name.Replace(" ", "."); var nameWithReplacedDots = nameParserResult.Name.Replace(' ', '.');
foreach (var group in groupedBy) foreach (var group in groupedBy)
{ {

View File

@ -2,6 +2,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization; using System.Globalization;
using SQLitePCL.pretty; using SQLitePCL.pretty;
@ -59,7 +60,7 @@ namespace Emby.Server.Implementations.Data
connection.RunInTransaction(conn => connection.RunInTransaction(conn =>
{ {
conn.ExecuteAll(string.Join(";", queries)); conn.ExecuteAll(string.Join(';', queries));
}); });
} }
@ -142,11 +143,10 @@ namespace Emby.Server.Implementations.Data
return result[index].ReadGuidFromBlob(); return result[index].ReadGuidFromBlob();
} }
[Conditional("DEBUG")]
private static void CheckName(string name) private static void CheckName(string name)
{ {
#if DEBUG
throw new ArgumentException("Invalid param name: " + name, nameof(name)); throw new ArgumentException("Invalid param name: " + name, nameof(name));
#endif
} }
public static void TryBind(this IStatement statement, string name, double value) public static void TryBind(this IStatement statement, string name, double value)

View File

@ -687,7 +687,7 @@ namespace Emby.Server.Implementations.Data
if (item.Genres.Length > 0) if (item.Genres.Length > 0)
{ {
saveItemStatement.TryBind("@Genres", string.Join("|", item.Genres)); saveItemStatement.TryBind("@Genres", string.Join('|', item.Genres));
} }
else else
{ {
@ -749,7 +749,7 @@ namespace Emby.Server.Implementations.Data
if (item.LockedFields.Length > 0) if (item.LockedFields.Length > 0)
{ {
saveItemStatement.TryBind("@LockedFields", string.Join("|", item.LockedFields)); saveItemStatement.TryBind("@LockedFields", string.Join('|', item.LockedFields));
} }
else else
{ {
@ -758,7 +758,7 @@ namespace Emby.Server.Implementations.Data
if (item.Studios.Length > 0) if (item.Studios.Length > 0)
{ {
saveItemStatement.TryBind("@Studios", string.Join("|", item.Studios)); saveItemStatement.TryBind("@Studios", string.Join('|', item.Studios));
} }
else else
{ {
@ -785,7 +785,7 @@ namespace Emby.Server.Implementations.Data
if (item.Tags.Length > 0) if (item.Tags.Length > 0)
{ {
saveItemStatement.TryBind("@Tags", string.Join("|", item.Tags)); saveItemStatement.TryBind("@Tags", string.Join('|', item.Tags));
} }
else else
{ {
@ -807,7 +807,7 @@ namespace Emby.Server.Implementations.Data
if (item is Trailer trailer && trailer.TrailerTypes.Length > 0) if (item is Trailer trailer && trailer.TrailerTypes.Length > 0)
{ {
saveItemStatement.TryBind("@TrailerTypes", string.Join("|", trailer.TrailerTypes)); saveItemStatement.TryBind("@TrailerTypes", string.Join('|', trailer.TrailerTypes));
} }
else else
{ {
@ -902,7 +902,7 @@ namespace Emby.Server.Implementations.Data
if (item.ProductionLocations.Length > 0) if (item.ProductionLocations.Length > 0)
{ {
saveItemStatement.TryBind("@ProductionLocations", string.Join("|", item.ProductionLocations)); saveItemStatement.TryBind("@ProductionLocations", string.Join('|', item.ProductionLocations));
} }
else else
{ {
@ -911,7 +911,7 @@ namespace Emby.Server.Implementations.Data
if (item.ExtraIds.Length > 0) if (item.ExtraIds.Length > 0)
{ {
saveItemStatement.TryBind("@ExtraIds", string.Join("|", item.ExtraIds)); saveItemStatement.TryBind("@ExtraIds", string.Join('|', item.ExtraIds));
} }
else else
{ {
@ -931,7 +931,7 @@ namespace Emby.Server.Implementations.Data
string artists = null; string artists = null;
if (item is IHasArtist hasArtists && hasArtists.Artists.Count > 0) if (item is IHasArtist hasArtists && hasArtists.Artists.Count > 0)
{ {
artists = string.Join("|", hasArtists.Artists); artists = string.Join('|', hasArtists.Artists);
} }
saveItemStatement.TryBind("@Artists", artists); saveItemStatement.TryBind("@Artists", artists);
@ -940,7 +940,7 @@ namespace Emby.Server.Implementations.Data
if (item is IHasAlbumArtist hasAlbumArtists if (item is IHasAlbumArtist hasAlbumArtists
&& hasAlbumArtists.AlbumArtists.Count > 0) && hasAlbumArtists.AlbumArtists.Count > 0)
{ {
albumArtists = string.Join("|", hasAlbumArtists.AlbumArtists); albumArtists = string.Join('|', hasAlbumArtists.AlbumArtists);
} }
saveItemStatement.TryBind("@AlbumArtists", albumArtists); saveItemStatement.TryBind("@AlbumArtists", albumArtists);
@ -2549,7 +2549,7 @@ namespace Emby.Server.Implementations.Data
if (groups.Count > 0) if (groups.Count > 0)
{ {
return " Group by " + string.Join(",", groups); return " Group by " + string.Join(',', groups);
} }
return string.Empty; return string.Empty;
@ -2578,7 +2578,7 @@ namespace Emby.Server.Implementations.Data
} }
var commandText = "select " var commandText = "select "
+ string.Join(",", GetFinalColumnsToSelect(query, new[] { "count(distinct PresentationUniqueKey)" })) + string.Join(',', GetFinalColumnsToSelect(query, new[] { "count(distinct PresentationUniqueKey)" }))
+ GetFromText() + GetFromText()
+ GetJoinUserDataText(query); + GetJoinUserDataText(query);
@ -2630,7 +2630,7 @@ namespace Emby.Server.Implementations.Data
} }
var commandText = "select " var commandText = "select "
+ string.Join(",", GetFinalColumnsToSelect(query, _retriveItemColumns)) + string.Join(',', GetFinalColumnsToSelect(query, _retriveItemColumns))
+ GetFromText() + GetFromText()
+ GetJoinUserDataText(query); + GetJoinUserDataText(query);
@ -2880,7 +2880,7 @@ namespace Emby.Server.Implementations.Data
} }
var commandText = "select " var commandText = "select "
+ string.Join(",", GetFinalColumnsToSelect(query, _retriveItemColumns)) + string.Join(',', GetFinalColumnsToSelect(query, _retriveItemColumns))
+ GetFromText() + GetFromText()
+ GetJoinUserDataText(query); + GetJoinUserDataText(query);
@ -2923,15 +2923,15 @@ namespace Emby.Server.Implementations.Data
if (EnableGroupByPresentationUniqueKey(query)) if (EnableGroupByPresentationUniqueKey(query))
{ {
commandText += " select " + string.Join(",", GetFinalColumnsToSelect(query, new[] { "count (distinct PresentationUniqueKey)" })) + GetFromText(); commandText += " select " + string.Join(',', GetFinalColumnsToSelect(query, new[] { "count (distinct PresentationUniqueKey)" })) + GetFromText();
} }
else if (query.GroupBySeriesPresentationUniqueKey) else if (query.GroupBySeriesPresentationUniqueKey)
{ {
commandText += " select " + string.Join(",", GetFinalColumnsToSelect(query, new[] { "count (distinct SeriesPresentationUniqueKey)" })) + GetFromText(); commandText += " select " + string.Join(',', GetFinalColumnsToSelect(query, new[] { "count (distinct SeriesPresentationUniqueKey)" })) + GetFromText();
} }
else else
{ {
commandText += " select " + string.Join(",", GetFinalColumnsToSelect(query, new[] { "count (guid)" })) + GetFromText(); commandText += " select " + string.Join(',', GetFinalColumnsToSelect(query, new[] { "count (guid)" })) + GetFromText();
} }
commandText += GetJoinUserDataText(query) commandText += GetJoinUserDataText(query)
@ -3039,7 +3039,7 @@ namespace Emby.Server.Implementations.Data
return string.Empty; return string.Empty;
} }
return " ORDER BY " + string.Join(",", orderBy.Select(i => return " ORDER BY " + string.Join(',', orderBy.Select(i =>
{ {
var columnMap = MapOrderByField(i.Item1, query); var columnMap = MapOrderByField(i.Item1, query);
@ -3137,7 +3137,7 @@ namespace Emby.Server.Implementations.Data
var now = DateTime.UtcNow; var now = DateTime.UtcNow;
var commandText = "select " var commandText = "select "
+ string.Join(",", GetFinalColumnsToSelect(query, new[] { "guid" })) + string.Join(',', GetFinalColumnsToSelect(query, new[] { "guid" }))
+ GetFromText() + GetFromText()
+ GetJoinUserDataText(query); + GetJoinUserDataText(query);
@ -3203,7 +3203,7 @@ namespace Emby.Server.Implementations.Data
var now = DateTime.UtcNow; var now = DateTime.UtcNow;
var commandText = "select " + string.Join(",", GetFinalColumnsToSelect(query, new[] { "guid", "path" })) + GetFromText(); var commandText = "select " + string.Join(',', GetFinalColumnsToSelect(query, new[] { "guid", "path" })) + GetFromText();
var whereClauses = GetWhereClauses(query, null); var whereClauses = GetWhereClauses(query, null);
if (whereClauses.Count != 0) if (whereClauses.Count != 0)
@ -3284,7 +3284,7 @@ namespace Emby.Server.Implementations.Data
var now = DateTime.UtcNow; var now = DateTime.UtcNow;
var commandText = "select " var commandText = "select "
+ string.Join(",", GetFinalColumnsToSelect(query, new[] { "guid" })) + string.Join(',', GetFinalColumnsToSelect(query, new[] { "guid" }))
+ GetFromText() + GetFromText()
+ GetJoinUserDataText(query); + GetJoinUserDataText(query);
@ -3327,15 +3327,15 @@ namespace Emby.Server.Implementations.Data
if (EnableGroupByPresentationUniqueKey(query)) if (EnableGroupByPresentationUniqueKey(query))
{ {
commandText += " select " + string.Join(",", GetFinalColumnsToSelect(query, new[] { "count (distinct PresentationUniqueKey)" })) + GetFromText(); commandText += " select " + string.Join(',', GetFinalColumnsToSelect(query, new[] { "count (distinct PresentationUniqueKey)" })) + GetFromText();
} }
else if (query.GroupBySeriesPresentationUniqueKey) else if (query.GroupBySeriesPresentationUniqueKey)
{ {
commandText += " select " + string.Join(",", GetFinalColumnsToSelect(query, new[] { "count (distinct SeriesPresentationUniqueKey)" })) + GetFromText(); commandText += " select " + string.Join(',', GetFinalColumnsToSelect(query, new[] { "count (distinct SeriesPresentationUniqueKey)" })) + GetFromText();
} }
else else
{ {
commandText += " select " + string.Join(",", GetFinalColumnsToSelect(query, new[] { "count (guid)" })) + GetFromText(); commandText += " select " + string.Join(',', GetFinalColumnsToSelect(query, new[] { "count (guid)" })) + GetFromText();
} }
commandText += GetJoinUserDataText(query) commandText += GetJoinUserDataText(query)
@ -3596,7 +3596,7 @@ namespace Emby.Server.Implementations.Data
} }
else if (excludeTypes.Length > 1) else if (excludeTypes.Length > 1)
{ {
var inClause = string.Join(",", excludeTypes.Select(i => "'" + i + "'")); var inClause = string.Join(',', excludeTypes.Select(i => "'" + i + "'"));
whereClauses.Add($"type not in ({inClause})"); whereClauses.Add($"type not in ({inClause})");
} }
} }
@ -3607,7 +3607,7 @@ namespace Emby.Server.Implementations.Data
} }
else if (includeTypes.Length > 1) else if (includeTypes.Length > 1)
{ {
var inClause = string.Join(",", includeTypes.Select(i => "'" + i + "'")); var inClause = string.Join(',', includeTypes.Select(i => "'" + i + "'"));
whereClauses.Add($"type in ({inClause})"); whereClauses.Add($"type in ({inClause})");
} }
@ -3618,7 +3618,7 @@ namespace Emby.Server.Implementations.Data
} }
else if (query.ChannelIds.Count > 1) else if (query.ChannelIds.Count > 1)
{ {
var inClause = string.Join(",", query.ChannelIds.Select(i => "'" + i.ToString("N", CultureInfo.InvariantCulture) + "'")); var inClause = string.Join(',', query.ChannelIds.Select(i => "'" + i.ToString("N", CultureInfo.InvariantCulture) + "'"));
whereClauses.Add($"ChannelId in ({inClause})"); whereClauses.Add($"ChannelId in ({inClause})");
} }
@ -4351,7 +4351,7 @@ namespace Emby.Server.Implementations.Data
} }
else if (query.Years.Length > 1) else if (query.Years.Length > 1)
{ {
var val = string.Join(",", query.Years); var val = string.Join(',', query.Years);
whereClauses.Add("ProductionYear in (" + val + ")"); whereClauses.Add("ProductionYear in (" + val + ")");
} }
@ -4401,7 +4401,7 @@ namespace Emby.Server.Implementations.Data
} }
else if (queryMediaTypes.Length > 1) else if (queryMediaTypes.Length > 1)
{ {
var val = string.Join(",", queryMediaTypes.Select(i => "'" + i + "'")); var val = string.Join(',', queryMediaTypes.Select(i => "'" + i + "'"));
whereClauses.Add("MediaType in (" + val + ")"); whereClauses.Add("MediaType in (" + val + ")");
} }
@ -4498,7 +4498,7 @@ namespace Emby.Server.Implementations.Data
var paramName = "@HasAnyProviderId" + index; var paramName = "@HasAnyProviderId" + index;
// this is a search for the placeholder // this is a search for the placeholder
hasProviderIds.Add("ProviderIds like " + paramName + ""); hasProviderIds.Add("ProviderIds like " + paramName);
// this replaces the placeholder with a value, here: %key=val% // this replaces the placeholder with a value, here: %key=val%
if (statement != null) if (statement != null)
@ -4549,7 +4549,7 @@ namespace Emby.Server.Implementations.Data
} }
else if (enableItemsByName && includedItemByNameTypes.Count > 1) else if (enableItemsByName && includedItemByNameTypes.Count > 1)
{ {
var itemByNameTypeVal = string.Join(",", includedItemByNameTypes.Select(i => "'" + i + "'")); var itemByNameTypeVal = string.Join(',', includedItemByNameTypes.Select(i => "'" + i + "'"));
whereClauses.Add("(TopParentId=@TopParentId or Type in (" + itemByNameTypeVal + "))"); whereClauses.Add("(TopParentId=@TopParentId or Type in (" + itemByNameTypeVal + "))");
} }
else else
@ -4564,7 +4564,7 @@ namespace Emby.Server.Implementations.Data
} }
else if (queryTopParentIds.Length > 1) else if (queryTopParentIds.Length > 1)
{ {
var val = string.Join(",", queryTopParentIds.Select(i => "'" + i.ToString("N", CultureInfo.InvariantCulture) + "'")); var val = string.Join(',', queryTopParentIds.Select(i => "'" + i.ToString("N", CultureInfo.InvariantCulture) + "'"));
if (enableItemsByName && includedItemByNameTypes.Count == 1) if (enableItemsByName && includedItemByNameTypes.Count == 1)
{ {
@ -4576,7 +4576,7 @@ namespace Emby.Server.Implementations.Data
} }
else if (enableItemsByName && includedItemByNameTypes.Count > 1) else if (enableItemsByName && includedItemByNameTypes.Count > 1)
{ {
var itemByNameTypeVal = string.Join(",", includedItemByNameTypes.Select(i => "'" + i + "'")); var itemByNameTypeVal = string.Join(',', includedItemByNameTypes.Select(i => "'" + i + "'"));
whereClauses.Add("(Type in (" + itemByNameTypeVal + ") or TopParentId in (" + val + "))"); whereClauses.Add("(Type in (" + itemByNameTypeVal + ") or TopParentId in (" + val + "))");
} }
else else
@ -4597,7 +4597,7 @@ namespace Emby.Server.Implementations.Data
if (query.AncestorIds.Length > 1) if (query.AncestorIds.Length > 1)
{ {
var inClause = string.Join(",", query.AncestorIds.Select(i => "'" + i.ToString("N", CultureInfo.InvariantCulture) + "'")); var inClause = string.Join(',', query.AncestorIds.Select(i => "'" + i.ToString("N", CultureInfo.InvariantCulture) + "'"));
whereClauses.Add(string.Format(CultureInfo.InvariantCulture, "Guid in (select itemId from AncestorIds where AncestorIdText in ({0}))", inClause)); whereClauses.Add(string.Format(CultureInfo.InvariantCulture, "Guid in (select itemId from AncestorIds where AncestorIdText in ({0}))", inClause));
} }
@ -5148,7 +5148,7 @@ AND Type = @InternalPersonType)");
} }
else if (queryPersonTypes.Count > 1) else if (queryPersonTypes.Count > 1)
{ {
var val = string.Join(",", queryPersonTypes.Select(i => "'" + i + "'")); var val = string.Join(',', queryPersonTypes.Select(i => "'" + i + "'"));
whereClauses.Add("PersonType in (" + val + ")"); whereClauses.Add("PersonType in (" + val + ")");
} }
@ -5162,7 +5162,7 @@ AND Type = @InternalPersonType)");
} }
else if (queryExcludePersonTypes.Count > 1) else if (queryExcludePersonTypes.Count > 1)
{ {
var val = string.Join(",", queryExcludePersonTypes.Select(i => "'" + i + "'")); var val = string.Join(',', queryExcludePersonTypes.Select(i => "'" + i + "'"));
whereClauses.Add("PersonType not in (" + val + ")"); whereClauses.Add("PersonType not in (" + val + ")");
} }
@ -5308,19 +5308,19 @@ AND Type = @InternalPersonType)");
var typeClause = itemValueTypes.Length == 1 ? var typeClause = itemValueTypes.Length == 1 ?
("Type=" + itemValueTypes[0].ToString(CultureInfo.InvariantCulture)) : ("Type=" + itemValueTypes[0].ToString(CultureInfo.InvariantCulture)) :
("Type in (" + string.Join(",", itemValueTypes.Select(i => i.ToString(CultureInfo.InvariantCulture))) + ")"); ("Type in (" + string.Join(',', itemValueTypes.Select(i => i.ToString(CultureInfo.InvariantCulture))) + ")");
var commandText = "Select Value From ItemValues where " + typeClause; var commandText = "Select Value From ItemValues where " + typeClause;
if (withItemTypes.Count > 0) if (withItemTypes.Count > 0)
{ {
var typeString = string.Join(",", withItemTypes.Select(i => "'" + i + "'")); var typeString = string.Join(',', withItemTypes.Select(i => "'" + i + "'"));
commandText += " AND ItemId In (select guid from typedbaseitems where type in (" + typeString + "))"; commandText += " AND ItemId In (select guid from typedbaseitems where type in (" + typeString + "))";
} }
if (excludeItemTypes.Count > 0) if (excludeItemTypes.Count > 0)
{ {
var typeString = string.Join(",", excludeItemTypes.Select(i => "'" + i + "'")); var typeString = string.Join(',', excludeItemTypes.Select(i => "'" + i + "'"));
commandText += " AND ItemId not In (select guid from typedbaseitems where type in (" + typeString + "))"; commandText += " AND ItemId not In (select guid from typedbaseitems where type in (" + typeString + "))";
} }
@ -5363,7 +5363,7 @@ AND Type = @InternalPersonType)");
var typeClause = itemValueTypes.Length == 1 ? var typeClause = itemValueTypes.Length == 1 ?
("Type=" + itemValueTypes[0].ToString(CultureInfo.InvariantCulture)) : ("Type=" + itemValueTypes[0].ToString(CultureInfo.InvariantCulture)) :
("Type in (" + string.Join(",", itemValueTypes.Select(i => i.ToString(CultureInfo.InvariantCulture))) + ")"); ("Type in (" + string.Join(',', itemValueTypes.Select(i => i.ToString(CultureInfo.InvariantCulture))) + ")");
InternalItemsQuery typeSubQuery = null; InternalItemsQuery typeSubQuery = null;
@ -5427,7 +5427,7 @@ AND Type = @InternalPersonType)");
columns = GetFinalColumnsToSelect(query, columns); columns = GetFinalColumnsToSelect(query, columns);
var commandText = "select " var commandText = "select "
+ string.Join(",", columns) + string.Join(',', columns)
+ GetFromText() + GetFromText()
+ GetJoinUserDataText(query); + GetJoinUserDataText(query);
@ -5504,7 +5504,7 @@ AND Type = @InternalPersonType)");
if (query.EnableTotalRecordCount) if (query.EnableTotalRecordCount)
{ {
var countText = "select " var countText = "select "
+ string.Join(",", GetFinalColumnsToSelect(query, new[] { "count (distinct PresentationUniqueKey)" })) + string.Join(',', GetFinalColumnsToSelect(query, new[] { "count (distinct PresentationUniqueKey)" }))
+ GetFromText() + GetFromText()
+ GetJoinUserDataText(query) + GetJoinUserDataText(query)
+ whereText; + whereText;
@ -5565,7 +5565,7 @@ AND Type = @InternalPersonType)");
if (query.EnableTotalRecordCount) if (query.EnableTotalRecordCount)
{ {
commandText = "select " commandText = "select "
+ string.Join(",", GetFinalColumnsToSelect(query, new[] { "count (distinct PresentationUniqueKey)" })) + string.Join(',', GetFinalColumnsToSelect(query, new[] { "count (distinct PresentationUniqueKey)" }))
+ GetFromText() + GetFromText()
+ GetJoinUserDataText(query) + GetJoinUserDataText(query)
+ whereText; + whereText;

View File

@ -47,7 +47,7 @@ namespace Emby.Server.Implementations.Data
connection.RunInTransaction( connection.RunInTransaction(
db => db =>
{ {
db.ExecuteAll(string.Join(";", new[] { db.ExecuteAll(string.Join(';', new[] {
"create table if not exists UserDatas (key nvarchar not null, userId INT not null, rating float null, played bit not null, playCount int not null, isFavorite bit not null, playbackPositionTicks bigint not null, lastPlayedDate datetime null, AudioStreamIndex INT, SubtitleStreamIndex INT)", "create table if not exists UserDatas (key nvarchar not null, userId INT not null, rating float null, played bit not null, playCount int not null, isFavorite bit not null, playbackPositionTicks bigint not null, lastPlayedDate datetime null, AudioStreamIndex INT, SubtitleStreamIndex INT)",

View File

@ -35,8 +35,8 @@ namespace Emby.Server.Implementations.LiveTv.Listings
private readonly ICryptoProvider _cryptoProvider; private readonly ICryptoProvider _cryptoProvider;
private readonly ConcurrentDictionary<string, NameValuePair> _tokens = new ConcurrentDictionary<string, NameValuePair>(); private readonly ConcurrentDictionary<string, NameValuePair> _tokens = new ConcurrentDictionary<string, NameValuePair>();
private DateTime _lastErrorResponse;
private readonly JsonSerializerOptions _jsonOptions = JsonDefaults.GetOptions(); private readonly JsonSerializerOptions _jsonOptions = JsonDefaults.GetOptions();
private DateTime _lastErrorResponse;
public SchedulesDirect( public SchedulesDirect(
ILogger<SchedulesDirect> logger, ILogger<SchedulesDirect> logger,

View File

@ -155,7 +155,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
if (channelIdValues.Count > 0) if (channelIdValues.Count > 0)
{ {
channel.Id = string.Join("_", channelIdValues); channel.Id = string.Join('_', channelIdValues);
} }
return channel; return channel;

View File

@ -166,7 +166,7 @@ namespace Emby.Server.Implementations.MediaEncoder
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogError(ex, "Error extracting chapter images for {0}", string.Join(",", video.Path)); _logger.LogError(ex, "Error extracting chapter images for {0}", string.Join(',', video.Path));
success = false; success = false;
break; break;
} }

View File

@ -143,7 +143,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
Directory.CreateDirectory(parentPath); Directory.CreateDirectory(parentPath);
string text = string.Join("|", previouslyFailedImages); string text = string.Join('|', previouslyFailedImages);
File.WriteAllText(failHistoryPath, text); File.WriteAllText(failHistoryPath, text);
} }

View File

@ -223,7 +223,7 @@ namespace Jellyfin.Api.Controllers
DeInterlace = true, DeInterlace = true,
RequireNonAnamorphic = true, RequireNonAnamorphic = true,
EnableMpegtsM2TsMode = true, EnableMpegtsM2TsMode = true,
TranscodeReasons = mediaSource.TranscodeReasons == null ? null : string.Join(",", mediaSource.TranscodeReasons.Select(i => i.ToString()).ToArray()), TranscodeReasons = mediaSource.TranscodeReasons == null ? null : string.Join(',', mediaSource.TranscodeReasons.Select(i => i.ToString()).ToArray()),
Context = EncodingContext.Static, Context = EncodingContext.Static,
StreamOptions = new Dictionary<string, string>(), StreamOptions = new Dictionary<string, string>(),
EnableAdaptiveBitrateStreaming = true EnableAdaptiveBitrateStreaming = true
@ -254,7 +254,7 @@ namespace Jellyfin.Api.Controllers
CopyTimestamps = true, CopyTimestamps = true,
StartTimeTicks = startTimeTicks, StartTimeTicks = startTimeTicks,
SubtitleMethod = SubtitleDeliveryMethod.Embed, SubtitleMethod = SubtitleDeliveryMethod.Embed,
TranscodeReasons = mediaSource.TranscodeReasons == null ? null : string.Join(",", mediaSource.TranscodeReasons.Select(i => i.ToString()).ToArray()), TranscodeReasons = mediaSource.TranscodeReasons == null ? null : string.Join(',', mediaSource.TranscodeReasons.Select(i => i.ToString()).ToArray()),
Context = EncodingContext.Static Context = EncodingContext.Static
}; };

View File

@ -222,7 +222,7 @@ namespace Jellyfin.Api.Helpers
{ {
// Force HEVC Main Profile and disable video stream copy. // Force HEVC Main Profile and disable video stream copy.
state.OutputVideoCodec = "hevc"; state.OutputVideoCodec = "hevc";
var sdrVideoUrl = ReplaceProfile(playlistUrl, "hevc", string.Join(",", requestedVideoProfiles), "main"); var sdrVideoUrl = ReplaceProfile(playlistUrl, "hevc", string.Join(',', requestedVideoProfiles), "main");
sdrVideoUrl += "&AllowVideoStreamCopy=false"; sdrVideoUrl += "&AllowVideoStreamCopy=false";
EncodingHelper encodingHelper = new EncodingHelper(_mediaEncoder, _fileSystem, _subtitleEncoder, _configuration); EncodingHelper encodingHelper = new EncodingHelper(_mediaEncoder, _fileSystem, _subtitleEncoder, _configuration);

View File

@ -1243,7 +1243,7 @@ namespace MediaBrowser.Controller.Entities
} }
} }
return string.Join("/", terms.ToArray()); return string.Join('/', terms.ToArray());
} }
/// <summary> /// <summary>
@ -2795,7 +2795,7 @@ namespace MediaBrowser.Controller.Entities
{ {
var list = GetEtagValues(user); var list = GetEtagValues(user);
return string.Join("|", list).GetMD5().ToString("N", CultureInfo.InvariantCulture); return string.Join('|', list).GetMD5().ToString("N", CultureInfo.InvariantCulture);
} }
protected virtual List<string> GetEtagValues(User user) protected virtual List<string> GetEtagValues(User user)

View File

@ -107,7 +107,7 @@ namespace MediaBrowser.Controller.Entities.TV
return key; return key;
} }
return key + "-" + string.Join("-", folders); return key + "-" + string.Join('-', folders);
} }
private static string GetUniqueSeriesKey(BaseItem series) private static string GetUniqueSeriesKey(BaseItem series)

View File

@ -1381,7 +1381,8 @@ namespace MediaBrowser.Controller.MediaEncoding
var requestedProfile = requestedProfiles[0]; var requestedProfile = requestedProfiles[0];
// strip spaces because they may be stripped out on the query string as well // strip spaces because they may be stripped out on the query string as well
if (!string.IsNullOrEmpty(videoStream.Profile) && !requestedProfiles.Contains(videoStream.Profile.Replace(" ", ""), StringComparer.OrdinalIgnoreCase)) if (!string.IsNullOrEmpty(videoStream.Profile)
&& !requestedProfiles.Contains(videoStream.Profile.Replace(" ", "", StringComparison.Ordinal), StringComparer.OrdinalIgnoreCase))
{ {
var currentScore = GetVideoProfileScore(videoStream.Profile); var currentScore = GetVideoProfileScore(videoStream.Profile);
var requestedScore = GetVideoProfileScore(requestedProfile); var requestedScore = GetVideoProfileScore(requestedProfile);
@ -1710,7 +1711,7 @@ namespace MediaBrowser.Controller.MediaEncoding
if (filters.Count > 0) if (filters.Count > 0)
{ {
return " -af \"" + string.Join(",", filters) + "\""; return " -af \"" + string.Join(',', filters) + "\"";
} }
return string.Empty; return string.Empty;
@ -2888,7 +2889,7 @@ namespace MediaBrowser.Controller.MediaEncoding
output += string.Format( output += string.Format(
CultureInfo.InvariantCulture, CultureInfo.InvariantCulture,
"{0}", "{0}",
string.Join(",", filters)); string.Join(',', filters));
} }
return output; return output;
@ -3864,7 +3865,7 @@ namespace MediaBrowser.Controller.MediaEncoding
GetInputArgument(state, encodingOptions), GetInputArgument(state, encodingOptions),
threads, threads,
" -vn", " -vn",
string.Join(" ", audioTranscodeParams), string.Join(' ', audioTranscodeParams),
outputPath, outputPath,
string.Empty, string.Empty,
string.Empty, string.Empty,

View File

@ -214,7 +214,7 @@ namespace MediaBrowser.LocalMetadata.Savers
if (item.LockedFields.Length > 0) if (item.LockedFields.Length > 0)
{ {
writer.WriteElementString("LockedFields", string.Join("|", item.LockedFields)); writer.WriteElementString("LockedFields", string.Join('|', item.LockedFields));
} }
if (item.CriticRating.HasValue) if (item.CriticRating.HasValue)

View File

@ -1496,7 +1496,7 @@ namespace MediaBrowser.MediaEncoding.Probing
video.IndexNumber = int.Parse(numbers[0].Replace(".", string.Empty, StringComparison.Ordinal).Split('/')[0], CultureInfo.InvariantCulture); video.IndexNumber = int.Parse(numbers[0].Replace(".", string.Empty, StringComparison.Ordinal).Split('/')[0], CultureInfo.InvariantCulture);
int totalEpisodesInSeason = int.Parse(numbers[0].Replace(".", string.Empty, StringComparison.Ordinal).Split('/')[1], CultureInfo.InvariantCulture); int totalEpisodesInSeason = int.Parse(numbers[0].Replace(".", string.Empty, StringComparison.Ordinal).Split('/')[1], CultureInfo.InvariantCulture);
description = string.Join(" ", numbers, 1, numbers.Length - 1).Trim(); // Skip the first, concatenate the rest, clean up spaces and save it description = string.Join(' ', numbers, 1, numbers.Length - 1).Trim(); // Skip the first, concatenate the rest, clean up spaces and save it
} }
else else
{ {
@ -1508,7 +1508,7 @@ namespace MediaBrowser.MediaEncoding.Probing
if (subtitle.Contains('.', StringComparison.Ordinal)) if (subtitle.Contains('.', StringComparison.Ordinal))
{ {
// skip the comment, keep the subtitle // skip the comment, keep the subtitle
description = string.Join(".", subtitle.Split('.'), 1, subtitle.Split('.').Length - 1).Trim(); // skip the first description = string.Join('.', subtitle.Split('.'), 1, subtitle.Split('.').Length - 1).Trim(); // skip the first
} }
else else
{ {

View File

@ -1733,7 +1733,7 @@ namespace MediaBrowser.Model.Dlna
if (condition.Condition == ProfileConditionType.Equals || condition.Condition == ProfileConditionType.EqualsAny) if (condition.Condition == ProfileConditionType.Equals || condition.Condition == ProfileConditionType.EqualsAny)
{ {
item.SetOption(qualifier, "profile", string.Join(",", values)); item.SetOption(qualifier, "profile", string.Join(',', values));
} }
} }

View File

@ -193,12 +193,12 @@ namespace MediaBrowser.Model.Dlna
continue; continue;
} }
var encodedValue = pair.Value.Replace(" ", "%20"); var encodedValue = pair.Value.Replace(" ", "%20", StringComparison.Ordinal);
list.Add(string.Format(CultureInfo.InvariantCulture, "{0}={1}", pair.Name, encodedValue)); list.Add(string.Format(CultureInfo.InvariantCulture, "{0}={1}", pair.Name, encodedValue));
} }
string queryString = string.Join("&", list.ToArray()); string queryString = string.Join('&', list);
return GetUrl(baseUrl, queryString); return GetUrl(baseUrl, queryString);
} }
@ -238,11 +238,11 @@ namespace MediaBrowser.Model.Dlna
string audioCodecs = item.AudioCodecs.Length == 0 ? string audioCodecs = item.AudioCodecs.Length == 0 ?
string.Empty : string.Empty :
string.Join(",", item.AudioCodecs); string.Join(',', item.AudioCodecs);
string videoCodecs = item.VideoCodecs.Length == 0 ? string videoCodecs = item.VideoCodecs.Length == 0 ?
string.Empty : string.Empty :
string.Join(",", item.VideoCodecs); string.Join(',', item.VideoCodecs);
list.Add(new NameValuePair("DeviceProfileId", item.DeviceProfileId ?? string.Empty)); list.Add(new NameValuePair("DeviceProfileId", item.DeviceProfileId ?? string.Empty));
list.Add(new NameValuePair("DeviceId", item.DeviceId ?? string.Empty)); list.Add(new NameValuePair("DeviceId", item.DeviceId ?? string.Empty));
@ -322,7 +322,7 @@ namespace MediaBrowser.Model.Dlna
string subtitleCodecs = item.SubtitleCodecs.Length == 0 ? string subtitleCodecs = item.SubtitleCodecs.Length == 0 ?
string.Empty : string.Empty :
string.Join(",", item.SubtitleCodecs); string.Join(',', item.SubtitleCodecs);
list.Add(new NameValuePair("SubtitleCodec", item.SubtitleStreamIndex.HasValue && item.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Embed ? subtitleCodecs : string.Empty)); list.Add(new NameValuePair("SubtitleCodec", item.SubtitleStreamIndex.HasValue && item.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Embed ? subtitleCodecs : string.Empty));
@ -351,12 +351,12 @@ namespace MediaBrowser.Model.Dlna
} }
// strip spaces to avoid having to encode h264 profile names // strip spaces to avoid having to encode h264 profile names
list.Add(new NameValuePair(pair.Key, pair.Value.Replace(" ", ""))); list.Add(new NameValuePair(pair.Key, pair.Value.Replace(" ", string.Empty, StringComparison.Ordinal)));
} }
if (!item.IsDirectStream) if (!item.IsDirectStream)
{ {
list.Add(new NameValuePair("TranscodeReasons", string.Join(",", item.TranscodeReasons.Distinct().Select(i => i.ToString())))); list.Add(new NameValuePair("TranscodeReasons", string.Join(',', item.TranscodeReasons.Distinct().Select(i => i.ToString()))));
} }
return list; return list;

View File

@ -211,7 +211,7 @@ namespace MediaBrowser.Model.Entities
return result.ToString(); return result.ToString();
} }
return string.Join(" ", attributes); return string.Join(' ', attributes);
} }
case MediaStreamType.Subtitle: case MediaStreamType.Subtitle:

View File

@ -465,7 +465,7 @@ namespace MediaBrowser.XbmcMetadata.Savers
if (item.LockedFields.Length > 0) if (item.LockedFields.Length > 0)
{ {
writer.WriteElementString("lockedfields", string.Join("|", item.LockedFields)); writer.WriteElementString("lockedfields", string.Join('|', item.LockedFields));
} }
writer.WriteElementString("dateadded", item.DateCreated.ToLocalTime().ToString(DateAddedFormat, CultureInfo.InvariantCulture)); writer.WriteElementString("dateadded", item.DateCreated.ToLocalTime().ToString(DateAddedFormat, CultureInfo.InvariantCulture));