more sync movement

This commit is contained in:
Luke Pulverenti
2014-12-12 22:56:30 -05:00
parent 3fb40eb02e
commit ab3da46113
49 changed files with 1001 additions and 149 deletions

View File

@@ -736,16 +736,27 @@ namespace MediaBrowser.Server.Implementations.Library
}
private UserRootFolder _userRootFolder;
private readonly object _syncLock = new object();
public Folder GetUserRootFolder()
{
if (_userRootFolder == null)
{
var userRootPath = ConfigurationManager.ApplicationPaths.DefaultUserViewsPath;
lock (_syncLock)
{
if (_userRootFolder == null)
{
var userRootPath = ConfigurationManager.ApplicationPaths.DefaultUserViewsPath;
Directory.CreateDirectory(userRootPath);
Directory.CreateDirectory(userRootPath);
_userRootFolder = GetItemById(GetNewItemId(userRootPath, typeof(UserRootFolder))) as UserRootFolder ??
(UserRootFolder)ResolvePath(new DirectoryInfo(userRootPath));
_userRootFolder = GetItemById(GetNewItemId(userRootPath, typeof(UserRootFolder))) as UserRootFolder;
if (_userRootFolder == null)
{
_userRootFolder = (UserRootFolder)ResolvePath(new DirectoryInfo(userRootPath));
}
}
}
}
return _userRootFolder;

View File

@@ -1,6 +1,7 @@
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Playlists;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -53,6 +54,18 @@ namespace MediaBrowser.Server.Implementations.Library
return GetInstantMixFromGenres(genres, user);
}
public IEnumerable<Audio> GetInstantMixFromPlaylist(Playlist item, User user)
{
var genres = item
.GetRecursiveChildren(user, true)
.OfType<Audio>()
.SelectMany(i => i.Genres)
.Concat(item.Genres)
.Distinct(StringComparer.OrdinalIgnoreCase);
return GetInstantMixFromGenres(genres, user);
}
public IEnumerable<Audio> GetInstantMixFromGenres(IEnumerable<string> genres, User user)
{
var inputItems = user.RootFolder.GetRecursiveChildren(user);

View File

@@ -168,7 +168,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
{
if (string.Equals(collectionType, CollectionType.MusicVideos, StringComparison.OrdinalIgnoreCase))
{
return FindMovie<MusicVideo>(args.Path, args.Parent, args.FileSystemChildren.ToList(), args.DirectoryService, collectionType);
return FindMovie<MusicVideo>(args.Path, args.Parent, args.FileSystemChildren.ToList(), args.DirectoryService, collectionType, false);
}
if (string.Equals(collectionType, CollectionType.HomeVideos, StringComparison.OrdinalIgnoreCase))