Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy V7.0 #389

Merged
merged 47 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
9221852
updated libraries and version
NeoCoderMatrix86 Aug 1, 2024
31bdd99
Merge pull request #379 from NeoCoderMatrix86/PrepareV7
NeoCoderMatrix86 Aug 1, 2024
c65a47c
Update AudioCuesheetEditor.csproj
NeoCoderMatrix86 Aug 19, 2024
3995d32
Merge branch 'development' into PrepareV6.1
NeoCoderMatrix86 Aug 19, 2024
7d58e5a
Merge pull request #382 from NeoCoderMatrix86/PrepareV6.1
NeoCoderMatrix86 Aug 19, 2024
eeb75c4
Update AudioCuesheetEditor.csproj
NeoCoderMatrix86 Aug 19, 2024
0563982
Merge pull request #383 from NeoCoderMatrix86/PrepareV7
NeoCoderMatrix86 Aug 19, 2024
8b33492
Added service for text import
NeoCoderMatrix86 Aug 26, 2024
1b3ff1f
added EditImportOptions component
NeoCoderMatrix86 Aug 26, 2024
31cf057
switched import to use services
NeoCoderMatrix86 Aug 26, 2024
94c9457
temporarily disabled unit tests
NeoCoderMatrix86 Aug 26, 2024
b490653
fixed import with new import model
NeoCoderMatrix86 Aug 26, 2024
efb987b
Removed TODOs
NeoCoderMatrix86 Aug 26, 2024
b8d88ff
added import of flags
NeoCoderMatrix86 Aug 27, 2024
5712339
added import of cataloguenumber, etc.
NeoCoderMatrix86 Aug 27, 2024
ab55bf3
added missing localization
NeoCoderMatrix86 Aug 27, 2024
ac19339
changes to import options reanalyse the text
NeoCoderMatrix86 Aug 27, 2024
0407685
added import of cuesheets
NeoCoderMatrix86 Aug 27, 2024
2565b01
added importing of project files
NeoCoderMatrix86 Aug 28, 2024
6fa136d
fixing unit tests
NeoCoderMatrix86 Aug 28, 2024
59af636
removed obsolete DateTimeUtility
NeoCoderMatrix86 Aug 28, 2024
e77f89e
Update TimeSpanUtilityTests.cs
NeoCoderMatrix86 Aug 28, 2024
38db9d1
reduced complexity of importmanager
NeoCoderMatrix86 Aug 28, 2024
f426483
added interface for local storage provider
NeoCoderMatrix86 Aug 28, 2024
0b16b70
fixed unit tests for cuesheet
NeoCoderMatrix86 Aug 28, 2024
8bb501b
Update CuesheetTests.cs
NeoCoderMatrix86 Aug 28, 2024
5a3230f
Update CuesheetTests.cs
NeoCoderMatrix86 Aug 28, 2024
b916590
Update ViewModeImport.razor
NeoCoderMatrix86 Aug 28, 2024
1517812
made import services thread safe
NeoCoderMatrix86 Aug 28, 2024
b7aae7c
Fixed cuesheetimport service unit tests
NeoCoderMatrix86 Aug 29, 2024
29c5436
Delete CuesheetImportfileTests.cs
NeoCoderMatrix86 Aug 29, 2024
7378334
fixed unit tests for text import
NeoCoderMatrix86 Aug 29, 2024
2dfa371
fixed tracechanagemanager tests
NeoCoderMatrix86 Aug 29, 2024
fe13f85
Update ImportManager.cs
NeoCoderMatrix86 Aug 29, 2024
31c440d
unified import files
NeoCoderMatrix86 Aug 29, 2024
9507924
Update ImportManager.cs
NeoCoderMatrix86 Aug 29, 2024
9c02366
made import to work with service
NeoCoderMatrix86 Aug 30, 2024
4935fca
Fixed import and tracing changes
NeoCoderMatrix86 Aug 30, 2024
eaace68
added import of startdatetime
NeoCoderMatrix86 Aug 30, 2024
ded97b5
best practise corrections
NeoCoderMatrix86 Sep 2, 2024
4c9624c
Merge pull request #385 from NeoCoderMatrix86/373-enhance-text-import…
NeoCoderMatrix86 Sep 2, 2024
c3d54f0
updated libraries
NeoCoderMatrix86 Sep 2, 2024
1f84b57
Update ViewModeImport.razor
NeoCoderMatrix86 Sep 2, 2024
875f524
Merge pull request #387 from NeoCoderMatrix86/384-edit-is-available-f…
NeoCoderMatrix86 Sep 2, 2024
42c3b7a
removed redundant file upload fields
NeoCoderMatrix86 Sep 17, 2024
4d2efc3
fixed record view selected step
NeoCoderMatrix86 Sep 17, 2024
86e557e
Merge pull request #388 from NeoCoderMatrix86/386-invalid-file-alert-…
NeoCoderMatrix86 Sep 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions AudioCuesheetEditor/AudioCuesheetEditor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<PackageProjectUrl>https://github.com/NeoCoderMatrix86/AudioCuesheetEditor</PackageProjectUrl>
<RazorLangVersion>3.0</RazorLangVersion>
<Version>6.0.0</Version>
<Version>7.0.0</Version>
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
<PublishTrimmed>true</PublishTrimmed>
<RunAOTCompilation>true</RunAOTCompilation>
Expand Down Expand Up @@ -53,6 +53,8 @@
<Content Remove="Resources\Localization\Index\en.json" />
<Content Remove="Resources\Localization\ValidationMessage\de.json" />
<Content Remove="Resources\Localization\ValidationMessage\en.json" />
<Content Remove="Resources\Localization\EditImportOptions\de.json" />
<Content Remove="Resources\Localization\EditImportOptions\en.json" />
<Content Remove="Resources\Localization\ViewModeImport\de.json" />
<Content Remove="Resources\Localization\ViewModeImport\en.json" />
<Content Remove="Resources\Localization\ViewModeRecord\de.json" />
Expand Down Expand Up @@ -98,6 +100,8 @@
<EmbeddedResource Include="Resources\Localization\Index\de.json" />
<EmbeddedResource Include="Resources\Localization\ValidationMessage\de.json" />
<EmbeddedResource Include="Resources\Localization\ValidationMessage\en.json" />
<EmbeddedResource Include="Resources\Localization\EditImportOptions\de.json" />
<EmbeddedResource Include="Resources\Localization\EditImportOptions\en.json" />
<EmbeddedResource Include="Resources\Localization\ViewModeImport\de.json" />
<EmbeddedResource Include="Resources\Localization\ViewModeImport\en.json" />
<EmbeddedResource Include="Resources\Localization\ViewModeRecord\de.json" />
Expand All @@ -110,20 +114,20 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Blazorise.Bootstrap5" Version="1.5.2" />
<PackageReference Include="Blazorise.Icons.FontAwesome" Version="1.5.2" />
<PackageReference Include="Blazorise.Bootstrap5" Version="1.6.1" />
<PackageReference Include="Blazorise.Icons.FontAwesome" Version="1.6.1" />
<PackageReference Include="MetaBrainz.MusicBrainz" Version="6.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.7" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.7" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.8" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.8" PrivateAssets="all" />
<PackageReference Include="BlazorDownloadFile" Version="2.4.0.2" />
<PackageReference Include="Blazorise.Components" Version="1.5.2" />
<PackageReference Include="Blazorise.Components" Version="1.6.1" />
<PackageReference Include="Howler.Blazor" Version="0.9.8" />
<PackageReference Include="Markdig" Version="0.37.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Configuration" Version="8.0.0" />
<PackageReference Include="System.Net.Http.Json" Version="8.0.0" />
<PackageReference Include="Toolbelt.Blazor.HotKeys2" Version="5.1.0" />
<PackageReference Include="z440.atl.core" Version="5.25.0" />
<PackageReference Include="z440.atl.core" Version="6.2.0" />
</ItemGroup>

<ItemGroup>
Expand Down
28 changes: 28 additions & 0 deletions AudioCuesheetEditor/Data/Options/ILocalStorageOptionsProvider.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//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
//<http: //www.gnu.org/licenses />.
using AudioCuesheetEditor.Model.Options;
using System.Linq.Expressions;

namespace AudioCuesheetEditor.Data.Options
{
public interface ILocalStorageOptionsProvider
{
event EventHandler<IOptions>? OptionSaved;
Task<T> GetOptions<T>() where T : IOptions;
Task SaveOptions(IOptions options);
Task SaveOptionsValue<T>(Expression<Func<T, object>> propertyExpression, object value) where T : class, IOptions, new();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

namespace AudioCuesheetEditor.Data.Options
{
public class LocalStorageOptionsProvider(IJSRuntime jsRuntime)
public class LocalStorageOptionsProvider(IJSRuntime jsRuntime): ILocalStorageOptionsProvider
{
public event EventHandler<IOptions>? OptionSaved;

Expand Down
104 changes: 5 additions & 99 deletions AudioCuesheetEditor/Extensions/SessionStateContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ public class SessionStateContainer
private ViewMode currentViewMode;
private Cuesheet cuesheet;
private Cuesheet? importCuesheet;
private TextImportfile? textImportFile;
private CuesheetImportfile? cuesheetImportFile;
private Audiofile? importAudiofile;

public SessionStateContainer(TraceChangeManager traceChangeManager)
Expand Down Expand Up @@ -65,50 +63,6 @@ public Cuesheet? ImportCuesheet
}
}

public TextImportfile? TextImportFile
{
get { return textImportFile; }
set
{
if (textImportFile != null)
{
textImportFile.AnalysisFinished -= TextImportScheme_AnalysisFinished;
}
textImportFile = value;
if (textImportFile != null)
{
textImportFile.AnalysisFinished += TextImportScheme_AnalysisFinished;
ImportCuesheet = textImportFile.Cuesheet;
}
else
{
ImportCuesheet = null;
}
}
}

public CuesheetImportfile? CuesheetImportFile
{
get { return cuesheetImportFile; }
set
{
if (cuesheetImportFile != null)
{
cuesheetImportFile.AnalysisFinished -= CuesheetImportFile_AnalysisFinished;
}
cuesheetImportFile = value;
if ((CuesheetImportFile != null) && (CuesheetImportFile.Cuesheet != null))
{
CuesheetImportFile.AnalysisFinished += CuesheetImportFile_AnalysisFinished;
ImportCuesheet = CuesheetImportFile.Cuesheet;
}
else
{
ImportCuesheet = null;
}
}
}

public Audiofile? ImportAudiofile
{
get => importAudiofile;
Expand All @@ -133,74 +87,26 @@ public ViewMode CurrentViewMode
}
}

public IImportfile? Importfile
{
get
{
if (TextImportFile != null)
{
return TextImportFile;
}
if (CuesheetImportFile != null)
{
return CuesheetImportFile;
}
return null;
}
}
public IImportfile? Importfile{ get; set; }

public void ResetImport()
{
TextImportFile = null;
CuesheetImportFile = null;
Importfile = null;
ImportAudiofile = null;
}

public void StartImportCuesheet(ApplicationOptions applicationOptions)
{
if (ImportCuesheet != null)
{
Cuesheet.Import(ImportCuesheet, applicationOptions, _traceChangeManager);
ImportCuesheet = null;
}
ResetImport();
ImportCuesheet = null;
}

private void SetCuesheetReference(Cuesheet value)
{
cuesheet.CuesheetImported -= Cuesheet_CuesheetImported;
cuesheet = value;
cuesheet.CuesheetImported += Cuesheet_CuesheetImported;
_traceChangeManager.Reset();
_traceChangeManager.TraceChanges(Cuesheet);
CuesheetChanged?.Invoke(this, EventArgs.Empty);
}
private void TextImportScheme_AnalysisFinished(object? sender, EventArgs eventArgs)
{
if (textImportFile != null)
{
ImportCuesheet = textImportFile.Cuesheet;
}
else
{
ImportCuesheet = null;
}
}
private void Cuesheet_CuesheetImported(object? sender, EventArgs e)

public void FireCuesheetImported()
{
CuesheetChanged?.Invoke(this, EventArgs.Empty);
}

void CuesheetImportFile_AnalysisFinished(object? sender, EventArgs e)
{
if (CuesheetImportFile != null)
{
ImportCuesheet = CuesheetImportFile.Cuesheet;
}
else
{
ImportCuesheet = null;
}
}
}
}
2 changes: 1 addition & 1 deletion AudioCuesheetEditor/Extensions/WebAssemblyHostExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static class WebAssemblyHostExtension
{
public async static Task SetDefaultCulture(this WebAssemblyHost host)
{
var localStorageOptionsProvider = host.Services.GetRequiredService<LocalStorageOptionsProvider>();
var localStorageOptionsProvider = host.Services.GetRequiredService<ILocalStorageOptionsProvider>();
var options = await localStorageOptionsProvider.GetOptions<ApplicationOptions>();

CultureInfo.DefaultThreadCurrentCulture = options.Culture;
Expand Down
4 changes: 2 additions & 2 deletions AudioCuesheetEditor/Model/AudioCuesheet/CatalogueNumber.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ protected override ValidationResult Validate(string property)
validationStatus = ValidationStatus.Success;
if (Value.All(Char.IsDigit) == false)
{
validationMessages ??= new();
validationMessages ??= [];
validationMessages.Add(new ValidationMessage("{0} must only contain numbers!", nameof(Value)));
}
if (Value.Length != 13)
{
validationMessages ??= new();
validationMessages ??= [];
validationMessages.Add(new ValidationMessage("{0} has an invalid length. Allowed length is {1}!", nameof(Value), 13));
}
}
Expand Down
56 changes: 2 additions & 54 deletions AudioCuesheetEditor/Model/AudioCuesheet/Cuesheet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
//along with Foobar. If not, see
//<http: //www.gnu.org/licenses />.
using AudioCuesheetEditor.Model.Entity;
using AudioCuesheetEditor.Model.IO;
using AudioCuesheetEditor.Model.IO.Audio;
using AudioCuesheetEditor.Model.IO.Export;
using AudioCuesheetEditor.Model.Options;
Expand All @@ -39,11 +38,8 @@ public class CuesheetSectionAddRemoveEventArgs(CuesheetSection section) : EventA
public CuesheetSection Section { get; } = section;
}

public class Cuesheet(TraceChangeManager? traceChangeManager = null) : Validateable<Cuesheet>, ICuesheetEntity, ITraceable
public class Cuesheet(TraceChangeManager? traceChangeManager = null) : Validateable<Cuesheet>, ITraceable, ICuesheet
{
public const String MimeType = "text/*";
public const String FileExtension = ".cue";

private readonly object syncLock = new();

private List<Track> tracks = [];
Expand All @@ -62,7 +58,6 @@ public class Cuesheet(TraceChangeManager? traceChangeManager = null) : Validatea
public event EventHandler<TrackAddRemoveEventArgs>? TrackRemoved;
public event EventHandler<CuesheetSectionAddRemoveEventArgs>? SectionAdded;
public event EventHandler<CuesheetSectionAddRemoveEventArgs>? SectionRemoved;
public event EventHandler? CuesheetImported;

[JsonInclude]
public IReadOnlyCollection<Track> Tracks
Expand Down Expand Up @@ -176,7 +171,7 @@ public TimeSpan? RecordingTime
}

[JsonIgnore]
public Boolean IsImporting { get; private set; }
public Boolean IsImporting { get; set; }

[JsonInclude]
public IReadOnlyCollection<CuesheetSection> Sections
Expand Down Expand Up @@ -393,27 +388,6 @@ public void MoveTrack(Track track, MoveDirection moveDirection)
}
}

public void Import(Cuesheet cuesheet, ApplicationOptions applicationOptions, TraceChangeManager? traceChangeManager = null)
{
//Since we use a stack for several changes we need to lock execution for everything else
lock (syncLock)
{
IsImporting = true;
//We are doing a bulk edit, so inform the TraceChangeManager
if (traceChangeManager != null)
{
traceChangeManager.BulkEdit = true;
}
CopyValues(cuesheet, applicationOptions);
if (traceChangeManager != null)
{
traceChangeManager.BulkEdit = false;
}
IsImporting = false;
}
CuesheetImported?.Invoke(this, EventArgs.Empty);
}

public void StartRecording()
{
recordingStart = DateTime.UtcNow;
Expand Down Expand Up @@ -554,32 +528,6 @@ private void ReCalculateTrackProperties(Track trackToCalculate)
}
}

/// <summary>
/// Copy values from import cuesheet to this cuesheet
/// </summary>
/// <param name="cuesheet">Reference to import cuesheet</param>
/// <param name="applicationOptions">Reference to application options</param>
private void CopyValues(Cuesheet cuesheet, ApplicationOptions applicationOptions)
{
Artist = cuesheet.Artist;
Title = cuesheet.Title;
Audiofile = cuesheet.Audiofile;
CDTextfile = cuesheet.CDTextfile;
Cataloguenumber = cuesheet.Cataloguenumber;
foreach (var importTrack in cuesheet.Tracks)
{
//We don't want to copy the cuesheet reference since we are doing a copy and want to assign the track to this object
var track = new Track(importTrack, false);
AddTrack(track, applicationOptions);
}
// Copy sections
foreach (var splitPoint in cuesheet.Sections)
{
var newSplitPoint = AddSection();
newSplitPoint.CopyValues(splitPoint);
}
}

private void Track_RankPropertyValueChanged(object? sender, string e)
{
if (sender is Track trackRaisedEvent)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,12 @@
//You should have received a copy of the GNU General Public License
//along with Foobar. If not, see
//<http: //www.gnu.org/licenses />.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace AudioCuesheetEditor.Model.AudioCuesheet
{
/// <summary>
/// Interface for cuesheet entities (Cuesheet, track, etc.)
/// </summary>
public interface ICuesheetEntity
public interface ICuesheet
{
public String? Artist { get; set; }
public String? Title { get; set; }
string? Artist { get; set; }
string? Title { get; set; }
}
}
Loading