public async Task ConvertEpisode(ManualPayload importPayload, bool isTest, PerformContext performContext) { this.logger.LogInformation($"Conversion beginning"); performContext.WriteLine($"Conversion beginning"); try { using (Process converter = new Process()) { converter.StartInfo.UseShellExecute = false; converter.StartInfo.FileName = this.settingsService.Settings.ConverterLocation; converter.StartInfo.Arguments = string.Format(this.settingsService.Settings.Arguments, importPayload.Filepath); converter.Start(); converter.WaitForExit(); this.logger.LogInformation("Conversion completed"); performContext.WriteLine($"Conversion completed"); } } catch (Exception e) { this.logger.LogError(e.Message); } if (this.settingsService.Settings.NotifyPlexAutoscan) { this.logger.LogInformation("Notifying Plex Autoscan"); var request = new PlexAutoscanPayload() { EventType = "Manual", Filepath = Path.GetDirectoryName(importPayload.Filepath) }; performContext.WriteLine($"Notifying Plex Autoscan with payload: {JsonConvert.SerializeObject(request)}"); await this.plexAutoscanProxy.Notify(request); } }
public async Task ConvertEpisode(RadarrWebhookPayload importPayload, bool isTest, PerformContext performContext) { performContext.WriteLine($"Conversion beginning"); this.logger.LogInformation($"Conversion beginning"); var path = isTest ? "test.mkv" : importPayload.Movie.FolderPath + "/" + importPayload.MovieFile.RelativePath; try { using (Process converter = new Process()) { converter.StartInfo.UseShellExecute = false; converter.StartInfo.FileName = this.settingsService.Settings.ConverterLocation; converter.StartInfo.Arguments = string.Format(this.settingsService.Settings.Arguments, this.folderMappingService.ReplacePathWithMappings(path, this.settingsService.Settings.RadarrPathMappings)); converter.Start(); converter.WaitForExit(); this.logger.LogInformation("Conversion completed"); performContext.WriteLine($"Conversion completed"); await this.radarrService.NotifyService(importPayload, isTest, performContext); } } catch (Exception e) { this.logger.LogError(e.Message); } if (this.settingsService.Settings.NotifyPlexAutoscan) { this.logger.LogInformation("Notifying Plex Autoscan"); var request = new PlexAutoscanPayload() { EventType = "Manual", Filepath = importPayload.Movie.FolderPath }; performContext.WriteLine($"Notifying Plex Autoscan with payload: {JsonConvert.SerializeObject(request)}"); await this.plexAutoscanProxy.Notify(request); } }