8 Commits
6 changed files with 35 additions and 19 deletions
+3
View File
@@ -3,6 +3,9 @@
## ##
## Get latest from `dotnet new gitignore` ## Get latest from `dotnet new gitignore`
# published files
dist/
# dotenv files # dotenv files
.env .env
appsettings*.json appsettings*.json
+14
View File
@@ -2,6 +2,20 @@
All notable changes to this project will be documented in this file. See [versionize](https://github.com/versionize/versionize) for commit guidelines. All notable changes to this project will be documented in this file. See [versionize](https://github.com/versionize/versionize) for commit guidelines.
<a name="0.2.0"></a>
## [0.2.0](https://www.github.com/StevanFreeborn/stream-shorts/releases/tag/v0.2.0) (2025-08-21)
### Features
* display location of output with link inside panel ([57e95b2](https://www.github.com/StevanFreeborn/stream-shorts/commit/57e95b2ea19ea97019df70bd7a5414984faaa1c7))
<a name="0.1.0"></a>
## [0.1.0](https://www.github.com/StevanFreeborn/stream-shorts/releases/tag/v0.1.0) (2025-08-21)
### Features
* fallback to static AnsiConsole if exception occurs before registered in DI container ([d560909](https://www.github.com/StevanFreeborn/stream-shorts/commit/d560909f16f0a97b399f8139f94b6f2fe07cf033))
<a name="0.0.0"></a> <a name="0.0.0"></a>
## [0.0.0](https://www.github.com/StevanFreeborn/stream-shorts/releases/tag/v0.0.0) (2025-08-20) ## [0.0.0](https://www.github.com/StevanFreeborn/stream-shorts/releases/tag/v0.0.0) (2025-08-20)
@@ -71,10 +71,7 @@ internal sealed class DefaultCommand(
await _console.Status() await _console.Status()
.Spinner(Spinner.Known.Dots) .Spinner(Spinner.Known.Dots)
.StartAsync("Extracting audio...", async _ => .StartAsync("Extracting audio...", async _ => audioStream = await _audioExtractor.ExtractMp3FromMp4Async(videoStream));
{
audioStream = await _audioExtractor.ExtractMp3FromMp4Async(videoStream);
});
if (audioStream is null) if (audioStream is null)
{ {
@@ -102,10 +99,8 @@ internal sealed class DefaultCommand(
var now = _timeProvider.GetUtcNow(); var now = _timeProvider.GetUtcNow();
var inputFileName = _fileSystem.Path.GetFileNameWithoutExtension(settings.Stream); var inputFileName = _fileSystem.Path.GetFileNameWithoutExtension(settings.Stream);
var outputDirectoryPath = _fileSystem.Path.Combine( var outputDirectory = $"{now:yyyy_MM_dd_HH_mm_ss}_{inputFileName}";
AppContext.BaseDirectory, var outputDirectoryPath = _fileSystem.Path.Combine(AppContext.BaseDirectory, outputDirectory);
$"{now:yyyy_MM_dd_HH_mm_ss}_{inputFileName}"
);
_fileSystem.Directory.CreateDirectory(outputDirectoryPath); _fileSystem.Directory.CreateDirectory(outputDirectoryPath);
@@ -118,10 +113,7 @@ internal sealed class DefaultCommand(
await _console.Status() await _console.Status()
.Spinner(Spinner.Known.Dots) .Spinner(Spinner.Known.Dots)
.StartAsync("Analyzing transcript...", async _ => .StartAsync("Analyzing transcript...", async _ => analysis = await _transcriptAnalyzer.AnalyzeAsync(transcriptionSegments));
{
analysis = await _transcriptAnalyzer.AnalyzeAsync(transcriptionSegments);
});
if (analysis is null) if (analysis is null)
{ {
@@ -149,14 +141,21 @@ internal sealed class DefaultCommand(
} }
}); });
_console.MarkupLine($"[blue]Shorts created[/] [green]successfully![/]"); var directoryUri = new Uri(outputDirectoryPath).AbsoluteUri;
var panel = new Panel($"[blue link={directoryUri}]{outputDirectory}[/]")
{
Header = new PanelHeader($"[blue]Shorts created[/] [green]successfully![/]")
};
return 0; _console.Write(panel);
return (int)ExitCode.SuccessFullyProcessedStream;
} }
private enum ExitCode private enum ExitCode
{ {
FailedToExtractAudio, FailedToExtractAudio,
FailedToAnalyzeTranscript, FailedToAnalyzeTranscript,
SuccessFullyProcessedStream,
} }
} }
@@ -18,9 +18,9 @@ internal static class HostBuilderExtensions
app.Configure(static c => app.Configure(static c =>
c.SetExceptionHandler(static (ex, resolver) => c.SetExceptionHandler(static (ex, resolver) =>
{ {
var console = resolver?.Resolve(typeof(IAnsiConsole)) as IAnsiConsole; var console = resolver?.Resolve(typeof(IAnsiConsole)) as IAnsiConsole ?? AnsiConsole.Console;
console?.MarkupLine($"[red]An error occurred while executing the command:[/]"); console.MarkupLine($"[red]An error occurred while executing the command:[/]");
console?.WriteException(ex, ExceptionFormats.ShortenEverything); console.WriteException(ex, ExceptionFormats.ShortenEverything);
}) })
); );
+1 -1
View File
@@ -25,7 +25,7 @@ try
services.AddSingleton(TimeProvider.System); services.AddSingleton(TimeProvider.System);
services.AddSingleton<IAudioExtractor, AudioExtractor>(); services.AddSingleton<IAudioExtractor, AudioExtractor>();
services.AddSingleton<ITranscriber, WhisperTranscriber>(); services.AddSingleton<ITranscriber, WhisperTranscriber>();
services.AddSingleton<ITranscriptAnalyzer, GeminiAnalyzer>(sp => services.AddSingleton<ITranscriptAnalyzer, GeminiAnalyzer>(static sp =>
{ {
const string modelOptionName = "Model"; const string modelOptionName = "Model";
const string keyOptionName = "ApiKey"; const string keyOptionName = "ApiKey";
@@ -4,7 +4,7 @@
<AssemblyTitle>StreamShorts.Console</AssemblyTitle> <AssemblyTitle>StreamShorts.Console</AssemblyTitle>
<Product>StreamShorts.Console</Product> <Product>StreamShorts.Console</Product>
<Description>A command-line interface for StreamShorts</Description> <Description>A command-line interface for StreamShorts</Description>
<Version>0.0.0</Version> <Version>0.2.0</Version>
<Authors>Stevan Freeborn</Authors> <Authors>Stevan Freeborn</Authors>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<PublishSingleFile>true</PublishSingleFile> <PublishSingleFile>true</PublishSingleFile>