mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-20 09:04:42 +01:00
Fix multiple mistakes and warnings
This commit is contained in:
@@ -218,14 +218,12 @@ namespace Emby.Server.Implementations.Dto
|
||||
AttachUserSpecificInfo(dto, item, user, options);
|
||||
}
|
||||
|
||||
if (item is IHasMediaSources hasMediaSources)
|
||||
if (item is IHasMediaSources
|
||||
&& options.ContainsField(ItemFields.MediaSources))
|
||||
{
|
||||
if (options.ContainsField(ItemFields.MediaSources))
|
||||
{
|
||||
dto.MediaSources = _mediaSourceManager().GetStaticMediaSources(item, true, user).ToArray();
|
||||
dto.MediaSources = _mediaSourceManager().GetStaticMediaSources(item, true, user).ToArray();
|
||||
|
||||
NormalizeMediaSourceContainers(dto);
|
||||
}
|
||||
NormalizeMediaSourceContainers(dto);
|
||||
}
|
||||
|
||||
if (options.ContainsField(ItemFields.Studios))
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Emby.Server.Implementations.HttpServer.Security
|
||||
|
||||
var user = auth.User;
|
||||
|
||||
if (user == null & !auth.UserId.Equals(Guid.Empty))
|
||||
if (user == null && auth.UserId != Guid.Empty)
|
||||
{
|
||||
throw new SecurityException("User with Id " + auth.UserId + " not found");
|
||||
}
|
||||
|
||||
@@ -57,7 +57,6 @@ namespace Emby.Server.Implementations.Library
|
||||
}
|
||||
|
||||
var filename = fileInfo.Name;
|
||||
var path = fileInfo.FullName;
|
||||
|
||||
// Ignore hidden files on UNIX
|
||||
if (Environment.OSVersion.Platform != PlatformID.Win32NT
|
||||
|
||||
@@ -273,14 +273,12 @@ namespace Emby.Server.Implementations.Library
|
||||
var user = Users.FirstOrDefault(i => string.Equals(username, i.Name, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
var success = false;
|
||||
string updatedUsername = null;
|
||||
IAuthenticationProvider authenticationProvider = null;
|
||||
|
||||
if (user != null)
|
||||
{
|
||||
var authResult = await AuthenticateLocalUser(username, password, hashedPassword, user, remoteEndPoint).ConfigureAwait(false);
|
||||
authenticationProvider = authResult.authenticationProvider;
|
||||
updatedUsername = authResult.username;
|
||||
success = authResult.success;
|
||||
}
|
||||
else
|
||||
@@ -288,7 +286,7 @@ namespace Emby.Server.Implementations.Library
|
||||
// user is null
|
||||
var authResult = await AuthenticateLocalUser(username, password, hashedPassword, null, remoteEndPoint).ConfigureAwait(false);
|
||||
authenticationProvider = authResult.authenticationProvider;
|
||||
updatedUsername = authResult.username;
|
||||
string updatedUsername = authResult.username;
|
||||
success = authResult.success;
|
||||
|
||||
if (success
|
||||
|
||||
@@ -236,7 +236,7 @@ namespace Emby.Server.Implementations.Library
|
||||
if (!parentId.Equals(Guid.Empty))
|
||||
{
|
||||
var parentItem = _libraryManager.GetItemById(parentId);
|
||||
if (parentItem is Channel parentItemChannel)
|
||||
if (parentItem is Channel)
|
||||
{
|
||||
return _channelManager.GetLatestChannelItemsInternal(
|
||||
new InternalItemsQuery(user)
|
||||
@@ -248,7 +248,7 @@ namespace Emby.Server.Implementations.Library
|
||||
IncludeItemTypes = request.IncludeItemTypes,
|
||||
EnableTotalRecordCount = false
|
||||
},
|
||||
CancellationToken.None).Result.Items;
|
||||
CancellationToken.None).GetAwaiter().GetResult().Items;
|
||||
}
|
||||
|
||||
if (parentItem is Folder parent)
|
||||
|
||||
@@ -208,9 +208,6 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
|
||||
private static string GetAudioArgs(MediaSourceInfo mediaSource)
|
||||
{
|
||||
var mediaStreams = mediaSource.MediaStreams ?? new List<MediaStream>();
|
||||
var inputAudioCodec = mediaStreams.Where(i => i.Type == MediaStreamType.Audio).Select(i => i.Codec).FirstOrDefault() ?? string.Empty;
|
||||
|
||||
return "-codec:a:0 copy";
|
||||
|
||||
//var audioChannels = 2;
|
||||
|
||||
@@ -17,7 +17,6 @@ using MediaBrowser.Model.LiveTv;
|
||||
using MediaBrowser.Model.Net;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Net.Http.Headers;
|
||||
|
||||
namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
{
|
||||
@@ -41,6 +40,12 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
|
||||
private string UserAgent => _appHost.ApplicationUserAgent;
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Name => "Schedules Direct";
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Type => nameof(SchedulesDirect);
|
||||
|
||||
private static List<string> GetScheduleRequestDates(DateTime startDateUtc, DateTime endDateUtc)
|
||||
{
|
||||
var dates = new List<string>();
|
||||
@@ -103,7 +108,6 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
httpOptions.RequestHeaders["token"] = token;
|
||||
|
||||
using (var response = await Post(httpOptions, true, info).ConfigureAwait(false))
|
||||
using (var reader = new StreamReader(response.Content))
|
||||
{
|
||||
var dailySchedules = await _jsonSerializer.DeserializeFromStreamAsync<List<ScheduleDirect.Day>>(response.Content).ConfigureAwait(false);
|
||||
_logger.LogDebug("Found {ScheduleCount} programs on {ChannelID} ScheduleDirect", dailySchedules.Count, channelId);
|
||||
@@ -122,7 +126,6 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
httpOptions.RequestContent = "[\"" + string.Join("\", \"", programsID) + "\"]";
|
||||
|
||||
using (var innerResponse = await Post(httpOptions, true, info).ConfigureAwait(false))
|
||||
using (var innerReader = new StreamReader(innerResponse.Content))
|
||||
{
|
||||
var programDetails = await _jsonSerializer.DeserializeFromStreamAsync<List<ScheduleDirect.ProgramDetails>>(innerResponse.Content).ConfigureAwait(false);
|
||||
var programDict = programDetails.ToDictionary(p => p.programID, y => y);
|
||||
@@ -152,14 +155,14 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
var imagesWithText = allImages.Where(i => string.Equals(i.text, "yes", StringComparison.OrdinalIgnoreCase));
|
||||
var imagesWithoutText = allImages.Where(i => string.Equals(i.text, "no", StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
const double desiredAspect = 0.666666667;
|
||||
const double DesiredAspect = 2.0 / 3;
|
||||
|
||||
programEntry.primaryImage = GetProgramImage(ApiUrl, imagesWithText, true, desiredAspect) ??
|
||||
GetProgramImage(ApiUrl, allImages, true, desiredAspect);
|
||||
programEntry.primaryImage = GetProgramImage(ApiUrl, imagesWithText, true, DesiredAspect) ??
|
||||
GetProgramImage(ApiUrl, allImages, true, DesiredAspect);
|
||||
|
||||
const double wideAspect = 1.77777778;
|
||||
const double WideAspect = 16.0 / 9;
|
||||
|
||||
programEntry.thumbImage = GetProgramImage(ApiUrl, imagesWithText, true, wideAspect);
|
||||
programEntry.thumbImage = GetProgramImage(ApiUrl, imagesWithText, true, WideAspect);
|
||||
|
||||
// Don't supply the same image twice
|
||||
if (string.Equals(programEntry.primaryImage, programEntry.thumbImage, StringComparison.Ordinal))
|
||||
@@ -167,7 +170,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
programEntry.thumbImage = null;
|
||||
}
|
||||
|
||||
programEntry.backdropImage = GetProgramImage(ApiUrl, imagesWithoutText, true, wideAspect);
|
||||
programEntry.backdropImage = GetProgramImage(ApiUrl, imagesWithoutText, true, WideAspect);
|
||||
|
||||
//programEntry.bannerImage = GetProgramImage(ApiUrl, data, "Banner", false) ??
|
||||
// GetProgramImage(ApiUrl, data, "Banner-L1", false) ??
|
||||
@@ -178,6 +181,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
|
||||
programsInfo.Add(GetProgram(channelId, schedule, programDict[schedule.programID]));
|
||||
}
|
||||
|
||||
return programsInfo;
|
||||
}
|
||||
}
|
||||
@@ -185,12 +189,10 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
|
||||
private static int GetSizeOrder(ScheduleDirect.ImageData image)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(image.height))
|
||||
if (!string.IsNullOrWhiteSpace(image.height)
|
||||
&& int.TryParse(image.height, out int value))
|
||||
{
|
||||
if (int.TryParse(image.height, out int value))
|
||||
{
|
||||
return value;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -736,16 +738,11 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
|
||||
httpOptions.RequestHeaders["token"] = token;
|
||||
|
||||
using (var response = await _httpClient.SendAsync(httpOptions, "PUT"))
|
||||
using (await _httpClient.SendAsync(httpOptions, "PUT"))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public string Name => "Schedules Direct";
|
||||
|
||||
public static string TypeName = "SchedulesDirect";
|
||||
public string Type => TypeName;
|
||||
|
||||
private async Task<bool> HasLineup(ListingsProviderInfo info, CancellationToken cancellationToken)
|
||||
{
|
||||
if (string.IsNullOrEmpty(info.ListingsId))
|
||||
|
||||
@@ -60,16 +60,6 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
private IListingsProvider[] _listingProviders = Array.Empty<IListingsProvider>();
|
||||
private readonly IFileSystem _fileSystem;
|
||||
|
||||
public event EventHandler<GenericEventArgs<TimerEventInfo>> SeriesTimerCancelled;
|
||||
public event EventHandler<GenericEventArgs<TimerEventInfo>> TimerCancelled;
|
||||
public event EventHandler<GenericEventArgs<TimerEventInfo>> TimerCreated;
|
||||
public event EventHandler<GenericEventArgs<TimerEventInfo>> SeriesTimerCreated;
|
||||
|
||||
public string GetEmbyTvActiveRecordingPath(string id)
|
||||
{
|
||||
return EmbyTV.EmbyTV.Current.GetActiveRecordingPath(id);
|
||||
}
|
||||
|
||||
public LiveTvManager(
|
||||
IServerApplicationHost appHost,
|
||||
IServerConfigurationManager config,
|
||||
@@ -102,17 +92,34 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
_tvDtoService = new LiveTvDtoService(dtoService, imageProcessor, loggerFactory, appHost, _libraryManager);
|
||||
}
|
||||
|
||||
public event EventHandler<GenericEventArgs<TimerEventInfo>> SeriesTimerCancelled;
|
||||
|
||||
public event EventHandler<GenericEventArgs<TimerEventInfo>> TimerCancelled;
|
||||
|
||||
public event EventHandler<GenericEventArgs<TimerEventInfo>> TimerCreated;
|
||||
|
||||
public event EventHandler<GenericEventArgs<TimerEventInfo>> SeriesTimerCreated;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the services.
|
||||
/// </summary>
|
||||
/// <value>The services.</value>
|
||||
public IReadOnlyList<ILiveTvService> Services => _services;
|
||||
|
||||
public ITunerHost[] TunerHosts => _tunerHosts;
|
||||
|
||||
public IListingsProvider[] ListingProviders => _listingProviders;
|
||||
|
||||
private LiveTvOptions GetConfiguration()
|
||||
{
|
||||
return _config.GetConfiguration<LiveTvOptions>("livetv");
|
||||
}
|
||||
|
||||
public string GetEmbyTvActiveRecordingPath(string id)
|
||||
{
|
||||
return EmbyTV.EmbyTV.Current.GetActiveRecordingPath(id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds the parts.
|
||||
/// </summary>
|
||||
@@ -130,13 +137,13 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
{
|
||||
if (service is EmbyTV.EmbyTV embyTv)
|
||||
{
|
||||
embyTv.TimerCreated += EmbyTv_TimerCreated;
|
||||
embyTv.TimerCancelled += EmbyTv_TimerCancelled;
|
||||
embyTv.TimerCreated += OnEmbyTvTimerCreated;
|
||||
embyTv.TimerCancelled += OnEmbyTvTimerCancelled;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void EmbyTv_TimerCancelled(object sender, GenericEventArgs<string> e)
|
||||
private void OnEmbyTvTimerCancelled(object sender, GenericEventArgs<string> e)
|
||||
{
|
||||
var timerId = e.Argument;
|
||||
|
||||
@@ -149,10 +156,9 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
});
|
||||
}
|
||||
|
||||
private void EmbyTv_TimerCreated(object sender, GenericEventArgs<TimerInfo> e)
|
||||
private void OnEmbyTvTimerCreated(object sender, GenericEventArgs<TimerInfo> e)
|
||||
{
|
||||
var timer = e.Argument;
|
||||
var service = sender as ILiveTvService;
|
||||
|
||||
TimerCreated?.Invoke(this, new GenericEventArgs<TimerEventInfo>
|
||||
{
|
||||
@@ -164,10 +170,6 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
});
|
||||
}
|
||||
|
||||
public ITunerHost[] TunerHosts => _tunerHosts;
|
||||
|
||||
public IListingsProvider[] ListingProviders => _listingProviders;
|
||||
|
||||
public List<NameIdPair> GetTunerHostTypes()
|
||||
{
|
||||
return _tunerHosts.OrderBy(i => i.Name).Select(i => new NameIdPair
|
||||
@@ -966,9 +968,6 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
|
||||
private async Task AddRecordingInfo(IEnumerable<Tuple<BaseItemDto, string, string>> programs, CancellationToken cancellationToken)
|
||||
{
|
||||
var timers = new Dictionary<string, List<TimerInfo>>();
|
||||
var seriesTimers = new Dictionary<string, List<SeriesTimerInfo>>();
|
||||
|
||||
IReadOnlyList<TimerInfo> timerList = null;
|
||||
IReadOnlyList<SeriesTimerInfo> seriesTimerList = null;
|
||||
|
||||
@@ -1601,8 +1600,6 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
|
||||
if (!string.IsNullOrEmpty(query.Id))
|
||||
{
|
||||
var guid = new Guid(query.Id);
|
||||
|
||||
timers = timers
|
||||
.Where(i => string.Equals(_tvDtoService.GetInternalTimerId(i.Item1.Id), query.Id, StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
|
||||
@@ -424,14 +424,14 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
||||
return false;
|
||||
}
|
||||
|
||||
var nameTag = buf[offset++];
|
||||
offset++; // Name Tag
|
||||
|
||||
var nameLength = buf[offset++];
|
||||
|
||||
// skip the name field to get to value for return
|
||||
offset += nameLength;
|
||||
|
||||
var valueTag = buf[offset++];
|
||||
offset++; // Value Tag
|
||||
|
||||
var valueLength = buf[offset++];
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Emby.Server.Implementations.Services
|
||||
{
|
||||
PropertySetFn = propertySetFn;
|
||||
PropertyParseStringFn = propertyParseStringFn;
|
||||
PropertyType = PropertyType;
|
||||
PropertyType = propertyType;
|
||||
}
|
||||
|
||||
public Action<object, object> PropertySetFn { get; private set; }
|
||||
|
||||
Reference in New Issue
Block a user