aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller
diff options
context:
space:
mode:
authorTim Hobbs <jesus.tesh@gmail.com>2014-03-05 04:27:13 -0800
committerTim Hobbs <jesus.tesh@gmail.com>2014-03-05 04:27:13 -0800
commit482fde658746750075ff8a562ca1fb88f1739ef4 (patch)
tree7bd5084ffa6be20a4533eb37d94f852f2d888a84 /MediaBrowser.Controller
parent604f971477da4dca5247f7d531323175ad044150 (diff)
parent9396f16aed2f304789324afc83e0c9f385c5f00a (diff)
Merge branch 'master' of https://github.com/MediaBrowser/MediaBrowser
Conflicts: MediaBrowser.WebDashboard/dashboard-ui/scripts/mediaplayer.js
Diffstat (limited to 'MediaBrowser.Controller')
-rw-r--r--MediaBrowser.Controller/Entities/BaseItem.cs2
-rw-r--r--MediaBrowser.Controller/Entities/CollectionFolder.cs4
-rw-r--r--MediaBrowser.Controller/Entities/Folder.cs22
-rw-r--r--MediaBrowser.Controller/Entities/Game.cs8
-rw-r--r--MediaBrowser.Controller/Entities/IHasMetadata.cs12
-rw-r--r--MediaBrowser.Controller/Entities/ISupportsPlaceHolders.cs12
-rw-r--r--MediaBrowser.Controller/Entities/TV/Episode.cs2
-rw-r--r--MediaBrowser.Controller/Entities/Video.cs18
-rw-r--r--MediaBrowser.Controller/Library/TVUtils.cs7
-rw-r--r--MediaBrowser.Controller/MediaBrowser.Controller.csproj1
-rw-r--r--MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.cs17
-rw-r--r--MediaBrowser.Controller/Providers/BaseItemXmlParser.cs1
-rw-r--r--MediaBrowser.Controller/Providers/ICustomMetadataProvider.cs5
-rw-r--r--MediaBrowser.Controller/Providers/IProviderManager.cs12
-rw-r--r--MediaBrowser.Controller/Providers/IRemoteMetadataProvider.cs11
-rw-r--r--MediaBrowser.Controller/Resolvers/BaseVideoResolver.cs31
-rw-r--r--MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs18
17 files changed, 143 insertions, 40 deletions
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs
index 9d520cf6f..923673bd8 100644
--- a/MediaBrowser.Controller/Entities/BaseItem.cs
+++ b/MediaBrowser.Controller/Entities/BaseItem.cs
@@ -229,6 +229,8 @@ namespace MediaBrowser.Controller.Entities
}
}
+ public bool IsUnidentified { get; set; }
+
/// <summary>
/// Gets or sets the locked fields.
/// </summary>
diff --git a/MediaBrowser.Controller/Entities/CollectionFolder.cs b/MediaBrowser.Controller/Entities/CollectionFolder.cs
index 2d47cf632..6628ffc23 100644
--- a/MediaBrowser.Controller/Entities/CollectionFolder.cs
+++ b/MediaBrowser.Controller/Entities/CollectionFolder.cs
@@ -149,7 +149,7 @@ namespace MediaBrowser.Controller.Entities
try
{
- locationsDicionary = PhysicalLocations.Distinct().ToDictionary(i => i, StringComparer.OrdinalIgnoreCase);
+ locationsDicionary = PhysicalLocations.Distinct(StringComparer.OrdinalIgnoreCase).ToDictionary(i => i, StringComparer.OrdinalIgnoreCase);
}
catch (IOException ex)
{
@@ -181,7 +181,7 @@ namespace MediaBrowser.Controller.Entities
try
{
- locationsDicionary = PhysicalLocations.Distinct().ToDictionary(i => i, StringComparer.OrdinalIgnoreCase);
+ locationsDicionary = PhysicalLocations.Distinct(StringComparer.OrdinalIgnoreCase).ToDictionary(i => i, StringComparer.OrdinalIgnoreCase);
}
catch (IOException ex)
{
diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs
index 522bc3a2d..627f657ab 100644
--- a/MediaBrowser.Controller/Entities/Folder.cs
+++ b/MediaBrowser.Controller/Entities/Folder.cs
@@ -352,6 +352,26 @@ namespace MediaBrowser.Controller.Entities
return dictionary;
}
+ private bool IsValidFromResolver(BaseItem current, BaseItem newItem)
+ {
+ var currentAsPlaceHolder = current as ISupportsPlaceHolders;
+
+ if (currentAsPlaceHolder != null)
+ {
+ var newHasPlaceHolder = newItem as ISupportsPlaceHolders;
+
+ if (newHasPlaceHolder != null)
+ {
+ if (currentAsPlaceHolder.IsPlaceHolder != newHasPlaceHolder.IsPlaceHolder)
+ {
+ return false;
+ }
+ }
+ }
+
+ return current.IsInMixedFolder == newItem.IsInMixedFolder;
+ }
+
/// <summary>
/// Validates the children internal.
/// </summary>
@@ -401,7 +421,7 @@ namespace MediaBrowser.Controller.Entities
{
BaseItem currentChild;
- if (currentChildren.TryGetValue(child.Id, out currentChild) && child.IsInMixedFolder == currentChild.IsInMixedFolder)
+ if (currentChildren.TryGetValue(child.Id, out currentChild) && IsValidFromResolver(currentChild, child))
{
var currentChildLocationType = currentChild.LocationType;
if (currentChildLocationType != LocationType.Remote &&
diff --git a/MediaBrowser.Controller/Entities/Game.cs b/MediaBrowser.Controller/Entities/Game.cs
index e490a59cd..062bdfa88 100644
--- a/MediaBrowser.Controller/Entities/Game.cs
+++ b/MediaBrowser.Controller/Entities/Game.cs
@@ -7,7 +7,7 @@ using System.Linq;
namespace MediaBrowser.Controller.Entities
{
- public class Game : BaseItem, IHasSoundtracks, IHasTrailers, IHasThemeMedia, IHasTags, IHasScreenshots, IHasPreferredMetadataLanguage, IHasLookupInfo<GameInfo>
+ public class Game : BaseItem, IHasSoundtracks, IHasTrailers, IHasThemeMedia, IHasTags, IHasScreenshots, ISupportsPlaceHolders, IHasPreferredMetadataLanguage, IHasLookupInfo<GameInfo>
{
public List<Guid> SoundtrackIds { get; set; }
@@ -63,10 +63,10 @@ namespace MediaBrowser.Controller.Entities
public int? PlayersSupported { get; set; }
/// <summary>
- /// Gets or sets a value indicating whether this instance is installed on client.
+ /// Gets a value indicating whether this instance is place holder.
/// </summary>
- /// <value><c>true</c> if this instance is installed on client; otherwise, <c>false</c>.</value>
- public bool IsInstalledOnClient { get; set; }
+ /// <value><c>true</c> if this instance is place holder; otherwise, <c>false</c>.</value>
+ public bool IsPlaceHolder { get; set; }
/// <summary>
/// Gets or sets the game system.
diff --git a/MediaBrowser.Controller/Entities/IHasMetadata.cs b/MediaBrowser.Controller/Entities/IHasMetadata.cs
index 7182d086a..91f37135f 100644
--- a/MediaBrowser.Controller/Entities/IHasMetadata.cs
+++ b/MediaBrowser.Controller/Entities/IHasMetadata.cs
@@ -37,12 +37,6 @@ namespace MediaBrowser.Controller.Entities
DateTime DateLastSaved { get; set; }
/// <summary>
- /// Gets a value indicating whether this instance is in mixed folder.
- /// </summary>
- /// <value><c>true</c> if this instance is in mixed folder; otherwise, <c>false</c>.</value>
- bool IsInMixedFolder { get; }
-
- /// <summary>
/// Updates to repository.
/// </summary>
/// <param name="updateReason">The update reason.</param>
@@ -55,5 +49,11 @@ namespace MediaBrowser.Controller.Entities
/// </summary>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
bool BeforeMetadataRefresh();
+
+ /// <summary>
+ /// Gets or sets a value indicating whether this instance is unidentified.
+ /// </summary>
+ /// <value><c>true</c> if this instance is unidentified; otherwise, <c>false</c>.</value>
+ bool IsUnidentified { get; set; }
}
}
diff --git a/MediaBrowser.Controller/Entities/ISupportsPlaceHolders.cs b/MediaBrowser.Controller/Entities/ISupportsPlaceHolders.cs
new file mode 100644
index 000000000..2507c8ee6
--- /dev/null
+++ b/MediaBrowser.Controller/Entities/ISupportsPlaceHolders.cs
@@ -0,0 +1,12 @@
+
+namespace MediaBrowser.Controller.Entities
+{
+ public interface ISupportsPlaceHolders
+ {
+ /// <summary>
+ /// Gets a value indicating whether this instance is place holder.
+ /// </summary>
+ /// <value><c>true</c> if this instance is place holder; otherwise, <c>false</c>.</value>
+ bool IsPlaceHolder { get; }
+ }
+}
diff --git a/MediaBrowser.Controller/Entities/TV/Episode.cs b/MediaBrowser.Controller/Entities/TV/Episode.cs
index 4a3c82b46..503d1513c 100644
--- a/MediaBrowser.Controller/Entities/TV/Episode.cs
+++ b/MediaBrowser.Controller/Entities/TV/Episode.cs
@@ -185,7 +185,7 @@ namespace MediaBrowser.Controller.Entities.TV
{
get
{
- return LocationType == LocationType.Virtual && PremiereDate.HasValue && PremiereDate.Value < DateTime.UtcNow;
+ return LocationType == LocationType.Virtual && !IsUnaired;
}
}
diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.cs
index fa85f0edc..10034d7e5 100644
--- a/MediaBrowser.Controller/Entities/Video.cs
+++ b/MediaBrowser.Controller/Entities/Video.cs
@@ -16,7 +16,7 @@ namespace MediaBrowser.Controller.Entities
/// <summary>
/// Class Video
/// </summary>
- public class Video : BaseItem, IHasMediaStreams, IHasAspectRatio, IHasTags
+ public class Video : BaseItem, IHasMediaStreams, IHasAspectRatio, IHasTags, ISupportsPlaceHolders
{
public bool IsMultiPart { get; set; }
@@ -42,6 +42,8 @@ namespace MediaBrowser.Controller.Entities
/// <value><c>true</c> if this instance has subtitles; otherwise, <c>false</c>.</value>
public bool HasSubtitles { get; set; }
+ public bool IsPlaceHolder { get; set; }
+
/// <summary>
/// Gets or sets the tags.
/// </summary>
@@ -108,10 +110,13 @@ namespace MediaBrowser.Controller.Entities
return System.IO.Path.GetDirectoryName(Path);
}
- if (VideoType == VideoType.BluRay || VideoType == VideoType.Dvd ||
- VideoType == VideoType.HdDvd)
+ if (!IsPlaceHolder)
{
- return Path;
+ if (VideoType == VideoType.BluRay || VideoType == VideoType.Dvd ||
+ VideoType == VideoType.HdDvd)
+ {
+ return Path;
+ }
}
return base.ContainingFolderPath;
@@ -257,10 +262,7 @@ namespace MediaBrowser.Controller.Entities
{
if (!IsInMixedFolder)
{
- if (VideoType == VideoType.VideoFile || VideoType == VideoType.Iso)
- {
- return new[] { System.IO.Path.GetDirectoryName(Path) };
- }
+ return new[] { ContainingFolderPath };
}
return base.GetDeletePaths();
diff --git a/MediaBrowser.Controller/Library/TVUtils.cs b/MediaBrowser.Controller/Library/TVUtils.cs
index 82911117f..c64e4fa0c 100644
--- a/MediaBrowser.Controller/Library/TVUtils.cs
+++ b/MediaBrowser.Controller/Library/TVUtils.cs
@@ -234,9 +234,12 @@ namespace MediaBrowser.Controller.Library
{
var fullName = child.FullName;
- if (EntityResolutionHelper.IsVideoFile(fullName) && GetEpisodeNumberFromFile(fullName, false).HasValue)
+ if (EntityResolutionHelper.IsVideoFile(fullName) || EntityResolutionHelper.IsVideoPlaceHolder(fullName))
{
- return true;
+ if (GetEpisodeNumberFromFile(fullName, false).HasValue)
+ {
+ return true;
+ }
}
}
}
diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj
index c07693b36..ff446f2ef 100644
--- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj
+++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj
@@ -105,6 +105,7 @@
<Compile Include="Entities\ILibraryItem.cs" />
<Compile Include="Entities\ImageSourceInfo.cs" />
<Compile Include="Entities\IMetadataContainer.cs" />
+ <Compile Include="Entities\ISupportsPlaceHolders.cs" />
<Compile Include="Entities\ItemImageInfo.cs" />
<Compile Include="Entities\LinkedChild.cs" />
<Compile Include="Entities\MusicVideo.cs" />
diff --git a/MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.cs b/MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.cs
index b2b9e2af3..184033177 100644
--- a/MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.cs
+++ b/MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.cs
@@ -34,6 +34,7 @@ namespace MediaBrowser.Controller.MediaEncoding
{
case VideoType.BluRay:
type = InputType.Bluray;
+ inputPath = GetPlayableStreamFiles(inputPath[0], playableStreamFileNames).ToArray();
break;
case VideoType.Dvd:
type = InputType.Dvd;
@@ -46,6 +47,7 @@ namespace MediaBrowser.Controller.MediaEncoding
{
case IsoType.BluRay:
type = InputType.Bluray;
+ inputPath = GetPlayableStreamFiles(inputPath[0], playableStreamFileNames).ToArray();
break;
case IsoType.Dvd:
type = InputType.Dvd;
@@ -118,15 +120,16 @@ namespace MediaBrowser.Controller.MediaEncoding
return type;
}
- public static Model.Entities.MediaInfo GetMediaInfo(InternalMediaInfoResult data)
+ public static MediaInfo GetMediaInfo(InternalMediaInfoResult data)
{
var internalStreams = data.streams ?? new MediaStreamInfo[] { };
- var info = new Model.Entities.MediaInfo();
-
- info.MediaStreams = internalStreams.Select(s => GetMediaStream(s, data.format))
- .Where(i => i != null)
- .ToList();
+ var info = new MediaInfo
+ {
+ MediaStreams = internalStreams.Select(s => GetMediaStream(s, data.format))
+ .Where(i => i != null)
+ .ToList()
+ };
if (data.format != null)
{
@@ -137,7 +140,7 @@ namespace MediaBrowser.Controller.MediaEncoding
}
private static readonly CultureInfo UsCulture = new CultureInfo("en-US");
-
+
/// <summary>
/// Converts ffprobe stream info to our MediaStream class
/// </summary>
diff --git a/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs b/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs
index 0163dec20..d71c7af32 100644
--- a/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs
+++ b/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs
@@ -779,7 +779,6 @@ namespace MediaBrowser.Controller.Providers
break;
case "TMDbCollectionId":
- case "CollectionNumber":
var tmdbCollection = reader.ReadElementContentAsString();
if (!string.IsNullOrWhiteSpace(tmdbCollection))
{
diff --git a/MediaBrowser.Controller/Providers/ICustomMetadataProvider.cs b/MediaBrowser.Controller/Providers/ICustomMetadataProvider.cs
index c98810cbc..9aed4d921 100644
--- a/MediaBrowser.Controller/Providers/ICustomMetadataProvider.cs
+++ b/MediaBrowser.Controller/Providers/ICustomMetadataProvider.cs
@@ -14,4 +14,9 @@ namespace MediaBrowser.Controller.Providers
{
Task<ItemUpdateType> FetchAsync(TItemType item, IDirectoryService directoryService, CancellationToken cancellationToken);
}
+
+ public interface IPreRefreshProvider : ICustomMetadataProvider
+ {
+
+ }
}
diff --git a/MediaBrowser.Controller/Providers/IProviderManager.cs b/MediaBrowser.Controller/Providers/IProviderManager.cs
index 83ee6ae83..94b19498a 100644
--- a/MediaBrowser.Controller/Providers/IProviderManager.cs
+++ b/MediaBrowser.Controller/Providers/IProviderManager.cs
@@ -1,4 +1,5 @@
-using MediaBrowser.Controller.Entities;
+using MediaBrowser.Common.Net;
+using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities;
@@ -126,5 +127,14 @@ namespace MediaBrowser.Controller.Providers
CancellationToken cancellationToken)
where TItemType : BaseItem, new()
where TLookupType : ItemLookupInfo;
+
+ /// <summary>
+ /// Gets the search image.
+ /// </summary>
+ /// <param name="providerName">Name of the provider.</param>
+ /// <param name="url">The URL.</param>
+ /// <param name="cancellationToken">The cancellation token.</param>
+ /// <returns>Task{HttpResponseInfo}.</returns>
+ Task<HttpResponseInfo> GetSearchImage(string providerName, string url, CancellationToken cancellationToken);
}
} \ No newline at end of file
diff --git a/MediaBrowser.Controller/Providers/IRemoteMetadataProvider.cs b/MediaBrowser.Controller/Providers/IRemoteMetadataProvider.cs
index f00a22a3a..0ff7ee5a9 100644
--- a/MediaBrowser.Controller/Providers/IRemoteMetadataProvider.cs
+++ b/MediaBrowser.Controller/Providers/IRemoteMetadataProvider.cs
@@ -18,11 +18,8 @@ namespace MediaBrowser.Controller.Providers
Task<MetadataResult<TItemType>> GetMetadata(TLookupInfoType info, CancellationToken cancellationToken);
}
- public interface IRemoteSearchProvider<in TLookupInfoType> : IMetadataProvider
- where TLookupInfoType : ItemLookupInfo
+ public interface IRemoteSearchProvider : IMetadataProvider
{
- Task<IEnumerable<RemoteSearchResult>> GetSearchResults(TLookupInfoType searchInfo, CancellationToken cancellationToken);
-
/// <summary>
/// Gets the image response.
/// </summary>
@@ -31,6 +28,12 @@ namespace MediaBrowser.Controller.Providers
/// <returns>Task{HttpResponseInfo}.</returns>
Task<HttpResponseInfo> GetImageResponse(string url, CancellationToken cancellationToken);
}
+
+ public interface IRemoteSearchProvider<in TLookupInfoType> : IRemoteSearchProvider
+ where TLookupInfoType : ItemLookupInfo
+ {
+ Task<IEnumerable<RemoteSearchResult>> GetSearchResults(TLookupInfoType searchInfo, CancellationToken cancellationToken);
+ }
public class RemoteSearchQuery<T>
where T : ItemLookupInfo
diff --git a/MediaBrowser.Controller/Resolvers/BaseVideoResolver.cs b/MediaBrowser.Controller/Resolvers/BaseVideoResolver.cs
index aadaf5423..06bee2ad1 100644
--- a/MediaBrowser.Controller/Resolvers/BaseVideoResolver.cs
+++ b/MediaBrowser.Controller/Resolvers/BaseVideoResolver.cs
@@ -35,19 +35,44 @@ namespace MediaBrowser.Controller.Resolvers
// If the path is a file check for a matching extensions
if (!args.IsDirectory)
{
- if (EntityResolutionHelper.IsVideoFile(args.Path))
+ // http://wiki.xbmc.org/index.php?title=Media_stubs
+ var isPlaceHolder = EntityResolutionHelper.IsVideoPlaceHolder(args.Path);
+
+ if (EntityResolutionHelper.IsVideoFile(args.Path) || isPlaceHolder)
{
var extension = Path.GetExtension(args.Path);
var type = string.Equals(extension, ".iso", StringComparison.OrdinalIgnoreCase) || string.Equals(extension, ".img", StringComparison.OrdinalIgnoreCase) ?
VideoType.Iso : VideoType.VideoFile;
- return new TVideoType
+ var video = new TVideoType
{
VideoType = type,
Path = args.Path,
- IsInMixedFolder = true
+ IsInMixedFolder = true,
+ IsPlaceHolder = isPlaceHolder
};
+
+ if (isPlaceHolder)
+ {
+ if (args.Path.EndsWith("dvd.disc", StringComparison.OrdinalIgnoreCase))
+ {
+ video.VideoType = VideoType.Dvd;
+ }
+ else if (args.Path.EndsWith("hddvd.disc", StringComparison.OrdinalIgnoreCase))
+ {
+ video.VideoType = VideoType.HdDvd;
+ }
+ else if (args.Path.EndsWith("bluray.disc", StringComparison.OrdinalIgnoreCase) ||
+ args.Path.EndsWith("brrip.disc", StringComparison.OrdinalIgnoreCase) ||
+ args.Path.EndsWith("bd25.disc", StringComparison.OrdinalIgnoreCase) ||
+ args.Path.EndsWith("bd50.disc", StringComparison.OrdinalIgnoreCase))
+ {
+ video.VideoType = VideoType.BluRay;
+ }
+ }
+
+ return video;
}
}
diff --git a/MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs b/MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs
index 42b637140..0f93e8e8a 100644
--- a/MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs
+++ b/MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs
@@ -140,6 +140,24 @@ namespace MediaBrowser.Controller.Resolvers
}
/// <summary>
+ /// Determines whether [is place holder] [the specified path].
+ /// </summary>
+ /// <param name="path">The path.</param>
+ /// <returns><c>true</c> if [is place holder] [the specified path]; otherwise, <c>false</c>.</returns>
+ /// <exception cref="System.ArgumentNullException">path</exception>
+ public static bool IsVideoPlaceHolder(string path)
+ {
+ if (string.IsNullOrEmpty(path))
+ {
+ throw new ArgumentNullException("path");
+ }
+
+ var extension = Path.GetExtension(path);
+
+ return string.Equals(extension, ".disc", StringComparison.OrdinalIgnoreCase);
+ }
+
+ /// <summary>
/// Ensures DateCreated and DateModified have values
/// </summary>
/// <param name="fileSystem">The file system.</param>