sandreas / tone

tone is a cross platform audio tagger and metadata editor to dump and modify metadata for a wide variety of formats, including mp3, m4b, flac and more. It has no dependencies and can be downloaded as single binary for Windows, macOS, Linux and other common platforms.
https://pilabor.com
Apache License 2.0
410 stars 17 forks source link

Scripting issue with very large files / very many chapters #40

Closed sandreas closed 4 months ago

sandreas commented 1 year ago

The following script runs into an error:

// reindexChapters.js 
function reindexChapters(metadata, parameters) {
  var count = metadata.Chapters.Count;
  var newChapters = [];
  console.log("found " + count + " chapters to reindex");
  for(var i=0;i<count;i++) {
    metadata.Chapters[i].Title = "Chapter " + (i+1);
  }
}

tone.RegisterTagger("reindexChapters");
tone tag "my-audiobook.m4b" --taggers="reindexChapters" --script="reindexChapters.js" --dry-run

Original report: https://github.com/sandreas/m4b-tool/issues/216#issuecomment-1483459119

I'm running into an issue which large audiobooks (do know if its the file size (all are bigger than 1GB) or the chapter number). found 563 chapters to reindex Error: Object reference not set to an instance of an object. Any ideas? Best regards, Stefan
StefanDorschu commented 1 year ago

Maybe this helps you?

found 512 chapters to reindex Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object. at Spectre.Console.ExceptionFormatter.TryGetTupleName(ParameterInfo parameter, Type parameterType, String& tupleName) in /_/src/Spectre.Console/Widgets/Exceptions/ExceptionFormatter.cs: line 314 at Spectre.Console.ExceptionFormatter.GetParameterName(ParameterInfo parameter) in /_/src/Spectre.Console/Widgets/Exceptions/ExceptionFormatter.cs:line 280 at Spectre.Console.ExceptionFormatter.GetStackFrames(Exception ex, ExceptionSettings settings) in /_/src/Spectre.Console/Widgets/Exceptions/ExceptionFormatter.cs:line 79 at Spectre.Console.ExceptionFormatter.GetException(Exception exception, ExceptionSettings settings) in /_/src/Spectre.Console/Widgets/Exceptions/ExceptionFormatter.cs:line 22 at Spectre.Console.ExceptionFormatter.Format(Exception exception, ExceptionSettings settings) in /_/src/Spectre.Console/Widgets/Exceptions/ExceptionFormatter.cs:line 7 at Spectre.Console.ExceptionExtensions.GetRenderable(Exception exception, ExceptionSettings settings) in /_/src/Spectre.Console/Extensions/ExceptionExtensions.cs:line 40 at Spectre.Console.ExceptionExtensions.GetRenderable(Exception exception, ExceptionFormats format) in /_/src/Spectre.Console/Extensions/ExceptionExtensions.cs:line 21 at Spectre.Console.AnsiConsole.WriteException(Exception exception, ExceptionFormats format) in /_/src/Spectre.Console/AnsiConsole.Exceptions.cs:line 15 at Program.<Main>$(String[] args) at Program.<Main>(String[] args) Aborted (core dumped)

StefanDorschu commented 1 year ago

Any news on this?

sandreas commented 1 year ago

Still on it. Currently I'm on a nother project taking all of my time... will try to give you an update as soon as it's fixed or I have a workaround.

StefanDorschu commented 1 year ago

Ok. Thank you for all your effort!

sandreas commented 4 months ago

@StefanDorschu

tone 0.1.6 is out. Since it is the first release after a long time, this issue may have been fixed with the new jint release. I would love to get feedback, please backup your files.

StefanDorschu commented 4 months ago

Works like a charm! Problem solved!

sandreas commented 4 months ago

Great, closing this issue then :-) Have a nice day.