Add error handling for audible-split

This commit is contained in:
Nemo 2020-10-26 23:20:02 +05:30
parent 30e47d347c
commit 05fd7f3d39
2 changed files with 8 additions and 0 deletions

View File

@ -87,6 +87,7 @@ This lives in my `~/projects/scripts` directory and is added to my `$PATH`. Not
| snippy.sh | Third-party. Helper script for i3 to let me create snippets and type them easily. | | snippy.sh | Third-party. Helper script for i3 to let me create snippets and type them easily. |
| split-audio-by-chapters | Splits a audiobook by its various chapters. I added support for providing a chapters.txt file with chapter names in case the M4B file doesn't have correct names | | split-audio-by-chapters | Splits a audiobook by its various chapters. I added support for providing a chapters.txt file with chapter names in case the M4B file doesn't have correct names |
| split-by-audible | Similar to split-audio-by-chapters, but this one uses a different chapter-listing format, which is what you get when you copy the Audible tracklist from the Audible web player. | | split-by-audible | Similar to split-audio-by-chapters, but this one uses a different chapter-listing format, which is what you get when you copy the Audible tracklist from the Audible web player. |
| split-by-silence | ffmpeg wrapper to use silence detection to split files. [Source](https://gist.github.com/vi/2fe3eb63383fcfdad7483ac7c97e9deb)
| sql | Third-party. Runs SQL commands against different drivers based on DBURL. This is a GNU project | | sql | Third-party. Runs SQL commands against different drivers based on DBURL. This is a GNU project |
| ssl-cipher-test.sh | Runs a SSL Cipher test by testing all available ciphers against an upstream server | | ssl-cipher-test.sh | Runs a SSL Cipher test by testing all available ciphers against an upstream server |
| stream-audio.sh | Streams pulseaudio to RTSP | | stream-audio.sh | Streams pulseaudio to RTSP |

View File

@ -22,9 +22,16 @@ This is exactly what you'll get if you copy-paste the listing from the web playe
Unfortunately, I've found that for very long Audiobooks, this isn't precise enough and the errors add up. Unfortunately, I've found that for very long Audiobooks, this isn't precise enough and the errors add up.
*/ */
if(count($argv) != 3) {
die("Please run as split-by-audible audio.m4a listing.txt\n");
}
$INPUT_FILE=$argv[1]; $INPUT_FILE=$argv[1];
$listing=$argv[2]; $listing=$argv[2];
is_readable($INPUT_FILE) or die("$INPUT_FILE not readable\n");
is_readable($listing) or die("$listing not readable\n");
$startTime = 0; $startTime = 0;
$inputData = file($listing); $inputData = file($listing);