private void AddEncodingJobs(string path) { string[] files = Directory.GetFiles(path); foreach (string file in files) { if (Utils.IsMovieFile(file)) { EncodeMovieJob encodeMovieJob = new EncodeMovieJob(handBrakeService, file, MakeMkvKeepFiles); jobQueue.AddJob(encodeMovieJob); } } string[] dirs = Directory.GetDirectories(path); foreach (string dir in dirs) { AddEncodingJobs(dir); } }
private void ProcessFileSystemChange(string path) { // check if this is a directory if (Directory.Exists(path)) { // create a new watcher SetupFileMonitoring(path); } else { // check if this is a movie file if (Utils.IsMovieFile(path)) { // Check if we have a job for this file if (!FindEncodeJobForPath(path)) { EncodeMovieJob job = new EncodeMovieJob(handBrakeService, path, MakeMkvKeepFiles); jobQueue.AddJob(job); } Console.WriteLine(path); } } }