@ -54,9 +54,29 @@ namespace Emby.Server.Implementations.Library
/// </summary>
public class LibraryManager : ILibraryManager
{
private readonly ILogger _logger ;
private readonly ITaskManager _taskManager ;
private readonly IUserManager _userManager ;
private readonly IUserDataManager _userDataRepository ;
private readonly IServerConfigurationManager _configurationManager ;
private readonly Lazy < ILibraryMonitor > _libraryMonitorFactory ;
private readonly Lazy < IProviderManager > _providerManagerFactory ;
private readonly Lazy < IUserViewManager > _userviewManagerFactory ;
private readonly IServerApplicationHost _appHost ;
private readonly IMediaEncoder _mediaEncoder ;
private readonly IFileSystem _fileSystem ;
private readonly IItemRepository _itemRepository ;
private readonly ConcurrentDictionary < Guid , BaseItem > _libraryItemsCache ;
private NamingOptions _namingOptions ;
private string [ ] _videoFileExtensions ;
private ILibraryMonitor LibraryMonitor = > _libraryMonitorFactory . Value ;
private IProviderManager ProviderManager = > _providerManagerFactory . Value ;
private IUserViewManager UserViewManager = > _userviewManagerFactory . Value ;
/// <summary>
/// Gets or sets the postscan tasks.
/// </summary>
@ -89,12 +109,6 @@ namespace Emby.Server.Implementations.Library
/// <value>The comparers.</value>
private IBaseItemComparer [ ] Comparers { get ; set ; }
/// <summary>
/// Gets or sets the active item repository
/// </summary>
/// <value>The item repository.</value>
public IItemRepository ItemRepository { get ; set ; }
/// <summary>
/// Occurs when [item added].
/// </summary>
@ -110,90 +124,47 @@ namespace Emby.Server.Implementations.Library
/// </summary>
public event EventHandler < ItemChangeEventArgs > ItemRemoved ;
/// <summary>
/// The _logger
/// </summary>
private readonly ILogger _logger ;
/// <summary>
/// The _task manager
/// </summary>
private readonly ITaskManager _taskManager ;
/// <summary>
/// The _user manager
/// </summary>
private readonly IUserManager _userManager ;
/// <summary>
/// The _user data repository
/// </summary>
private readonly IUserDataManager _userDataRepository ;
/// <summary>
/// Gets or sets the configuration manager.
/// </summary>
/// <value>The configuration manager.</value>
private IServerConfigurationManager ConfigurationManager { get ; set ; }
private readonly Func < ILibraryMonitor > _libraryMonitorFactory ;
private readonly Func < IProviderManager > _providerManagerFactory ;
private readonly Func < IUserViewManager > _userviewManager ;
public bool IsScanRunning { get ; private set ; }
private IServerApplicationHost _appHost ;
private readonly IMediaEncoder _mediaEncoder ;
/// <summary>
/// The _library items cache
/// </summary>
private readonly ConcurrentDictionary < Guid , BaseItem > _libraryItemsCache ;
/// <summary>
/// Gets the library items cache.
/// </summary>
/// <value>The library items cache.</value>
private ConcurrentDictionary < Guid , BaseItem > LibraryItemsCache = > _libraryItemsCache ;
private readonly IFileSystem _fileSystem ;
/// <summary>
/// Initializes a new instance of the <see cref="LibraryManager" /> class.
/// </summary>
/// <param name="appHost">The application host</param>
/// <param name="logger Factory ">The logger factory .</param>
/// <param name="logger">The logger.</param>
/// <param name="taskManager">The task manager.</param>
/// <param name="userManager">The user manager.</param>
/// <param name="configurationManager">The configuration manager.</param>
/// <param name="userDataRepository">The user data repository.</param>
public LibraryManager (
IServerApplicationHost appHost ,
ILogger Factory loggerFactory ,
ILogger < LibraryManager > logger ,
ITaskManager taskManager ,
IUserManager userManager ,
IServerConfigurationManager configurationManager ,
IUserDataManager userDataRepository ,
Func < ILibraryMonitor > libraryMonitorFactory ,
Lazy < ILibraryMonitor > libraryMonitorFactory ,
IFileSystem fileSystem ,
Func < IProviderManager > providerManagerFactory ,
Func < IUserViewManager > userviewManager ,
IMediaEncoder mediaEncoder )
Lazy < IProviderManager > providerManagerFactory ,
Lazy < IUserViewManager > userviewManagerFactory ,
IMediaEncoder mediaEncoder ,
IItemRepository itemRepository )
{
_appHost = appHost ;
_logger = logger Factory. CreateLogger ( nameof ( LibraryManager ) ) ;
_logger = logger ;
_taskManager = taskManager ;
_userManager = userManager ;
C onfigurationManager = configurationManager ;
_c onfigurationManager = configurationManager ;
_userDataRepository = userDataRepository ;
_libraryMonitorFactory = libraryMonitorFactory ;
_fileSystem = fileSystem ;
_providerManagerFactory = providerManagerFactory ;
_userviewManager = userviewManager ;
_userviewManager Factory = userviewManager Factory ;
_mediaEncoder = mediaEncoder ;
_itemRepository = itemRepository ;
_libraryItemsCache = new ConcurrentDictionary < Guid , BaseItem > ( ) ;
C onfigurationManager. ConfigurationUpdated + = ConfigurationUpdated ;
_c onfigurationManager. ConfigurationUpdated + = ConfigurationUpdated ;
RecordConfigurationValues ( configurationManager . Configuration ) ;
}
@ -272,7 +243,7 @@ namespace Emby.Server.Implementations.Library
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
private void ConfigurationUpdated ( object sender , EventArgs e )
{
var config = C onfigurationManager. Configuration ;
var config = _c onfigurationManager. Configuration ;
var wizardChanged = config . IsStartupWizardCompleted ! = _wizardCompleted ;
@ -306,7 +277,7 @@ namespace Emby.Server.Implementations.Library
}
}
L ibraryItemsCache. AddOrUpdate ( item . Id , item , delegate { return item ; } ) ;
_l ibraryItemsCache. AddOrUpdate ( item . Id , item , delegate { return item ; } ) ;
}
public void DeleteItem ( BaseItem item , DeleteOptions options )
@ -437,10 +408,10 @@ namespace Emby.Server.Implementations.Library
item . SetParent ( null ) ;
I temRepository. DeleteItem ( item . Id ) ;
_i temRepository. DeleteItem ( item . Id ) ;
foreach ( var child in children )
{
I temRepository. DeleteItem ( child . Id ) ;
_i temRepository. DeleteItem ( child . Id ) ;
}
_libraryItemsCache . TryRemove ( item . Id , out BaseItem removed ) ;
@ -509,15 +480,15 @@ namespace Emby.Server.Implementations.Library
throw new ArgumentNullException ( nameof ( type ) ) ;
}
if ( key . StartsWith ( C onfigurationManager. ApplicationPaths . ProgramDataPath , StringComparison . Ordinal ) )
if ( key . StartsWith ( _c onfigurationManager. ApplicationPaths . ProgramDataPath , StringComparison . Ordinal ) )
{
// Try to normalize paths located underneath program-data in an attempt to make them more portable
key = key . Substring ( C onfigurationManager. ApplicationPaths . ProgramDataPath . Length )
key = key . Substring ( _c onfigurationManager. ApplicationPaths . ProgramDataPath . Length )
. TrimStart ( new [ ] { '/' , '\\' } )
. Replace ( "/" , "\\" ) ;
}
if ( forceCaseInsensitive | | ! C onfigurationManager. Configuration . EnableCaseSensitiveItemIds )
if ( forceCaseInsensitive | | ! _c onfigurationManager. Configuration . EnableCaseSensitiveItemIds )
{
key = key . ToLowerInvariant ( ) ;
}
@ -550,7 +521,7 @@ namespace Emby.Server.Implementations.Library
collectionType = GetContentTypeOverride ( fullPath , true ) ;
}
var args = new ItemResolveArgs ( C onfigurationManager. ApplicationPaths , directoryService )
var args = new ItemResolveArgs ( _c onfigurationManager. ApplicationPaths , directoryService )
{
Parent = parent ,
Path = fullPath ,
@ -720,7 +691,7 @@ namespace Emby.Server.Implementations.Library
/// <exception cref="InvalidOperationException">Cannot create the root folder until plugins have loaded.</exception>
public AggregateFolder CreateRootFolder ( )
{
var rootFolderPath = C onfigurationManager. ApplicationPaths . RootFolderPath ;
var rootFolderPath = _c onfigurationManager. ApplicationPaths . RootFolderPath ;
Directory . CreateDirectory ( rootFolderPath ) ;
@ -734,7 +705,7 @@ namespace Emby.Server.Implementations.Library
}
// Add in the plug-in folders
var path = Path . Combine ( C onfigurationManager. ApplicationPaths . DataPath , "playlists" ) ;
var path = Path . Combine ( _c onfigurationManager. ApplicationPaths . DataPath , "playlists" ) ;
Directory . CreateDirectory ( path ) ;
@ -786,7 +757,7 @@ namespace Emby.Server.Implementations.Library
{
if ( _userRootFolder = = null )
{
var userRootPath = C onfigurationManager. ApplicationPaths . DefaultUserViewsPath ;
var userRootPath = _c onfigurationManager. ApplicationPaths . DefaultUserViewsPath ;
_logger . LogDebug ( "Creating userRootPath at {path}" , userRootPath ) ;
Directory . CreateDirectory ( userRootPath ) ;
@ -980,7 +951,7 @@ namespace Emby.Server.Implementations.Library
where T : BaseItem , new ( )
{
var path = getPathFn ( name ) ;
var forceCaseInsensitiveId = C onfigurationManager. Configuration . EnableNormalizedItemByNameIds ;
var forceCaseInsensitiveId = _c onfigurationManager. Configuration . EnableNormalizedItemByNameIds ;
return GetNewItemIdInternal ( path , typeof ( T ) , forceCaseInsensitiveId ) ;
}
@ -994,7 +965,7 @@ namespace Emby.Server.Implementations.Library
public Task ValidatePeople ( CancellationToken cancellationToken , IProgress < double > progress )
{
// Ensure the location is available.
Directory . CreateDirectory ( C onfigurationManager. ApplicationPaths . PeoplePath ) ;
Directory . CreateDirectory ( _c onfigurationManager. ApplicationPaths . PeoplePath ) ;
return new PeopleValidator ( this , _logger , _fileSystem ) . ValidatePeople ( cancellationToken , progress ) ;
}
@ -1031,7 +1002,7 @@ namespace Emby.Server.Implementations.Library
public async Task ValidateMediaLibraryInternal ( IProgress < double > progress , CancellationToken cancellationToken )
{
IsScanRunning = true ;
_libraryMonitorFactory( ) . Stop ( ) ;
LibraryMonitor . Stop ( ) ;
try
{
@ -1039,7 +1010,7 @@ namespace Emby.Server.Implementations.Library
}
finally
{
_libraryMonitorFactory( ) . Start ( ) ;
LibraryMonitor . Start ( ) ;
IsScanRunning = false ;
}
}
@ -1148,7 +1119,7 @@ namespace Emby.Server.Implementations.Library
progress . Report ( percent * 100 ) ;
}
I temRepository. UpdateInheritedValues ( cancellationToken ) ;
_i temRepository. UpdateInheritedValues ( cancellationToken ) ;
progress . Report ( 100 ) ;
}
@ -1168,9 +1139,9 @@ namespace Emby.Server.Implementations.Library
var topLibraryFolders = GetUserRootFolder ( ) . Children . ToList ( ) ;
_logger . LogDebug ( "Getting refreshQueue" ) ;
var refreshQueue = includeRefreshState ? _providerManagerFactory( ) . GetRefreshQueue ( ) : null ;
var refreshQueue = includeRefreshState ? ProviderManager . GetRefreshQueue ( ) : null ;
return _fileSystem . GetDirectoryPaths ( C onfigurationManager. ApplicationPaths . DefaultUserViewsPath )
return _fileSystem . GetDirectoryPaths ( _c onfigurationManager. ApplicationPaths . DefaultUserViewsPath )
. Select ( dir = > GetVirtualFolderInfo ( dir , topLibraryFolders , refreshQueue ) )
. ToList ( ) ;
}
@ -1245,7 +1216,7 @@ namespace Emby.Server.Implementations.Library
throw new ArgumentException ( "Guid can't be empty" , nameof ( id ) ) ;
}
if ( L ibraryItemsCache. TryGetValue ( id , out BaseItem item ) )
if ( _l ibraryItemsCache. TryGetValue ( id , out BaseItem item ) )
{
return item ;
}
@ -1276,7 +1247,7 @@ namespace Emby.Server.Implementations.Library
AddUserToQuery ( query , query . User , allowExternalContent ) ;
}
return I temRepository. GetItemList ( query ) ;
return _i temRepository. GetItemList ( query ) ;
}
public List < BaseItem > GetItemList ( InternalItemsQuery query )
@ -1300,7 +1271,7 @@ namespace Emby.Server.Implementations.Library
AddUserToQuery ( query , query . User ) ;
}
return I temRepository. GetCount ( query ) ;
return _i temRepository. GetCount ( query ) ;
}
public List < BaseItem > GetItemList ( InternalItemsQuery query , List < BaseItem > parents )
@ -1315,7 +1286,7 @@ namespace Emby.Server.Implementations.Library
}
}
return I temRepository. GetItemList ( query ) ;
return _i temRepository. GetItemList ( query ) ;
}
public QueryResult < BaseItem > QueryItems ( InternalItemsQuery query )
@ -1327,12 +1298,12 @@ namespace Emby.Server.Implementations.Library
if ( query . EnableTotalRecordCount )
{
return I temRepository. GetItems ( query ) ;
return _i temRepository. GetItems ( query ) ;
}
return new QueryResult < BaseItem >
{
Items = I temRepository. GetItemList ( query ) . ToArray ( )
Items = _i temRepository. GetItemList ( query ) . ToArray ( )
} ;
}
@ -1343,7 +1314,7 @@ namespace Emby.Server.Implementations.Library
AddUserToQuery ( query , query . User ) ;
}
return I temRepository. GetItemIdsList ( query ) ;
return _i temRepository. GetItemIdsList ( query ) ;
}
public QueryResult < ( BaseItem , ItemCounts ) > GetStudios ( InternalItemsQuery query )
@ -1354,7 +1325,7 @@ namespace Emby.Server.Implementations.Library
}
SetTopParentOrAncestorIds ( query ) ;
return I temRepository. GetStudios ( query ) ;
return _i temRepository. GetStudios ( query ) ;
}
public QueryResult < ( BaseItem , ItemCounts ) > GetGenres ( InternalItemsQuery query )
@ -1365,7 +1336,7 @@ namespace Emby.Server.Implementations.Library
}
SetTopParentOrAncestorIds ( query ) ;
return I temRepository. GetGenres ( query ) ;
return _i temRepository. GetGenres ( query ) ;
}
public QueryResult < ( BaseItem , ItemCounts ) > GetMusicGenres ( InternalItemsQuery query )
@ -1376,7 +1347,7 @@ namespace Emby.Server.Implementations.Library
}
SetTopParentOrAncestorIds ( query ) ;
return I temRepository. GetMusicGenres ( query ) ;
return _i temRepository. GetMusicGenres ( query ) ;
}
public QueryResult < ( BaseItem , ItemCounts ) > GetAllArtists ( InternalItemsQuery query )
@ -1387,7 +1358,7 @@ namespace Emby.Server.Implementations.Library
}
SetTopParentOrAncestorIds ( query ) ;
return I temRepository. GetAllArtists ( query ) ;
return _i temRepository. GetAllArtists ( query ) ;
}
public QueryResult < ( BaseItem , ItemCounts ) > GetArtists ( InternalItemsQuery query )
@ -1398,7 +1369,7 @@ namespace Emby.Server.Implementations.Library
}
SetTopParentOrAncestorIds ( query ) ;
return I temRepository. GetArtists ( query ) ;
return _i temRepository. GetArtists ( query ) ;
}
private void SetTopParentOrAncestorIds ( InternalItemsQuery query )
@ -1439,7 +1410,7 @@ namespace Emby.Server.Implementations.Library
}
SetTopParentOrAncestorIds ( query ) ;
return I temRepository. GetAlbumArtists ( query ) ;
return _i temRepository. GetAlbumArtists ( query ) ;
}
public QueryResult < BaseItem > GetItemsResult ( InternalItemsQuery query )
@ -1460,10 +1431,10 @@ namespace Emby.Server.Implementations.Library
if ( query . EnableTotalRecordCount )
{
return I temRepository. GetItems ( query ) ;
return _i temRepository. GetItems ( query ) ;
}
var list = I temRepository. GetItemList ( query ) ;
var list = _i temRepository. GetItemList ( query ) ;
return new QueryResult < BaseItem >
{
@ -1509,7 +1480,7 @@ namespace Emby.Server.Implementations.Library
string . IsNullOrEmpty ( query . SeriesPresentationUniqueKey ) & &
query . ItemIds . Length = = 0 )
{
var userViews = _userviewManager( ) . GetUserViews ( new UserViewQuery
var userViews = UserViewManager . GetUserViews ( new UserViewQuery
{
UserId = user . Id ,
IncludeHidden = true ,
@ -1809,7 +1780,7 @@ namespace Emby.Server.Implementations.Library
// Don't iterate multiple times
var itemsList = items . ToList ( ) ;
I temRepository. SaveItems ( itemsList , cancellationToken ) ;
_i temRepository. SaveItems ( itemsList , cancellationToken ) ;
foreach ( var item in itemsList )
{
@ -1846,7 +1817,7 @@ namespace Emby.Server.Implementations.Library
public void UpdateImages ( BaseItem item )
{
I temRepository. SaveImages ( item ) ;
_i temRepository. SaveImages ( item ) ;
RegisterItem ( item ) ;
}
@ -1863,7 +1834,7 @@ namespace Emby.Server.Implementations.Library
{
if ( item . IsFileProtocol )
{
_providerManagerFactory( ) . SaveMetadata ( item , updateReason ) ;
ProviderManager . SaveMetadata ( item , updateReason ) ;
}
item . DateLastSaved = DateTime . UtcNow ;
@ -1871,7 +1842,7 @@ namespace Emby.Server.Implementations.Library
RegisterItem ( item ) ;
}
I temRepository. SaveItems ( itemsList , cancellationToken ) ;
_i temRepository. SaveItems ( itemsList , cancellationToken ) ;
if ( ItemUpdated ! = null )
{
@ -1947,7 +1918,7 @@ namespace Emby.Server.Implementations.Library
/// <returns>BaseItem.</returns>
public BaseItem RetrieveItem ( Guid id )
{
return I temRepository. RetrieveItem ( id ) ;
return _i temRepository. RetrieveItem ( id ) ;
}
public List < Folder > GetCollectionFolders ( BaseItem item )
@ -2066,7 +2037,7 @@ namespace Emby.Server.Implementations.Library
private string GetContentTypeOverride ( string path , bool inherit )
{
var nameValuePair = C onfigurationManager. Configuration . ContentTypes
var nameValuePair = _c onfigurationManager. Configuration . ContentTypes
. FirstOrDefault ( i = > _fileSystem . AreEqual ( i . Name , path )
| | ( inherit & & ! string . IsNullOrEmpty ( i . Name )
& & _fileSystem . ContainsSubPath ( i . Name , path ) ) ) ;
@ -2115,7 +2086,7 @@ namespace Emby.Server.Implementations.Library
string sortName )
{
var path = Path . Combine (
C onfigurationManager. ApplicationPaths . InternalMetadataPath ,
_c onfigurationManager. ApplicationPaths . InternalMetadataPath ,
"views" ,
_fileSystem . GetValidFilename ( viewType ) ) ;
@ -2147,7 +2118,7 @@ namespace Emby.Server.Implementations.Library
if ( refresh )
{
item . UpdateToRepository ( ItemUpdateType . MetadataImport , CancellationToken . None ) ;
_providerManagerFactory( ) . QueueRefresh ( item . Id , new MetadataRefreshOptions ( new DirectoryService ( _fileSystem ) ) , RefreshPriority . Normal ) ;
ProviderManager . QueueRefresh ( item . Id , new MetadataRefreshOptions ( new DirectoryService ( _fileSystem ) ) , RefreshPriority . Normal ) ;
}
return item ;
@ -2165,7 +2136,7 @@ namespace Emby.Server.Implementations.Library
var id = GetNewItemId ( idValues , typeof ( UserView ) ) ;
var path = Path . Combine ( C onfigurationManager. ApplicationPaths . InternalMetadataPath , "views" , id . ToString ( "N" , CultureInfo . InvariantCulture ) ) ;
var path = Path . Combine ( _c onfigurationManager. ApplicationPaths . InternalMetadataPath , "views" , id . ToString ( "N" , CultureInfo . InvariantCulture ) ) ;
var item = GetItemById ( id ) as UserView ;
@ -2202,7 +2173,7 @@ namespace Emby.Server.Implementations.Library
if ( refresh )
{
_providerManagerFactory( ) . QueueRefresh (
ProviderManager . QueueRefresh (
item . Id ,
new MetadataRefreshOptions ( new DirectoryService ( _fileSystem ) )
{
@ -2269,7 +2240,7 @@ namespace Emby.Server.Implementations.Library
if ( refresh )
{
_providerManagerFactory( ) . QueueRefresh (
ProviderManager . QueueRefresh (
item . Id ,
new MetadataRefreshOptions ( new DirectoryService ( _fileSystem ) )
{
@ -2303,7 +2274,7 @@ namespace Emby.Server.Implementations.Library
var id = GetNewItemId ( idValues , typeof ( UserView ) ) ;
var path = Path . Combine ( C onfigurationManager. ApplicationPaths . InternalMetadataPath , "views" , id . ToString ( "N" , CultureInfo . InvariantCulture ) ) ;
var path = Path . Combine ( _c onfigurationManager. ApplicationPaths . InternalMetadataPath , "views" , id . ToString ( "N" , CultureInfo . InvariantCulture ) ) ;
var item = GetItemById ( id ) as UserView ;
@ -2346,7 +2317,7 @@ namespace Emby.Server.Implementations.Library
if ( refresh )
{
_providerManagerFactory( ) . QueueRefresh (
ProviderManager . QueueRefresh (
item . Id ,
new MetadataRefreshOptions ( new DirectoryService ( _fileSystem ) )
{
@ -2364,7 +2335,7 @@ namespace Emby.Server.Implementations.Library
string videoPath ,
string [ ] files )
{
new SubtitleResolver ( BaseItem . LocalizationManager , _fileSystem ). AddExternalSubtitleStreams ( streams , videoPath , streams . Count , files ) ;
new SubtitleResolver ( BaseItem . LocalizationManager ). AddExternalSubtitleStreams ( streams , videoPath , streams . Count , files ) ;
}
/// <inheritdoc />
@ -2675,8 +2646,8 @@ namespace Emby.Server.Implementations.Library
}
}
var metadataPath = C onfigurationManager. Configuration . MetadataPath ;
var metadataNetworkPath = C onfigurationManager. Configuration . MetadataNetworkPath ;
var metadataPath = _c onfigurationManager. Configuration . MetadataPath ;
var metadataNetworkPath = _c onfigurationManager. Configuration . MetadataNetworkPath ;
if ( ! string . IsNullOrWhiteSpace ( metadataPath ) & & ! string . IsNullOrWhiteSpace ( metadataNetworkPath ) )
{
@ -2687,7 +2658,7 @@ namespace Emby.Server.Implementations.Library
}
}
foreach ( var map in C onfigurationManager. Configuration . PathSubstitutions )
foreach ( var map in _c onfigurationManager. Configuration . PathSubstitutions )
{
if ( ! string . IsNullOrWhiteSpace ( map . From ) )
{
@ -2756,7 +2727,7 @@ namespace Emby.Server.Implementations.Library
public List < PersonInfo > GetPeople ( InternalPeopleQuery query )
{
return I temRepository. GetPeople ( query ) ;
return _i temRepository. GetPeople ( query ) ;
}
public List < PersonInfo > GetPeople ( BaseItem item )
@ -2779,7 +2750,7 @@ namespace Emby.Server.Implementations.Library
public List < Person > GetPeopleItems ( InternalPeopleQuery query )
{
return I temRepository. GetPeopleNames ( query ) . Select ( i = >
return _i temRepository. GetPeopleNames ( query ) . Select ( i = >
{
try
{
@ -2796,7 +2767,7 @@ namespace Emby.Server.Implementations.Library
public List < string > GetPeopleNames ( InternalPeopleQuery query )
{
return I temRepository. GetPeopleNames ( query ) ;
return _i temRepository. GetPeopleNames ( query ) ;
}
public void UpdatePeople ( BaseItem item , List < PersonInfo > people )
@ -2806,7 +2777,7 @@ namespace Emby.Server.Implementations.Library
return ;
}
I temRepository. UpdatePeople ( item . Id , people ) ;
_i temRepository. UpdatePeople ( item . Id , people ) ;
}
public async Task < ItemImageInfo > ConvertImageToLocal ( BaseItem item , ItemImageInfo image , int imageIndex )
@ -2817,7 +2788,7 @@ namespace Emby.Server.Implementations.Library
{
_logger . LogDebug ( "ConvertImageToLocal item {0} - image url: {1}" , item . Id , url ) ;
await _providerManagerFactory( ) . SaveImage ( item , url , image . Type , imageIndex , CancellationToken . None ) . ConfigureAwait ( false ) ;
await ProviderManager . SaveImage ( item , url , image . Type , imageIndex , CancellationToken . None ) . ConfigureAwait ( false ) ;
item . UpdateToRepository ( ItemUpdateType . ImageUpdate , CancellationToken . None ) ;
@ -2850,7 +2821,7 @@ namespace Emby.Server.Implementations.Library
name = _fileSystem . GetValidFilename ( name ) ;
var rootFolderPath = C onfigurationManager. ApplicationPaths . DefaultUserViewsPath ;
var rootFolderPath = _c onfigurationManager. ApplicationPaths . DefaultUserViewsPath ;
var virtualFolderPath = Path . Combine ( rootFolderPath , name ) ;
while ( Directory . Exists ( virtualFolderPath ) )
@ -2869,7 +2840,7 @@ namespace Emby.Server.Implementations.Library
}
}
_libraryMonitorFactory( ) . Stop ( ) ;
LibraryMonitor . Stop ( ) ;
try
{
@ -2904,7 +2875,7 @@ namespace Emby.Server.Implementations.Library
{
// Need to add a delay here or directory watchers may still pick up the changes
await Task . Delay ( 1000 ) . ConfigureAwait ( false ) ;
_libraryMonitorFactory( ) . Start ( ) ;
LibraryMonitor . Start ( ) ;
}
}
}
@ -2964,7 +2935,7 @@ namespace Emby.Server.Implementations.Library
throw new FileNotFoundException ( "The network path does not exist." ) ;
}
var rootFolderPath = C onfigurationManager. ApplicationPaths . DefaultUserViewsPath ;
var rootFolderPath = _c onfigurationManager. ApplicationPaths . DefaultUserViewsPath ;
var virtualFolderPath = Path . Combine ( rootFolderPath , virtualFolderName ) ;
var shortcutFilename = Path . GetFileNameWithoutExtension ( path ) ;
@ -3007,7 +2978,7 @@ namespace Emby.Server.Implementations.Library
throw new FileNotFoundException ( "The network path does not exist." ) ;
}
var rootFolderPath = C onfigurationManager. ApplicationPaths . DefaultUserViewsPath ;
var rootFolderPath = _c onfigurationManager. ApplicationPaths . DefaultUserViewsPath ;
var virtualFolderPath = Path . Combine ( rootFolderPath , virtualFolderName ) ;
var libraryOptions = CollectionFolder . GetLibraryOptions ( virtualFolderPath ) ;
@ -3060,7 +3031,7 @@ namespace Emby.Server.Implementations.Library
throw new ArgumentNullException ( nameof ( name ) ) ;
}
var rootFolderPath = C onfigurationManager. ApplicationPaths . DefaultUserViewsPath ;
var rootFolderPath = _c onfigurationManager. ApplicationPaths . DefaultUserViewsPath ;
var path = Path . Combine ( rootFolderPath , name ) ;
@ -3069,7 +3040,7 @@ namespace Emby.Server.Implementations.Library
throw new FileNotFoundException ( "The media folder does not exist" ) ;
}
_libraryMonitorFactory( ) . Stop ( ) ;
LibraryMonitor . Stop ( ) ;
try
{
@ -3089,7 +3060,7 @@ namespace Emby.Server.Implementations.Library
{
// Need to add a delay here or directory watchers may still pick up the changes
await Task . Delay ( 1000 ) . ConfigureAwait ( false ) ;
_libraryMonitorFactory( ) . Start ( ) ;
LibraryMonitor . Start ( ) ;
}
}
}
@ -3103,7 +3074,7 @@ namespace Emby.Server.Implementations.Library
var removeList = new List < NameValuePair > ( ) ;
foreach ( var contentType in C onfigurationManager. Configuration . ContentTypes )
foreach ( var contentType in _c onfigurationManager. Configuration . ContentTypes )
{
if ( string . IsNullOrWhiteSpace ( contentType . Name ) )
{
@ -3118,11 +3089,11 @@ namespace Emby.Server.Implementations.Library
if ( removeList . Count > 0 )
{
ConfigurationManager. Configuration . ContentTypes = C onfigurationManager. Configuration . ContentTypes
_configurationManager. Configuration . ContentTypes = _c onfigurationManager. Configuration . ContentTypes
. Except ( removeList )
. ToArray ( ) ;
C onfigurationManager. SaveConfiguration ( ) ;
_c onfigurationManager. SaveConfiguration ( ) ;
}
}
@ -3133,7 +3104,7 @@ namespace Emby.Server.Implementations.Library
throw new ArgumentNullException ( nameof ( mediaPath ) ) ;
}
var rootFolderPath = C onfigurationManager. ApplicationPaths . DefaultUserViewsPath ;
var rootFolderPath = _c onfigurationManager. ApplicationPaths . DefaultUserViewsPath ;
var virtualFolderPath = Path . Combine ( rootFolderPath , virtualFolderName ) ;
if ( ! Directory . Exists ( virtualFolderPath ) )