Skip to content

Commit

Permalink
Fix recording directories failing to get stored
Browse files Browse the repository at this point in the history
Fix a bug that caused the recording directories to not get stored at the first startup of the program
  • Loading branch information
mStylias committed Sep 27, 2023
1 parent 8d14f7d commit b27680f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
18 changes: 9 additions & 9 deletions src/AutoLectureRecorder/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,17 +154,23 @@ private async Task InitializeSettings()

var generalSettings = getGeneralSettingsTask.Result;
var recordingSettings = getRecordingSettingsTask.Result;
var recordingDirectories = recordingDirectoriesTask.Result;
var recordingDirectories = recordingDirectoriesTask.Result?.ToArray();

var screen = Screen.PrimaryScreen;
if (recordingDirectories is null || recordingDirectories.Any() == false)
{
var defaultRecordingSettings = recorder.GetDefaultSettings(screen!.Bounds.Width, screen.Bounds.Height);
await recordingsRepository.AddRecordingDirectory(defaultRecordingSettings.RecordingsLocalPath);
}

if (generalSettings == null && recordingSettings == null)
{
await settingsRepository.ResetAllSettings(Screen.PrimaryScreen!.Bounds.Width,
Screen.PrimaryScreen.Bounds.Height,
recorder);
return;
}

var screen = Screen.PrimaryScreen;

if (recordingSettings is null)
{
await settingsRepository.ResetRecordingSettings(screen!.Bounds.Width, screen.Bounds.Height, recorder);
Expand All @@ -174,12 +180,6 @@ await settingsRepository.ResetAllSettings(Screen.PrimaryScreen!.Bounds.Width,
{
await settingsRepository.ResetGeneralSettings();
}

if (recordingDirectories is null || recordingDirectories.Any() == false)
{
var defaultRecordingSettings = recorder.GetDefaultSettings(screen!.Bounds.Width, screen.Bounds.Height);
await recordingsRepository.AddRecordingDirectory(defaultRecordingSettings.RecordingsLocalPath);
}
}

private async Task SetupLecturesScheduler()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ public VideoInformationRetriever(IRecordingsRepository recordingsRepository)

public async Task<List<AlrVideoInformation>?> GetVideoInformationOfLecture(string subjectName, int semester)
{
var recordingFilesDirectories = await
_recordingsRepository.GetAllRecordingDirectories();
var recordingFilesDirectories = (await
_recordingsRepository.GetAllRecordingDirectories())?.ToArray();

if (recordingFilesDirectories is null) return null;
if (recordingFilesDirectories is null || recordingFilesDirectories.Length == 0) return null;

var recordingsInformation = new List<AlrVideoInformation>();
foreach (var recordingFilesRootDirectory in recordingFilesDirectories)
Expand Down

0 comments on commit b27680f

Please sign in to comment.