Skip to content

Commit

Permalink
removed audio processing with ffmpeg
Browse files Browse the repository at this point in the history
  • Loading branch information
NeoCoderMatrix86 committed Apr 2, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent d2f300e commit 9e65aa2
Showing 15 changed files with 35 additions and 313 deletions.
1 change: 0 additions & 1 deletion AudioCuesheetEditor/AudioCuesheetEditor.csproj
Original file line number Diff line number Diff line change
@@ -97,7 +97,6 @@

<ItemGroup>
<PackageReference Include="Blazorise.Bootstrap5" Version="1.1.5" />
<PackageReference Include="FFmpegBlazor" Version="1.0.0.7" />
<PackageReference Include="MetaBrainz.MusicBrainz" Version="5.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.1" PrivateAssets="all" />
118 changes: 0 additions & 118 deletions AudioCuesheetEditor/Model/IO/Audio/AudioConverterService.cs

This file was deleted.

23 changes: 0 additions & 23 deletions AudioCuesheetEditor/Model/IO/Audio/IAudioConverterService.cs

This file was deleted.

23 changes: 0 additions & 23 deletions AudioCuesheetEditor/Model/IO/Export/ExportAudiofile.cs

This file was deleted.

1 change: 0 additions & 1 deletion AudioCuesheetEditor/Model/IO/Export/Exportfile.cs
Original file line number Diff line number Diff line change
@@ -23,6 +23,5 @@ public class Exportfile
public byte[]? Content { get; set; }
public TimeSpan? Begin { get; set; }
public TimeSpan? End { get; set; }
public ExportAudiofile? ExportAudiofile { get; set; }
}
}
66 changes: 5 additions & 61 deletions AudioCuesheetEditor/Model/IO/Export/ExportfileGenerator.cs
Original file line number Diff line number Diff line change
@@ -35,20 +35,19 @@ public class ExportfileGenerator : Validateable<ExportfileGenerator>
public Cuesheet Cuesheet { get; }
public Exportprofile? Exportprofile { get; set; }
public ApplicationOptions? ApplicationOptions { get; set; }
public IAudioConverterService? AudioConverterService { get; set; }
public ExportType ExportType { get; set; }

public ExportfileGenerator(ExportType exportType, Cuesheet cuesheet, Exportprofile? exportprofile = null, ApplicationOptions? applicationOptions = null, IAudioConverterService? audioConverterService = null)
public ExportfileGenerator(ExportType exportType, Cuesheet cuesheet, Exportprofile? exportprofile = null, ApplicationOptions? applicationOptions = null)
{
ExportType = exportType;
Cuesheet = cuesheet;
Exportprofile = exportprofile;
ApplicationOptions = applicationOptions;
AudioConverterService = audioConverterService;
}

public async Task<IReadOnlyCollection<Exportfile>> GenerateExportfilesAsync()
public IReadOnlyCollection<Exportfile> GenerateExportfiles()
{
//TODO: Generate export files with start 00:00:00 and each end set correctly!
List<Exportfile> exportfiles = new();
if (Validate().Status != ValidationStatus.Error)
{
@@ -80,8 +79,7 @@ public async Task<IReadOnlyCollection<Exportfile>> GenerateExportfilesAsync()
}
if (content != null)
{
var exportAudiofile = await GetAudiofileContentAsync(audioFileName, previousSplitPointMoment, splitPoint);
exportfiles.Add(new Exportfile() { Name = filename, Content = Encoding.UTF8.GetBytes(content), Begin = previousSplitPointMoment, End = splitPoint.Moment, ExportAudiofile = exportAudiofile });
exportfiles.Add(new Exportfile() { Name = filename, Content = Encoding.UTF8.GetBytes(content), Begin = previousSplitPointMoment, End = splitPoint.Moment });
}
previousSplitPointMoment = splitPoint.Moment;
counter++;
@@ -105,8 +103,7 @@ public async Task<IReadOnlyCollection<Exportfile>> GenerateExportfilesAsync()
}
if (content != null)
{
var exportAudiofile = await GetAudiofileContentAsync(audioFileName, previousSplitPointMoment);
exportfiles.Add(new Exportfile() { Name = filename, Content = Encoding.UTF8.GetBytes(content), Begin = previousSplitPointMoment, ExportAudiofile = exportAudiofile });
exportfiles.Add(new Exportfile() { Name = filename, Content = Encoding.UTF8.GetBytes(content), Begin = previousSplitPointMoment });
}
}
else
@@ -315,38 +312,6 @@ private String WriteExport(String audiofileName, TimeSpan? from = null, SplitPoi
return builder.ToString();
}

private async Task<ExportAudiofile?> GetAudiofileContentAsync(String audiofileName, TimeSpan? from = null, SplitPoint? splitPoint = null)
{
ExportAudiofile? exportAudiofile = null;
if ((from != null) || (splitPoint != null))
{
TimeSpan start = TimeSpan.Zero;
if (from != null)
{
start = from.Value;
}
else
{
var minBegin = Cuesheet.Tracks.Min(x => x.Begin);
if (minBegin != null)
{
start = minBegin.Value;
}
}
if (AudioConverterService == null)
{
throw new NullReferenceException();
}
if (Cuesheet.Audiofile == null)
{
throw new NullReferenceException();
}
var content = await AudioConverterService.SplitAudiofileAsync(Cuesheet.Audiofile, start, splitPoint?.Moment);
exportAudiofile = new() { Name = audiofileName, Content = content };
}
return exportAudiofile;
}

protected override ValidationResult Validate(string property)
{
ValidationResult validationResult;
@@ -414,27 +379,6 @@ protected override ValidationResult Validate(string property)
validationResult = ValidationResult.Create(ValidationStatus.NoValidation);
}
break;
case nameof(AudioConverterService):
if (Cuesheet.SplitPoints.Any())
{
if (AudioConverterService == null)
{
var validationMessages = new List<ValidationMessage>()
{
new("{0} has no value!", nameof(Exportprofile))
};
validationResult = ValidationResult.Create(ValidationStatus.Error, validationMessages);
}
else
{
validationResult = ValidationResult.Create(ValidationStatus.Success);
}
}
else
{
validationResult = ValidationResult.Create(ValidationStatus.NoValidation);
}
break;
default:
validationResult = ValidationResult.Create(ValidationStatus.NoValidation);
break;
1 change: 1 addition & 0 deletions AudioCuesheetEditor/Model/IO/Export/SplitPoint.cs
Original file line number Diff line number Diff line change
@@ -22,6 +22,7 @@ namespace AudioCuesheetEditor.Model.IO.Export
{
public class SplitPoint : Validateable<SplitPoint>, ITraceable
{
//TODO: Add audio file name as property to be set by user
private Cuesheet? cuesheet;
private TimeSpan? moment;
private String? artist;
1 change: 0 additions & 1 deletion AudioCuesheetEditor/Program.cs
Original file line number Diff line number Diff line change
@@ -52,7 +52,6 @@
builder.Services.AddScoped<SessionStateContainer>();
builder.Services.AddScoped<TraceChangeManager>();
builder.Services.AddScoped<DateTimeUtility>();
builder.Services.AddScoped<IAudioConverterService, AudioConverterService>();

builder.Services.AddLogging();
builder.Logging.AddConfiguration(builder.Configuration.GetSection("Logging"));
Original file line number Diff line number Diff line change
@@ -7,7 +7,6 @@
"Begin": "Anfang",
"End": "Ende",
"Content": "Inhalt",
"ExportAudiofile": "Verarbeitete Audiodatei",
"Download this file": "Diese Datei herunterladen",
"Generate export files": "Exportdateien generieren",
"Abort": "Abbrechen",
Original file line number Diff line number Diff line change
@@ -7,7 +7,6 @@
"Begin": "Begin",
"End": "End",
"Content": "Content",
"ExportAudiofile": "Split audiofile",
"Download this file": "Download this file",
"Generate export files": "Generate export files",
"Abort": "Abort",
3 changes: 1 addition & 2 deletions AudioCuesheetEditor/Shared/MainLayout.razor
Original file line number Diff line number Diff line change
@@ -31,7 +31,6 @@ along with Foobar. If not, see
@inject SessionStateContainer _sessionStateContainer
@inject IBlazorDownloadFileService _blazorDownloadFileService
@inject ITextLocalizer<ValidationMessage> _validationMessageLocalizer
@inject IAudioConverterService _audioConverterService

<ErrorBoundary>
<ChildContent>
@@ -419,7 +418,7 @@ along with Foobar. If not, see
{
get
{
var generator = new ExportfileGenerator(ExportType.Cuesheet, _sessionStateContainer.Cuesheet, applicationOptions: applicationOptions, audioConverterService: _audioConverterService);
var generator = new ExportfileGenerator(ExportType.Cuesheet, _sessionStateContainer.Cuesheet, applicationOptions: applicationOptions);
var validationResult = generator.Validate();
if (validationResult.Status == Model.Entity.ValidationStatus.Error)
{
Loading

0 comments on commit 9e65aa2

Please sign in to comment.