mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
fix refresh of tv recordings
This commit is contained in:
parent
326fa5a670
commit
cf9ef0e43d
@ -69,17 +69,7 @@ namespace MediaBrowser.Api.Library
|
|||||||
public object Get(GetPhyscialPaths request)
|
public object Get(GetPhyscialPaths request)
|
||||||
{
|
{
|
||||||
var result = _libraryManager.RootFolder.Children
|
var result = _libraryManager.RootFolder.Children
|
||||||
.SelectMany(c =>
|
.SelectMany(c => c.PhysicalLocations)
|
||||||
{
|
|
||||||
var locationType = c.LocationType;
|
|
||||||
|
|
||||||
if (locationType != LocationType.Remote && locationType != LocationType.Virtual)
|
|
||||||
{
|
|
||||||
return c.PhysicalLocations;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new List<string>();
|
|
||||||
})
|
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
return ToOptimizedSerializedResultUsingCache(result);
|
return ToOptimizedSerializedResultUsingCache(result);
|
||||||
|
@ -243,8 +243,8 @@ namespace MediaBrowser.Api
|
|||||||
public object Get(GetFile request)
|
public object Get(GetFile request)
|
||||||
{
|
{
|
||||||
var item = _dtoService.GetItemByDtoId(request.Id);
|
var item = _dtoService.GetItemByDtoId(request.Id);
|
||||||
|
var locationType = item.LocationType;
|
||||||
if (item.LocationType == LocationType.Remote || item.LocationType == LocationType.Virtual)
|
if (locationType == LocationType.Remote || locationType == LocationType.Virtual)
|
||||||
{
|
{
|
||||||
throw new ArgumentException("This command cannot be used for remote or virtual items.");
|
throw new ArgumentException("This command cannot be used for remote or virtual items.");
|
||||||
}
|
}
|
||||||
@ -331,8 +331,7 @@ namespace MediaBrowser.Api
|
|||||||
{
|
{
|
||||||
if (item.Parent is AggregateFolder)
|
if (item.Parent is AggregateFolder)
|
||||||
{
|
{
|
||||||
return user.RootFolder.GetChildren(user, true).FirstOrDefault(i => i.LocationType == LocationType.FileSystem &&
|
return user.RootFolder.GetChildren(user, true).FirstOrDefault(i => i.PhysicalLocations.Contains(item.Path));
|
||||||
i.PhysicalLocations.Contains(item.Path));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
@ -442,12 +441,9 @@ namespace MediaBrowser.Api
|
|||||||
|
|
||||||
var parent = item.Parent;
|
var parent = item.Parent;
|
||||||
|
|
||||||
if (item.LocationType == LocationType.Offline)
|
var locationType = item.LocationType;
|
||||||
{
|
|
||||||
throw new InvalidOperationException(string.Format("{0} is currently offline.", item.Name));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item.LocationType == LocationType.FileSystem)
|
if (locationType == LocationType.FileSystem || locationType == LocationType.Offline)
|
||||||
{
|
{
|
||||||
foreach (var path in item.GetDeletePaths().ToList())
|
foreach (var path in item.GetDeletePaths().ToList())
|
||||||
{
|
{
|
||||||
|
@ -157,6 +157,16 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual bool SupportsLocalMetadata
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var locationType = LocationType;
|
||||||
|
|
||||||
|
return locationType == LocationType.FileSystem || locationType == LocationType.Offline;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This is just a helper for convenience
|
/// This is just a helper for convenience
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1052,50 +1052,17 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
throw new ArgumentNullException();
|
throw new ArgumentNullException();
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
if (string.Equals(Path, path, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
var locationType = LocationType;
|
return this;
|
||||||
|
|
||||||
if (locationType == LocationType.Remote && string.Equals(Path, path, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (locationType != LocationType.Virtual && PhysicalLocations.Contains(path, StringComparer.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (IOException ex)
|
|
||||||
{
|
|
||||||
Logger.ErrorException("Error getting ResolveArgs for {0}", ex, Path);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return RecursiveChildren.Where(i => i.LocationType != LocationType.Virtual).FirstOrDefault(i =>
|
if (PhysicalLocations.Contains(path, StringComparer.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
try
|
return this;
|
||||||
{
|
}
|
||||||
if (string.Equals(i.Path, path, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i.LocationType != LocationType.Remote)
|
return RecursiveChildren.FirstOrDefault(i => string.Equals(i.Path, path, StringComparison.OrdinalIgnoreCase) || i.PhysicalLocations.Contains(path, StringComparer.OrdinalIgnoreCase));
|
||||||
{
|
|
||||||
if (i.PhysicalLocations.Contains(path, StringComparer.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
catch (IOException ex)
|
|
||||||
{
|
|
||||||
Logger.ErrorException("Error getting ResolveArgs for {0}", ex, Path);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool IsPlayed(User user)
|
public override bool IsPlayed(User user)
|
||||||
|
@ -136,6 +136,12 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns><c>true</c> if [is save local metadata enabled]; otherwise, <c>false</c>.</returns>
|
/// <returns><c>true</c> if [is save local metadata enabled]; otherwise, <c>false</c>.</returns>
|
||||||
bool IsSaveLocalMetadataEnabled();
|
bool IsSaveLocalMetadataEnabled();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a value indicating whether [supports local metadata].
|
||||||
|
/// </summary>
|
||||||
|
/// <value><c>true</c> if [supports local metadata]; otherwise, <c>false</c>.</value>
|
||||||
|
bool SupportsLocalMetadata { get; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class HasImagesExtensions
|
public static class HasImagesExtensions
|
||||||
|
@ -185,7 +185,7 @@ namespace MediaBrowser.Controller.Entities.TV
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return LocationType == Model.Entities.LocationType.Virtual && PremiereDate.HasValue && PremiereDate.Value < DateTime.UtcNow;
|
return LocationType == LocationType.Virtual && PremiereDate.HasValue && PremiereDate.Value < DateTime.UtcNow;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,7 +198,7 @@ namespace MediaBrowser.Controller.Entities.TV
|
|||||||
[IgnoreDataMember]
|
[IgnoreDataMember]
|
||||||
public bool IsVirtualUnaired
|
public bool IsVirtualUnaired
|
||||||
{
|
{
|
||||||
get { return LocationType == Model.Entities.LocationType.Virtual && IsUnaired; }
|
get { return LocationType == LocationType.Virtual && IsUnaired; }
|
||||||
}
|
}
|
||||||
|
|
||||||
[IgnoreDataMember]
|
[IgnoreDataMember]
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
using MediaBrowser.Controller.Library;
|
||||||
using System.Linq;
|
|
||||||
using MediaBrowser.Controller.Providers;
|
using MediaBrowser.Controller.Providers;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.Entities
|
namespace MediaBrowser.Controller.Entities
|
||||||
{
|
{
|
||||||
@ -18,5 +19,18 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
{
|
{
|
||||||
return base.GetNonCachedChildren(directoryService).Concat(LibraryManager.RootFolder.VirtualChildren);
|
return base.GetNonCachedChildren(directoryService).Concat(LibraryManager.RootFolder.VirtualChildren);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override ItemUpdateType BeforeMetadataRefresh()
|
||||||
|
{
|
||||||
|
var updateType = base.BeforeMetadataRefresh();
|
||||||
|
|
||||||
|
if (string.Equals("default", Name, System.StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
Name = "Default Media Library";
|
||||||
|
updateType = updateType | ItemUpdateType.MetadataEdit;
|
||||||
|
}
|
||||||
|
|
||||||
|
return updateType;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,19 +25,6 @@ namespace MediaBrowser.Controller.LiveTv
|
|||||||
|
|
||||||
public string ServiceName { get; set; }
|
public string ServiceName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns the folder containing the item.
|
|
||||||
/// If the item is a folder, it returns the folder itself
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The containing folder path.</value>
|
|
||||||
public override string ContainingFolderPath
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return Path;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether this instance is owned item.
|
/// Gets a value indicating whether this instance is owned item.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -46,19 +46,6 @@ namespace MediaBrowser.Controller.LiveTv
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns the folder containing the item.
|
|
||||||
/// If the item is a folder, it returns the folder itself
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The containing folder path.</value>
|
|
||||||
public override string ContainingFolderPath
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return Path;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether this instance is owned item.
|
/// Gets a value indicating whether this instance is owned item.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Entities.Audio;
|
using MediaBrowser.Controller.Entities.Audio;
|
||||||
using MediaBrowser.Controller.Providers;
|
using MediaBrowser.Controller.Providers;
|
||||||
using MediaBrowser.Model.Entities;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
@ -35,16 +34,7 @@ namespace MediaBrowser.Providers.All
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
var locationType = item.LocationType;
|
if (item.SupportsLocalMetadata)
|
||||||
|
|
||||||
if (locationType == LocationType.FileSystem ||
|
|
||||||
locationType == LocationType.Offline)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// These always save locally
|
|
||||||
if (item is IItemByName || item is User)
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
using MediaBrowser.Controller.Entities.Audio;
|
using MediaBrowser.Controller.Entities.Audio;
|
||||||
using MediaBrowser.Controller.Entities.Movies;
|
using MediaBrowser.Controller.Entities.Movies;
|
||||||
using MediaBrowser.Controller.Entities.TV;
|
using MediaBrowser.Controller.Entities.TV;
|
||||||
|
using MediaBrowser.Controller.LiveTv;
|
||||||
using MediaBrowser.Controller.Providers;
|
using MediaBrowser.Controller.Providers;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using System;
|
using System;
|
||||||
@ -26,9 +27,7 @@ namespace MediaBrowser.Providers.All
|
|||||||
|
|
||||||
public bool Supports(IHasImages item)
|
public bool Supports(IHasImages item)
|
||||||
{
|
{
|
||||||
var locationType = item.LocationType;
|
if (item.SupportsLocalMetadata)
|
||||||
|
|
||||||
if (locationType == LocationType.FileSystem)
|
|
||||||
{
|
{
|
||||||
// Episode has it's own provider
|
// Episode has it's own provider
|
||||||
if (item.IsOwnedItem || item is Episode || item is Audio)
|
if (item.IsOwnedItem || item is Episode || item is Audio)
|
||||||
@ -39,7 +38,7 @@ namespace MediaBrowser.Providers.All
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (locationType == LocationType.Virtual)
|
if (item.LocationType == LocationType.Virtual)
|
||||||
{
|
{
|
||||||
var season = item as Season;
|
var season = item as Season;
|
||||||
|
|
||||||
|
@ -60,9 +60,14 @@ namespace MediaBrowser.Providers
|
|||||||
|
|
||||||
protected abstract FileInfo GetXmlFile(ItemInfo info);
|
protected abstract FileInfo GetXmlFile(ItemInfo info);
|
||||||
|
|
||||||
|
protected virtual FileInfo GetXmlFile(ItemInfo info, IDirectoryService directoryService)
|
||||||
|
{
|
||||||
|
return GetXmlFile(info);
|
||||||
|
}
|
||||||
|
|
||||||
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService, DateTime date)
|
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService, DateTime date)
|
||||||
{
|
{
|
||||||
var file = GetXmlFile(new ItemInfo { IsInMixedFolder = item.IsInMixedFolder, Path = item.Path });
|
var file = GetXmlFile(new ItemInfo { IsInMixedFolder = item.IsInMixedFolder, Path = item.Path }, directoryService);
|
||||||
|
|
||||||
if (file == null)
|
if (file == null)
|
||||||
{
|
{
|
||||||
|
@ -15,7 +15,7 @@ namespace MediaBrowser.Providers.Folders
|
|||||||
|
|
||||||
public bool Supports(IHasImages item)
|
public bool Supports(IHasImages item)
|
||||||
{
|
{
|
||||||
return item is CollectionFolder && item.LocationType == LocationType.FileSystem;
|
return item is CollectionFolder && item.SupportsLocalMetadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Order
|
public int Order
|
||||||
|
@ -93,13 +93,9 @@ namespace MediaBrowser.Providers.Manager
|
|||||||
{
|
{
|
||||||
var series = season.Series;
|
var series = season.Series;
|
||||||
|
|
||||||
if (series != null)
|
if (series != null && series.SupportsLocalMetadata)
|
||||||
{
|
{
|
||||||
var seriesLocationType = series.LocationType;
|
saveLocally = true;
|
||||||
if (seriesLocationType == LocationType.FileSystem || seriesLocationType == LocationType.Offline)
|
|
||||||
{
|
|
||||||
saveLocally = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -351,7 +351,7 @@ namespace MediaBrowser.Providers.Manager
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.LocationType != LocationType.FileSystem && provider is ILocalMetadataProvider)
|
if (!item.SupportsLocalMetadata && provider is ILocalMetadataProvider)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -148,7 +148,7 @@ namespace MediaBrowser.Providers.MediaInfo
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.LocationType == LocationType.FileSystem)
|
if (item.SupportsLocalMetadata)
|
||||||
{
|
{
|
||||||
var video = item as Video;
|
var video = item as Video;
|
||||||
|
|
||||||
|
@ -27,8 +27,7 @@ namespace MediaBrowser.Providers.Savers
|
|||||||
/// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
|
/// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
|
||||||
public bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType)
|
public bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType)
|
||||||
{
|
{
|
||||||
var locationType = item.LocationType;
|
if (!item.SupportsLocalMetadata)
|
||||||
if (locationType == LocationType.Remote || locationType == LocationType.Virtual)
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -27,8 +27,7 @@ namespace MediaBrowser.Providers.Savers
|
|||||||
/// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
|
/// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
|
||||||
public bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType)
|
public bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType)
|
||||||
{
|
{
|
||||||
var locationType = item.LocationType;
|
if (!item.SupportsLocalMetadata)
|
||||||
if (locationType == LocationType.Remote || locationType == LocationType.Virtual)
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -27,8 +27,7 @@ namespace MediaBrowser.Providers.Savers
|
|||||||
/// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
|
/// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
|
||||||
public bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType)
|
public bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType)
|
||||||
{
|
{
|
||||||
var locationType = item.LocationType;
|
if (!item.SupportsLocalMetadata)
|
||||||
if (locationType == LocationType.Remote || locationType == LocationType.Virtual)
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -22,8 +22,7 @@ namespace MediaBrowser.Providers.Savers
|
|||||||
/// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
|
/// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
|
||||||
public bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType)
|
public bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType)
|
||||||
{
|
{
|
||||||
var locationType = item.LocationType;
|
if (!item.SupportsLocalMetadata)
|
||||||
if (locationType == LocationType.Remote || locationType == LocationType.Virtual)
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -31,8 +31,7 @@ namespace MediaBrowser.Providers.Savers
|
|||||||
/// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
|
/// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
|
||||||
public bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType)
|
public bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType)
|
||||||
{
|
{
|
||||||
var locationType = item.LocationType;
|
if (!item.SupportsLocalMetadata)
|
||||||
if (locationType == LocationType.Remote || locationType == LocationType.Virtual)
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -29,8 +29,7 @@ namespace MediaBrowser.Providers.Savers
|
|||||||
/// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
|
/// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
|
||||||
public bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType)
|
public bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType)
|
||||||
{
|
{
|
||||||
var locationType = item.LocationType;
|
if (!item.SupportsLocalMetadata)
|
||||||
if (locationType == LocationType.Remote || locationType == LocationType.Virtual)
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -27,8 +27,7 @@ namespace MediaBrowser.Providers.Savers
|
|||||||
/// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
|
/// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
|
||||||
public bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType)
|
public bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType)
|
||||||
{
|
{
|
||||||
var locationType = item.LocationType;
|
if (!item.SupportsLocalMetadata)
|
||||||
if (locationType == LocationType.Remote || locationType == LocationType.Virtual)
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -31,8 +31,7 @@ namespace MediaBrowser.Providers.Savers
|
|||||||
/// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
|
/// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
|
||||||
public bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType)
|
public bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType)
|
||||||
{
|
{
|
||||||
var locationType = item.LocationType;
|
if (!item.SupportsLocalMetadata)
|
||||||
if (locationType == LocationType.Remote || locationType == LocationType.Virtual)
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -41,8 +41,7 @@ namespace MediaBrowser.Providers.Savers
|
|||||||
/// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
|
/// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
|
||||||
public bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType)
|
public bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType)
|
||||||
{
|
{
|
||||||
var locationType = item.LocationType;
|
if (!item.SupportsLocalMetadata)
|
||||||
if (locationType == LocationType.Remote || locationType == LocationType.Virtual)
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -31,8 +31,7 @@ namespace MediaBrowser.Providers.Savers
|
|||||||
/// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
|
/// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
|
||||||
public bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType)
|
public bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType)
|
||||||
{
|
{
|
||||||
var locationType = item.LocationType;
|
if (!item.SupportsLocalMetadata)
|
||||||
if (locationType == LocationType.Remote || locationType == LocationType.Virtual)
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -27,8 +27,7 @@ namespace MediaBrowser.Providers.Savers
|
|||||||
/// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
|
/// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
|
||||||
public bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType)
|
public bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType)
|
||||||
{
|
{
|
||||||
var locationType = item.LocationType;
|
if (!item.SupportsLocalMetadata)
|
||||||
if (locationType == LocationType.Remote || locationType == LocationType.Virtual)
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -28,8 +28,7 @@ namespace MediaBrowser.Providers.Savers
|
|||||||
/// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
|
/// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
|
||||||
public bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType)
|
public bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType)
|
||||||
{
|
{
|
||||||
var locationType = item.LocationType;
|
if (!item.SupportsLocalMetadata)
|
||||||
if (locationType == LocationType.Remote || locationType == LocationType.Virtual)
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ namespace MediaBrowser.Providers.TV
|
|||||||
|
|
||||||
public bool Supports(IHasImages item)
|
public bool Supports(IHasImages item)
|
||||||
{
|
{
|
||||||
return item is Episode && item.LocationType == LocationType.FileSystem;
|
return item is Episode && item.SupportsLocalMetadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<LocalImageInfo> GetImages(IHasImages item, IDirectoryService directoryService)
|
public List<LocalImageInfo> GetImages(IHasImages item, IDirectoryService directoryService)
|
||||||
@ -77,28 +77,5 @@ namespace MediaBrowser.Providers.TV
|
|||||||
})
|
})
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<LocalImageInfo> GetFilesFromMetadataFolder(string filenameWithoutExtension, IEnumerable<FileInfo> metadataFiles)
|
|
||||||
{
|
|
||||||
return metadataFiles
|
|
||||||
.Where(i =>
|
|
||||||
{
|
|
||||||
if (BaseItem.SupportedImageExtensions.Contains(i.Extension))
|
|
||||||
{
|
|
||||||
if (string.Equals(filenameWithoutExtension, Path.GetFileNameWithoutExtension(i.Name), StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
})
|
|
||||||
.Select(i => new LocalImageInfo
|
|
||||||
{
|
|
||||||
FileInfo = i,
|
|
||||||
Type = ImageType.Primary
|
|
||||||
})
|
|
||||||
.ToList();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,5 +30,15 @@ namespace MediaBrowser.Providers.TV
|
|||||||
|
|
||||||
return new FileInfo(metadataFile);
|
return new FileInfo(metadataFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override FileInfo GetXmlFile(ItemInfo info, IDirectoryService directoryService)
|
||||||
|
{
|
||||||
|
var metadataPath = Path.GetDirectoryName(info.Path);
|
||||||
|
metadataPath = Path.Combine(metadataPath, "metadata");
|
||||||
|
|
||||||
|
var metadataFile = Path.Combine(metadataPath, Path.ChangeExtension(Path.GetFileName(info.Path), ".xml"));
|
||||||
|
|
||||||
|
return directoryService.GetFile(metadataFile);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -273,8 +273,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
|
|||||||
{
|
{
|
||||||
if (item.LocationType == LocationType.FileSystem)
|
if (item.LocationType == LocationType.FileSystem)
|
||||||
{
|
{
|
||||||
return collections.Where(i => i.LocationType == LocationType.FileSystem &&
|
return collections.Where(i => i.PhysicalLocations.Contains(item.Path)).Cast<T>();
|
||||||
i.PhysicalLocations.Contains(item.Path)).Cast<T>();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -283,7 +282,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
|
|||||||
{
|
{
|
||||||
if (item.Id == user.RootFolder.Id)
|
if (item.Id == user.RootFolder.Id)
|
||||||
{
|
{
|
||||||
return new T[] { item };
|
return new[] { item };
|
||||||
}
|
}
|
||||||
|
|
||||||
return new T[] { };
|
return new T[] { };
|
||||||
|
@ -161,7 +161,6 @@ namespace MediaBrowser.Server.Implementations.IO
|
|||||||
.RootFolder
|
.RootFolder
|
||||||
.Children
|
.Children
|
||||||
.OfType<Folder>()
|
.OfType<Folder>()
|
||||||
.Where(i => i.LocationType != LocationType.Remote && i.LocationType != LocationType.Virtual)
|
|
||||||
.SelectMany(f => f.PhysicalLocations)
|
.SelectMany(f => f.PhysicalLocations)
|
||||||
.Distinct(StringComparer.OrdinalIgnoreCase)
|
.Distinct(StringComparer.OrdinalIgnoreCase)
|
||||||
.OrderBy(i => i)
|
.OrderBy(i => i)
|
||||||
|
@ -1399,22 +1399,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||||||
.Distinct()
|
.Distinct()
|
||||||
.SelectMany(i => i.Children)
|
.SelectMany(i => i.Children)
|
||||||
.OfType<CollectionFolder>()
|
.OfType<CollectionFolder>()
|
||||||
.Where(i =>
|
.Where(i => string.Equals(i.Path, item.Path, StringComparison.OrdinalIgnoreCase) || i.PhysicalLocations.Contains(item.Path))
|
||||||
{
|
|
||||||
var locationType = i.LocationType;
|
|
||||||
|
|
||||||
if (locationType == LocationType.Remote || locationType == LocationType.Virtual)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.Equals(i.Path, item.Path, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return i.PhysicalLocations.Contains(item.Path);
|
|
||||||
})
|
|
||||||
.Select(i => i.CollectionType)
|
.Select(i => i.CollectionType)
|
||||||
.Where(i => !string.IsNullOrEmpty(i))
|
.Where(i => !string.IsNullOrEmpty(i))
|
||||||
.Distinct()
|
.Distinct()
|
||||||
|
@ -615,13 +615,9 @@ namespace MediaBrowser.Server.Implementations.Session
|
|||||||
}
|
}
|
||||||
|
|
||||||
var items = command.ItemIds.Select(i => _libraryManager.GetItemById(new Guid(i)))
|
var items = command.ItemIds.Select(i => _libraryManager.GetItemById(new Guid(i)))
|
||||||
|
.Where(i => i.LocationType != LocationType.Virtual)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
if (items.Any(i => i.LocationType == LocationType.Virtual))
|
|
||||||
{
|
|
||||||
throw new ArgumentException("Virtual items are not playable.");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (command.PlayCommand != PlayCommand.PlayNow)
|
if (command.PlayCommand != PlayCommand.PlayNow)
|
||||||
{
|
{
|
||||||
if (items.Any(i => !session.QueueableMediaTypes.Contains(i.MediaType, StringComparer.OrdinalIgnoreCase)))
|
if (items.Any(i => !session.QueueableMediaTypes.Contains(i.MediaType, StringComparer.OrdinalIgnoreCase)))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user