aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller
diff options
context:
space:
mode:
authorTim Hobbs <jesus.tesh@gmail.com>2014-05-18 15:45:16 -0700
committerTim Hobbs <jesus.tesh@gmail.com>2014-05-18 15:45:16 -0700
commit6e1082563173b6b71b96fc8e38ff974f49c07add (patch)
treeebdf2c12344afd856c040b8396b288dc6be8f8e2 /MediaBrowser.Controller
parent0bf6fdb5a4050f30ac8100210a9fe9e2a48f63e2 (diff)
parent708d5a416ed373c158b3dc45952a1fd123fb74e8 (diff)
Merge branch 'master' of https://github.com/MediaBrowser/MediaBrowser into upstream-master
Diffstat (limited to 'MediaBrowser.Controller')
-rw-r--r--MediaBrowser.Controller/Channels/Channel.cs2
-rw-r--r--MediaBrowser.Controller/Channels/ChannelAudioItem.cs26
-rw-r--r--MediaBrowser.Controller/Channels/ChannelCategoryItem.cs9
-rw-r--r--MediaBrowser.Controller/Channels/ChannelItemInfo.cs2
-rw-r--r--MediaBrowser.Controller/Channels/ChannelMediaInfo.cs3
-rw-r--r--MediaBrowser.Controller/Channels/ChannelVideoItem.cs21
-rw-r--r--MediaBrowser.Controller/Channels/IChannel.cs17
-rw-r--r--MediaBrowser.Controller/Channels/IChannelItem.cs2
-rw-r--r--MediaBrowser.Controller/Channels/IChannelManager.cs8
-rw-r--r--MediaBrowser.Controller/Channels/IChannelMediaItem.cs6
-rw-r--r--MediaBrowser.Controller/Entities/AdultVideo.cs4
-rw-r--r--MediaBrowser.Controller/Entities/Audio/Audio.cs4
-rw-r--r--MediaBrowser.Controller/Entities/BaseItem.cs7
-rw-r--r--MediaBrowser.Controller/Entities/Folder.cs5
-rw-r--r--MediaBrowser.Controller/Entities/Movies/Movie.cs4
-rw-r--r--MediaBrowser.Controller/Entities/MusicVideo.cs8
-rw-r--r--MediaBrowser.Controller/Entities/Trailer.cs4
-rw-r--r--MediaBrowser.Controller/Providers/BaseItemXmlParser.cs84
-rw-r--r--MediaBrowser.Controller/Providers/ILocalMetadataProvider.cs3
-rw-r--r--MediaBrowser.Controller/Providers/MetadataRefreshOptions.cs17
-rw-r--r--MediaBrowser.Controller/Session/ISessionController.cs10
-rw-r--r--MediaBrowser.Controller/Session/SessionInfo.cs13
-rw-r--r--MediaBrowser.Controller/Subtitles/ISubtitleManager.cs25
-rw-r--r--MediaBrowser.Controller/Subtitles/SubtitleResponse.cs1
-rw-r--r--MediaBrowser.Controller/Subtitles/SubtitleSearchRequest.cs3
25 files changed, 232 insertions, 56 deletions
diff --git a/MediaBrowser.Controller/Channels/Channel.cs b/MediaBrowser.Controller/Channels/Channel.cs
index b894893c6c..3d9d0d381d 100644
--- a/MediaBrowser.Controller/Channels/Channel.cs
+++ b/MediaBrowser.Controller/Channels/Channel.cs
@@ -10,7 +10,7 @@ namespace MediaBrowser.Controller.Channels
public override bool IsVisible(User user)
{
- if (user.Configuration.BlockedChannels.Contains(Name, StringComparer.OrdinalIgnoreCase))
+ if (user.Configuration.BlockedChannels.Contains(Id.ToString("N"), StringComparer.OrdinalIgnoreCase))
{
return false;
}
diff --git a/MediaBrowser.Controller/Channels/ChannelAudioItem.cs b/MediaBrowser.Controller/Channels/ChannelAudioItem.cs
index 72a996b193..6d32f7d356 100644
--- a/MediaBrowser.Controller/Channels/ChannelAudioItem.cs
+++ b/MediaBrowser.Controller/Channels/ChannelAudioItem.cs
@@ -1,6 +1,8 @@
-using System.Linq;
-using MediaBrowser.Controller.Entities.Audio;
+using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Model.Configuration;
+using MediaBrowser.Model.Entities;
+using System.Collections.Generic;
+using System.Linq;
namespace MediaBrowser.Controller.Channels
{
@@ -18,6 +20,8 @@ namespace MediaBrowser.Controller.Channels
public string OriginalImageUrl { get; set; }
+ public List<ChannelMediaInfo> ChannelMediaSources { get; set; }
+
protected override bool GetBlockUnratedValue(UserConfiguration config)
{
return config.BlockUnratedItems.Contains(UnratedItem.ChannelContent);
@@ -30,5 +34,23 @@ namespace MediaBrowser.Controller.Channels
return false;
}
}
+
+ public ChannelAudioItem()
+ {
+ ChannelMediaSources = new List<ChannelMediaInfo>();
+ }
+
+ public override LocationType LocationType
+ {
+ get
+ {
+ if (string.IsNullOrEmpty(Path))
+ {
+ return LocationType.Remote;
+ }
+
+ return base.LocationType;
+ }
+ }
}
}
diff --git a/MediaBrowser.Controller/Channels/ChannelCategoryItem.cs b/MediaBrowser.Controller/Channels/ChannelCategoryItem.cs
index b20dcf6204..c18f748563 100644
--- a/MediaBrowser.Controller/Channels/ChannelCategoryItem.cs
+++ b/MediaBrowser.Controller/Channels/ChannelCategoryItem.cs
@@ -1,5 +1,6 @@
using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.Configuration;
+using System.Collections.Generic;
namespace MediaBrowser.Controller.Channels
{
@@ -8,10 +9,11 @@ namespace MediaBrowser.Controller.Channels
public string ExternalId { get; set; }
public string ChannelId { get; set; }
-
+
public ChannelItemType ChannelItemType { get; set; }
public string OriginalImageUrl { get; set; }
+ public List<string> Tags { get; set; }
protected override bool GetBlockUnratedValue(UserConfiguration config)
{
@@ -26,5 +28,10 @@ namespace MediaBrowser.Controller.Channels
return false;
}
}
+
+ public ChannelCategoryItem()
+ {
+ Tags = new List<string>();
+ }
}
}
diff --git a/MediaBrowser.Controller/Channels/ChannelItemInfo.cs b/MediaBrowser.Controller/Channels/ChannelItemInfo.cs
index 7bb8d15fc3..948754e49e 100644
--- a/MediaBrowser.Controller/Channels/ChannelItemInfo.cs
+++ b/MediaBrowser.Controller/Channels/ChannelItemInfo.cs
@@ -19,6 +19,7 @@ namespace MediaBrowser.Controller.Channels
public List<string> Genres { get; set; }
public List<string> Studios { get; set; }
+ public List<string> Tags { get; set; }
public List<PersonInfo> People { get; set; }
@@ -49,6 +50,7 @@ namespace MediaBrowser.Controller.Channels
Genres = new List<string>();
Studios = new List<string>();
People = new List<PersonInfo>();
+ Tags = new List<string>();
ProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
}
}
diff --git a/MediaBrowser.Controller/Channels/ChannelMediaInfo.cs b/MediaBrowser.Controller/Channels/ChannelMediaInfo.cs
index 8105bf43cd..3630342679 100644
--- a/MediaBrowser.Controller/Channels/ChannelMediaInfo.cs
+++ b/MediaBrowser.Controller/Channels/ChannelMediaInfo.cs
@@ -18,9 +18,12 @@ namespace MediaBrowser.Controller.Channels
public int? Height { get; set; }
public int? AudioChannels { get; set; }
+ public bool IsRemote { get; set; }
+
public ChannelMediaInfo()
{
RequiredHttpHeaders = new Dictionary<string, string>();
+ IsRemote = true;
}
}
} \ No newline at end of file
diff --git a/MediaBrowser.Controller/Channels/ChannelVideoItem.cs b/MediaBrowser.Controller/Channels/ChannelVideoItem.cs
index 0d2bd933be..01438bfad6 100644
--- a/MediaBrowser.Controller/Channels/ChannelVideoItem.cs
+++ b/MediaBrowser.Controller/Channels/ChannelVideoItem.cs
@@ -1,6 +1,7 @@
using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities;
+using System.Collections.Generic;
using System.Globalization;
using System.Linq;
@@ -20,6 +21,8 @@ namespace MediaBrowser.Controller.Channels
public string OriginalImageUrl { get; set; }
+ public List<ChannelMediaInfo> ChannelMediaSources { get; set; }
+
public override string GetUserDataKey()
{
if (ContentType == ChannelMediaContentType.Trailer)
@@ -55,5 +58,23 @@ namespace MediaBrowser.Controller.Channels
return false;
}
}
+
+ public ChannelVideoItem()
+ {
+ ChannelMediaSources = new List<ChannelMediaInfo>();
+ }
+
+ public override LocationType LocationType
+ {
+ get
+ {
+ if (string.IsNullOrEmpty(Path))
+ {
+ return LocationType.Remote;
+ }
+
+ return base.LocationType;
+ }
+ }
}
}
diff --git a/MediaBrowser.Controller/Channels/IChannel.cs b/MediaBrowser.Controller/Channels/IChannel.cs
index bd0bd64ea6..85744119ca 100644
--- a/MediaBrowser.Controller/Channels/IChannel.cs
+++ b/MediaBrowser.Controller/Channels/IChannel.cs
@@ -16,6 +16,12 @@ namespace MediaBrowser.Controller.Channels
string Name { get; }
/// <summary>
+ /// Gets the data version.
+ /// </summary>
+ /// <value>The data version.</value>
+ string DataVersion { get; }
+
+ /// <summary>
/// Gets the channel information.
/// </summary>
/// <returns>ChannelInfo.</returns>
@@ -59,4 +65,15 @@ namespace MediaBrowser.Controller.Channels
/// <returns>IEnumerable{ImageType}.</returns>
IEnumerable<ImageType> GetSupportedChannelImages();
}
+
+ public interface IRequiresMediaInfoCallback
+ {
+ /// <summary>
+ /// Gets the channel item media information.
+ /// </summary>
+ /// <param name="id">The identifier.</param>
+ /// <param name="cancellationToken">The cancellation token.</param>
+ /// <returns>Task{IEnumerable{ChannelMediaInfo}}.</returns>
+ Task<IEnumerable<ChannelMediaInfo>> GetChannelItemMediaInfo(string id, CancellationToken cancellationToken);
+ }
}
diff --git a/MediaBrowser.Controller/Channels/IChannelItem.cs b/MediaBrowser.Controller/Channels/IChannelItem.cs
index fc088b8886..8b97701138 100644
--- a/MediaBrowser.Controller/Channels/IChannelItem.cs
+++ b/MediaBrowser.Controller/Channels/IChannelItem.cs
@@ -2,7 +2,7 @@
namespace MediaBrowser.Controller.Channels
{
- public interface IChannelItem : IHasImages
+ public interface IChannelItem : IHasImages, IHasTags
{
string ChannelId { get; set; }
diff --git a/MediaBrowser.Controller/Channels/IChannelManager.cs b/MediaBrowser.Controller/Channels/IChannelManager.cs
index 05f9afcf00..a47f6e6aee 100644
--- a/MediaBrowser.Controller/Channels/IChannelManager.cs
+++ b/MediaBrowser.Controller/Channels/IChannelManager.cs
@@ -31,5 +31,13 @@ namespace MediaBrowser.Controller.Channels
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{QueryResult{BaseItemDto}}.</returns>
Task<QueryResult<BaseItemDto>> GetChannelItems(ChannelItemQuery query, CancellationToken cancellationToken);
+
+ /// <summary>
+ /// Gets the channel item media sources.
+ /// </summary>
+ /// <param name="id">The identifier.</param>
+ /// <param name="cancellationToken">The cancellation token.</param>
+ /// <returns>Task{IEnumerable{ChannelMediaInfo}}.</returns>
+ Task<IEnumerable<ChannelMediaInfo>> GetChannelItemMediaSources(string id, CancellationToken cancellationToken);
}
}
diff --git a/MediaBrowser.Controller/Channels/IChannelMediaItem.cs b/MediaBrowser.Controller/Channels/IChannelMediaItem.cs
index 3a2c076e0a..1e634027f0 100644
--- a/MediaBrowser.Controller/Channels/IChannelMediaItem.cs
+++ b/MediaBrowser.Controller/Channels/IChannelMediaItem.cs
@@ -1,9 +1,13 @@
-namespace MediaBrowser.Controller.Channels
+using System.Collections.Generic;
+
+namespace MediaBrowser.Controller.Channels
{
public interface IChannelMediaItem : IChannelItem
{
bool IsInfiniteStream { get; set; }
ChannelMediaContentType ContentType { get; set; }
+
+ List<ChannelMediaInfo> ChannelMediaSources { get; set; }
}
} \ No newline at end of file
diff --git a/MediaBrowser.Controller/Entities/AdultVideo.cs b/MediaBrowser.Controller/Entities/AdultVideo.cs
index 9791f7cf79..00270accf1 100644
--- a/MediaBrowser.Controller/Entities/AdultVideo.cs
+++ b/MediaBrowser.Controller/Entities/AdultVideo.cs
@@ -3,7 +3,7 @@ using MediaBrowser.Controller.Providers;
namespace MediaBrowser.Controller.Entities
{
- public class AdultVideo : Video, IHasPreferredMetadataLanguage, IHasTaglines
+ public class AdultVideo : Video, IHasProductionLocations, IHasPreferredMetadataLanguage, IHasTaglines
{
/// <summary>
/// Gets or sets the preferred metadata language.
@@ -16,12 +16,14 @@ namespace MediaBrowser.Controller.Entities
/// </summary>
/// <value>The preferred metadata country code.</value>
public string PreferredMetadataCountryCode { get; set; }
+ public List<string> ProductionLocations { get; set; }
public List<string> Taglines { get; set; }
public AdultVideo()
{
Taglines = new List<string>();
+ ProductionLocations = new List<string>();
}
public override bool BeforeMetadataRefresh()
diff --git a/MediaBrowser.Controller/Entities/Audio/Audio.cs b/MediaBrowser.Controller/Entities/Audio/Audio.cs
index 40b52b8861..dca645a750 100644
--- a/MediaBrowser.Controller/Entities/Audio/Audio.cs
+++ b/MediaBrowser.Controller/Entities/Audio/Audio.cs
@@ -10,16 +10,18 @@ namespace MediaBrowser.Controller.Entities.Audio
/// <summary>
/// Class Audio
/// </summary>
- public class Audio : BaseItem, IHasMediaStreams, IHasAlbumArtist, IHasArtist, IHasMusicGenres, IHasLookupInfo<SongInfo>
+ public class Audio : BaseItem, IHasMediaStreams, IHasAlbumArtist, IHasArtist, IHasMusicGenres, IHasLookupInfo<SongInfo>, IHasTags
{
public string FormatName { get; set; }
public long? Size { get; set; }
public string Container { get; set; }
public int? TotalBitrate { get; set; }
+ public List<string> Tags { get; set; }
public Audio()
{
Artists = new List<string>();
+ Tags = new List<string>();
}
/// <summary>
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs
index 3a0b251eef..52c6e951ee 100644
--- a/MediaBrowser.Controller/Entities/BaseItem.cs
+++ b/MediaBrowser.Controller/Entities/BaseItem.cs
@@ -1501,6 +1501,13 @@ namespace MediaBrowser.Controller.Entities
return userdata != null && userdata.Played;
}
+ public bool IsFavoriteOrLiked(User user)
+ {
+ var userdata = UserDataManager.GetUserData(user.Id, GetUserDataKey());
+
+ return userdata != null && (userdata.IsFavorite || (userdata.Likes ?? false));
+ }
+
public virtual bool IsUnplayed(User user)
{
var userdata = UserDataManager.GetUserData(user.Id, GetUserDataKey());
diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs
index 21b34c7338..e4d9355d28 100644
--- a/MediaBrowser.Controller/Entities/Folder.cs
+++ b/MediaBrowser.Controller/Entities/Folder.cs
@@ -281,7 +281,10 @@ namespace MediaBrowser.Controller.Entities
{
if (this is ICollectionFolder)
{
- if (user.Configuration.BlockedMediaFolders.Contains(Name, StringComparer.OrdinalIgnoreCase))
+ if (user.Configuration.BlockedMediaFolders.Contains(Id.ToString("N"), StringComparer.OrdinalIgnoreCase) ||
+
+ // Backwards compatibility
+ user.Configuration.BlockedMediaFolders.Contains(Name, StringComparer.OrdinalIgnoreCase))
{
return false;
}
diff --git a/MediaBrowser.Controller/Entities/Movies/Movie.cs b/MediaBrowser.Controller/Entities/Movies/Movie.cs
index f53b676105..5510c795a0 100644
--- a/MediaBrowser.Controller/Entities/Movies/Movie.cs
+++ b/MediaBrowser.Controller/Entities/Movies/Movie.cs
@@ -14,7 +14,7 @@ namespace MediaBrowser.Controller.Entities.Movies
/// <summary>
/// Class Movie
/// </summary>
- public class Movie : Video, IHasCriticRating, IHasSoundtracks, IHasBudget, IHasKeywords, IHasTrailers, IHasThemeMedia, IHasTaglines, IHasPreferredMetadataLanguage, IHasAwards, IHasMetascore, IHasLookupInfo<MovieInfo>, ISupportsBoxSetGrouping
+ public class Movie : Video, IHasCriticRating, IHasSoundtracks, IHasProductionLocations, IHasBudget, IHasKeywords, IHasTrailers, IHasThemeMedia, IHasTaglines, IHasPreferredMetadataLanguage, IHasAwards, IHasMetascore, IHasLookupInfo<MovieInfo>, ISupportsBoxSetGrouping
{
public List<Guid> SpecialFeatureIds { get; set; }
@@ -22,6 +22,7 @@ namespace MediaBrowser.Controller.Entities.Movies
public List<Guid> ThemeSongIds { get; set; }
public List<Guid> ThemeVideoIds { get; set; }
+ public List<string> ProductionLocations { get; set; }
/// <summary>
/// This is just a cache to enable quick access by Id
@@ -48,6 +49,7 @@ namespace MediaBrowser.Controller.Entities.Movies
BoxSetIdList = new List<Guid>();
Taglines = new List<string>();
Keywords = new List<string>();
+ ProductionLocations = new List<string>();
}
public string AwardSummary { get; set; }
diff --git a/MediaBrowser.Controller/Entities/MusicVideo.cs b/MediaBrowser.Controller/Entities/MusicVideo.cs
index 554914ec6b..bbb2bc8755 100644
--- a/MediaBrowser.Controller/Entities/MusicVideo.cs
+++ b/MediaBrowser.Controller/Entities/MusicVideo.cs
@@ -9,7 +9,7 @@ using System.Runtime.Serialization;
namespace MediaBrowser.Controller.Entities
{
- public class MusicVideo : Video, IHasArtist, IHasMusicGenres, IHasBudget, IHasLookupInfo<MusicVideoInfo>
+ public class MusicVideo : Video, IHasArtist, IHasMusicGenres, IHasProductionLocations, IHasBudget, IHasLookupInfo<MusicVideoInfo>
{
/// <summary>
/// Gets or sets the artist.
@@ -34,6 +34,12 @@ namespace MediaBrowser.Controller.Entities
/// </summary>
/// <value>The revenue.</value>
public double? Revenue { get; set; }
+ public List<string> ProductionLocations { get; set; }
+
+ public MusicVideo()
+ {
+ ProductionLocations = new List<string>();
+ }
[IgnoreDataMember]
public List<string> AllArtists
diff --git a/MediaBrowser.Controller/Entities/Trailer.cs b/MediaBrowser.Controller/Entities/Trailer.cs
index 53ec030a78..569334ec3f 100644
--- a/MediaBrowser.Controller/Entities/Trailer.cs
+++ b/MediaBrowser.Controller/Entities/Trailer.cs
@@ -12,11 +12,12 @@ namespace MediaBrowser.Controller.Entities
/// <summary>
/// Class Trailer
/// </summary>
- public class Trailer : Video, IHasCriticRating, IHasSoundtracks, IHasBudget, IHasTrailers, IHasKeywords, IHasTaglines, IHasPreferredMetadataLanguage, IHasMetascore, IHasLookupInfo<TrailerInfo>
+ public class Trailer : Video, IHasCriticRating, IHasSoundtracks, IHasProductionLocations, IHasBudget, IHasTrailers, IHasKeywords, IHasTaglines, IHasPreferredMetadataLanguage, IHasMetascore, IHasLookupInfo<TrailerInfo>
{
public List<Guid> SoundtrackIds { get; set; }
public string PreferredMetadataLanguage { get; set; }
+ public List<string> ProductionLocations { get; set; }
/// <summary>
/// Gets or sets the preferred metadata country code.
@@ -31,6 +32,7 @@ namespace MediaBrowser.Controller.Entities
SoundtrackIds = new List<Guid>();
LocalTrailerIds = new List<Guid>();
Keywords = new List<string>();
+ ProductionLocations = new List<string>();
}
public float? Metascore { get; set; }
diff --git a/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs b/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs
index 48a639d4d4..41f994303b 100644
--- a/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs
+++ b/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs
@@ -62,34 +62,6 @@ namespace MediaBrowser.Controller.Providers
ValidationType = ValidationType.None
};
- var hasTaglines = item as IHasTaglines;
- if (hasTaglines != null)
- {
- hasTaglines.Taglines.Clear();
- }
-
- item.Studios.Clear();
- item.Genres.Clear();
- item.People.Clear();
-
- var hasTags = item as IHasTags;
- if (hasTags != null)
- {
- hasTags.Tags.Clear();
- }
-
- var hasKeywords = item as IHasKeywords;
- if (hasKeywords != null)
- {
- hasKeywords.Keywords.Clear();
- }
-
- var hasTrailers = item as IHasTrailers;
- if (hasTrailers != null)
- {
- hasTrailers.RemoteTrailers.Clear();
- }
-
//Fetch(item, metadataFile, settings, Encoding.GetEncoding("ISO-8859-1"), cancellationToken);
Fetch(item, metadataFile, settings, Encoding.UTF8, cancellationToken);
}
@@ -373,6 +345,15 @@ namespace MediaBrowser.Controller.Providers
break;
}
+ case "Countries":
+ {
+ using (var subtree = reader.ReadSubtree())
+ {
+ FetchFromCountriesNode(subtree, item);
+ }
+ break;
+ }
+
case "ContentRating":
case "MPAARating":
{
@@ -857,6 +838,42 @@ namespace MediaBrowser.Controller.Providers
}
}
+ private void FetchFromCountriesNode(XmlReader reader, T item)
+ {
+ reader.MoveToContent();
+
+ while (reader.Read())
+ {
+ if (reader.NodeType == XmlNodeType.Element)
+ {
+ switch (reader.Name)
+ {
+ case "Country":
+ {
+ var val = reader.ReadElementContentAsString();
+
+ if (!string.IsNullOrWhiteSpace(val))
+ {
+ var hasProductionLocations = item as IHasProductionLocations;
+ if (hasProductionLocations != null)
+ {
+ if (!string.IsNullOrWhiteSpace(val))
+ {
+ hasProductionLocations.AddProductionLocation(val);
+ }
+ }
+ }
+ break;
+ }
+
+ default:
+ reader.Skip();
+ break;
+ }
+ }
+ }
+ }
+
/// <summary>
/// Fetches from taglines node.
/// </summary>
@@ -1059,16 +1076,13 @@ namespace MediaBrowser.Controller.Providers
}
}
- protected async Task FetchChaptersFromXmlNode(BaseItem item, XmlReader reader, IItemRepository repository, CancellationToken cancellationToken)
+ protected List<ChapterInfo> FetchChaptersFromXmlNode(BaseItem item, XmlReader reader)
{
- var runtime = item.RunTimeTicks ?? 0;
-
using (reader)
{
- var chapters = GetChaptersFromXmlNode(reader)
- .Where(i => i.StartPositionTicks >= 0 && i.StartPositionTicks < runtime);
-
- await repository.SaveChapters(item.Id, chapters, cancellationToken).ConfigureAwait(false);
+ return GetChaptersFromXmlNode(reader)
+ .Where(i => i.StartPositionTicks >= 0)
+ .ToList();
}
}
diff --git a/MediaBrowser.Controller/Providers/ILocalMetadataProvider.cs b/MediaBrowser.Controller/Providers/ILocalMetadataProvider.cs
index a7c1e6e1b8..1320db67a0 100644
--- a/MediaBrowser.Controller/Providers/ILocalMetadataProvider.cs
+++ b/MediaBrowser.Controller/Providers/ILocalMetadataProvider.cs
@@ -1,4 +1,5 @@
using MediaBrowser.Controller.Entities;
+using MediaBrowser.Model.Entities;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
@@ -35,10 +36,12 @@ namespace MediaBrowser.Controller.Providers
public T Item { get; set; }
public List<LocalImageInfo> Images { get; set; }
+ public List<ChapterInfo> Chapters { get; set; }
public LocalMetadataResult()
{
Images = new List<LocalImageInfo>();
+ Chapters = new List<ChapterInfo>();
}
}
}
diff --git a/MediaBrowser.Controller/Providers/MetadataRefreshOptions.cs b/MediaBrowser.Controller/Providers/MetadataRefreshOptions.cs
index 780aa6a568..35e86fb87c 100644
--- a/MediaBrowser.Controller/Providers/MetadataRefreshOptions.cs
+++ b/MediaBrowser.Controller/Providers/MetadataRefreshOptions.cs
@@ -34,17 +34,22 @@ namespace MediaBrowser.Controller.Providers
/// <summary>
/// Providers will be executed based on default rules
/// </summary>
- EnsureMetadata,
+ EnsureMetadata = 0,
/// <summary>
/// No providers will be executed
/// </summary>
- None,
+ None = 1,
/// <summary>
/// All providers will be executed to search for new metadata
/// </summary>
- FullRefresh
+ FullRefresh = 2,
+
+ /// <summary>
+ /// The validation only
+ /// </summary>
+ ValidationOnly = 3
}
public enum ImageRefreshMode
@@ -52,16 +57,16 @@ namespace MediaBrowser.Controller.Providers
/// <summary>
/// The default
/// </summary>
- Default,
+ Default = 0,
/// <summary>
/// Existing images will be validated
/// </summary>
- ValidationOnly,
+ ValidationOnly = 1,
/// <summary>
/// All providers will be executed to search for new metadata
/// </summary>
- FullRefresh
+ FullRefresh = 2
}
}
diff --git a/MediaBrowser.Controller/Session/ISessionController.cs b/MediaBrowser.Controller/Session/ISessionController.cs
index 1b50bad47d..d6dd7698e6 100644
--- a/MediaBrowser.Controller/Session/ISessionController.cs
+++ b/MediaBrowser.Controller/Session/ISessionController.cs
@@ -1,5 +1,6 @@
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Session;
+using MediaBrowser.Model.System;
using System.Threading;
using System.Threading.Tasks;
@@ -14,6 +15,12 @@ namespace MediaBrowser.Controller.Session
bool IsSessionActive { get; }
/// <summary>
+ /// Gets a value indicating whether [supports media remote control].
+ /// </summary>
+ /// <value><c>true</c> if [supports media remote control]; otherwise, <c>false</c>.</value>
+ bool SupportsMediaControl { get; }
+
+ /// <summary>
/// Sends the play command.
/// </summary>
/// <param name="command">The command.</param>
@@ -48,9 +55,10 @@ namespace MediaBrowser.Controller.Session
/// <summary>
/// Sends the restart required message.
/// </summary>
+ /// <param name="info">The information.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
- Task SendRestartRequiredNotification(CancellationToken cancellationToken);
+ Task SendRestartRequiredNotification(SystemInfo info, CancellationToken cancellationToken);
/// <summary>
/// Sends the user data change info.
diff --git a/MediaBrowser.Controller/Session/SessionInfo.cs b/MediaBrowser.Controller/Session/SessionInfo.cs
index 9f5b687cc4..bc0f8a5d16 100644
--- a/MediaBrowser.Controller/Session/SessionInfo.cs
+++ b/MediaBrowser.Controller/Session/SessionInfo.cs
@@ -139,6 +139,19 @@ namespace MediaBrowser.Controller.Session
}
}
+ public bool SupportsMediaControl
+ {
+ get
+ {
+ if (SessionController != null)
+ {
+ return SessionController.SupportsMediaControl;
+ }
+
+ return false;
+ }
+ }
+
public bool ContainsUser(Guid userId)
{
return (UserId ?? Guid.Empty) == UserId || AdditionalUsers.Any(i => userId == new Guid(i.UserId));
diff --git a/MediaBrowser.Controller/Subtitles/ISubtitleManager.cs b/MediaBrowser.Controller/Subtitles/ISubtitleManager.cs
index 8b0ef223c3..1d66d1505b 100644
--- a/MediaBrowser.Controller/Subtitles/ISubtitleManager.cs
+++ b/MediaBrowser.Controller/Subtitles/ISubtitleManager.cs
@@ -39,12 +39,33 @@ namespace MediaBrowser.Controller.Subtitles
/// </summary>
/// <param name="video">The video.</param>
/// <param name="subtitleId">The subtitle identifier.</param>
- /// <param name="providerName">Name of the provider.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
Task DownloadSubtitles(Video video,
string subtitleId,
- string providerName,
CancellationToken cancellationToken);
+
+ /// <summary>
+ /// Gets the remote subtitles.
+ /// </summary>
+ /// <param name="id">The identifier.</param>
+ /// <param name="cancellationToken">The cancellation token.</param>
+ /// <returns>Task{SubtitleResponse}.</returns>
+ Task<SubtitleResponse> GetRemoteSubtitles(string id, CancellationToken cancellationToken);
+
+ /// <summary>
+ /// Deletes the subtitles.
+ /// </summary>
+ /// <param name="itemId">The item identifier.</param>
+ /// <param name="index">The index.</param>
+ /// <returns>Task.</returns>
+ Task DeleteSubtitles(string itemId, int index);
+
+ /// <summary>
+ /// Gets the providers.
+ /// </summary>
+ /// <param name="itemId">The item identifier.</param>
+ /// <returns>IEnumerable{SubtitleProviderInfo}.</returns>
+ IEnumerable<SubtitleProviderInfo> GetProviders(string itemId);
}
}
diff --git a/MediaBrowser.Controller/Subtitles/SubtitleResponse.cs b/MediaBrowser.Controller/Subtitles/SubtitleResponse.cs
index 69e92c1f58..e2f6dfc97b 100644
--- a/MediaBrowser.Controller/Subtitles/SubtitleResponse.cs
+++ b/MediaBrowser.Controller/Subtitles/SubtitleResponse.cs
@@ -6,6 +6,7 @@ namespace MediaBrowser.Controller.Subtitles
{
public string Language { get; set; }
public string Format { get; set; }
+ public bool IsForced { get; set; }
public Stream Stream { get; set; }
}
} \ No newline at end of file
diff --git a/MediaBrowser.Controller/Subtitles/SubtitleSearchRequest.cs b/MediaBrowser.Controller/Subtitles/SubtitleSearchRequest.cs
index e833871298..e781c048b9 100644
--- a/MediaBrowser.Controller/Subtitles/SubtitleSearchRequest.cs
+++ b/MediaBrowser.Controller/Subtitles/SubtitleSearchRequest.cs
@@ -21,8 +21,11 @@ namespace MediaBrowser.Controller.Subtitles
public long? RuntimeTicks { get; set; }
public Dictionary<string, string> ProviderIds { get; set; }
+ public bool SearchAllProviders { get; set; }
+
public SubtitleSearchRequest()
{
+ SearchAllProviders = true;
ProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
}
}