mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
fixes #296 - Prevent non-movie videos from appearing in Movies view
This commit is contained in:
parent
1f1eab209a
commit
657097ee15
@ -185,7 +185,8 @@ namespace MediaBrowser.Api
|
|||||||
MovieCount = items.OfType<Movie>().Count(),
|
MovieCount = items.OfType<Movie>().Count(),
|
||||||
SeriesCount = items.OfType<Series>().Count(),
|
SeriesCount = items.OfType<Series>().Count(),
|
||||||
SongCount = items.OfType<Audio>().Count(),
|
SongCount = items.OfType<Audio>().Count(),
|
||||||
TrailerCount = items.OfType<Trailer>().Count()
|
TrailerCount = items.OfType<Trailer>().Count(),
|
||||||
|
MusicVideoCount = items.OfType<MusicVideo>().Count()
|
||||||
};
|
};
|
||||||
|
|
||||||
return ToOptimizedResult(counts);
|
return ToOptimizedResult(counts);
|
||||||
|
@ -174,7 +174,9 @@ namespace MediaBrowser.Api.UserLibrary
|
|||||||
|
|
||||||
SongCount = items.OfType<Audio>().Count(),
|
SongCount = items.OfType<Audio>().Count(),
|
||||||
|
|
||||||
AlbumCount = items.OfType<MusicAlbum>().Count()
|
AlbumCount = items.OfType<MusicAlbum>().Count(),
|
||||||
|
|
||||||
|
MusicVideoCount = items.OfType<MusicVideo>().Count()
|
||||||
};
|
};
|
||||||
|
|
||||||
return ToOptimizedResult(counts);
|
return ToOptimizedResult(counts);
|
||||||
|
@ -165,7 +165,9 @@ namespace MediaBrowser.Api.UserLibrary
|
|||||||
|
|
||||||
AlbumCount = items.OfType<MusicAlbum>().Count(),
|
AlbumCount = items.OfType<MusicAlbum>().Count(),
|
||||||
|
|
||||||
EpisodeCount = items.OfType<Episode>().Count()
|
EpisodeCount = items.OfType<Episode>().Count(),
|
||||||
|
|
||||||
|
MusicVideoCount = items.OfType<MusicVideo>().Count()
|
||||||
};
|
};
|
||||||
|
|
||||||
return ToOptimizedResult(counts);
|
return ToOptimizedResult(counts);
|
||||||
|
@ -136,7 +136,9 @@ namespace MediaBrowser.Api.UserLibrary
|
|||||||
|
|
||||||
SongCount = items.OfType<Audio>().Count(),
|
SongCount = items.OfType<Audio>().Count(),
|
||||||
|
|
||||||
AlbumCount = items.OfType<MusicAlbum>().Count()
|
AlbumCount = items.OfType<MusicAlbum>().Count(),
|
||||||
|
|
||||||
|
MusicVideoCount = items.OfType<MusicVideo>().Count()
|
||||||
};
|
};
|
||||||
|
|
||||||
return ToOptimizedResult(counts);
|
return ToOptimizedResult(counts);
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
using System;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Controller.IO;
|
using System;
|
||||||
using MediaBrowser.Model.Entities;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
42
MediaBrowser.Controller/Entities/MusicVideo.cs
Normal file
42
MediaBrowser.Controller/Entities/MusicVideo.cs
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
using MediaBrowser.Model.Entities;
|
||||||
|
using System.Runtime.Serialization;
|
||||||
|
|
||||||
|
namespace MediaBrowser.Controller.Entities
|
||||||
|
{
|
||||||
|
public class MusicVideo : Video
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Should be overridden to return the proper folder where metadata lives
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The meta location.</value>
|
||||||
|
[IgnoreDataMember]
|
||||||
|
public override string MetaLocation
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return VideoType == VideoType.VideoFile || VideoType == VideoType.Iso ? System.IO.Path.GetDirectoryName(Path) : Path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the user data key.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>System.String.</returns>
|
||||||
|
public override string GetUserDataKey()
|
||||||
|
{
|
||||||
|
return this.GetProviderId(MetadataProviders.Tmdb) ?? this.GetProviderId(MetadataProviders.Imdb) ?? base.GetUserDataKey();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Needed because the resolver stops at the movie folder and we find the video inside.
|
||||||
|
/// </summary>
|
||||||
|
/// <value><c>true</c> if [use parent path to create resolve args]; otherwise, <c>false</c>.</value>
|
||||||
|
protected override bool UseParentPathToCreateResolveArgs
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return VideoType == VideoType.VideoFile || VideoType == VideoType.Iso;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -73,6 +73,7 @@
|
|||||||
<Compile Include="Configuration\IServerConfigurationManager.cs" />
|
<Compile Include="Configuration\IServerConfigurationManager.cs" />
|
||||||
<Compile Include="Dto\SessionInfoDtoBuilder.cs" />
|
<Compile Include="Dto\SessionInfoDtoBuilder.cs" />
|
||||||
<Compile Include="Entities\Audio\MusicAlbumDisc.cs" />
|
<Compile Include="Entities\Audio\MusicAlbumDisc.cs" />
|
||||||
|
<Compile Include="Entities\MusicVideo.cs" />
|
||||||
<Compile Include="Library\ILibraryPostScanTask.cs" />
|
<Compile Include="Library\ILibraryPostScanTask.cs" />
|
||||||
<Compile Include="Library\ILibraryPrescanTask.cs" />
|
<Compile Include="Library\ILibraryPrescanTask.cs" />
|
||||||
<Compile Include="Providers\Movies\FanArtMovieUpdatesPrescanTask.cs" />
|
<Compile Include="Providers\Movies\FanArtMovieUpdatesPrescanTask.cs" />
|
||||||
|
@ -235,7 +235,7 @@ namespace MediaBrowser.Controller.Providers.MediaInfo
|
|||||||
/// <param name="video">The video.</param>
|
/// <param name="video">The video.</param>
|
||||||
private void AddExternalSubtitles(Video video)
|
private void AddExternalSubtitles(Video video)
|
||||||
{
|
{
|
||||||
var useParent = (video.VideoType == VideoType.VideoFile || video.VideoType == VideoType.Iso) && !(video is Movie);
|
var useParent = (video.VideoType == VideoType.VideoFile || video.VideoType == VideoType.Iso) && !(video is Movie) && !(video is MusicVideo);
|
||||||
|
|
||||||
if (useParent && video.Parent == null)
|
if (useParent && video.Parent == null)
|
||||||
{
|
{
|
||||||
|
@ -103,7 +103,7 @@ namespace MediaBrowser.Controller.Providers.Movies
|
|||||||
return !trailer.IsLocalTrailer;
|
return !trailer.IsLocalTrailer;
|
||||||
}
|
}
|
||||||
|
|
||||||
return item is Movie || item is BoxSet;
|
return item is Movie || item is BoxSet || item is MusicVideo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -82,7 +82,7 @@ namespace MediaBrowser.Controller.Providers.Movies
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Don't support local trailers
|
// Don't support local trailers
|
||||||
return item is Movie || item is BoxSet;
|
return item is Movie || item is BoxSet || item is MusicVideo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -100,7 +100,7 @@ namespace MediaBrowser.Controller.Providers.Movies
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Don't support local trailers
|
// Don't support local trailers
|
||||||
return item is Movie || item is BoxSet;
|
return item is Movie || item is BoxSet || item is MusicVideo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -23,7 +23,14 @@ namespace MediaBrowser.Controller.Providers.Movies
|
|||||||
|
|
||||||
public override bool Supports(BaseItem item)
|
public override bool Supports(BaseItem item)
|
||||||
{
|
{
|
||||||
return item is Movie || item is BoxSet;
|
var trailer = item as Trailer;
|
||||||
|
|
||||||
|
if (trailer != null)
|
||||||
|
{
|
||||||
|
return !trailer.IsLocalTrailer;
|
||||||
|
}
|
||||||
|
|
||||||
|
return item is Movie || item is BoxSet || item is MusicVideo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -25,7 +25,14 @@ namespace MediaBrowser.Controller.Providers.Movies
|
|||||||
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
|
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
|
||||||
public override bool Supports(BaseItem item)
|
public override bool Supports(BaseItem item)
|
||||||
{
|
{
|
||||||
return item is Movie || item is BoxSet;
|
var trailer = item as Trailer;
|
||||||
|
|
||||||
|
if (trailer != null)
|
||||||
|
{
|
||||||
|
return !trailer.IsLocalTrailer;
|
||||||
|
}
|
||||||
|
|
||||||
|
return item is Movie || item is BoxSet || item is MusicVideo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -87,7 +87,7 @@ namespace MediaBrowser.Controller.Providers.Movies
|
|||||||
return !trailer.IsLocalTrailer;
|
return !trailer.IsLocalTrailer;
|
||||||
}
|
}
|
||||||
|
|
||||||
return item is Movie;
|
return item is Movie || item is MusicVideo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -19,6 +19,18 @@ namespace MediaBrowser.Controller.Resolvers
|
|||||||
/// <param name="args">The args.</param>
|
/// <param name="args">The args.</param>
|
||||||
/// <returns>`0.</returns>
|
/// <returns>`0.</returns>
|
||||||
protected override T Resolve(ItemResolveArgs args)
|
protected override T Resolve(ItemResolveArgs args)
|
||||||
|
{
|
||||||
|
return ResolveVideo<T>(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Resolves the video.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TVideoType">The type of the T video type.</typeparam>
|
||||||
|
/// <param name="args">The args.</param>
|
||||||
|
/// <returns>``0.</returns>
|
||||||
|
protected TVideoType ResolveVideo<TVideoType>(ItemResolveArgs args)
|
||||||
|
where TVideoType : Video, new()
|
||||||
{
|
{
|
||||||
// If the path is a file check for a matching extensions
|
// If the path is a file check for a matching extensions
|
||||||
if (!args.IsDirectory)
|
if (!args.IsDirectory)
|
||||||
@ -30,7 +42,7 @@ namespace MediaBrowser.Controller.Resolvers
|
|||||||
var type = string.Equals(extension, ".iso", StringComparison.OrdinalIgnoreCase) || string.Equals(extension, ".img", StringComparison.OrdinalIgnoreCase) ?
|
var type = string.Equals(extension, ".iso", StringComparison.OrdinalIgnoreCase) || string.Equals(extension, ".img", StringComparison.OrdinalIgnoreCase) ?
|
||||||
VideoType.Iso : VideoType.VideoFile;
|
VideoType.Iso : VideoType.VideoFile;
|
||||||
|
|
||||||
return new T
|
return new TVideoType
|
||||||
{
|
{
|
||||||
VideoType = type,
|
VideoType = type,
|
||||||
Path = args.Path
|
Path = args.Path
|
||||||
|
@ -46,5 +46,10 @@ namespace MediaBrowser.Model.Dto
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The album count.</value>
|
/// <value>The album count.</value>
|
||||||
public int AlbumCount { get; set; }
|
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; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,5 +41,10 @@ namespace MediaBrowser.Model.Dto
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The album count.</value>
|
/// <value>The album count.</value>
|
||||||
public int AlbumCount { get; set; }
|
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; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class MovieResolver
|
/// Class MovieResolver
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class MovieResolver : BaseVideoResolver<Movie>
|
public class MovieResolver : BaseVideoResolver<Video>
|
||||||
{
|
{
|
||||||
private IServerApplicationPaths ApplicationPaths { get; set; }
|
private IServerApplicationPaths ApplicationPaths { get; set; }
|
||||||
|
|
||||||
@ -43,10 +43,10 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
|
|||||||
/// Resolves the specified args.
|
/// Resolves the specified args.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="args">The args.</param>
|
/// <param name="args">The args.</param>
|
||||||
/// <returns>Movie.</returns>
|
/// <returns>Video.</returns>
|
||||||
protected override Movie Resolve(ItemResolveArgs args)
|
protected override Video Resolve(ItemResolveArgs args)
|
||||||
{
|
{
|
||||||
// Must be a directory and under a 'Movies' VF
|
// Must be a directory
|
||||||
if (args.IsDirectory)
|
if (args.IsDirectory)
|
||||||
{
|
{
|
||||||
// Avoid expensive tests against VF's and all their children by not allowing this
|
// Avoid expensive tests against VF's and all their children by not allowing this
|
||||||
@ -70,8 +70,22 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The movie must be a video file
|
// Since the looping is expensive, this is an optimization to help us avoid it
|
||||||
return FindMovie(args);
|
if (args.ContainsMetaFileByName("series.xml") || args.Path.IndexOf("[tvdbid", StringComparison.OrdinalIgnoreCase) != -1)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.Path.IndexOf("[trailers]", StringComparison.OrdinalIgnoreCase) != -1)
|
||||||
|
{
|
||||||
|
return FindMovie<Trailer>(args);
|
||||||
|
}
|
||||||
|
if (args.Path.IndexOf("[musicvideos]", StringComparison.OrdinalIgnoreCase) != -1)
|
||||||
|
{
|
||||||
|
return FindMovie<MusicVideo>(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
return FindMovie<Movie>(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@ -82,7 +96,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="item">The item.</param>
|
/// <param name="item">The item.</param>
|
||||||
/// <param name="args">The args.</param>
|
/// <param name="args">The args.</param>
|
||||||
protected override void SetInitialItemValues(Movie item, ItemResolveArgs args)
|
protected override void SetInitialItemValues(Video item, ItemResolveArgs args)
|
||||||
{
|
{
|
||||||
base.SetInitialItemValues(item, args);
|
base.SetInitialItemValues(item, args);
|
||||||
|
|
||||||
@ -93,7 +107,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
|
|||||||
/// Sets the provider id from path.
|
/// Sets the provider id from path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="item">The item.</param>
|
/// <param name="item">The item.</param>
|
||||||
private void SetProviderIdFromPath(Movie item)
|
private void SetProviderIdFromPath(Video item)
|
||||||
{
|
{
|
||||||
//we need to only look at the name of this actual item (not parents)
|
//we need to only look at the name of this actual item (not parents)
|
||||||
var justName = Path.GetFileName(item.Path);
|
var justName = Path.GetFileName(item.Path);
|
||||||
@ -111,18 +125,13 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="args">The args.</param>
|
/// <param name="args">The args.</param>
|
||||||
/// <returns>Movie.</returns>
|
/// <returns>Movie.</returns>
|
||||||
private Movie FindMovie(ItemResolveArgs args)
|
private T FindMovie<T>(ItemResolveArgs args)
|
||||||
|
where T : Video, new ()
|
||||||
{
|
{
|
||||||
// Since the looping is expensive, this is an optimization to help us avoid it
|
|
||||||
if (args.ContainsMetaFileByName("series.xml") || args.Path.IndexOf("[tvdbid", StringComparison.OrdinalIgnoreCase) != -1)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Optimization to avoid having to resolve every file
|
// Optimization to avoid having to resolve every file
|
||||||
bool? isKnownMovie = null;
|
bool? isKnownMovie = null;
|
||||||
|
|
||||||
var movies = new List<Movie>();
|
var movies = new List<T>();
|
||||||
|
|
||||||
// Loop through each child file/folder and see if we find a video
|
// Loop through each child file/folder and see if we find a video
|
||||||
foreach (var child in args.FileSystemChildren)
|
foreach (var child in args.FileSystemChildren)
|
||||||
@ -131,7 +140,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
|
|||||||
{
|
{
|
||||||
if (IsDvdDirectory(child.Name))
|
if (IsDvdDirectory(child.Name))
|
||||||
{
|
{
|
||||||
return new Movie
|
return new T
|
||||||
{
|
{
|
||||||
Path = args.Path,
|
Path = args.Path,
|
||||||
VideoType = VideoType.Dvd
|
VideoType = VideoType.Dvd
|
||||||
@ -139,7 +148,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
|
|||||||
}
|
}
|
||||||
if (IsBluRayDirectory(child.Name))
|
if (IsBluRayDirectory(child.Name))
|
||||||
{
|
{
|
||||||
return new Movie
|
return new T
|
||||||
{
|
{
|
||||||
Path = args.Path,
|
Path = args.Path,
|
||||||
VideoType = VideoType.BluRay
|
VideoType = VideoType.BluRay
|
||||||
@ -147,7 +156,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
|
|||||||
}
|
}
|
||||||
if (IsHdDvdDirectory(child.Name))
|
if (IsHdDvdDirectory(child.Name))
|
||||||
{
|
{
|
||||||
return new Movie
|
return new T
|
||||||
{
|
{
|
||||||
Path = args.Path,
|
Path = args.Path,
|
||||||
VideoType = VideoType.HdDvd
|
VideoType = VideoType.HdDvd
|
||||||
@ -169,7 +178,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
|
|||||||
Path = child.FullName
|
Path = child.FullName
|
||||||
};
|
};
|
||||||
|
|
||||||
var item = base.Resolve(childArgs);
|
var item = ResolveVideo<T>(childArgs);
|
||||||
|
|
||||||
if (item != null)
|
if (item != null)
|
||||||
{
|
{
|
||||||
|
@ -489,6 +489,7 @@ namespace MediaBrowser.WebDashboard.Api
|
|||||||
"musicartists.js",
|
"musicartists.js",
|
||||||
"musicgenres.js",
|
"musicgenres.js",
|
||||||
"musicrecommended.js",
|
"musicrecommended.js",
|
||||||
|
"musicvideos.js",
|
||||||
"playlist.js",
|
"playlist.js",
|
||||||
"plugincatalogpage.js",
|
"plugincatalogpage.js",
|
||||||
"pluginspage.js",
|
"pluginspage.js",
|
||||||
|
@ -324,6 +324,9 @@
|
|||||||
<Content Include="dashboard-ui\musicrecommended.html">
|
<Content Include="dashboard-ui\musicrecommended.html">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Content Include="dashboard-ui\musicvideos.html">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
<Content Include="dashboard-ui\scripts\edititemimages.js">
|
<Content Include="dashboard-ui\scripts\edititemimages.js">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
@ -336,6 +339,9 @@
|
|||||||
<Content Include="dashboard-ui\scripts\musicrecommended.js">
|
<Content Include="dashboard-ui\scripts\musicrecommended.js">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Content Include="dashboard-ui\scripts\musicvideos.js">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
<Content Include="dashboard-ui\scripts\search.js">
|
<Content Include="dashboard-ui\scripts\search.js">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user