From e1933ef1f2514820bdcd381845f2405d60e79e90 Mon Sep 17 00:00:00 2001 From: NeoCodeMatrix86 <40752681+NeoCoderMatrix86@users.noreply.github.com> Date: Wed, 30 Sep 2026 16:55:20 +0200 Subject: [PATCH 01/33] Update SessionStateContainer.cs --- AudioCuesheetEditor/Services/UI/SessionStateContainer.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/AudioCuesheetEditor/Services/UI/SessionStateContainer.cs b/AudioCuesheetEditor/Services/UI/SessionStateContainer.cs index 4e5d6cb7..d173e489 100644 --- a/AudioCuesheetEditor/Services/UI/SessionStateContainer.cs +++ b/AudioCuesheetEditor/Services/UI/SessionStateContainer.cs @@ -79,6 +79,7 @@ public async Task InitializeAsync() public void ResetImport() { Importfile = null; + //TODO: Revoke object url of ImportAudiofiles before removing them ImportAudiofiles = []; ImportCuesheet = null; ImportIsAnalyzed = false; From 207563343fb2995e84104f950c9525de1cecc9f8 Mon Sep 17 00:00:00 2001 From: NeoCodeMatrix86 <40752681+NeoCoderMatrix86@users.noreply.github.com> Date: Thu, 1 Oct 2026 17:26:09 +0200 Subject: [PATCH 02/33] Update ImportManager.cs --- AudioCuesheetEditor/Services/IO/ImportManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AudioCuesheetEditor/Services/IO/ImportManager.cs b/AudioCuesheetEditor/Services/IO/ImportManager.cs index 01ad1937..47eaf1ac 100644 --- a/AudioCuesheetEditor/Services/IO/ImportManager.cs +++ b/AudioCuesheetEditor/Services/IO/ImportManager.cs @@ -13,7 +13,6 @@ //You should have received a copy of the GNU General Public License //along with Foobar. If not, see //. -using AngleSharp.Media.Dom; using AudioCuesheetEditor.Model.AudioCuesheet; using AudioCuesheetEditor.Model.AudioCuesheet.Import; using AudioCuesheetEditor.Model.IO; @@ -115,6 +114,7 @@ public void ImportCuesheet() _sessionStateContainer.Cuesheet = newCuesheet; _traceChangeManager.AddChange(new TracedChange(_sessionStateContainer, new(previousValue, nameof(SessionStateContainer.Cuesheet)))); } + //TODO: Import Audiofiles before resetting import _sessionStateContainer.ResetImport(); stopwatch.Stop(); if (_logger.IsEnabled(LogLevel.Debug)) From 43bfd929361ca51a3b374461b21c26a1a9373706 Mon Sep 17 00:00:00 2001 From: NeoCodeMatrix86 <40752681+NeoCoderMatrix86@users.noreply.github.com> Date: Thu, 1 Oct 2026 17:41:56 +0200 Subject: [PATCH 03/33] Update ImportManager.cs --- AudioCuesheetEditor/Services/IO/ImportManager.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/AudioCuesheetEditor/Services/IO/ImportManager.cs b/AudioCuesheetEditor/Services/IO/ImportManager.cs index 47eaf1ac..abddb251 100644 --- a/AudioCuesheetEditor/Services/IO/ImportManager.cs +++ b/AudioCuesheetEditor/Services/IO/ImportManager.cs @@ -188,10 +188,11 @@ void CopyCuesheet(Cuesheet target, ICuesheet cuesheetToCopy) target.Artist = cuesheetToCopy.Artist; target.Title = cuesheetToCopy.Title; target.Cataloguenumber = cuesheetToCopy.Cataloguenumber; + IEnumerable audiofiles = []; if (cuesheetToCopy is Cuesheet originCuesheet) { target.CDTextfile = originCuesheet.CDTextfile; - AttachClonedAudiofiles(target, originCuesheet.Audiofiles); + audiofiles = originCuesheet.Audiofiles; } if (cuesheetToCopy is ImportCuesheet importCuesheet) { @@ -199,8 +200,9 @@ void CopyCuesheet(Cuesheet target, ICuesheet cuesheetToCopy) { target.CDTextfile = new CDTextfile(importCuesheet.CDTextfile); } - AttachClonedAudiofiles(target, importCuesheet.Audiofiles); + audiofiles = importCuesheet.Audiofiles; } + AttachClonedAudiofiles(target, audiofiles); } void AttachClonedAudiofiles(Cuesheet target, IEnumerable audiofiles) From a03251c79f66a64a5d7f762f2a56c3c87839fd3e Mon Sep 17 00:00:00 2001 From: NeoCodeMatrix86 <40752681+NeoCoderMatrix86@users.noreply.github.com> Date: Mon, 5 Oct 2026 11:01:01 +0200 Subject: [PATCH 04/33] first step for importing audiofiles --- AudioCuesheetEditor.sln | 2 +- AudioCuesheetEditor/Pages/Index.razor | 2 + AudioCuesheetEditor/Program.cs | 1 + .../Services/IO/AudioImportService.cs | 50 +++++++ .../Services/IO/IAudioImportService.cs | 29 ++++ .../Dialogs/ImportAudiofilesDialog.de.resx | 126 ++++++++++++++++++ .../Dialogs/ImportAudiofilesDialog.razor | 55 ++++++++ .../Dialogs/ImportAudiofilesDialog.resx | 126 ++++++++++++++++++ 8 files changed, 390 insertions(+), 1 deletion(-) create mode 100644 AudioCuesheetEditor/Services/IO/AudioImportService.cs create mode 100644 AudioCuesheetEditor/Services/IO/IAudioImportService.cs create mode 100644 AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.de.resx create mode 100644 AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.razor create mode 100644 AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.resx diff --git a/AudioCuesheetEditor.sln b/AudioCuesheetEditor.sln index 40cbf088..73237fb1 100644 --- a/AudioCuesheetEditor.sln +++ b/AudioCuesheetEditor.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 18 -VisualStudioVersion = 18.3.11512.155 d18.3 +VisualStudioVersion = 18.3.11512.155 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AudioCuesheetEditor", "AudioCuesheetEditor\AudioCuesheetEditor.csproj", "{099AE4DF-4847-460F-BBF2-207B9A35B58D}" EndProject diff --git a/AudioCuesheetEditor/Pages/Index.razor b/AudioCuesheetEditor/Pages/Index.razor index a8b75db0..5eeb904c 100644 --- a/AudioCuesheetEditor/Pages/Index.razor +++ b/AudioCuesheetEditor/Pages/Index.razor @@ -26,6 +26,7 @@ along with Foobar. If not, see @inject DialogManager _dialogManager @inject ISnackbar _snackbar @inject ICuesheetManager _cuesheetManager +@inject IAudioImportService _audioImportService @@ -118,6 +119,7 @@ along with Foobar. If not, see { _dialogManager.HideLoadingDialog(); } + await _audioImportService.MapAudioImportAsync(); }); } } \ No newline at end of file diff --git a/AudioCuesheetEditor/Program.cs b/AudioCuesheetEditor/Program.cs index 52932a92..3e75dd2d 100644 --- a/AudioCuesheetEditor/Program.cs +++ b/AudioCuesheetEditor/Program.cs @@ -61,6 +61,7 @@ builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); +builder.Services.AddScoped(); builder.Services.AddLogging(); // Read out configuration for loglevel diff --git a/AudioCuesheetEditor/Services/IO/AudioImportService.cs b/AudioCuesheetEditor/Services/IO/AudioImportService.cs new file mode 100644 index 00000000..0c864ff8 --- /dev/null +++ b/AudioCuesheetEditor/Services/IO/AudioImportService.cs @@ -0,0 +1,50 @@ +//This file is part of AudioCuesheetEditor. + +//AudioCuesheetEditor is free software: you can redistribute it and/or modify +//it under the terms of the GNU General Public License as published by +//the Free Software Foundation, either version 3 of the License, or +//(at your option) any later version. + +//AudioCuesheetEditor is distributed in the hope that it will be useful, +//but WITHOUT ANY WARRANTY; without even the implied warranty of +//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +//GNU General Public License for more details. + +//You should have received a copy of the GNU General Public License +//along with Foobar. If not, see +//. +using AudioCuesheetEditor.Model.IO.Audio; +using AudioCuesheetEditor.Services.UI; +using AudioCuesheetEditor.Shared.Dialogs; +using MudBlazor; + +namespace AudioCuesheetEditor.Services.IO +{ + /// + public class AudioImportService(IDialogService dialogService, ISessionStateContainer sessionStateContainer) : IAudioImportService + { + private readonly ISessionStateContainer _sessionStateContainer = sessionStateContainer; + private readonly IDialogService _dialogService = dialogService; + + /// + public async Task MapAudioImportAsync() + { + //TODO: Tests + var mappedAudiofiles = _sessionStateContainer.ActiveCuesheet!.Audiofiles.ToDictionary(x => x, x => (Audiofile?)null); + //TODO: automatic mapping + var parameters = new DialogParameters + { + { x => x.MappedAudiofiles, mappedAudiofiles }, + { x => x.ImportAudiofiles, _sessionStateContainer.ImportAudiofiles } + }; + var options = new DialogOptions() { BackdropClick = false, FullWidth = true }; + var dialog = await _dialogService.ShowAsync(null, parameters, options); + var result = await dialog.Result; + //TODO: get mapping from dialog and apply it to the cuesheet + //if ((result?.Canceled == false) && (result.Data is Track editedTrack)) + //{ + + //} + } + } +} diff --git a/AudioCuesheetEditor/Services/IO/IAudioImportService.cs b/AudioCuesheetEditor/Services/IO/IAudioImportService.cs new file mode 100644 index 00000000..a481489f --- /dev/null +++ b/AudioCuesheetEditor/Services/IO/IAudioImportService.cs @@ -0,0 +1,29 @@ +//This file is part of AudioCuesheetEditor. + +//AudioCuesheetEditor is free software: you can redistribute it and/or modify +//it under the terms of the GNU General Public License as published by +//the Free Software Foundation, either version 3 of the License, or +//(at your option) any later version. + +//AudioCuesheetEditor is distributed in the hope that it will be useful, +//but WITHOUT ANY WARRANTY; without even the implied warranty of +//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +//GNU General Public License for more details. + +//You should have received a copy of the GNU General Public License +//along with Foobar. If not, see +//. +namespace AudioCuesheetEditor.Services.IO +{ + /// + /// Service for importing audio files and matching them to the cuesheet. + /// + public interface IAudioImportService + { + /// + /// Maps the import audio from session state to the active cuesheet. If mapping is not possible automatically the user gets a dialog. + /// + /// + Task MapAudioImportAsync(); + } +} diff --git a/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.de.resx b/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.de.resx new file mode 100644 index 00000000..ed296166 --- /dev/null +++ b/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.de.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Abbrechen + + + Ok + + \ No newline at end of file diff --git a/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.razor b/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.razor new file mode 100644 index 00000000..02cd697f --- /dev/null +++ b/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.razor @@ -0,0 +1,55 @@ + +@inherits BaseLocalizedComponent + +@inject IStringLocalizer _localizer + + + + + + + + + + @_localizer["Ok"] + @_localizer["Abort"] + + + +@code { + [CascadingParameter] + private IMudDialogInstance? _mudDialog { get; set; } + + [Parameter] + [EditorRequired] + public IList ImportAudiofiles { get; set; } + + [Parameter] + [EditorRequired] + public Dictionary MappedAudiofiles { get; set; } + + //TODO: Add posibility to add new audiofiles to the cuesheet + //TODO: Add posibility to move audiofiles up and down in the cuesheet + //TODO: Add posibility to delete audiofiles in the cuesheet + //TODO: Loop over activecuesheet audiofiles and display relation to import audiofiles + //TODO: Title + //TODO: Actions + //TODO: Mapping of import files to current files + +} diff --git a/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.resx b/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.resx new file mode 100644 index 00000000..22160cd6 --- /dev/null +++ b/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Abort + + + Ok + + \ No newline at end of file From adbefc3cc19126663d01d44bb28ae61f3732f6e0 Mon Sep 17 00:00:00 2001 From: NeoCodeMatrix86 <40752681+NeoCoderMatrix86@users.noreply.github.com> Date: Mon, 5 Oct 2026 11:46:07 +0200 Subject: [PATCH 05/33] Update AudioImportService.cs --- .../Services/IO/AudioImportService.cs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/AudioCuesheetEditor/Services/IO/AudioImportService.cs b/AudioCuesheetEditor/Services/IO/AudioImportService.cs index 0c864ff8..a3a87edb 100644 --- a/AudioCuesheetEditor/Services/IO/AudioImportService.cs +++ b/AudioCuesheetEditor/Services/IO/AudioImportService.cs @@ -40,11 +40,17 @@ public async Task MapAudioImportAsync() var options = new DialogOptions() { BackdropClick = false, FullWidth = true }; var dialog = await _dialogService.ShowAsync(null, parameters, options); var result = await dialog.Result; - //TODO: get mapping from dialog and apply it to the cuesheet - //if ((result?.Canceled == false) && (result.Data is Track editedTrack)) - //{ - - //} + if (result?.Canceled == false) + { + if (result.Data is Dictionary audiofileMapping) + { + //TODO: Apply mapping to cuesheet + } + } + else + { + _sessionStateContainer.ResetImport(); + } } } } From 31c3f9f2c9e625a531ad2069173b9ae340353429 Mon Sep 17 00:00:00 2001 From: NeoCodeMatrix86 <40752681+NeoCoderMatrix86@users.noreply.github.com> Date: Mon, 5 Oct 2026 13:25:15 +0200 Subject: [PATCH 06/33] Update ImportAudiofilesDialog.razor --- .../Shared/Dialogs/ImportAudiofilesDialog.razor | 4 ---- 1 file changed, 4 deletions(-) diff --git a/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.razor b/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.razor index 02cd697f..b0b18db1 100644 --- a/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.razor +++ b/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.razor @@ -20,9 +20,6 @@ along with Foobar. If not, see @inject IStringLocalizer _localizer - - - @@ -48,7 +45,6 @@ along with Foobar. If not, see //TODO: Add posibility to move audiofiles up and down in the cuesheet //TODO: Add posibility to delete audiofiles in the cuesheet //TODO: Loop over activecuesheet audiofiles and display relation to import audiofiles - //TODO: Title //TODO: Actions //TODO: Mapping of import files to current files From 813600006837d89681299679fb0c3a6fc5e6b748 Mon Sep 17 00:00:00 2001 From: NeoCodeMatrix86 <40752681+NeoCoderMatrix86@users.noreply.github.com> Date: Mon, 5 Oct 2026 13:25:20 +0200 Subject: [PATCH 07/33] Update AudioImportService.cs --- AudioCuesheetEditor/Services/IO/AudioImportService.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/AudioCuesheetEditor/Services/IO/AudioImportService.cs b/AudioCuesheetEditor/Services/IO/AudioImportService.cs index a3a87edb..6acfd413 100644 --- a/AudioCuesheetEditor/Services/IO/AudioImportService.cs +++ b/AudioCuesheetEditor/Services/IO/AudioImportService.cs @@ -38,6 +38,7 @@ public async Task MapAudioImportAsync() { x => x.ImportAudiofiles, _sessionStateContainer.ImportAudiofiles } }; var options = new DialogOptions() { BackdropClick = false, FullWidth = true }; + //TODO: Title var dialog = await _dialogService.ShowAsync(null, parameters, options); var result = await dialog.Result; if (result?.Canceled == false) From b4c7b8689f17175b671a16bad4882e761fdb52c5 Mon Sep 17 00:00:00 2001 From: NeoCodeMatrix86 <40752681+NeoCoderMatrix86@users.noreply.github.com> Date: Mon, 5 Oct 2026 13:40:23 +0200 Subject: [PATCH 08/33] fix title --- AudioCuesheetEditor/Services/IO/AudioImportService.cs | 10 ++++++---- .../Services/UI/ISessionStateContainer.cs | 1 + .../Services/UI/SessionStateContainer.cs | 1 + .../Shared/Dialogs/ImportAudiofilesDialog.de.resx | 3 +++ .../Shared/Dialogs/ImportAudiofilesDialog.razor | 5 +++++ .../Shared/Dialogs/ImportAudiofilesDialog.resx | 3 +++ 6 files changed, 19 insertions(+), 4 deletions(-) diff --git a/AudioCuesheetEditor/Services/IO/AudioImportService.cs b/AudioCuesheetEditor/Services/IO/AudioImportService.cs index 6acfd413..02fec362 100644 --- a/AudioCuesheetEditor/Services/IO/AudioImportService.cs +++ b/AudioCuesheetEditor/Services/IO/AudioImportService.cs @@ -29,16 +29,18 @@ public class AudioImportService(IDialogService dialogService, ISessionStateConta /// public async Task MapAudioImportAsync() { - //TODO: Tests - var mappedAudiofiles = _sessionStateContainer.ActiveCuesheet!.Audiofiles.ToDictionary(x => x, x => (Audiofile?)null); + //TODO: Tests + foreach (var audiofile in _sessionStateContainer.ActiveCuesheet!.Audiofiles) + { + _sessionStateContainer.ImportAudiofileMapping.Add(audiofile, null); + } //TODO: automatic mapping var parameters = new DialogParameters { - { x => x.MappedAudiofiles, mappedAudiofiles }, + { x => x.MappedAudiofiles, _sessionStateContainer.ImportAudiofileMapping }, { x => x.ImportAudiofiles, _sessionStateContainer.ImportAudiofiles } }; var options = new DialogOptions() { BackdropClick = false, FullWidth = true }; - //TODO: Title var dialog = await _dialogService.ShowAsync(null, parameters, options); var result = await dialog.Result; if (result?.Canceled == false) diff --git a/AudioCuesheetEditor/Services/UI/ISessionStateContainer.cs b/AudioCuesheetEditor/Services/UI/ISessionStateContainer.cs index 0e68b86b..4ec4c1ef 100644 --- a/AudioCuesheetEditor/Services/UI/ISessionStateContainer.cs +++ b/AudioCuesheetEditor/Services/UI/ISessionStateContainer.cs @@ -26,6 +26,7 @@ public interface ISessionStateContainer public Cuesheet Cuesheet { get; set; } public Cuesheet? ImportCuesheet { get; set; } public IList ImportAudiofiles { get; set; } + public Dictionary ImportAudiofileMapping { get; set; } public IImportfile? Importfile { get; set; } public Boolean ImportIsAnalyzed { get; set; } public void ResetImport(); diff --git a/AudioCuesheetEditor/Services/UI/SessionStateContainer.cs b/AudioCuesheetEditor/Services/UI/SessionStateContainer.cs index d173e489..cbf023fb 100644 --- a/AudioCuesheetEditor/Services/UI/SessionStateContainer.cs +++ b/AudioCuesheetEditor/Services/UI/SessionStateContainer.cs @@ -66,6 +66,7 @@ public Cuesheet? ImportCuesheet } } public IList ImportAudiofiles { get; set; } = []; + public Dictionary ImportAudiofileMapping { get; set; } = []; public IImportfile? Importfile { get; set; } public Boolean ImportIsAnalyzed { get; set; } = false; diff --git a/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.de.resx b/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.de.resx index ed296166..6bce74ef 100644 --- a/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.de.resx +++ b/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.de.resx @@ -120,6 +120,9 @@ Abbrechen + + Dateien zuordnen + Ok diff --git a/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.razor b/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.razor index b0b18db1..526a69d1 100644 --- a/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.razor +++ b/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.razor @@ -20,6 +20,11 @@ along with Foobar. If not, see @inject IStringLocalizer _localizer + + + @_localizer["Assign files"] + + diff --git a/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.resx b/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.resx index 22160cd6..c8a23ff1 100644 --- a/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.resx +++ b/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.resx @@ -120,6 +120,9 @@ Abort + + Assign files + Ok From d81c50386ed21616692125b0b29035b6a23eee43 Mon Sep 17 00:00:00 2001 From: NeoCodeMatrix86 <40752681+NeoCoderMatrix86@users.noreply.github.com> Date: Mon, 5 Oct 2026 13:41:19 +0200 Subject: [PATCH 09/33] Update ImportAudiofilesDialog.razor --- AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.razor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.razor b/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.razor index 526a69d1..8492e963 100644 --- a/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.razor +++ b/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.razor @@ -36,7 +36,7 @@ along with Foobar. If not, see @code { [CascadingParameter] - private IMudDialogInstance? _mudDialog { get; set; } + IMudDialogInstance? _mudDialog { get; set; } [Parameter] [EditorRequired] From 34a88077a35a23a8f61bb899d46dbd07cb3e2680 Mon Sep 17 00:00:00 2001 From: NeoCodeMatrix86 <40752681+NeoCoderMatrix86@users.noreply.github.com> Date: Mon, 5 Oct 2026 13:42:08 +0200 Subject: [PATCH 10/33] Update SessionStateContainer.cs --- AudioCuesheetEditor/Services/UI/SessionStateContainer.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/AudioCuesheetEditor/Services/UI/SessionStateContainer.cs b/AudioCuesheetEditor/Services/UI/SessionStateContainer.cs index cbf023fb..45e04ab1 100644 --- a/AudioCuesheetEditor/Services/UI/SessionStateContainer.cs +++ b/AudioCuesheetEditor/Services/UI/SessionStateContainer.cs @@ -81,6 +81,7 @@ public void ResetImport() { Importfile = null; //TODO: Revoke object url of ImportAudiofiles before removing them + ImportAudiofileMapping = []; ImportAudiofiles = []; ImportCuesheet = null; ImportIsAnalyzed = false; From ede483cdacc2ee87a5e556d016a5978f78c97736 Mon Sep 17 00:00:00 2001 From: NeoCodeMatrix86 <40752681+NeoCoderMatrix86@users.noreply.github.com> Date: Tue, 6 Oct 2026 13:38:25 +0200 Subject: [PATCH 11/33] dialog for mapping of audiofiles --- .../Services/IO/AudioImportService.cs | 1 + .../Dialogs/ImportAudiofilesDialog.razor | 88 ++++++++++++++++++- 2 files changed, 85 insertions(+), 4 deletions(-) diff --git a/AudioCuesheetEditor/Services/IO/AudioImportService.cs b/AudioCuesheetEditor/Services/IO/AudioImportService.cs index 02fec362..c22908a5 100644 --- a/AudioCuesheetEditor/Services/IO/AudioImportService.cs +++ b/AudioCuesheetEditor/Services/IO/AudioImportService.cs @@ -47,6 +47,7 @@ public async Task MapAudioImportAsync() { if (result.Data is Dictionary audiofileMapping) { + _sessionStateContainer.ImportAudiofileMapping = audiofileMapping; //TODO: Apply mapping to cuesheet } } diff --git a/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.razor b/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.razor index 8492e963..1914224e 100644 --- a/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.razor +++ b/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.razor @@ -26,7 +26,27 @@ along with Foobar. If not, see - + + + @_localizer["Files"] + + @foreach (var dropzone in _dropzones) + { + + @GetFileName(dropzone.Value) + + } + + @_localizer["Uploaded files"] + + + + + @context.Name + + + @_localizer["Ok"] @@ -46,11 +66,71 @@ along with Foobar. If not, see [EditorRequired] public Dictionary MappedAudiofiles { get; set; } + List _audiofiles = []; + const string UploadedZoneIdentifier = "uploaded"; + Dictionary _dropzones = []; + string? _sourceZoneIdentifier; + + protected override void OnInitialized() + { + base.OnInitialized(); + _dropzones = MappedAudiofiles.ToDictionary(x => Guid.NewGuid().ToString(), x => x.Key); + SetImportAudiofiles(); + } + + bool ItemsSelector(Audiofile item, string zone) + { + if (zone == UploadedZoneIdentifier) + { + return ImportAudiofiles.Contains(item); + } + var audiofile = _dropzones[zone]; + return MappedAudiofiles[audiofile] == item; + } + + void ItemPicked(MudDragAndDropItemTransaction itemTransaction) + { + _sourceZoneIdentifier = itemTransaction.SourceZoneIdentifier; + } + + void ItemDropped(MudItemDropInfo itemDropInfo) + { + if (_sourceZoneIdentifier != null && _sourceZoneIdentifier != UploadedZoneIdentifier) + { + var sourceAudiofile = _dropzones[_sourceZoneIdentifier]; + var currentlyMapped = MappedAudiofiles[sourceAudiofile]; + if (currentlyMapped != null) + { + ImportAudiofiles.Add(currentlyMapped); + } + MappedAudiofiles[sourceAudiofile] = null; + } + var targetAudiofile = _dropzones[itemDropInfo.DropzoneIdentifier]; + var currentlyMappedFile = MappedAudiofiles[targetAudiofile]; + MappedAudiofiles[targetAudiofile] = itemDropInfo.Item; + ImportAudiofiles.Remove(itemDropInfo.Item!); + if (currentlyMappedFile != null) + { + ImportAudiofiles.Add(currentlyMappedFile); + } + SetImportAudiofiles(); + _sourceZoneIdentifier = null; + } + + String GetFileName(Audiofile audiofile) + { + return String.IsNullOrEmpty(audiofile.Name) ? _localizer["No file uploaded!"] : audiofile.Name; + } + + void SetImportAudiofiles() + { + _audiofiles = [.. ImportAudiofiles, .. MappedAudiofiles.Values.Where(x => x != null).Select(x => x!)]; + } + //TODO: Add posibility to add new audiofiles to the cuesheet //TODO: Add posibility to move audiofiles up and down in the cuesheet //TODO: Add posibility to delete audiofiles in the cuesheet //TODO: Loop over activecuesheet audiofiles and display relation to import audiofiles //TODO: Actions - //TODO: Mapping of import files to current files - -} + //TODO: Disable Ok while not all files are mapped +} \ No newline at end of file From 99bc0aaaabc912e67aaee3c2c4c9a25b77355099 Mon Sep 17 00:00:00 2001 From: NeoCodeMatrix86 <40752681+NeoCoderMatrix86@users.noreply.github.com> Date: Tue, 6 Oct 2026 13:44:45 +0200 Subject: [PATCH 12/33] Update ImportAudiofilesDialog.razor --- .../Shared/Dialogs/ImportAudiofilesDialog.razor | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.razor b/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.razor index 1914224e..aebe09f5 100644 --- a/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.razor +++ b/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.razor @@ -33,7 +33,7 @@ along with Foobar. If not, see @foreach (var dropzone in _dropzones) { - + @GetFileName(dropzone.Value) } @@ -130,7 +130,5 @@ along with Foobar. If not, see //TODO: Add posibility to add new audiofiles to the cuesheet //TODO: Add posibility to move audiofiles up and down in the cuesheet //TODO: Add posibility to delete audiofiles in the cuesheet - //TODO: Loop over activecuesheet audiofiles and display relation to import audiofiles - //TODO: Actions //TODO: Disable Ok while not all files are mapped } \ No newline at end of file From 85883216b9ec4cb1d1e83d1e5585dec18b1b18ea Mon Sep 17 00:00:00 2001 From: NeoCodeMatrix86 <40752681+NeoCoderMatrix86@users.noreply.github.com> Date: Tue, 6 Oct 2026 13:46:56 +0200 Subject: [PATCH 13/33] disable ok while not all files are mapped --- .../Shared/Dialogs/ImportAudiofilesDialog.razor | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.razor b/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.razor index aebe09f5..ce86bc9b 100644 --- a/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.razor +++ b/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.razor @@ -49,7 +49,7 @@ along with Foobar. If not, see - @_localizer["Ok"] + @_localizer["Ok"] @_localizer["Abort"] @@ -130,5 +130,4 @@ along with Foobar. If not, see //TODO: Add posibility to add new audiofiles to the cuesheet //TODO: Add posibility to move audiofiles up and down in the cuesheet //TODO: Add posibility to delete audiofiles in the cuesheet - //TODO: Disable Ok while not all files are mapped } \ No newline at end of file From db35c4073055d42c661a221f62295ac18a716ea8 Mon Sep 17 00:00:00 2001 From: NeoCodeMatrix86 <40752681+NeoCoderMatrix86@users.noreply.github.com> Date: Tue, 6 Oct 2026 13:52:00 +0200 Subject: [PATCH 14/33] display track count --- .../Shared/Dialogs/ImportAudiofilesDialog.razor | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.razor b/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.razor index ce86bc9b..6d83b88c 100644 --- a/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.razor +++ b/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.razor @@ -34,7 +34,10 @@ along with Foobar. If not, see @foreach (var dropzone in _dropzones) { - @GetFileName(dropzone.Value) + + @GetFileName(dropzone.Value) + @_localizer["Track count: {0}", @dropzone.Value.Tracks.Count] + } From bbe0f7a5cbc91b9102f75727aa36ab7b5d827b07 Mon Sep 17 00:00:00 2001 From: NeoCodeMatrix86 <40752681+NeoCoderMatrix86@users.noreply.github.com> Date: Tue, 6 Oct 2026 13:56:54 +0200 Subject: [PATCH 15/33] add localization --- .../Shared/Dialogs/ImportAudiofilesDialog.de.resx | 12 ++++++++++++ .../Shared/Dialogs/ImportAudiofilesDialog.razor | 2 +- .../Shared/Dialogs/ImportAudiofilesDialog.resx | 12 ++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.de.resx b/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.de.resx index 6bce74ef..854890d0 100644 --- a/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.de.resx +++ b/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.de.resx @@ -123,7 +123,19 @@ Dateien zuordnen + + Dateien + + + Keine Datei hochgeladen! + Ok + + Anzahl Titel: {0} + + + Hochgeladene Dateien + \ No newline at end of file diff --git a/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.razor b/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.razor index 6d83b88c..2386d00c 100644 --- a/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.razor +++ b/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.razor @@ -42,7 +42,7 @@ along with Foobar. If not, see } @_localizer["Uploaded files"] - + diff --git a/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.resx b/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.resx index c8a23ff1..e8253d84 100644 --- a/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.resx +++ b/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.resx @@ -123,7 +123,19 @@ Assign files + + Files + + + No file uploaded! + Ok + + Track count: {0} + + + Uploaded files + \ No newline at end of file From 5698eb7bb1aee474900e1d6bb2129adf971a2040 Mon Sep 17 00:00:00 2001 From: NeoCodeMatrix86 <40752681+NeoCoderMatrix86@users.noreply.github.com> Date: Tue, 6 Oct 2026 14:20:53 +0200 Subject: [PATCH 16/33] Update AudioImportService.cs --- AudioCuesheetEditor/Services/IO/AudioImportService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AudioCuesheetEditor/Services/IO/AudioImportService.cs b/AudioCuesheetEditor/Services/IO/AudioImportService.cs index c22908a5..d4d0def6 100644 --- a/AudioCuesheetEditor/Services/IO/AudioImportService.cs +++ b/AudioCuesheetEditor/Services/IO/AudioImportService.cs @@ -29,7 +29,7 @@ public class AudioImportService(IDialogService dialogService, ISessionStateConta /// public async Task MapAudioImportAsync() { - //TODO: Tests + //TODO: Tests? foreach (var audiofile in _sessionStateContainer.ActiveCuesheet!.Audiofiles) { _sessionStateContainer.ImportAudiofileMapping.Add(audiofile, null); From 66dce518cff2dfa0a79f763c962083ca48b750ab Mon Sep 17 00:00:00 2001 From: NeoCodeMatrix86 <40752681+NeoCoderMatrix86@users.noreply.github.com> Date: Tue, 6 Oct 2026 14:33:04 +0200 Subject: [PATCH 17/33] add and remove files during import --- .../Dialogs/ImportAudiofilesDialog.de.resx | 3 + .../Dialogs/ImportAudiofilesDialog.razor | 67 ++++++++++++++----- .../Dialogs/ImportAudiofilesDialog.resx | 3 + 3 files changed, 57 insertions(+), 16 deletions(-) diff --git a/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.de.resx b/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.de.resx index 854890d0..ef606d12 100644 --- a/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.de.resx +++ b/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.de.resx @@ -120,6 +120,9 @@ Abbrechen + + Datei hinzufügen + Dateien zuordnen diff --git a/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.razor b/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.razor index 2386d00c..7228b7f1 100644 --- a/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.razor +++ b/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.razor @@ -29,18 +29,34 @@ along with Foobar. If not, see - @_localizer["Files"] - - @foreach (var dropzone in _dropzones) - { - - - @GetFileName(dropzone.Value) - @_localizer["Track count: {0}", @dropzone.Value.Tracks.Count] - - - } - + + + + @_localizer["Files"] + + + + + + + + + + + + @foreach (var dropzone in _dropzones) + { + + + @GetFileName(dropzone.Value) + @_localizer["Track count: {0}", @dropzone.Value.Tracks.Count] + + + + } + + + @_localizer["Uploaded files"] @@ -77,7 +93,7 @@ along with Foobar. If not, see protected override void OnInitialized() { base.OnInitialized(); - _dropzones = MappedAudiofiles.ToDictionary(x => Guid.NewGuid().ToString(), x => x.Key); + SetDropzones(); SetImportAudiofiles(); } @@ -130,7 +146,26 @@ along with Foobar. If not, see _audiofiles = [.. ImportAudiofiles, .. MappedAudiofiles.Values.Where(x => x != null).Select(x => x!)]; } - //TODO: Add posibility to add new audiofiles to the cuesheet - //TODO: Add posibility to move audiofiles up and down in the cuesheet - //TODO: Add posibility to delete audiofiles in the cuesheet + void SetDropzones() + { + _dropzones = MappedAudiofiles.ToDictionary(x => Guid.NewGuid().ToString(), x => x.Key); + } + + void AddButtonClicked() + { + var audiofile = new Audiofile(); + MappedAudiofiles.Add(audiofile, null); + SetDropzones(); + } + + void DeleteButtonClicked(Audiofile audiofile) + { + var currentlyMappedAudiofile = MappedAudiofiles[audiofile]; + if (currentlyMappedAudiofile != null) + { + ImportAudiofiles.Add(currentlyMappedAudiofile); + } + MappedAudiofiles.Remove(audiofile); + SetDropzones(); + } } \ No newline at end of file diff --git a/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.resx b/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.resx index e8253d84..2cd88420 100644 --- a/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.resx +++ b/AudioCuesheetEditor/Shared/Dialogs/ImportAudiofilesDialog.resx @@ -120,6 +120,9 @@ Abort + + Add file + Assign files From 3f03cd3949239a054ef68b65527a77fd81255d12 Mon Sep 17 00:00:00 2001 From: NeoCodeMatrix86 <40752681+NeoCoderMatrix86@users.noreply.github.com> Date: Tue, 6 Oct 2026 16:20:24 +0200 Subject: [PATCH 18/33] Update FileInputManager.cs --- .../Services/IO/FileInputManager.cs | 30 +++++++++---------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/AudioCuesheetEditor/Services/IO/FileInputManager.cs b/AudioCuesheetEditor/Services/IO/FileInputManager.cs index ef25fdd5..81176be4 100644 --- a/AudioCuesheetEditor/Services/IO/FileInputManager.cs +++ b/AudioCuesheetEditor/Services/IO/FileInputManager.cs @@ -89,25 +89,22 @@ public bool CheckFileMimeType(string? fileContentType, string fileName, string m public async Task CreateAudiofileAsync(FileUpload fileUpload) { - Audiofile? audiofile = null; - if (fileUpload.ObjectUrl != null) + // Check file mime type + var codec = GetAudioCodec(fileUpload.Name, fileUpload.ContentType); + Audiofile? audiofile; + if (codec != null) { - // Check file mime type - var codec = GetAudioCodec(fileUpload.Name, fileUpload.ContentType); - if (codec != null) + TimeSpan? duration = null; + if (String.IsNullOrEmpty(fileUpload.ObjectUrl) == false) { - TimeSpan? duration = null; - if (String.IsNullOrEmpty(fileUpload.ObjectUrl) == false) - { - var durationSeconds = await _jsRuntime.InvokeAsync("getAudioDurationFromFile", fileUpload.ObjectUrl); - duration = TimeSpan.FromSeconds(durationSeconds); - } - audiofile = new Audiofile(fileUpload.Name, fileUpload.ObjectUrl, codec, duration); - } - else - { - throw new ArgumentException("The audiofile provided is not of a valid type."); + var durationSeconds = await _jsRuntime.InvokeAsync("getAudioDurationFromFile", fileUpload.ObjectUrl); + duration = TimeSpan.FromSeconds(durationSeconds); } + audiofile = new Audiofile(fileUpload.Name, fileUpload.ObjectUrl, codec, duration); + } + else + { + throw new ArgumentException("The audiofile provided is not of a valid type."); } return audiofile; } @@ -154,6 +151,7 @@ public async Task> CreateFileUploadsAsync(IReadOnlyList< string? objectUrl = null; if (IsValidAudiofile(file.Name, file.ContentType)) { + //TODO: Upload multiple audiofiles at once fails to get correct audio object url because of only one fileInputId objectUrl = await _jsRuntime.InvokeAsync("getObjectURLFromMudFileUpload", fileInputId); } else From 6986f65e9b6bd2b36321f0be09dcbdb1acf65999 Mon Sep 17 00:00:00 2001 From: NeoCodeMatrix86 <40752681+NeoCoderMatrix86@users.noreply.github.com> Date: Tue, 6 Oct 2026 16:38:51 +0200 Subject: [PATCH 19/33] Update AudioImportService.cs --- .../Services/IO/AudioImportService.cs | 29 +++++++++++++++---- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/AudioCuesheetEditor/Services/IO/AudioImportService.cs b/AudioCuesheetEditor/Services/IO/AudioImportService.cs index d4d0def6..79ae5c00 100644 --- a/AudioCuesheetEditor/Services/IO/AudioImportService.cs +++ b/AudioCuesheetEditor/Services/IO/AudioImportService.cs @@ -14,6 +14,7 @@ //along with Foobar. If not, see //. using AudioCuesheetEditor.Model.IO.Audio; +using AudioCuesheetEditor.Services.AudioCuesheet; using AudioCuesheetEditor.Services.UI; using AudioCuesheetEditor.Shared.Dialogs; using MudBlazor; @@ -21,15 +22,18 @@ namespace AudioCuesheetEditor.Services.IO { /// - public class AudioImportService(IDialogService dialogService, ISessionStateContainer sessionStateContainer) : IAudioImportService + public class AudioImportService(IDialogService dialogService, ISessionStateContainer sessionStateContainer, ITraceChangeManager traceChangeManager, IAudiofileManager audiofileManager) : IAudioImportService { private readonly ISessionStateContainer _sessionStateContainer = sessionStateContainer; private readonly IDialogService _dialogService = dialogService; + private readonly ITraceChangeManager _traceChangeManager = traceChangeManager; + private readonly IAudiofileManager _audiofileManager = audiofileManager; /// public async Task MapAudioImportAsync() { //TODO: Tests? + _sessionStateContainer.ImportAudiofileMapping.Clear(); foreach (var audiofile in _sessionStateContainer.ActiveCuesheet!.Audiofiles) { _sessionStateContainer.ImportAudiofileMapping.Add(audiofile, null); @@ -48,13 +52,26 @@ public async Task MapAudioImportAsync() if (result.Data is Dictionary audiofileMapping) { _sessionStateContainer.ImportAudiofileMapping = audiofileMapping; - //TODO: Apply mapping to cuesheet + _traceChangeManager.BulkEdit = true; + foreach (var mapping in _sessionStateContainer.ImportAudiofileMapping.Where(x => x.Value != null)) + { + var audiofile = _sessionStateContainer.ActiveCuesheet.Audiofiles.FirstOrDefault(x => x.Equals(mapping.Key)); + if (audiofile != null) + { + _audiofileManager.SetProperty(audiofile, x => x.ObjectURL, mapping.Value!.ObjectURL); + _audiofileManager.SetProperty(audiofile, x => x.AudioCodec, mapping.Value!.AudioCodec); + _audiofileManager.SetProperty(audiofile, x => x.Duration, mapping.Value!.Duration); + _audiofileManager.SetProperty(audiofile, x => x.Name, mapping.Value!.Name); + } + else + { + //TODO: add new audiofile to cuesheet + } + } + _traceChangeManager.BulkEdit = false; } } - else - { - _sessionStateContainer.ResetImport(); - } + _sessionStateContainer.ResetImport(); } } } From f8e3976385a4f42965ea1021781d444d79691d6c Mon Sep 17 00:00:00 2001 From: NeoCodeMatrix86 <40752681+NeoCoderMatrix86@users.noreply.github.com> Date: Wed, 7 Oct 2026 09:27:23 +0200 Subject: [PATCH 20/33] fix audio file upload bug --- .../Services/IO/FileInputManagerTests.cs | 5 ++--- .../Services/IO/FileInputManager.cs | 5 ++--- .../Services/IO/IFileInputManager.cs | 3 +-- .../Shared/Inputs/FileDropOverlay.razor | 6 ++---- .../wwwroot/scripts/library.js | 20 ++++++++++++------- 5 files changed, 20 insertions(+), 19 deletions(-) diff --git a/AudioCuesheetEditor.Tests/Services/IO/FileInputManagerTests.cs b/AudioCuesheetEditor.Tests/Services/IO/FileInputManagerTests.cs index 3b920a6d..90d6038e 100644 --- a/AudioCuesheetEditor.Tests/Services/IO/FileInputManagerTests.cs +++ b/AudioCuesheetEditor.Tests/Services/IO/FileInputManagerTests.cs @@ -232,7 +232,6 @@ public async Task CreateFileUploadsAsync_ReturnsFileUploads_WhenFileHasTextConte // Arrange var firstFile = CreateBrowserFile("Test.txt", "text/plain", "Just a test!"); var secondFile = CreateBrowserFile("Test.mp3", "audio/mpeg"); - var fileInputId = nameof(CreateFileUploadsAsync_ReturnsFileUploads_WhenFileHasTextContentAsync); IReadOnlyList browserfiles = [ firstFile, secondFile @@ -240,7 +239,7 @@ public async Task CreateFileUploadsAsync_ReturnsFileUploads_WhenFileHasTextConte var objectUrl = "Some object url!"; _jsRuntimeMock.Setup(js => js.InvokeAsync(It.IsAny(), It.IsAny())).ReturnsAsync(objectUrl); // Act - var result = await _service.CreateFileUploadsAsync(browserfiles, fileInputId); + var result = await _service.CreateFileUploadsAsync(browserfiles); // Assert Assert.HasCount(2, result); Assert.AreEqual(firstFile.Name, result.First().Name); @@ -265,7 +264,7 @@ public async Task CreateFileUploadsAsync_ReturnsEmpty_WhenFilesHaveInvalidMimeTy // Act var result = await _service.CreateFileUploadsAsync(browserfiles); // Assert - Assert.HasCount(0, result); + Assert.IsEmpty(result); } static IBrowserFile CreateBrowserFile(string name, string contentType, string? content = null) diff --git a/AudioCuesheetEditor/Services/IO/FileInputManager.cs b/AudioCuesheetEditor/Services/IO/FileInputManager.cs index 81176be4..033f3693 100644 --- a/AudioCuesheetEditor/Services/IO/FileInputManager.cs +++ b/AudioCuesheetEditor/Services/IO/FileInputManager.cs @@ -137,7 +137,7 @@ public async Task ReadFileContentAsync(IBrowserFile browserFile) } /// - public async Task> CreateFileUploadsAsync(IReadOnlyList browserFiles, string? fileInputId = null) + public async Task> CreateFileUploadsAsync(IReadOnlyList browserFiles) { List fileUploads = []; foreach (var file in browserFiles) @@ -151,8 +151,7 @@ public async Task> CreateFileUploadsAsync(IReadOnlyList< string? objectUrl = null; if (IsValidAudiofile(file.Name, file.ContentType)) { - //TODO: Upload multiple audiofiles at once fails to get correct audio object url because of only one fileInputId - objectUrl = await _jsRuntime.InvokeAsync("getObjectURLFromMudFileUpload", fileInputId); + objectUrl = await _jsRuntime.InvokeAsync("getObjectURLFromMudFileUpload", file.Name, file.Size, file.ContentType, file.LastModified.ToUnixTimeMilliseconds()); } else { diff --git a/AudioCuesheetEditor/Services/IO/IFileInputManager.cs b/AudioCuesheetEditor/Services/IO/IFileInputManager.cs index ca2a552a..dc00ba32 100644 --- a/AudioCuesheetEditor/Services/IO/IFileInputManager.cs +++ b/AudioCuesheetEditor/Services/IO/IFileInputManager.cs @@ -58,8 +58,7 @@ public interface IFileInputManager /// Generates file upload references for files /// /// - /// /// - Task> CreateFileUploadsAsync(IReadOnlyList browserFiles, string? fileInputId = null); + Task> CreateFileUploadsAsync(IReadOnlyList browserFiles); } } \ No newline at end of file diff --git a/AudioCuesheetEditor/Shared/Inputs/FileDropOverlay.razor b/AudioCuesheetEditor/Shared/Inputs/FileDropOverlay.razor index deb044b1..9f381fd2 100644 --- a/AudioCuesheetEditor/Shared/Inputs/FileDropOverlay.razor +++ b/AudioCuesheetEditor/Shared/Inputs/FileDropOverlay.razor @@ -26,7 +26,7 @@ along with Foobar. If not, see @inject IFileInputManager _fileInputManager -