Merge pull request #1565 from MediaBrowser/dev

Dev
This commit is contained in:
Luke 2016-03-19 18:49:48 -04:00
commit 1933f15977
28 changed files with 88 additions and 174 deletions

View File

@ -0,0 +1,11 @@
using MediaBrowser.Controller.Entities;
namespace MediaBrowser.Controller.Channels
{
public interface IChannelItem : IHasImages, IHasTags
{
string ChannelId { get; set; }
string ExternalId { get; set; }
}
}

View File

@ -0,0 +1,18 @@
using MediaBrowser.Model.Channels;
using MediaBrowser.Model.Entities;
using System.Collections.Generic;
namespace MediaBrowser.Controller.Channels
{
public interface IChannelMediaItem : IChannelItem
{
long? RunTimeTicks { get; set; }
string MediaType { get; }
ChannelMediaContentType ContentType { get; set; }
ExtraType? ExtraType { get; set; }
List<ChannelMediaInfo> ChannelMediaSources { get; set; }
}
}

View File

@ -190,6 +190,13 @@ namespace MediaBrowser.Controller.Entities
}
}
/// <summary>
/// Gets or sets the name of the service.
/// </summary>
/// <value>The name of the service.</value>
[IgnoreDataMember]
public string ServiceName { get; set; }
/// <summary>
/// If this content came from an external service, the id of the content on that service
/// </summary>

View File

@ -1,10 +0,0 @@
using MediaBrowser.Controller.Entities;
namespace MediaBrowser.Controller.LiveTv
{
public interface ILiveTvItem : IHasId
{
string ServiceName { get; set; }
string ExternalId { get; set; }
}
}

View File

@ -50,7 +50,7 @@ namespace MediaBrowser.Controller.LiveTv
/// </summary>
/// <param name="recording">The recording.</param>
/// <returns>Task.</returns>
Task DeleteRecording(ILiveTvRecording recording);
Task DeleteRecording(BaseItem recording);
/// <summary>
/// Cancels the timer.
@ -156,7 +156,7 @@ namespace MediaBrowser.Controller.LiveTv
/// <param name="id">The identifier.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>LiveTvRecording.</returns>
Task<ILiveTvRecording> GetInternalRecording(string id, CancellationToken cancellationToken);
Task<BaseItem> GetInternalRecording(string id, CancellationToken cancellationToken);
/// <summary>
/// Gets the recording stream.
@ -396,7 +396,7 @@ namespace MediaBrowser.Controller.LiveTv
/// </summary>
/// <param name="recording">The recording.</param>
/// <returns>Task.</returns>
Task OnRecordingFileDeleted(ILiveTvRecording recording);
Task OnRecordingFileDeleted(BaseItem recording);
/// <summary>
/// Gets the sat ini mappings.

View File

@ -9,8 +9,10 @@ using System.Threading.Tasks;
namespace MediaBrowser.Controller.LiveTv
{
public interface ILiveTvRecording : IHasImages, IHasMediaSources, IHasUserData, ILiveTvItem, IHasStartDate, IHasProgramAttributes
public interface ILiveTvRecording : IHasImages, IHasMediaSources, IHasUserData, IHasStartDate, IHasProgramAttributes
{
string ServiceName { get; set; }
string ExternalId { get; set; }
string ChannelId { get; }
string MediaType { get; }

View File

@ -57,8 +57,6 @@ namespace MediaBrowser.Controller.LiveTv
return name + "-" + Name + (EpisodeTitle ?? string.Empty);
}
public string ServiceName { get; set; }
/// <summary>
/// Gets a value indicating whether this instance is owned item.
/// </summary>

View File

@ -11,7 +11,7 @@ using System.Runtime.Serialization;
namespace MediaBrowser.Controller.LiveTv
{
public class LiveTvChannel : BaseItem, IHasMediaSources, ILiveTvItem
public class LiveTvChannel : BaseItem, IHasMediaSources
{
/// <summary>
/// Gets the user data key.
@ -59,12 +59,6 @@ namespace MediaBrowser.Controller.LiveTv
/// <value>The type of the channel.</value>
public ChannelType ChannelType { get; set; }
/// <summary>
/// Gets or sets the name of the service.
/// </summary>
/// <value>The name of the service.</value>
public string ServiceName { get; set; }
[IgnoreDataMember]
public override LocationType LocationType
{

View File

@ -11,7 +11,7 @@ using MediaBrowser.Model.Entities;
namespace MediaBrowser.Controller.LiveTv
{
public class LiveTvProgram : BaseItem, ILiveTvItem, IHasLookupInfo<LiveTvProgramLookupInfo>, IHasStartDate, IHasProgramAttributes
public class LiveTvProgram : BaseItem, IHasLookupInfo<LiveTvProgramLookupInfo>, IHasStartDate, IHasProgramAttributes
{
/// <summary>
/// Gets the user data key.
@ -39,13 +39,6 @@ namespace MediaBrowser.Controller.LiveTv
return base.CreateUserDataKey();
}
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
[IgnoreDataMember]
public string ServiceName { get; set; }
[IgnoreDataMember]
public override SourceType SourceType
{

View File

@ -72,8 +72,6 @@ namespace MediaBrowser.Controller.LiveTv
return base.CreateUserDataKey();
}
public string ServiceName { get; set; }
[IgnoreDataMember]
public override string MediaType
{

View File

@ -85,8 +85,10 @@
<Compile Include="Channels\ChannelSearchInfo.cs" />
<Compile Include="Channels\ChannelVideoItem.cs" />
<Compile Include="Channels\IChannel.cs" />
<Compile Include="Channels\IChannelItem.cs" />
<Compile Include="Channels\IChannelManager.cs" />
<Compile Include="Channels\Channel.cs" />
<Compile Include="Channels\IChannelMediaItem.cs" />
<Compile Include="Channels\IHasCacheKey.cs" />
<Compile Include="Channels\IIndexableChannel.cs" />
<Compile Include="Channels\InternalAllChannelMediaQuery.cs" />
@ -202,7 +204,6 @@
<Compile Include="Library\UserDataSaveEventArgs.cs" />
<Compile Include="LiveTv\IHasRegistrationInfo.cs" />
<Compile Include="LiveTv\IListingsProvider.cs" />
<Compile Include="LiveTv\ILiveTvItem.cs" />
<Compile Include="LiveTv\ITunerHost.cs" />
<Compile Include="LiveTv\RecordingGroup.cs" />
<Compile Include="LiveTv\RecordingStatusChangedEventArgs.cs" />

View File

@ -470,9 +470,6 @@
<Compile Include="..\MediaBrowser.Model\Dto\ImageOptions.cs">
<Link>Dto\ImageOptions.cs</Link>
</Compile>
<Compile Include="..\MediaBrowser.Model\Dto\ItemByNameCounts.cs">
<Link>Dto\ItemByNameCounts.cs</Link>
</Compile>
<Compile Include="..\MediaBrowser.Model\Dto\ItemCounts.cs">
<Link>Dto\ItemCounts.cs</Link>
</Compile>

View File

@ -444,9 +444,6 @@
<Compile Include="..\MediaBrowser.Model\Dto\ImageOptions.cs">
<Link>Dto\ImageOptions.cs</Link>
</Compile>
<Compile Include="..\MediaBrowser.Model\Dto\ItemByNameCounts.cs">
<Link>Dto\ItemByNameCounts.cs</Link>
</Compile>
<Compile Include="..\MediaBrowser.Model\Dto\ItemCounts.cs">
<Link>Dto\ItemCounts.cs</Link>
</Compile>

View File

@ -62,12 +62,6 @@ namespace MediaBrowser.Model.Configuration
/// <value><c>true</c> if this instance is port authorized; otherwise, <c>false</c>.</value>
public bool IsPortAuthorized { get; set; }
/// <summary>
/// Gets or sets the item by name path.
/// </summary>
/// <value>The item by name path.</value>
public string ItemsByNamePath { get; set; }
/// <summary>
/// Gets or sets the metadata path.
/// </summary>

View File

@ -792,6 +792,11 @@ namespace MediaBrowser.Model.Dto
/// <value>The locked fields.</value>
public List<MetadataFields> LockedFields { get; set; }
/// <summary>
/// Gets or sets the trailer count.
/// </summary>
/// <value>The trailer count.</value>
public int? TrailerCount { get; set; }
/// <summary>
/// Gets or sets the movie count.
/// </summary>

View File

@ -1,63 +0,0 @@
using System;
namespace MediaBrowser.Model.Dto
{
/// <summary>
/// Class ItemByNameCounts
/// </summary>
public class ItemByNameCounts
{
public string UserId { get; set; }
/// <summary>
/// Gets or sets the total count.
/// </summary>
/// <value>The total count.</value>
public int TotalCount { get; set; }
/// <summary>
/// Gets or sets the adult video count.
/// </summary>
/// <value>The adult video count.</value>
public int AdultVideoCount { get; set; }
/// <summary>
/// Gets or sets the movie count.
/// </summary>
/// <value>The movie count.</value>
public int MovieCount { get; set; }
/// <summary>
/// Gets or sets the series count.
/// </summary>
/// <value>The series count.</value>
public int SeriesCount { get; set; }
/// <summary>
/// Gets or sets the episode count.
/// </summary>
/// <value>The episode count.</value>
public int EpisodeCount { get; set; }
/// <summary>
/// Gets or sets the game count.
/// </summary>
/// <value>The game count.</value>
public int GameCount { get; set; }
/// <summary>
/// Gets or sets the trailer count.
/// </summary>
/// <value>The trailer count.</value>
public int TrailerCount { get; set; }
/// <summary>
/// Gets or sets the song count.
/// </summary>
/// <value>The song count.</value>
public int SongCount { get; set; }
/// <summary>
/// Gets or sets the album count.
/// </summary>
/// <value>The album count.</value>
public int AlbumCount { get; set; }
/// <summary>
/// Gets or sets the music video count.
/// </summary>
/// <value>The music video count.</value>
public int MusicVideoCount { get; set; }
}
}

View File

@ -215,7 +215,6 @@
<Compile Include="Dto\IItemDto.cs" />
<Compile Include="Dto\ImageByNameInfo.cs" />
<Compile Include="Dto\ImageInfo.cs" />
<Compile Include="Dto\ItemByNameCounts.cs" />
<Compile Include="Dto\ItemCounts.cs" />
<Compile Include="Dto\ItemIndex.cs" />
<Compile Include="Dto\RatingType.cs" />

View File

@ -2,7 +2,7 @@ namespace MediaBrowser.Model.Providers
{
public class SubtitleOptions
{
public bool SkipIfGraphicalSubtitlesPresent { get; set; }
public bool SkipIfEmbeddedSubtitlesPresent { get; set; }
public bool SkipIfAudioTrackMatches { get; set; }
public string[] DownloadLanguages { get; set; }
public bool DownloadMovieSubtitles { get; set; }

View File

@ -532,7 +532,7 @@ namespace MediaBrowser.Providers.MediaInfo
_subtitleManager)
.DownloadSubtitles(video,
currentStreams.Concat(externalSubtitleStreams).ToList(),
subtitleOptions.SkipIfGraphicalSubtitlesPresent,
subtitleOptions.SkipIfEmbeddedSubtitlesPresent,
subtitleOptions.SkipIfAudioTrackMatches,
subtitleOptions.DownloadLanguages,
cancellationToken).ConfigureAwait(false);

View File

@ -26,7 +26,7 @@ namespace MediaBrowser.Providers.MediaInfo
public async Task<List<string>> DownloadSubtitles(Video video,
List<MediaStream> mediaStreams,
bool skipIfGraphicalSubtitlesPresent,
bool skipIfEmbeddedSubtitlesPresent,
bool skipIfAudioTrackMatches,
IEnumerable<string> languages,
CancellationToken cancellationToken)
@ -59,7 +59,7 @@ namespace MediaBrowser.Providers.MediaInfo
{
try
{
var downloaded = await DownloadSubtitles(video, mediaStreams, skipIfGraphicalSubtitlesPresent, skipIfAudioTrackMatches, lang, mediaType, cancellationToken)
var downloaded = await DownloadSubtitles(video, mediaStreams, skipIfEmbeddedSubtitlesPresent, skipIfAudioTrackMatches, lang, mediaType, cancellationToken)
.ConfigureAwait(false);
if (downloaded)
@ -78,7 +78,7 @@ namespace MediaBrowser.Providers.MediaInfo
private async Task<bool> DownloadSubtitles(Video video,
List<MediaStream> mediaStreams,
bool skipIfGraphicalSubtitlesPresent,
bool skipIfEmbeddedSubtitlesPresent,
bool skipIfAudioTrackMatches,
string language,
VideoContentType mediaType,
@ -107,8 +107,8 @@ namespace MediaBrowser.Providers.MediaInfo
}
// There's an internal subtitle stream for this language
if (skipIfGraphicalSubtitlesPresent &&
mediaStreams.Any(i => i.Type == MediaStreamType.Subtitle && !i.IsTextSubtitleStream && string.Equals(i.Language, language, StringComparison.OrdinalIgnoreCase)))
if (skipIfEmbeddedSubtitlesPresent &&
mediaStreams.Any(i => i.Type == MediaStreamType.Subtitle && !i.IsExternal && string.Equals(i.Language, language, StringComparison.OrdinalIgnoreCase)))
{
return false;
}

View File

@ -114,7 +114,7 @@ namespace MediaBrowser.Providers.MediaInfo
_subtitleManager)
.DownloadSubtitles(video,
mediaStreams,
options.SkipIfGraphicalSubtitlesPresent,
options.SkipIfEmbeddedSubtitlesPresent,
options.SkipIfAudioTrackMatches,
options.DownloadLanguages,
cancellationToken).ConfigureAwait(false);

View File

@ -145,7 +145,6 @@ namespace MediaBrowser.Server.Implementations.Configuration
{
var newConfig = (ServerConfiguration)newConfiguration;
ValidateItemByNamePath(newConfig);
ValidatePathSubstitutions(newConfig);
ValidateMetadataPath(newConfig);
ValidateSslCertificate(newConfig);
@ -189,28 +188,6 @@ namespace MediaBrowser.Server.Implementations.Configuration
}
}
/// <summary>
/// Replaces the item by name path.
/// </summary>
/// <param name="newConfig">The new configuration.</param>
/// <exception cref="System.IO.DirectoryNotFoundException"></exception>
private void ValidateItemByNamePath(ServerConfiguration newConfig)
{
var newPath = newConfig.ItemsByNamePath;
if (!string.IsNullOrWhiteSpace(newPath)
&& !string.Equals(Configuration.ItemsByNamePath ?? string.Empty, newPath))
{
// Validate
if (!FileSystem.DirectoryExists(newPath))
{
throw new DirectoryNotFoundException(string.Format("{0} does not exist.", newPath));
}
EnsureWriteAccess(newPath);
}
}
/// <summary>
/// Validates the metadata path.
/// </summary>

View File

@ -457,6 +457,7 @@ namespace MediaBrowser.Server.Implementations.Dto
dto.EpisodeCount = taggedItems.Count(i => i is Episode);
dto.GameCount = taggedItems.Count(i => i is Game);
dto.MovieCount = taggedItems.Count(i => i is Movie);
dto.TrailerCount = taggedItems.Count(i => i is Trailer);
dto.MusicVideoCount = taggedItems.Count(i => i is MusicVideo);
dto.SeriesCount = taggedItems.Count(i => i is Series);
dto.SongCount = taggedItems.Count(i => i is Audio);

View File

@ -300,7 +300,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
return _libraryManager.GetItemById(id) as LiveTvProgram;
}
public async Task<ILiveTvRecording> GetInternalRecording(string id, CancellationToken cancellationToken)
public async Task<BaseItem> GetInternalRecording(string id, CancellationToken cancellationToken)
{
if (string.IsNullOrWhiteSpace(id))
{
@ -313,7 +313,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
}, cancellationToken).ConfigureAwait(false);
return result.Items.FirstOrDefault() as ILiveTvRecording;
return result.Items.FirstOrDefault();
}
private readonly SemaphoreSlim _liveStreamSemaphore = new SemaphoreSlim(1, 1);
@ -358,7 +358,12 @@ namespace MediaBrowser.Server.Implementations.LiveTv
return list;
}
private ILiveTvService GetService(ILiveTvItem item)
private ILiveTvService GetService(ILiveTvRecording item)
{
return GetService(item.ServiceName);
}
private ILiveTvService GetService(BaseItem item)
{
return GetService(item.ServiceName);
}
@ -1693,7 +1698,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
};
}
public Task OnRecordingFileDeleted(ILiveTvRecording recording)
public Task OnRecordingFileDeleted(BaseItem recording)
{
var service = GetService(recording);
@ -1715,10 +1720,10 @@ namespace MediaBrowser.Server.Implementations.LiveTv
throw new ResourceNotFoundException(string.Format("Recording with Id {0} not found", recordingId));
}
await DeleteRecording(recording).ConfigureAwait(false);
await DeleteRecording((BaseItem)recording).ConfigureAwait(false);
}
public async Task DeleteRecording(ILiveTvRecording recording)
public async Task DeleteRecording(BaseItem recording)
{
var service = GetService(recording.ServiceName);

View File

@ -36,15 +36,13 @@ namespace MediaBrowser.Server.Implementations.LiveTv
public Task<IEnumerable<MediaSourceInfo>> GetMediaSources(IHasMediaSources item, CancellationToken cancellationToken)
{
var channelItem = item as ILiveTvItem;
var baseItem = (BaseItem)item;
if (channelItem != null)
if (baseItem.SourceType == SourceType.LiveTV)
{
var hasMetadata = (IHasMetadata)channelItem;
if (string.IsNullOrWhiteSpace(hasMetadata.Path))
if (string.IsNullOrWhiteSpace(baseItem.Path))
{
return GetMediaSourcesInternal(channelItem, cancellationToken);
return GetMediaSourcesInternal(item, cancellationToken);
}
}
@ -54,8 +52,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv
// Do not use a pipe here because Roku http requests to the server will fail, without any explicit error message.
private const char StreamIdDelimeter = '_';
private const string StreamIdDelimeterString = "_";
private async Task<IEnumerable<MediaSourceInfo>> GetMediaSourcesInternal(ILiveTvItem item, CancellationToken cancellationToken)
private async Task<IEnumerable<MediaSourceInfo>> GetMediaSourcesInternal(IHasMediaSources item, CancellationToken cancellationToken)
{
IEnumerable<MediaSourceInfo> sources;

View File

@ -100,7 +100,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp
{
if (string.IsNullOrWhiteSpace(info.M3UUrl))
{
return;
//return;
}
await _liveTvManager.SaveTunerHost(new TunerHostInfo

View File

@ -719,15 +719,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
_saveItemCommand.GetParameter(index++).Value = null;
}
var tvItem = item as ILiveTvItem;
if (tvItem != null)
{
_saveItemCommand.GetParameter(index++).Value = tvItem.ServiceName;
}
else
{
_saveItemCommand.GetParameter(index++).Value = null;
}
_saveItemCommand.GetParameter(index++).Value = item.ServiceName;
_saveItemCommand.GetParameter(index++).Value = string.Join("|", item.Tags.ToArray());
_saveItemCommand.GetParameter(index++).Value = item.IsFolder;
@ -1095,11 +1087,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
if (!reader.IsDBNull(43))
{
var tvItem = item as ILiveTvItem;
if (tvItem != null)
{
tvItem.ServiceName = reader.GetString(43);
}
item.ServiceName = reader.GetString(43);
}
if (!reader.IsDBNull(44))

View File

@ -308,9 +308,9 @@ namespace MediaBrowser.WebDashboard.Api
if (!string.Equals(mode, "cordova", StringComparison.OrdinalIgnoreCase))
{
var versionedBowerPath = Path.Combine(Path.GetDirectoryName(bowerPath), "bower_components" + _appHost.ApplicationVersion);
Directory.Move(bowerPath, versionedBowerPath);
bowerPath = versionedBowerPath;
//var versionedBowerPath = Path.Combine(Path.GetDirectoryName(bowerPath), "bower_components" + _appHost.ApplicationVersion);
//Directory.Move(bowerPath, versionedBowerPath);
//bowerPath = versionedBowerPath;
}
DeleteFilesByExtension(bowerPath, ".log");
@ -340,7 +340,11 @@ namespace MediaBrowser.WebDashboard.Api
DeleteFoldersByName(bowerPath, "guides");
DeleteFoldersByName(bowerPath, "grunt");
DeleteFoldersByName(bowerPath, "rollups");
DeleteFoldersByName(Path.Combine(bowerPath, "emby-webcomponents"), "fonts");
if (string.Equals(mode, "cordova", StringComparison.OrdinalIgnoreCase))
{
DeleteFoldersByName(Path.Combine(bowerPath, "emby-webcomponents"), "fonts");
}
_fileSystem.DeleteDirectory(Path.Combine(bowerPath, "jquery", "src"), true);