fix mapping multiple tuner channels to same epg channel

This commit is contained in:
Luke Pulverenti 2017-02-18 22:46:09 -05:00
parent 00760f7d24
commit 0ee1a0d7bd
27 changed files with 170 additions and 446 deletions

View File

@ -873,7 +873,13 @@ return null;
/// Gets or sets a value indicating whether this instance can self update. /// Gets or sets a value indicating whether this instance can self update.
/// </summary> /// </summary>
/// <value><c>true</c> if this instance can self update; otherwise, <c>false</c>.</value> /// <value><c>true</c> if this instance can self update; otherwise, <c>false</c>.</value>
public abstract bool CanSelfUpdate { get; } public virtual bool CanSelfUpdate
{
get
{
return false;
}
}
/// <summary> /// <summary>
/// Checks for update. /// Checks for update.

View File

@ -379,7 +379,7 @@ namespace Emby.Common.Implementations.ScheduledTasks
/// <exception cref="System.InvalidOperationException">Cannot execute a Task that is already running</exception> /// <exception cref="System.InvalidOperationException">Cannot execute a Task that is already running</exception>
public async Task Execute(TaskExecutionOptions options) public async Task Execute(TaskExecutionOptions options)
{ {
var task = ExecuteInternal(options); var task = Task.Run(async () => await ExecuteInternal(options).ConfigureAwait(false));
_currentTask = task; _currentTask = task;

View File

@ -312,7 +312,13 @@ namespace Emby.Server.Core
} }
} }
public abstract bool SupportsRunningAsService { get; } public virtual bool SupportsRunningAsService
{
get
{
return false;
}
}
/// <summary> /// <summary>
/// Gets the name. /// Gets the name.
@ -326,14 +332,26 @@ namespace Emby.Server.Core
} }
} }
public abstract bool IsRunningAsService { get; } public virtual bool IsRunningAsService
{
get
{
return false;
}
}
private Assembly GetAssembly(Type type) private Assembly GetAssembly(Type type)
{ {
return type.GetTypeInfo().Assembly; return type.GetTypeInfo().Assembly;
} }
public abstract bool SupportsAutoRunAtStartup { get; } public virtual bool SupportsAutoRunAtStartup
{
get
{
return EnvironmentInfo.OperatingSystem == MediaBrowser.Model.System.OperatingSystem.Windows;
}
}
private void SetBaseExceptionMessage() private void SetBaseExceptionMessage()
{ {
@ -716,7 +734,13 @@ namespace Emby.Server.Core
await ((UserManager)UserManager).Initialize().ConfigureAwait(false); await ((UserManager)UserManager).Initialize().ConfigureAwait(false);
} }
protected abstract bool SupportsDualModeSockets { get; } protected virtual bool SupportsDualModeSockets
{
get
{
return true;
}
}
private ICertificate GetCertificate(string certificateLocation) private ICertificate GetCertificate(string certificateLocation)
{ {
@ -761,7 +785,75 @@ namespace Emby.Server.Core
return new ImageProcessor(LogManager.GetLogger("ImageProcessor"), ServerConfigurationManager.ApplicationPaths, FileSystemManager, JsonSerializer, ImageEncoder, maxConcurrentImageProcesses, () => LibraryManager, TimerFactory); return new ImageProcessor(LogManager.GetLogger("ImageProcessor"), ServerConfigurationManager.ApplicationPaths, FileSystemManager, JsonSerializer, ImageEncoder, maxConcurrentImageProcesses, () => LibraryManager, TimerFactory);
} }
protected abstract FFMpegInstallInfo GetFfmpegInstallInfo(); protected virtual FFMpegInstallInfo GetFfmpegInstallInfo()
{
var info = new FFMpegInstallInfo();
// Windows builds: http://ffmpeg.zeranoe.com/builds/
// Linux builds: http://johnvansickle.com/ffmpeg/
// OS X builds: http://ffmpegmac.net/
// OS X x64: http://www.evermeet.cx/ffmpeg/
if (EnvironmentInfo.OperatingSystem == MediaBrowser.Model.System.OperatingSystem.Linux)
{
info.FFMpegFilename = "ffmpeg";
info.FFProbeFilename = "ffprobe";
info.ArchiveType = "7z";
info.Version = "20160215";
info.DownloadUrls = GetLinuxDownloadUrls();
}
else if (EnvironmentInfo.OperatingSystem == MediaBrowser.Model.System.OperatingSystem.Windows)
{
info.FFMpegFilename = "ffmpeg.exe";
info.FFProbeFilename = "ffprobe.exe";
info.Version = "20160410";
info.ArchiveType = "7z";
info.DownloadUrls = GetWindowsDownloadUrls();
}
// No version available - user requirement
info.DownloadUrls = new string[] { };
return info;
}
private string[] GetWindowsDownloadUrls()
{
switch (EnvironmentInfo.SystemArchitecture)
{
case Architecture.X64:
return new[]
{
"https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/windows/ffmpeg-20160410-win64.7z"
};
case Architecture.X86:
return new[]
{
"https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/windows/ffmpeg-20160410-win32.7z"
};
}
return new string[] { };
}
private string[] GetLinuxDownloadUrls()
{
switch (EnvironmentInfo.SystemArchitecture)
{
case Architecture.X64:
return new[]
{
"https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/linux/ffmpeg-git-20160215-64bit-static.7z"
};
case Architecture.X86:
return new[]
{
"https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/linux/ffmpeg-git-20160215-32bit-static.7z"
};
}
return new string[] { };
}
/// <summary> /// <summary>
/// Registers the media encoder. /// Registers the media encoder.
@ -1489,7 +1581,10 @@ namespace Emby.Server.Core
} }
} }
protected abstract void AuthorizeServer(); protected virtual void AuthorizeServer()
{
throw new NotImplementedException();
}
public event EventHandler HasUpdateAvailableChanged; public event EventHandler HasUpdateAvailableChanged;
@ -1565,7 +1660,10 @@ namespace Emby.Server.Core
} }
} }
protected abstract void ConfigureAutoRunInternal(bool autorun); protected virtual void ConfigureAutoRunInternal(bool autorun)
{
throw new NotImplementedException();
}
/// <summary> /// <summary>
/// This returns localhost in the case of no external dns, and the hostname if the /// This returns localhost in the case of no external dns, and the hostname if the
@ -1631,7 +1729,10 @@ namespace Emby.Server.Core
EnableLoopbackInternal(appName); EnableLoopbackInternal(appName);
} }
protected abstract void EnableLoopbackInternal(string appName); protected virtual void EnableLoopbackInternal(string appName)
{
}
private void RegisterModules() private void RegisterModules()
{ {

View File

@ -2872,7 +2872,8 @@ namespace Emby.Server.Implementations.Data
} }
if (string.Equals(name, ItemSortBy.IsFavoriteOrLiked, StringComparison.OrdinalIgnoreCase)) if (string.Equals(name, ItemSortBy.IsFavoriteOrLiked, StringComparison.OrdinalIgnoreCase))
{ {
return new Tuple<string, bool>("IsFavorite", true); // (Select Case When Abs(COALESCE(ProductionYear, 0) - @ItemProductionYear) < 10 Then 2 Else 0 End )
return new Tuple<string, bool>("(Select Case When IsFavorite is null Then 0 Else IsFavorite End )", true);
} }
if (string.Equals(name, ItemSortBy.IsFolder, StringComparison.OrdinalIgnoreCase)) if (string.Equals(name, ItemSortBy.IsFolder, StringComparison.OrdinalIgnoreCase))
{ {

View File

@ -492,7 +492,7 @@ namespace Emby.Server.Implementations.Dto
} }
} }
//if (!(item is LiveTvProgram)) if (!(item is LiveTvProgram))
{ {
dto.PlayAccess = item.GetPlayAccess(user); dto.PlayAccess = item.GetPlayAccess(user);
} }
@ -1420,7 +1420,7 @@ namespace Emby.Server.Implementations.Dto
{ {
dto.AirDays = series.AirDays; dto.AirDays = series.AirDays;
dto.AirTime = series.AirTime; dto.AirTime = series.AirTime;
dto.SeriesStatus = series.Status; dto.Status = series.Status.HasValue ? series.Status.Value.ToString() : null;
} }
// Add SeasonInfo // Add SeasonInfo

View File

@ -986,6 +986,11 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
foreach (var program in programs) foreach (var program in programs)
{ {
program.ChannelId = channelId; program.ChannelId = channelId;
if (provider.Item2.EnableNewProgramIds)
{
program.Id += "_" + channelId;
}
} }
if (programs.Count > 0) if (programs.Count > 0)

View File

@ -81,12 +81,6 @@ namespace Emby.Server.Implementations.LiveTv.Listings
return programsInfo; return programsInfo;
} }
if (string.IsNullOrWhiteSpace(info.ListingsId))
{
_logger.Warn("ListingsId is null, returning empty program list");
return programsInfo;
}
var dates = GetScheduleRequestDates(startDateUtc, endDateUtc); var dates = GetScheduleRequestDates(startDateUtc, endDateUtc);
string stationID = channelId; string stationID = channelId;
@ -156,7 +150,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
programDetails.Where(p => p.hasImageArtwork).Select(p => p.programID) programDetails.Where(p => p.hasImageArtwork).Select(p => p.programID)
.ToList(); .ToList();
var images = await GetImageForPrograms(info, programIdsWithImages, cancellationToken); var images = await GetImageForPrograms(info, programIdsWithImages, cancellationToken).ConfigureAwait(false);
var schedules = dailySchedules.SelectMany(d => d.programs); var schedules = dailySchedules.SelectMany(d => d.programs);
foreach (ScheduleDirect.Program schedule in schedules) foreach (ScheduleDirect.Program schedule in schedules)

View File

@ -168,7 +168,6 @@ namespace Emby.Server.Implementations.LiveTv.Listings
EpisodeNumber = p.Episode == null ? null : p.Episode.Episode, EpisodeNumber = p.Episode == null ? null : p.Episode.Episode,
EpisodeTitle = episodeTitle, EpisodeTitle = episodeTitle,
Genres = p.Categories, Genres = p.Categories,
Id = String.Format("{0}_{1:O}", p.ChannelId, p.StartDate), // Construct an id from the channel and start date,
StartDate = GetDate(p.StartDate), StartDate = GetDate(p.StartDate),
Name = p.Title, Name = p.Title,
Overview = p.Description, Overview = p.Description,
@ -208,6 +207,9 @@ namespace Emby.Server.Implementations.LiveTv.Listings
programInfo.ShowId = uniqueString.GetMD5().ToString("N"); programInfo.ShowId = uniqueString.GetMD5().ToString("N");
} }
// Construct an id from the channel and start date
programInfo.Id = String.Format("{0}_{1:O}", p.ChannelId, p.StartDate);
if (programInfo.IsMovie) if (programInfo.IsMovie)
{ {
programInfo.IsSeries = false; programInfo.IsSeries = false;

View File

@ -598,10 +598,6 @@ namespace Emby.Server.Implementations.LiveTv
item.ParentId = channel.Id; item.ParentId = channel.Id;
//item.ChannelType = channelType; //item.ChannelType = channelType;
if (!string.Equals(item.ServiceName, serviceName, StringComparison.Ordinal))
{
forceUpdate = true;
}
item.ServiceName = serviceName; item.ServiceName = serviceName;
item.Audio = info.Audio; item.Audio = info.Audio;
@ -1311,7 +1307,7 @@ namespace Emby.Server.Implementations.LiveTv
var isKids = false; var isKids = false;
var iSSeries = false; var iSSeries = false;
var channelPrograms = await service.GetProgramsAsync(GetItemExternalId(currentChannel), start, end, cancellationToken).ConfigureAwait(false); var channelPrograms = (await service.GetProgramsAsync(GetItemExternalId(currentChannel), start, end, cancellationToken).ConfigureAwait(false)).ToList();
var existingPrograms = _libraryManager.GetItemList(new InternalItemsQuery var existingPrograms = _libraryManager.GetItemList(new InternalItemsQuery
{ {
@ -1409,7 +1405,7 @@ namespace Emby.Server.Implementations.LiveTv
double percent = numComplete; double percent = numComplete;
percent /= allChannelsList.Count; percent /= allChannelsList.Count;
progress.Report(80 * percent + 10); progress.Report(85 * percent + 15);
} }
progress.Report(100); progress.Report(100);
@ -1884,7 +1880,7 @@ namespace Emby.Server.Implementations.LiveTv
: _tvDtoService.GetInternalTimerId(service.Name, info.TimerId).ToString("N"); : _tvDtoService.GetInternalTimerId(service.Name, info.TimerId).ToString("N");
dto.StartDate = info.StartDate; dto.StartDate = info.StartDate;
dto.RecordingStatus = info.Status; dto.Status = info.Status.ToString();
dto.IsRepeat = info.IsRepeat; dto.IsRepeat = info.IsRepeat;
dto.EpisodeTitle = info.EpisodeTitle; dto.EpisodeTitle = info.EpisodeTitle;
dto.IsMovie = info.IsMovie; dto.IsMovie = info.IsMovie;
@ -2865,6 +2861,7 @@ namespace Emby.Server.Implementations.LiveTv
{ {
info.Id = Guid.NewGuid().ToString("N"); info.Id = Guid.NewGuid().ToString("N");
config.ListingProviders.Add(info); config.ListingProviders.Add(info);
info.EnableNewProgramIds = true;
} }
else else
{ {

View File

@ -9,17 +9,14 @@ using MediaBrowser.Model.MediaInfo;
using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Serialization;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Model.IO; using MediaBrowser.Model.IO;
using MediaBrowser.Common.Extensions; using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.IO;
using MediaBrowser.Controller; using MediaBrowser.Controller;
using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.IO;
using MediaBrowser.Controller.MediaEncoding; using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Net; using MediaBrowser.Model.Net;
@ -66,7 +63,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
return id; return id;
} }
private async Task<IEnumerable<Channels>> GetLineup(TunerHostInfo info, CancellationToken cancellationToken) private async Task<List<Channels>> GetLineup(TunerHostInfo info, CancellationToken cancellationToken)
{ {
var options = new HttpRequestOptions var options = new HttpRequestOptions
{ {
@ -74,7 +71,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
CancellationToken = cancellationToken, CancellationToken = cancellationToken,
BufferContent = false BufferContent = false
}; };
using (var stream = await _httpClient.Get(options)) using (var stream = await _httpClient.Get(options).ConfigureAwait(false))
{ {
var lineup = JsonSerializer.DeserializeFromStream<List<Channels>>(stream) ?? new List<Channels>(); var lineup = JsonSerializer.DeserializeFromStream<List<Channels>>(stream) ?? new List<Channels>();
@ -127,7 +124,8 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
CacheMode = CacheMode.Unconditional, CacheMode = CacheMode.Unconditional,
TimeoutMs = Convert.ToInt32(TimeSpan.FromSeconds(5).TotalMilliseconds), TimeoutMs = Convert.ToInt32(TimeSpan.FromSeconds(5).TotalMilliseconds),
BufferContent = false BufferContent = false
}))
}).ConfigureAwait(false))
{ {
var response = JsonSerializer.DeserializeFromStream<DiscoverResponse>(stream); var response = JsonSerializer.DeserializeFromStream<DiscoverResponse>(stream);
@ -169,7 +167,8 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
CancellationToken = cancellationToken, CancellationToken = cancellationToken,
TimeoutMs = Convert.ToInt32(TimeSpan.FromSeconds(5).TotalMilliseconds), TimeoutMs = Convert.ToInt32(TimeSpan.FromSeconds(5).TotalMilliseconds),
BufferContent = false BufferContent = false
}))
}).ConfigureAwait(false))
{ {
var tuners = new List<LiveTvTunerInfo>(); var tuners = new List<LiveTvTunerInfo>();
using (var sr = new StreamReader(stream, System.Text.Encoding.UTF8)) using (var sr = new StreamReader(stream, System.Text.Encoding.UTF8))
@ -536,7 +535,8 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
Url = string.Format("{0}/discover.json", GetApiUrl(info, false)), Url = string.Format("{0}/discover.json", GetApiUrl(info, false)),
CancellationToken = CancellationToken.None, CancellationToken = CancellationToken.None,
BufferContent = false BufferContent = false
}))
}).ConfigureAwait(false))
{ {
var response = JsonSerializer.DeserializeFromStream<DiscoverResponse>(stream); var response = JsonSerializer.DeserializeFromStream<DiscoverResponse>(stream);

View File

@ -74,10 +74,8 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
OnFinished = OnFinished OnFinished = OnFinished
}; };
var initial = _sharedBuffer.ToList();
var list = new List<byte>(); var list = new List<byte>();
foreach (var bytes in _sharedBuffer)
foreach (var bytes in initial)
{ {
list.AddRange(bytes); list.AddRange(bytes);
} }

View File

@ -401,10 +401,21 @@ namespace MediaBrowser.Api
var series = item as Series; var series = item as Series;
if (series != null) if (series != null)
{ {
series.Status = request.SeriesStatus; series.Status = GetSeriesStatus(request);
series.AirDays = request.AirDays; series.AirDays = request.AirDays;
series.AirTime = request.AirTime; series.AirTime = request.AirTime;
} }
} }
private SeriesStatus? GetSeriesStatus(BaseItemDto item)
{
if (string.IsNullOrEmpty(item.Status))
{
return null;
}
return (SeriesStatus)Enum.Parse(typeof(SeriesStatus), item.Status, true);
}
} }
} }

View File

@ -173,10 +173,6 @@
<Project>{17E1F4E6-8ABD-4FE5-9ECF-43D4B6087BA2}</Project> <Project>{17E1F4E6-8ABD-4FE5-9ECF-43D4B6087BA2}</Project>
<Name>MediaBrowser.Controller</Name> <Name>MediaBrowser.Controller</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\MediaBrowser.MediaEncoding\MediaBrowser.MediaEncoding.csproj">
<Project>{0bd82fa6-eb8a-4452-8af5-74f9c3849451}</Project>
<Name>MediaBrowser.MediaEncoding</Name>
</ProjectReference>
<ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj"> <ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj">
<Project>{7EEEB4BB-F3E8-48FC-B4C5-70F0FFF8329B}</Project> <Project>{7EEEB4BB-F3E8-48FC-B4C5-70F0FFF8329B}</Project>
<Name>MediaBrowser.Model</Name> <Name>MediaBrowser.Model</Name>

View File

@ -22,7 +22,6 @@ using System.Threading.Tasks;
using MediaBrowser.Common.Net; using MediaBrowser.Common.Net;
using MediaBrowser.Controller; using MediaBrowser.Controller;
using MediaBrowser.Controller.Net; using MediaBrowser.Controller.Net;
using MediaBrowser.MediaEncoding.Encoder;
using MediaBrowser.Model.Diagnostics; using MediaBrowser.Model.Diagnostics;
namespace MediaBrowser.Api.Playback namespace MediaBrowser.Api.Playback

View File

@ -13,7 +13,7 @@ using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using MediaBrowser.MediaEncoding.Encoder; using MediaBrowser.Controller.MediaEncoding;
namespace MediaBrowser.Api.Playback namespace MediaBrowser.Api.Playback
{ {

View File

@ -199,9 +199,9 @@ namespace MediaBrowser.Api.Playback
if (isHeadRequest) if (isHeadRequest)
{ {
return service.Head(newRequest); return await service.Head(newRequest).ConfigureAwait(false);
} }
return service.Get(newRequest); return await service.Get(newRequest).ConfigureAwait(false);
} }
else else
{ {
@ -239,9 +239,9 @@ namespace MediaBrowser.Api.Playback
if (isHeadRequest) if (isHeadRequest)
{ {
return service.Head(newRequest); return await service.Head(newRequest).ConfigureAwait(false);
} }
return service.Get(newRequest); return await service.Get(newRequest).ConfigureAwait(false);
} }
} }
} }

View File

@ -37,7 +37,7 @@ namespace MediaBrowser.Api.Sync
options.Add(SyncJobOption.ItemLimit); options.Add(SyncJobOption.ItemLimit);
break; break;
} }
if (item.IsFolderItem && !item.IsMusicGenre && !item.IsArtist && !item.IsType("musicalbum") && !item.IsGameGenre) if ((item.IsFolder ?? false) && !item.IsMusicGenre && !item.IsArtist && !item.IsType("musicalbum") && !item.IsGameGenre)
{ {
options.Add(SyncJobOption.Quality); options.Add(SyncJobOption.Quality);
options.Add(SyncJobOption.Profile); options.Add(SyncJobOption.Profile);
@ -57,7 +57,7 @@ namespace MediaBrowser.Api.Sync
{ {
if (item.SupportsSync ?? false) if (item.SupportsSync ?? false)
{ {
if (item.IsFolderItem || item.IsGameGenre || item.IsMusicGenre || item.IsGenre || item.IsArtist || item.IsStudio || item.IsPerson) if ((item.IsFolder ?? false) || item.IsGameGenre || item.IsMusicGenre || item.IsGenre || item.IsArtist || item.IsStudio || item.IsPerson)
{ {
options.Add(SyncJobOption.SyncNewContent); options.Add(SyncJobOption.SyncNewContent);
options.Add(SyncJobOption.ItemLimit); options.Add(SyncJobOption.ItemLimit);

View File

@ -184,6 +184,8 @@
<Compile Include="LiveTv\TimerInfo.cs" /> <Compile Include="LiveTv\TimerInfo.cs" />
<Compile Include="LiveTv\TunerChannelMapping.cs" /> <Compile Include="LiveTv\TunerChannelMapping.cs" />
<Compile Include="MediaEncoding\ChapterImageRefreshOptions.cs" /> <Compile Include="MediaEncoding\ChapterImageRefreshOptions.cs" />
<Compile Include="MediaEncoding\EncodingHelper.cs" />
<Compile Include="MediaEncoding\EncodingJobInfo.cs" />
<Compile Include="MediaEncoding\EncodingJobOptions.cs" /> <Compile Include="MediaEncoding\EncodingJobOptions.cs" />
<Compile Include="MediaEncoding\IEncodingManager.cs" /> <Compile Include="MediaEncoding\IEncodingManager.cs" />
<Compile Include="MediaEncoding\ImageEncodingOptions.cs" /> <Compile Include="MediaEncoding\ImageEncodingOptions.cs" />

View File

@ -3,22 +3,16 @@ using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Dlna; using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Dto; using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities; using MediaBrowser.Model.Entities;
using MediaBrowser.Model.IO; using MediaBrowser.Model.IO;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.MediaInfo; using MediaBrowser.Model.MediaInfo;
namespace MediaBrowser.MediaEncoding.Encoder namespace MediaBrowser.Controller.MediaEncoding
{ {
public class EncodingHelper public class EncodingHelper
{ {

View File

@ -1,11 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Model.Dlna; using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Dto; using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities; using MediaBrowser.Model.Entities;
@ -13,7 +9,7 @@ using MediaBrowser.Model.IO;
using MediaBrowser.Model.Logging; using MediaBrowser.Model.Logging;
using MediaBrowser.Model.MediaInfo; using MediaBrowser.Model.MediaInfo;
namespace MediaBrowser.MediaEncoding.Encoder namespace MediaBrowser.Controller.MediaEncoding
{ {
// For now, a common base class until the API and MediaEncoding classes are unified // For now, a common base class until the API and MediaEncoding classes are unified
public class EncodingJobInfo public class EncodingJobInfo

View File

@ -50,10 +50,8 @@
<Compile Include="Configuration\EncodingConfigurationFactory.cs" /> <Compile Include="Configuration\EncodingConfigurationFactory.cs" />
<Compile Include="Encoder\AudioEncoder.cs" /> <Compile Include="Encoder\AudioEncoder.cs" />
<Compile Include="Encoder\BaseEncoder.cs" /> <Compile Include="Encoder\BaseEncoder.cs" />
<Compile Include="Encoder\EncodingHelper.cs" />
<Compile Include="Encoder\EncodingJob.cs" /> <Compile Include="Encoder\EncodingJob.cs" />
<Compile Include="Encoder\EncodingJobFactory.cs" /> <Compile Include="Encoder\EncodingJobFactory.cs" />
<Compile Include="Encoder\EncodingJobInfo.cs" />
<Compile Include="Encoder\EncodingUtils.cs" /> <Compile Include="Encoder\EncodingUtils.cs" />
<Compile Include="Encoder\EncoderValidator.cs" /> <Compile Include="Encoder\EncoderValidator.cs" />
<Compile Include="Encoder\FontConfigLoader.cs" /> <Compile Include="Encoder\FontConfigLoader.cs" />

View File

@ -342,15 +342,6 @@ namespace MediaBrowser.Model.Dto
/// <value><c>true</c> if this instance is folder; otherwise, <c>false</c>.</value> /// <value><c>true</c> if this instance is folder; otherwise, <c>false</c>.</value>
public bool? IsFolder { get; set; } public bool? IsFolder { get; set; }
[IgnoreDataMember]
public bool IsFolderItem
{
get
{
return IsFolder ?? false;
}
}
/// <summary> /// <summary>
/// Gets or sets the parent id. /// Gets or sets the parent id.
/// </summary> /// </summary>
@ -458,56 +449,6 @@ namespace MediaBrowser.Model.Dto
/// <value>The status.</value> /// <value>The status.</value>
public string Status { get; set; } public string Status { get; set; }
[IgnoreDataMember]
public SeriesStatus? SeriesStatus
{
get
{
if (string.IsNullOrEmpty(Status))
{
return null;
}
return (SeriesStatus)Enum.Parse(typeof(SeriesStatus), Status, true);
}
set
{
if (value == null)
{
Status = null;
}
else
{
Status = value.Value.ToString();
}
}
}
[IgnoreDataMember]
public RecordingStatus? RecordingStatus
{
get
{
if (string.IsNullOrEmpty(Status))
{
return null;
}
return (RecordingStatus)Enum.Parse(typeof(RecordingStatus), Status, true);
}
set
{
if (value == null)
{
Status = null;
}
else
{
Status = value.Value.ToString();
}
}
}
/// <summary> /// <summary>
/// Gets or sets the air time. /// Gets or sets the air time.
/// </summary> /// </summary>
@ -650,19 +591,6 @@ namespace MediaBrowser.Model.Dto
return IsType(type.Name); return IsType(type.Name);
} }
/// <summary>
/// Gets or sets a value indicating whether [supports playlists].
/// </summary>
/// <value><c>true</c> if [supports playlists]; otherwise, <c>false</c>.</value>
[IgnoreDataMember]
public bool SupportsPlaylists
{
get
{
return RunTimeTicks.HasValue || IsFolderItem || IsGenre || IsMusicGenre || IsArtist;
}
}
/// <summary> /// <summary>
/// Determines whether the specified type is type. /// Determines whether the specified type is type.
/// </summary> /// </summary>
@ -876,56 +804,6 @@ namespace MediaBrowser.Model.Dto
/// <value>The series timer identifier.</value> /// <value>The series timer identifier.</value>
public string SeriesTimerId { get; set; } public string SeriesTimerId { get; set; }
/// <summary>
/// Gets a value indicating whether this instance can resume.
/// </summary>
/// <value><c>true</c> if this instance can resume; otherwise, <c>false</c>.</value>
[IgnoreDataMember]
public bool CanResume
{
get { return UserData != null && UserData.PlaybackPositionTicks > 0; }
}
/// <summary>
/// Gets the resume position ticks.
/// </summary>
/// <value>The resume position ticks.</value>
[IgnoreDataMember]
public long ResumePositionTicks
{
get { return UserData == null ? 0 : UserData.PlaybackPositionTicks; }
}
/// <summary>
/// Gets the backdrop count.
/// </summary>
/// <value>The backdrop count.</value>
[IgnoreDataMember]
public int BackdropCount
{
get { return BackdropImageTags == null ? 0 : BackdropImageTags.Count; }
}
/// <summary>
/// Gets the screenshot count.
/// </summary>
/// <value>The screenshot count.</value>
[IgnoreDataMember]
public int ScreenshotCount
{
get { return ScreenshotImageTags == null ? 0 : ScreenshotImageTags.Count; }
}
/// <summary>
/// Gets a value indicating whether this instance has banner.
/// </summary>
/// <value><c>true</c> if this instance has banner; otherwise, <c>false</c>.</value>
[IgnoreDataMember]
public bool HasBanner
{
get { return ImageTags != null && ImageTags.ContainsKey(ImageType.Banner); }
}
/// <summary> /// <summary>
/// Gets a value indicating whether this instance has art. /// Gets a value indicating whether this instance has art.
/// </summary> /// </summary>
@ -976,46 +854,6 @@ namespace MediaBrowser.Model.Dto
get { return ImageTags != null && ImageTags.ContainsKey(ImageType.Primary); } get { return ImageTags != null && ImageTags.ContainsKey(ImageType.Primary); }
} }
/// <summary>
/// Gets a value indicating whether this instance has disc image.
/// </summary>
/// <value><c>true</c> if this instance has disc image; otherwise, <c>false</c>.</value>
[IgnoreDataMember]
public bool HasDiscImage
{
get { return ImageTags != null && ImageTags.ContainsKey(ImageType.Disc); }
}
/// <summary>
/// Gets a value indicating whether this instance has box image.
/// </summary>
/// <value><c>true</c> if this instance has box image; otherwise, <c>false</c>.</value>
[IgnoreDataMember]
public bool HasBoxImage
{
get { return ImageTags != null && ImageTags.ContainsKey(ImageType.Box); }
}
/// <summary>
/// Gets a value indicating whether this instance has box image.
/// </summary>
/// <value><c>true</c> if this instance has box image; otherwise, <c>false</c>.</value>
[IgnoreDataMember]
public bool HasBoxRearImage
{
get { return ImageTags != null && ImageTags.ContainsKey(ImageType.BoxRear); }
}
/// <summary>
/// Gets a value indicating whether this instance has menu image.
/// </summary>
/// <value><c>true</c> if this instance has menu image; otherwise, <c>false</c>.</value>
[IgnoreDataMember]
public bool HasMenuImage
{
get { return ImageTags != null && ImageTags.ContainsKey(ImageType.Menu); }
}
/// <summary> /// <summary>
/// Gets a value indicating whether this instance is video. /// Gets a value indicating whether this instance is video.
/// </summary> /// </summary>
@ -1056,16 +894,6 @@ namespace MediaBrowser.Model.Dto
get { return StringHelper.EqualsIgnoreCase(Type, "Person"); } get { return StringHelper.EqualsIgnoreCase(Type, "Person"); }
} }
/// <summary>
/// Gets a value indicating whether this instance is root.
/// </summary>
/// <value><c>true</c> if this instance is root; otherwise, <c>false</c>.</value>
[IgnoreDataMember]
public bool IsRoot
{
get { return StringHelper.EqualsIgnoreCase(Type, "AggregateFolder"); }
}
[IgnoreDataMember] [IgnoreDataMember]
public bool IsMusicGenre public bool IsMusicGenre
{ {

View File

@ -48,15 +48,6 @@ namespace MediaBrowser.Model.LiveTv
public bool ImportFavoritesOnly { get; set; } public bool ImportFavoritesOnly { get; set; }
public bool AllowHWTranscoding { get; set; } public bool AllowHWTranscoding { get; set; }
public bool IsEnabled { get; set; } public bool IsEnabled { get; set; }
public string M3UUrl { get; set; }
public string InfoUrl { get; set; }
public string FriendlyName { get; set; }
public int Tuners { get; set; }
public string DiseqC { get; set; }
public string SourceA { get; set; }
public string SourceB { get; set; }
public string SourceC { get; set; }
public string SourceD { get; set; }
public bool EnableTvgId { get; set; } public bool EnableTvgId { get; set; }
public TunerHostInfo() public TunerHostInfo()
@ -85,6 +76,7 @@ namespace MediaBrowser.Model.LiveTv
public string[] MovieCategories { get; set; } public string[] MovieCategories { get; set; }
public NameValuePair[] ChannelMappings { get; set; } public NameValuePair[] ChannelMappings { get; set; }
public string MoviePrefix { get; set; } public string MoviePrefix { get; set; }
public bool EnableNewProgramIds { get; set; }
public ListingsProviderInfo() public ListingsProviderInfo()
{ {

View File

@ -26,63 +26,6 @@ namespace MediaBrowser.Server.Mono
} }
} }
public override bool CanSelfUpdate
{
get
{
return false;
}
}
protected override FFMpegInstallInfo GetFfmpegInstallInfo()
{
var info = new FFMpegInstallInfo();
// Windows builds: http://ffmpeg.zeranoe.com/builds/
// Linux builds: http://johnvansickle.com/ffmpeg/
// OS X builds: http://ffmpegmac.net/
// OS X x64: http://www.evermeet.cx/ffmpeg/
var environment = (MonoEnvironmentInfo) EnvironmentInfo;
if (environment.IsBsd)
{
}
else if (environment.OperatingSystem == Model.System.OperatingSystem.Linux)
{
info.FFMpegFilename = "ffmpeg";
info.FFProbeFilename = "ffprobe";
info.ArchiveType = "7z";
info.Version = "20160215";
info.DownloadUrls = GetDownloadUrls();
}
// No version available - user requirement
info.DownloadUrls = new string[] { };
return info;
}
private string[] GetDownloadUrls()
{
switch (EnvironmentInfo.SystemArchitecture)
{
case Architecture.X64:
return new[]
{
"https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/linux/ffmpeg-git-20160215-64bit-static.7z"
};
case Architecture.X86:
return new[]
{
"https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/linux/ffmpeg-git-20160215-32bit-static.7z"
};
}
return new string[] { };
}
protected override void RestartInternal() protected override void RestartInternal()
{ {
MainClass.Restart(StartupOptions); MainClass.Restart(StartupOptions);
@ -137,40 +80,5 @@ namespace MediaBrowser.Server.Mono
return new Version(1, 0); return new Version(1, 0);
} }
protected override void AuthorizeServer()
{
throw new NotImplementedException();
}
protected override void ConfigureAutoRunInternal(bool autorun)
{
throw new NotImplementedException();
}
protected override void EnableLoopbackInternal(string appName)
{
}
public override bool SupportsRunningAsService
{
get
{
return false;
}
}
public override bool SupportsAutoRunAtStartup
{
get { return false; }
}
public override bool IsRunningAsService
{
get
{
return false;
}
}
} }
} }

View File

@ -324,7 +324,7 @@ namespace MediaBrowser.ServerApplication
/// <param name="options">The options.</param> /// <param name="options">The options.</param>
private static void RunApplication(ServerApplicationPaths appPaths, ILogManager logManager, bool runService, StartupOptions options) private static void RunApplication(ServerApplicationPaths appPaths, ILogManager logManager, bool runService, StartupOptions options)
{ {
var fileSystem = new ManagedFileSystem(logManager.GetLogger("FileSystem"), true, true, true, appPaths.TempDirectory); var fileSystem = new ManagedFileSystem(logManager.GetLogger("FileSystem"), true, true, false, appPaths.TempDirectory);
fileSystem.AddShortcutHandler(new LnkShortcutHandler()); fileSystem.AddShortcutHandler(new LnkShortcutHandler());
fileSystem.AddShortcutHandler(new MbLinkShortcutHandler(fileSystem)); fileSystem.AddShortcutHandler(new MbLinkShortcutHandler(fileSystem));

View File

@ -27,38 +27,6 @@ namespace MediaBrowser.ServerApplication
get { return MainStartup.IsRunningAsService; } get { return MainStartup.IsRunningAsService; }
} }
protected override FFMpegInstallInfo GetFfmpegInstallInfo()
{
var info = new FFMpegInstallInfo();
info.FFMpegFilename = "ffmpeg.exe";
info.FFProbeFilename = "ffprobe.exe";
info.Version = "20160410";
info.ArchiveType = "7z";
info.DownloadUrls = GetDownloadUrls();
return info;
}
private string[] GetDownloadUrls()
{
switch (EnvironmentInfo.SystemArchitecture)
{
case Architecture.X64:
return new[]
{
"https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/windows/ffmpeg-20160410-win64.7z"
};
case Architecture.X86:
return new[]
{
"https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/windows/ffmpeg-20160410-win32.7z"
};
}
return new string[] { };
}
protected override void RestartInternal() protected override void RestartInternal()
{ {
MainStartup.Restart(); MainStartup.Restart();
@ -94,7 +62,7 @@ namespace MediaBrowser.ServerApplication
protected override void ConfigureAutoRunInternal(bool autorun) protected override void ConfigureAutoRunInternal(bool autorun)
{ {
var startupPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Startup); var startupPath = Environment.GetFolderPath(System.Environment.SpecialFolder.Startup);
if (autorun && !MainStartup.IsRunningAsService) if (autorun && !MainStartup.IsRunningAsService)
{ {
@ -121,14 +89,6 @@ namespace MediaBrowser.ServerApplication
} }
} }
protected override bool SupportsDualModeSockets
{
get
{
return true;
}
}
protected override void EnableLoopbackInternal(string appName) protected override void EnableLoopbackInternal(string appName)
{ {
LoopUtil.Run(appName); LoopUtil.Run(appName);
@ -150,14 +110,6 @@ namespace MediaBrowser.ServerApplication
} }
} }
public override bool SupportsAutoRunAtStartup
{
get
{
return true;
}
}
public override bool CanSelfUpdate public override bool CanSelfUpdate
{ {
get get
@ -165,61 +117,5 @@ namespace MediaBrowser.ServerApplication
return MainStartup.CanSelfUpdate; return MainStartup.CanSelfUpdate;
} }
} }
public bool PortsRequireAuthorization(string applicationPath)
{
var appNameSrch = Path.GetFileName(applicationPath);
var startInfo = new ProcessStartInfo
{
FileName = "netsh",
Arguments = "advfirewall firewall show rule \"" + appNameSrch + "\"",
CreateNoWindow = true,
UseShellExecute = false,
WindowStyle = ProcessWindowStyle.Hidden,
ErrorDialog = false,
RedirectStandardOutput = true
};
using (var process = Process.Start(startInfo))
{
process.Start();
try
{
var data = process.StandardOutput.ReadToEnd() ?? string.Empty;
if (data.IndexOf("Block", StringComparison.OrdinalIgnoreCase) != -1)
{
Logger.Info("Found potential windows firewall rule blocking Emby Server: " + data);
}
//var parts = data.Split('\n');
//return parts.Length > 4;
//return Confirm();
return false;
}
catch (Exception ex)
{
Logger.ErrorException("Error querying windows firewall", ex);
// Hate having to do this
try
{
process.Kill();
}
catch (Exception ex1)
{
Logger.ErrorException("Error killing process", ex1);
}
throw;
}
}
}
} }
} }

View File

@ -193,7 +193,7 @@ namespace Emby.Server
/// <param name="options">The options.</param> /// <param name="options">The options.</param>
private static void RunApplication(ServerApplicationPaths appPaths, ILogManager logManager, StartupOptions options, EnvironmentInfo environmentInfo) private static void RunApplication(ServerApplicationPaths appPaths, ILogManager logManager, StartupOptions options, EnvironmentInfo environmentInfo)
{ {
var fileSystem = new ManagedFileSystem(logManager.GetLogger("FileSystem"), true, true, true, appPaths.TempDirectory); var fileSystem = new ManagedFileSystem(logManager.GetLogger("FileSystem"), true, true, false, appPaths.TempDirectory);
fileSystem.AddShortcutHandler(new MbLinkShortcutHandler(fileSystem)); fileSystem.AddShortcutHandler(new MbLinkShortcutHandler(fileSystem));