Jump to content

SDK FFmpeg UnauthorizedAccessException and Library management


Recommended Posts

Posted

I have been wokring on a pluging and reliably had it calling ffmpeg to do transcoding for me in a specific way. "Something" happened on my dev box ( i can't figure out what), and now ffmpeg that is being called by emby cannot write anywhere. Not into C:\Programdata\Emby-Server, or C:\Users\<user>\AppData\Roaming\Emby-Server\programdata\transcoding-temp. I have reinstalled Emby, but have no idea what has changed in my environment to cause this. Currently I can no longer get ffmpeg from emby to write anywhere. However the plugin that is calling ffmpeg, can create the directories that it requires in those same directories just fine.

I am calling ffmpeg like this:

var Arguments_to_pass = $"-i \"{inputFilePath}\" -c:v copy -c:a copy -f segment -segment_time 5 -segment_format mpegts -flush_packets 1 -segment_list \"{m3u8FilePath}\" -segment_list_type m3u8 \"{outputFilePath}\"";

logger.Info("FFmpeg arguments: " + string.Join(" ", Arguments_to_pass));

// Configure FFmpeg process            

// Start FFmpeg pocess using IFfmpegManager
var ffmpegRunner = _ffmpegManager.CreateFfMpegRunner(playSessionId, transcodingDirectory);
ffmpegRunner.Start(Arguments_to_pass);


But have also had it running like this : (and had it working before it broke)

 var processStartInfo = new ProcessStartInfo
 {
     FileName = "ffmpeg",
     Arguments = $"-i \"{inputFilePath}\" -c:v copy -c:a copy -f segment -segment_time 5 -segment_format mpegts -flush_packets 1 -segment_list \"{m3u8FilePath}\" -segment_list_type m3u8 \"{outputFilePath}\"",
    //Arguments = $"-i \"{inputFilePath}\" -force_key_frames \"expr:gte(t,n_forced*5)\" -c:v libx264 -preset fast -crf 23 -c:a aac -b:a 128k -f segment -segment_time 5 -segment_format mpegts -flush_packets 1 -g 150 -segment_list \"{m3u8FilePath}\" -segment_list_type m3u8 \"{outputFilePath}\"",
     RedirectStandardOutput = true,
     RedirectStandardError = true,
     UseShellExecute = false,
     CreateNoWindow = true
 };

 var process = new Process { StartInfo = processStartInfo };
 process.OutputDataReceived += (sender, args) => HandleFfmpegOutput(args.Data, process, playSessionId);
 process.ErrorDataReceived += (sender, args) => HandleFfmpegOutput(args.Data, process, playSessionId);

 process.Start();

 

 

 

2025-01-05 20:58:17.619 Info Live-Video-Translator: M3U8 path: C:\Users\<user>\AppData\Roaming\Emby-Server\programdata\transcoding-temp\e96b94fe2045490e932d9d6aa5d2b1a8\playlist.m3u8
2025-01-05 20:58:17.619 Info Live-Video-Translator: Output path: C:\Users\<user>\AppData\Roaming\Emby-Server\programdata\transcoding-temp\e96b94fe2045490e932d9d6aa5d2b1a8\output%03d_original.ts
2025-01-05 20:58:17.619 Info Live-Video-Translator: FFmpeg arguments: -i "C:\Users\<user>\Downloads\Season 1\no-subs.mp4" -c:v copy -c:a copy -f segment -segment_time 5 -segment_format mpegts -flush_packets 1 -segment_list "C:\Users\<user>\AppData\Roaming\Emby-Server\programdata\transcoding-temp\e96b94fe2045490e932d9d6aa5d2b1a8\playlist.m3u8" -segment_list_type m3u8 "C:\Users\<user>\AppData\Roaming\Emby-Server\programdata\transcoding-temp\e96b94fe2045490e932d9d6aa5d2b1a8\output%03d_original.ts"
2025-01-05 20:58:17.621 Error FfmpegManager: ProcessRun 'e96b94fe2045490e932d9d6aa5d2b1a8': Error starting Ffmpeg. WorkingFolder: C:\Users\<user>\AppData\Roaming\Emby-Server\system
        *** Error Report ***
        Version: 4.8.10.0
        Command line: C:\Users\<user>\AppData\Roaming\Emby-Server\system\EmbyServer.dll -noautorunwebapp
        Operating system: Microsoft Windows 10.0.22631
        Framework: .NET 6.0.33
        OS/Process: x64/x64
        Runtime: C:/Users/<user>/AppData/Roaming/Emby-Server/system/System.Private.CoreLib.dll
        Processor count: 16
        Data path: C:\Users\<user>\AppData\Roaming\Emby-Server\programdata
        Application path: C:\Users\<user>\AppData\Roaming\Emby-Server\system
        System.UnauthorizedAccessException: System.UnauthorizedAccessException: Access to the path 'C:\Users\<user>\AppData\Roaming\Emby-Server\programdata\transcoding-temp\e96b94fe2045490e932d9d6aa5d2b1a8' is denied.
           at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)
           at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
           at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
           at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
           at System.IO.Strategies.FileStreamHelpers.ChooseStrategy(FileStream fileStream, String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, Int64 preallocationSize)
           at System.IO.FileStream..ctor(String path, FileStreamOptions options)
           at Emby.Server.Implementations.IO.ManagedFileSystem.GetFileStream(String path, FileOpenMode mode, FileAccessMode access, FileShareMode share, Int32 bufferSize, FileOpenOptions fileOpenOptions, Int64 preAllocationSize)
           at Emby.Server.Implementations.IO.ManagedFileSystem.GetFileStream(String path, FileOpenMode mode, FileAccessMode access, FileShareMode share, FileOpenOptions fileOpenOptions)
           at Emby.ProcessRun.Extensions.ProcessLogWriter..ctor(IFileSystem fileSystem, String logFilePath, Boolean writeStandardError, Boolean writeStandardOutput)
           at Emby.ProcessRun.Runners.ProcessRunnerCommon.OnInitialize()
           at Emby.ProcessRun.Runners.ProcessRunnerExtensible.OnBeforeStartProcessCore(StartParams processStartInfo)
           at Emby.ProcessRun.Runners.ProcessRunnerBase.Run(StartParams startParams)
           at Emby.ProcessRun.Runners.ProcessRunnerBase.Run(String exeFileName, String commandLineArgs, String workingDirectory)
           at Emby.Server.MediaEncoding.Unified.Ffmpeg.FfRunnerBase.Start(String commandLineArgs)
        Source: System.Private.CoreLib
        TargetSite: Microsoft.Win32.SafeHandles.SafeFileHandle CreateFile(System.String, System.IO.FileMode, System.IO.FileAccess, System.IO.FileShare, System.IO.FileOptions)

2025-01-05 20:58:17.621 Error Live-Video-Translator: Error starting FFmpeg transcoding for session e96b94fe2045490e932d9d6aa5d2b1a8: Access to the path 'C:\Users\<user>\AppData\Roaming\Emby-Server\programdata\transcoding-temp\e96b94fe2045490e932d9d6aa5d2b1a8' is denied.
2025-01-05 20:58:17.621 Error Live-Video-Translator: Exception in OnPlaybackStart(): System.UnauthorizedAccessException: Access to the path 'C:\Users\<user>\AppData\Roaming\Emby-Server\programdata\transcoding-temp\e96b94fe2045490e932d9d6aa5d2b1a8' is denied.
   at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
   at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
   at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
   at System.IO.Strategies.FileStreamHelpers.ChooseStrategy(FileStream fileStream, String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, Int64 preallocationSize)
   at System.IO.FileStream..ctor(String path, FileStreamOptions options)
   at Emby.Server.Implementations.IO.ManagedFileSystem.GetFileStream(String path, FileOpenMode mode, FileAccessMode access, FileShareMode share, Int32 bufferSize, FileOpenOptions fileOpenOptions, Int64 preAllocationSize)
   at Emby.Server.Implementations.IO.ManagedFileSystem.GetFileStream(String path, FileOpenMode mode, FileAccessMode access, FileShareMode share, FileOpenOptions fileOpenOptions)
   at Emby.ProcessRun.Extensions.ProcessLogWriter..ctor(IFileSystem fileSystem, String logFilePath, Boolean writeStandardError, Boolean writeStandardOutput)
   at Emby.ProcessRun.Runners.ProcessRunnerCommon.OnInitialize()
   at Emby.ProcessRun.Runners.ProcessRunnerExtensible.OnBeforeStartProcessCore(StartParams processStartInfo)
   at Emby.ProcessRun.Runners.ProcessRunnerBase.Run(StartParams startParams)
   at Emby.ProcessRun.Runners.ProcessRunnerBase.Run(String exeFileName, String commandLineArgs, String workingDirectory)
   at Emby.Server.MediaEncoding.Unified.Ffmpeg.FfRunnerBase.Start(String commandLineArgs)
   at EmbyPluginSimpleUI.Plugin.StartFfmpegTranscoding(String inputFilePath, String playSessionId)
   at EmbyPluginSimpleUI.Plugin.OnPlaybackStart(Object sender, PlaybackProgressEventArgs e)

 

 

 

I also want to programatically add a folder of my choosing to the library (unless there is a way to play a media item on the server, that's not in the library, if it is how do I achieve this?)
I am trying to add a folder to a new library like this, the library adding works, but my directory is not added to the library. I can see in the GUI the new library, but no folder in it.

        const string LIBRARY_NAME = "LiveVideoTemporaryLibrary";

        logger.Info($"No existing '{LIBRARY_NAME}' found. Creating a new one.");

        // Create a new library
        var libraryOptions = new LibraryOptions
        {
            EnablePhotos = true,
            ContentType = "mixedcontent"
        };

        _libraryManager.AddVirtualFolder(
            LIBRARY_NAME,
            directoryPath,
            libraryOptions,
            true);

 

 

 

Any help is greatly appreciated, thanks!

Posted

FFmpeg does not create folders, so you need to create the folder manually before running ffmpeg.

Posted
52 minutes ago, softworkz said:

FFmpeg does not create folders, so you need to create the folder manually before running ffmpeg.

Thanks;  but I am calling a folder creation before hand I just didn't show it.

 

Any other ideas regarding ffmpeg failing, or the library addition ?

Posted

What folder creation are you doing?

Posted
10 minutes ago, bobo99 said:
1 hour ago, softworkz said:

FFmpeg does not create folders, so you need to create the folder manually before running ffmpeg.

Thanks;  but I am calling a folder creation before hand I just didn't show it.

If you run the exact same ffmpeg command manually from a command prompt after it fails, does it work?
All paths are absolute, right?

Posted (edited)
1 hour ago, Luke said:

What folder creation are you doing?

I am creating a folder for ffmpeg to output to in the transcoding-temp directory. The folder name is the playsessionid.

1 hour ago, softworkz said:

If you run the exact same ffmpeg command manually from a command prompt after it fails, does it work?
All paths are absolute, right?

All paths are absolute (except I'm not specific where ffmpeg is), and if I run the command manually calling ffmpeg to output to that directory everything works exactly as intended.

The folder is created by the plugin successfully, just when ffmpeg is called to output to it, it falls over.

Works from command line
C:\Users\<user>\AppData\Roaming\Emby-Server\system>ffmpeg.exe -i "C:\Users\<user>\Downloads\Season 1\no-subs.mp4" -c:v copy -c:a copy -f segment -segment_time 5 -segment_format mpegts -flush_packets 1 -segment_list "C:\Users\<user>\AppData\Roaming\Emby-Server\programdata\transcoding-temp\58aec7485ff945dca78e2a69ccb13723\playlist.m3u8" -segment_list_type m3u8 "C:\Users\<user>\AppData\Roaming\Emby-Server\programdata\transcoding-temp\58aec7485ff945dca78e2a69ccb13723\output%03d_original.ts"
  

I want to emphasize that this worked for days while I was dev-ing, and then suddenly stopped, and I cannot diagnose what changed.

Before I call ffmpeg I create the folder like this:

private string GetTranscodingDirectory()
{
    var logger = _logManager.GetLogger(this.Name);

    logger.Info("Attempting to fetch the transcoding directory.");

    var programDataPath = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
    var embyProgramDataPath = Path.Combine(programDataPath, "Emby-Server", "programdata", "transcoding-temp");

    logger.Info($"Transcoding directory resolved to: {embyProgramDataPath}");

    return embyProgramDataPath;
}
var programDataPath = GetTranscodingDirectory();

var embyProgramDataPath = Path.Combine(programDataPath, playSessionId);
// calls function above

  // Ensure the directory exists and gets created
  Directory.CreateDirectory(embyProgramDataPath);

 

 

  var outputFilePath = Path.Combine(embyProgramDataPath, "output%03d_original.ts");
  var m3u8FilePath = Path.Combine(embyProgramDataPath, "playlist.m3u8");
  logger.Info($"Output path is: {outputFilePath}.");
  logger.Info($"M3U8 path is: {m3u8FilePath}.");

  // Generate m3u8 file
           
  var processStartInfo = new ProcessStartInfo
  {
      FileName = "ffmpeg",
      Arguments = $"-i \"{inputFilePath}\" -c:v copy -c:a copy -f segment -segment_time 5 -segment_format mpegts -flush_packets 1 -segment_list \"{m3u8FilePath}\" -segment_list_type m3u8 \"{outputFilePath}\"",
     //Arguments = $"-i \"{inputFilePath}\" -force_key_frames \"expr:gte(t,n_forced*5)\" -c:v libx264 -preset fast -crf 23 -c:a aac -b:a 128k -f segment -segment_time 5 -segment_format mpegts -flush_packets 1 -g 150 -segment_list \"{m3u8FilePath}\" -segment_list_type m3u8 \"{outputFilePath}\"",
      RedirectStandardOutput = true,
      RedirectStandardError = true,
      UseShellExecute = false,
      CreateNoWindow = true
  };

  var process = new Process { StartInfo = processStartInfo };
  process.OutputDataReceived += (sender, args) => HandleFfmpegOutput(args.Data, process, playSessionId);
  process.ErrorDataReceived += (sender, args) => HandleFfmpegOutput(args.Data, process, playSessionId);

  process.Start();
  process.BeginOutputReadLine();
  process.BeginErrorReadLine();

  logger.Info($"FFmpeg process started for session {playSessionId}.");

With logging outputting: (I replaced user)

Info Live-Video-Translator: Transcoding directory: C:\Users\<user>\AppData\Roaming\Emby-Server\programdata\transcoding-temp\58aec7485ff945dca78e2a69ccb13723
2025-01-08 18:05:58.167 Info Live-Video-Translator: M3U8 path: C:\Users\<user>\AppData\Roaming\Emby-Server\programdata\transcoding-temp\58aec7485ff945dca78e2a69ccb13723\playlist.m3u8
2025-01-08 18:05:58.167 Info Live-Video-Translator: Output path: C:\Users\<user>\AppData\Roaming\Emby-Server\programdata\transcoding-temp\58aec7485ff945dca78e2a69ccb13723\output%03d_original.ts
2025-01-08 18:05:58.167 Info Live-Video-Translator: FFmpeg arguments: -i "C:\Users\<user>\Downloads\Season 1\no-subs.mp4" -c:v copy -c:a copy -f segment -segment_time 5 -segment_format mpegts -flush_packets 1 -segment_list "C:\Users\<user>\AppData\Roaming\Emby-Server\programdata\transcoding-temp\58aec7485ff945dca78e2a69ccb13723\playlist.m3u8" -segment_list_type m3u8 "C:\Users\<user>\AppData\Roaming\Emby-Server\programdata\transcoding-temp\58aec7485ff945dca78e2a69ccb13723\output%03d_original.ts"
2025-01-08 18:05:58.168 Error FfmpegManager: ProcessRun '58aec7485ff945dca78e2a69ccb13723': Error starting Ffmpeg. WorkingFolder: C:\Users\<user>\AppData\Roaming\Emby-Server\system

 

 

FFmpeg arguments: -i "C:\Users\<user>\Downloads\Season 1\no-subs.mp4" -c:v copy -c:a copy -f segment -segment_time 5 -segment_format mpegts -flush_packets 1 -segment_list "C:\Users\<user>\AppData\Roaming\Emby-Server\programdata\transcoding-temp\58aec7485ff945dca78e2a69ccb13723\playlist.m3u8" -segment_list_type m3u8 "C:\Users\<user>\AppData\Roaming\Emby-Server\programdata\transcoding-temp\58aec7485ff945dca78e2a69ccb13723\output%03d_original.ts"
2025-01-08 18:05:58.168 Error FfmpegManager: ProcessRun '58aec7485ff945dca78e2a69ccb13723': Error starting Ffmpeg. WorkingFolder: C:\Users\<user>\AppData\Roaming\Emby-Server\system
        *** Error Report ***

 

 

 

 

I'm also trying to add my newly created directory with the ffmpeg output to a Library so I can call it later to be played, but I can never add the folder to the library... are these issues maybe related?

 

Edited by bobo99
Posted

OK unless I missed it I don’t see that folder creation in your code snippet.

Posted

 

5 minutes ago, Luke said:

 

OK unless I missed it I don’t see that folder creation in your code snippet.

11 minutes ago, bobo99 said:
  Directory.CreateDirectory(embyProgramDataPath);

Last line of the 4th code block in previous msg.

I can also confirm it being created on disk, and I can write to it using the plugin. However ffmpeg being called fails in that way.

Posted

Is that the parent folder or more than one level up? Do it see it getting created?

Posted (edited)
8 minutes ago, Luke said:

Is that the parent folder or more than one level up? Do it see it getting created?

Yes I see it being created on disk. My plugin can write generic files to it. ffmpeg being called to write to it fails in that only way.

I have tried writing to:

C:\Users\<user>\AppData\Roaming\Emby-Server\programdata\transcoding-temp\<playsessionid> gets created.

and C:\ProgramData\Emby-Server\programdata\transcoding-temp\<playsessionId> which also gets created, but same ffmpeg issue. Is it due to how I'm calling it?

Edited by bobo99
Posted (edited)

Probably unrelated, but you shold get the transcoding-temp path like this: Emby SDK Reference: IServerApplicationPaths.GetTranscodingTempPath()

For futher diagnosing, you can try to replace the executable of your command with "cmd" and then:

  • prefix your ffmpeg arguments with "/c echo" and see what gets into the output
  • prefix your ffmpeg arguments with "/c <path-to-ffmpeg>"
  • replace your ffmpeg arguments with "/c echo "123" >  {transcoding-outputfolder}\test.txt"

Also try (keeping ffmpeg as the exectuable):

  • change your ffmpeg arguments to only keep the input (-i ....) and afterwards just "c:\test.ts"
  • or "c:\temp\test.ts" and before create the temp folder and give permissions to everybody

 

Edited by softworkz
Posted

I assume you are not running Emby Server as a service or under another user account?

Posted
2 hours ago, softworkz said:

I assume you are not running Emby Server as a service or under another user account?

I think my try/catch wasn't allowing me to see that I had a poorly initialized object. After fixing that it all works as intended.

 

The last part I could use help with is adding the folder in question to the library (unless there is a way to directly play a file from disk that's not in the library? Is there?)

 

This is how I"m trying to accomplish it. This adds a new library of mixed content type that I can see in the gui, if it didn't exist before. However the folder is not added. Do you see anything obviously wrong ?

 

Thanks!

 

public void AddDirectoryToMixedContentLibraryAsync(string directoryPath, CancellationToken cancellationToken = default)
        {
            var logger = _logManager.GetLogger(nameof(TranscodingManager));

            try
            {
                // Validate the input directory path
                if (string.IsNullOrEmpty(directoryPath))
                {
                    logger.Error("Directory path is null or empty.");
                    throw new ArgumentException("Directory path cannot be null or empty.", nameof(directoryPath));
                }

                if (!Directory.Exists(directoryPath))
                {
                    logger.Error($"The specified directory does not exist: {directoryPath}");
                    throw new DirectoryNotFoundException($"The specified directory does not exist: {directoryPath}");
                }

                logger.Info($"Attempting to add directory '{directoryPath}' to Mixed Content library.");

                const string LIBRARY_NAME = "LiveVideoTemporaryLibrary";
                const string COLLECTION_TYPE = "mixedcontent";

                // Check if our specific library already exists
                var existingLibrary = _libraryManager.GetVirtualFolders()
                    .FirstOrDefault(vf => vf.Name == LIBRARY_NAME);

                var existingLibraries = _libraryManager.GetVirtualFolders();
                if (existingLibraries != null && existingLibraries.Any())
                {
                    logger.Info($"Found {existingLibraries.Count()} virtual libraries.");
                    foreach (var library in existingLibraries)
                    {
                        logger.Info("Library Details:");
                        logger.Info($"- Name: {library.Name}");
                        logger.Info($"- CollectionType: {(string.IsNullOrWhiteSpace(library.CollectionType) ? "Not Specified" : library.CollectionType)}");
                        logger.Info($"- ItemId: {library.ItemId}");
                        logger.Info($"- Locations Count: {library.Locations.Length}");
                        foreach (var location in library.Locations)
                        {
                            logger.Info($"  - Location Path: {location}");
                        }
                    }
                }
                else
                {
                    logger.Warn("No virtual libraries found.");
                }

                if (existingLibrary != null)
                {
                    logger.Info($"Library '{LIBRARY_NAME}' already exists.");

                    // Check if the directory is already in the library's paths
                    if (existingLibrary.Locations.Contains(directoryPath, StringComparer.OrdinalIgnoreCase))
                    {
                        logger.Info($"Directory '{directoryPath}' is already part of the library.");
                        return;
                    }

                    logger.Info($"Adding directory '{directoryPath}' to the existing library.");

                    // Get all current locations plus the new one
                    var updatedLocations = existingLibrary.Locations.ToList();
                    updatedLocations.Add(directoryPath);

                    if (long.TryParse(existingLibrary.ItemId.ToString(), out long folderId))
                    {
                        logger.Info($"Updating virtual folder with ID: {folderId}");

                        // Remove the old folder
                        _libraryManager.RemoveVirtualFolder(folderId, false);

                        // Add back with all locations including the new one
                        _libraryManager.AddVirtualFolder(
                            LIBRARY_NAME,
                            string.Join("|", updatedLocations),  // Join all paths with a separator
                            new LibraryOptions
                            {
                                EnablePhotos = true,
                                ContentType = COLLECTION_TYPE
                            },
                            true);

                        logger.Info($"Directory '{directoryPath}' successfully added to library.");
                    }
                    else
                    {
                        logger.Error($"Failed to parse folder ID: {existingLibrary.ItemId}");
                        throw new InvalidOperationException($"Could not parse folder ID: {existingLibrary.ItemId}");
                    }
                }
                else
                {
                    logger.Info($"No existing '{LIBRARY_NAME}' found. Creating a new one.");

                    // Create a new library
                    var libraryOptions = new LibraryOptions
                    {
                        EnablePhotos = true,
                        ContentType = COLLECTION_TYPE
                    };

                    _libraryManager.AddVirtualFolder(
                        LIBRARY_NAME,
                        directoryPath,
                        libraryOptions,
                        true);

                    logger.Info($"Created new library and added directory '{directoryPath}'.");
                }

                // Trigger library scan
                logger.Info("Triggering library validation and scan.");
                _libraryManager.ValidateMediaLibrary(new Progress<double>(), cancellationToken);
                logger.Info("Library validation and scan triggered successfully.");
            }
            catch (Exception ex)
            {
                logger.Error($"Error occurred while adding directory to Mixed Content library: {ex.Message}");
                logger.Error($"Stack Trace: {ex.StackTrace}");
                throw;
            }
        }

 

Posted

Hey Guys,

Could I get some guidance from a dev? I am making a plugin and am trying to initiate a "Scan Library Files" of a newly added Library. I don't want to scan all libraries, but just the newly added library.

//Adding the library

_libraryManager.AddVirtualFolder(library_name, "Mixed Content", libraryOptions, false);

 

I have look at various methods in various interfaces but I can't seem to figure out which one actually allows me to do the equivalent of "Scan Library Files" on just one library? Any guidance someone could provide?

Posted

Hi, the best thing to do is pass in true to scan the library. Yes it will currently refresh all libraries, but right now you don't have control over that. As this gets improved in the core server with adding libraries in the web UI, so too will your plugin.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...