Skip to content

Commit 8d7689f

Browse files
committed
Prepared release 0.1.9 with some minor improvements
1 parent c09ff85 commit 8d7689f

5 files changed

Lines changed: 63 additions & 5 deletions

File tree

tone/Commands/DumpCommand.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,22 @@ private async Task<ReturnCode> SpectreConsoleDelegate(IFileSystem fs, string out
4646
return await Task.FromResult(ReturnCode.Success);
4747
}
4848

49+
private async Task<ReturnCode> NoBreakDelegate(IFileSystem fs, string outputFile, IEnumerable<string> lines, CancellationToken ct)
50+
{
51+
foreach (var line in lines)
52+
{
53+
_console.WriteNoBreakLine(line);
54+
}
55+
return await Task.FromResult(ReturnCode.Success);
56+
}
57+
4958
private async Task<ReturnCode> WriteFileDelegate(IFileSystem fs, string outputFile, IEnumerable<string> lines, CancellationToken ct)
5059
{
5160
try
5261
{
5362
await fs.File.WriteAllLinesAsync(outputFile, lines, ct);
5463
}
55-
catch (Exception e)
64+
catch (Exception)
5665
{
5766
return ReturnCode.GeneralError;
5867
}
@@ -90,6 +99,11 @@ public override async Task<int> ExecuteAsync(CommandContext context, DumpCommand
9099
_ => NoSpecSuffix
91100
};
92101
}
102+
else if(settings.Format != SerializerFormat.Default && Console.IsOutputRedirected)
103+
{
104+
// Output width needs to be ajusted when output is redirected and format is json
105+
outputDelegate = NoBreakDelegate;
106+
}
93107

94108
foreach (var file in inputFiles)
95109
{

tone/Program.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.Linq;
55
using System.Net.Http;
66
using System.Threading;
7+
using ATL;
78
using GrokNet;
89
using Jint;
910
using Microsoft.Extensions.Configuration;
@@ -38,6 +39,13 @@
3839
{
3940
var debugMode = args.Contains("--debug");
4041

42+
// atldotnet basic settings to change the common behaviour
43+
Settings.UseFileNameWhenNoTitle = false; // don't fallback to filename when no title is set
44+
// Settings.NullAbsentValues = true; // use null instead of default when tags are considered empty
45+
Settings.OutputStacktracesToConsole = false; // don't output something to console
46+
// Settings.ID3v2_tagSubVersion = 3; // use id3v2.4 by default (4 for 2.4)
47+
// Settings.MP3_parseExactDuration = true; // more exact duration, takes longer
48+
4149
var settingsProvider = new CustomCommandSettingsProvider();
4250

4351
var services = new ServiceCollection();
@@ -223,7 +231,7 @@
223231
config.UseStrictParsing();
224232
config.CaseSensitivity(CaseSensitivity.None);
225233
config.SetApplicationName("tone");
226-
config.SetApplicationVersion("0.1.8");
234+
config.SetApplicationVersion("0.1.9");
227235
config.ValidateExamples();
228236
config.AddCommand<DumpCommand>("dump")
229237
.WithDescription("dump metadata for files and directories (directories are traversed recursively)")

tone/Services/SpectreConsoleService.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,19 @@ public SpectreConsoleService(IAnsiConsole? stdout = null, IAnsiConsole? stderr =
1616
{
1717
Out = new AnsiConsoleOutput(Console.Error)
1818
});
19-
19+
}
20+
21+
public void WriteNoBreakLine(string text)
22+
{
23+
var oldWidth = Output.Profile.Width;
24+
Output.Profile.Width = text.Length;
25+
Output.WriteLine(text, Style.Plain);
26+
Output.Profile.Width = oldWidth;
27+
}
28+
29+
/*
30+
public void AdjustOutputWidth()
31+
{
2032
// fix unwanted wrapping if output is redirected
2133
if (ShouldAdjustOutputWidth())
2234
{
@@ -28,7 +40,7 @@ public SpectreConsoleService(IAnsiConsole? stdout = null, IAnsiConsole? stderr =
2840
Error.Profile.Width = int.MaxValue;
2941
}
3042
}
31-
43+
3244
private static bool ShouldAdjustOutputWidth() => Environment.GetEnvironmentVariable("TONE_OUTPUT_REDIRECT") switch
3345
{
3446
"0" => false,
@@ -42,6 +54,7 @@ public SpectreConsoleService(IAnsiConsole? stdout = null, IAnsiConsole? stderr =
4254
"1" => true,
4355
_ => Console.IsErrorRedirected
4456
};
57+
*/
4558

4659
public Profile Profile => Output.Profile;
4760
public IAnsiConsoleCursor Cursor => Output.Cursor;
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Release Notes
2+
3+
## Fixed
4+
- #44 - Could not remove `movement` tag with `--meta-remove-property` - should now work as expected
5+
- #46 - Files without any metadata could not be modified in some cases (e.g. using only `--meta-subtitle`) - should now work as expected
6+
7+
## Changed
8+
- Improved fix for #68 - no environment variable needed any more
9+
10+
11+
12+
## Setup instructions
13+
14+
`tone` is released as single monolithic binary, so you don't need a setup file or any dependencies (not even a `.NET` runtime). Download the `tone`
15+
release for your platform, extract it and run it via command line. If you need help choosing your download, here are some hints:
16+
17+
- For Windows, only the x64 platform is available... choose `-win-x64.zip`
18+
- For `musl` (an alternative C library) choose your arch prefixed by `musl` (usually this is used in alpine `docker` images and other lightweight distributions)
19+
- For standard Linux (like *Fedora*, *Ubuntu*, etc.), it is recommended choose your arch without `musl` prefix
20+
- For *macOS* you might need to run `xattr -rd com.apple.quarantine tone` after extracting to remove `quarantine` flag
21+
22+

tone/tone.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.1" />
4848
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0" />
4949
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
50-
<PackageReference Include="Sandreas.AudioMetadata" Version="0.1.8" />
50+
<PackageReference Include="Sandreas.AudioMetadata" Version="0.2.1" />
5151
<PackageReference Include="Sandreas.SpectreConsoleHelpers" Version="0.0.2" />
5252
<PackageReference Include="Serilog" Version="4.0.2" />
5353
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
@@ -63,6 +63,7 @@
6363
<Folder Include="Common\Extensions\IEnumerable" />
6464
<Folder Include="var\data\output" />
6565
<Folder Include="var\issues\15" />
66+
<Folder Include="var\issues\55\input\" />
6667
<Folder Include="var\issues\59\" />
6768
</ItemGroup>
6869

0 commit comments

Comments
 (0)