This commit is contained in:
Techywarrior 2013-04-28 11:48:45 -07:00
commit 13d7090dc7
10 changed files with 30 additions and 37 deletions

View File

@ -337,11 +337,11 @@ namespace MediaBrowser.Api.UserLibrary
} }
/// <summary> /// <summary>
/// Class GetVideoBackdrops /// Class GetThemeVideos
/// </summary> /// </summary>
[Route("/Users/{UserId}/Items/{Id}/VideoBackdrops", "GET")] [Route("/Users/{UserId}/Items/{Id}/ThemeVideos", "GET")]
[Api(Description = "Gets video backdrops for an item")] [Api(Description = "Gets video backdrops for an item")]
public class GetVideoBackdrops : IReturn<VideoBackdropsResult> public class GetThemeVideos : IReturn<ThemeVideosResult>
{ {
/// <summary> /// <summary>
/// Gets or sets the user id. /// Gets or sets the user id.
@ -491,7 +491,7 @@ namespace MediaBrowser.Api.UserLibrary
/// </summary> /// </summary>
/// <param name="request">The request.</param> /// <param name="request">The request.</param>
/// <returns>System.Object.</returns> /// <returns>System.Object.</returns>
public object Get(GetVideoBackdrops request) public object Get(GetThemeVideos request)
{ {
var user = _userManager.GetUserById(request.UserId); var user = _userManager.GetUserById(request.UserId);
@ -502,9 +502,9 @@ namespace MediaBrowser.Api.UserLibrary
var dtoBuilder = new DtoBuilder(Logger, _libraryManager, _userDataRepository); var dtoBuilder = new DtoBuilder(Logger, _libraryManager, _userDataRepository);
var items = item.VideoBackdrops.Select(i => dtoBuilder.GetBaseItemDto(i, user, fields)).AsParallel().Select(t => t.Result).ToArray(); var items = item.ThemeVideos.Select(i => dtoBuilder.GetBaseItemDto(i, user, fields)).AsParallel().Select(t => t.Result).ToArray();
var result = new VideoBackdropsResult var result = new ThemeVideosResult
{ {
Items = items, Items = items,
TotalRecordCount = items.Length, TotalRecordCount = items.Length,

View File

@ -39,7 +39,7 @@ namespace MediaBrowser.Controller.Entities
/// </summary> /// </summary>
public const string TrailerFolderName = "trailers"; public const string TrailerFolderName = "trailers";
public const string ThemeSongsFolderName = "theme-music"; public const string ThemeSongsFolderName = "theme-music";
public const string VideoBackdropsFolderName = "backdrops"; public const string ThemeVideosFolderName = "backdrops";
/// <summary> /// <summary>
/// Gets or sets the name. /// Gets or sets the name.
@ -703,24 +703,24 @@ namespace MediaBrowser.Controller.Entities
} }
} }
private List<Video> _videoBackdrops; private List<Video> _themeVideos;
private bool _videoBackdropsInitialized; private bool _themeVideosInitialized;
private object _videoBackdropsSyncLock = new object(); private object _themeVideosSyncLock = new object();
[IgnoreDataMember] [IgnoreDataMember]
public List<Video> VideoBackdrops public List<Video> ThemeVideos
{ {
get get
{ {
LazyInitializer.EnsureInitialized(ref _videoBackdrops, ref _videoBackdropsInitialized, ref _videoBackdropsSyncLock, LoadVideoBackdrops); LazyInitializer.EnsureInitialized(ref _themeVideos, ref _themeVideosInitialized, ref _themeVideosSyncLock, LoadThemeVideos);
return _videoBackdrops; return _themeVideos;
} }
private set private set
{ {
_videoBackdrops = value; _themeVideos = value;
if (value == null) if (value == null)
{ {
_videoBackdropsInitialized = false; _themeVideosInitialized = false;
} }
} }
} }
@ -845,7 +845,7 @@ namespace MediaBrowser.Controller.Entities
/// Loads the video backdrops. /// Loads the video backdrops.
/// </summary> /// </summary>
/// <returns>List{Video}.</returns> /// <returns>List{Video}.</returns>
private List<Video> LoadVideoBackdrops() private List<Video> LoadThemeVideos()
{ {
ItemResolveArgs resolveArgs; ItemResolveArgs resolveArgs;
@ -864,7 +864,7 @@ namespace MediaBrowser.Controller.Entities
return new List<Video>(); return new List<Video>();
} }
var folder = resolveArgs.GetFileSystemEntryByName(VideoBackdropsFolderName); var folder = resolveArgs.GetFileSystemEntryByName(ThemeVideosFolderName);
// Path doesn't exist. No biggie // Path doesn't exist. No biggie
if (folder == null) if (folder == null)
@ -918,7 +918,7 @@ namespace MediaBrowser.Controller.Entities
// Lazy load these again // Lazy load these again
LocalTrailers = null; LocalTrailers = null;
ThemeSongs = null; ThemeSongs = null;
VideoBackdrops = null; ThemeVideos = null;
// Refresh for the item // Refresh for the item
var itemRefreshTask = ProviderManager.ExecuteMetadataProviders(this, cancellationToken, forceRefresh, allowSlowProviders); var itemRefreshTask = ProviderManager.ExecuteMetadataProviders(this, cancellationToken, forceRefresh, allowSlowProviders);
@ -930,7 +930,7 @@ namespace MediaBrowser.Controller.Entities
var themeSongTasks = ThemeSongs.Select(i => i.RefreshMetadata(cancellationToken, forceSave, forceRefresh, allowSlowProviders)); var themeSongTasks = ThemeSongs.Select(i => i.RefreshMetadata(cancellationToken, forceSave, forceRefresh, allowSlowProviders));
var videoBackdropTasks = VideoBackdrops.Select(i => i.RefreshMetadata(cancellationToken, forceSave, forceRefresh, allowSlowProviders)); var videoBackdropTasks = ThemeVideos.Select(i => i.RefreshMetadata(cancellationToken, forceSave, forceRefresh, allowSlowProviders));
cancellationToken.ThrowIfCancellationRequested(); cancellationToken.ThrowIfCancellationRequested();

View File

@ -14,7 +14,7 @@ namespace MediaBrowser.Model.Querying
public string OwnerId { get; set; } public string OwnerId { get; set; }
} }
public class VideoBackdropsResult : ItemsResult public class ThemeVideosResult : ItemsResult
{ {
/// <summary> /// <summary>
/// Gets or sets the owner id. /// Gets or sets the owner id.

View File

@ -39,7 +39,7 @@ namespace MediaBrowser.Server.Implementations.Library
{ {
var parentFolderName = Path.GetFileName(Path.GetDirectoryName(args.Path)); var parentFolderName = Path.GetFileName(Path.GetDirectoryName(args.Path));
if (string.Equals(parentFolderName, BaseItem.ThemeSongsFolderName, StringComparison.OrdinalIgnoreCase) || string.Equals(parentFolderName, BaseItem.VideoBackdropsFolderName, StringComparison.OrdinalIgnoreCase)) if (string.Equals(parentFolderName, BaseItem.ThemeSongsFolderName, StringComparison.OrdinalIgnoreCase) || string.Equals(parentFolderName, BaseItem.ThemeVideosFolderName, StringComparison.OrdinalIgnoreCase))
{ {
return false; return false;
} }
@ -62,7 +62,7 @@ namespace MediaBrowser.Server.Implementations.Library
return true; return true;
} }
if (string.Equals(filename, BaseItem.VideoBackdropsFolderName, StringComparison.OrdinalIgnoreCase)) if (string.Equals(filename, BaseItem.ThemeVideosFolderName, StringComparison.OrdinalIgnoreCase))
{ {
return true; return true;
} }

View File

@ -275,12 +275,12 @@ namespace MediaBrowser.Server.Implementations.Library
var specialFeatures = items.OfType<Movie>().SelectMany(i => i.SpecialFeatures).ToList(); var specialFeatures = items.OfType<Movie>().SelectMany(i => i.SpecialFeatures).ToList();
var localTrailers = items.SelectMany(i => i.LocalTrailers).ToList(); var localTrailers = items.SelectMany(i => i.LocalTrailers).ToList();
var themeSongs = items.SelectMany(i => i.ThemeSongs).ToList(); var themeSongs = items.SelectMany(i => i.ThemeSongs).ToList();
var videoBackdrops = items.SelectMany(i => i.VideoBackdrops).ToList(); var themeVideos = items.SelectMany(i => i.ThemeVideos).ToList();
items.AddRange(specialFeatures); items.AddRange(specialFeatures);
items.AddRange(localTrailers); items.AddRange(localTrailers);
items.AddRange(themeSongs); items.AddRange(themeSongs);
items.AddRange(videoBackdrops); items.AddRange(themeVideos);
// Need to use DistinctBy Id because there could be multiple instances with the same id // Need to use DistinctBy Id because there could be multiple instances with the same id
// due to sharing the default library // due to sharing the default library
@ -343,7 +343,7 @@ namespace MediaBrowser.Server.Implementations.Library
LibraryItemsCache.AddOrUpdate(subItem.Id, subItem, delegate { return copy; }); LibraryItemsCache.AddOrUpdate(subItem.Id, subItem, delegate { return copy; });
} }
foreach (var subItem in item.VideoBackdrops) foreach (var subItem in item.ThemeVideos)
{ {
// Prevent access to foreach variable in closure // Prevent access to foreach variable in closure
var copy = subItem; var copy = subItem;

View File

@ -99,13 +99,13 @@ namespace MediaBrowser.Server.Implementations.ScheduledTasks
var allItems = _libraryManager.RootFolder.RecursiveChildren.ToList(); var allItems = _libraryManager.RootFolder.RecursiveChildren.ToList();
var localTrailers = allItems.SelectMany(i => i.LocalTrailers); var localTrailers = allItems.SelectMany(i => i.LocalTrailers);
var videoBackdrops = allItems.SelectMany(i => i.VideoBackdrops); var themeVideos = allItems.SelectMany(i => i.ThemeVideos);
var videos = allItems.OfType<Video>().ToList(); var videos = allItems.OfType<Video>().ToList();
var items = videos; var items = videos;
items.AddRange(localTrailers); items.AddRange(localTrailers);
items.AddRange(videoBackdrops); items.AddRange(themeVideos);
items.AddRange(videos.OfType<Movie>().SelectMany(i => i.SpecialFeatures).ToList()); items.AddRange(videos.OfType<Movie>().SelectMany(i => i.SpecialFeatures).ToList());
items = items.Where(i => items = items.Where(i =>

View File

@ -455,7 +455,6 @@ namespace MediaBrowser.WebDashboard.Api
"edituserpage.js", "edituserpage.js",
"gamesrecommendedpage.js", "gamesrecommendedpage.js",
"gamesystemspage.js", "gamesystemspage.js",
"gamesystempage.js",
"gamespage.js", "gamespage.js",
"gamegenrepage.js", "gamegenrepage.js",
"gamestudiospage.js", "gamestudiospage.js",

View File

@ -1733,7 +1733,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
}); });
}; };
self.getVideoBackdrops = function (userId, itemId) { self.getThemeVideos = function (userId, itemId) {
if (!userId) { if (!userId) {
throw new Error("null userId"); throw new Error("null userId");
@ -1742,7 +1742,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
throw new Error("null itemId"); throw new Error("null itemId");
} }
var url = self.getUrl("Users/" + userId + "/Items/" + itemId + "/VideoBackdrops"); var url = self.getUrl("Users/" + userId + "/Items/" + itemId + "/ThemeVideos");
return self.ajax({ return self.ajax({
type: "GET", type: "GET",

View File

@ -219,9 +219,6 @@
<Content Include="dashboard-ui\gamestudios.html"> <Content Include="dashboard-ui\gamestudios.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="dashboard-ui\gamesystem.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\gamesystems.html"> <Content Include="dashboard-ui\gamesystems.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
@ -297,9 +294,6 @@
<Content Include="dashboard-ui\scripts\gamestudiospage.js"> <Content Include="dashboard-ui\scripts\gamestudiospage.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="dashboard-ui\scripts\gamesystempage.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\scripts\gamesystemspage.js"> <Content Include="dashboard-ui\scripts\gamesystemspage.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="MediaBrowser.ApiClient.Javascript" version="3.0.87" targetFramework="net45" /> <package id="MediaBrowser.ApiClient.Javascript" version="3.0.88" targetFramework="net45" />
<package id="ServiceStack.Common" version="3.9.43" targetFramework="net45" /> <package id="ServiceStack.Common" version="3.9.43" targetFramework="net45" />
<package id="ServiceStack.Text" version="3.9.43" targetFramework="net45" /> <package id="ServiceStack.Text" version="3.9.43" targetFramework="net45" />
</packages> </packages>