commit 41d519fa5a2562e4849545d0f00dce222492a0c0
Author: spesk1 <spesk@pm.me>
Date: Sun Jun 30 11:47:53 2019 -0400
Fixed a few bugs
diff --git a/yt-track-split b/yt-track-split
index 1363887..d9b3a61 100755
--- a/yt-track-split
+++ b/yt-track-split
@@ -71,6 +71,7 @@ sub get_end_time($$) {
my $end_time;
if ( $next_start_time =~ m/^(.*)\:([0-9]{2})$/ ) {
my $end_time_val = $2 - 1;
+ if ( length $end_time_val == 1 ) { $end_time_val = "0" . $end_time_val; }
$end_time = $1 . ":" . $end_time_val;
$end_time = prepend_zeros($end_time);
return $end_time;
@@ -133,8 +134,7 @@ sub run_split($$$$$) {
my $end_time = shift;
# Optionally covert to different codec?
my $filename = "$track_number" . "-" . "$track_name" . ".mp3";
- my $ffmpegCmd = "$ffmpegBin -i '$mp3_file' -acodec copy -ss $start_time -to $end_time $filename > /dev/null 2>&1";
- print "Splitting $track_name from $mp3_file -> $start_time - $end_time\n";
+ my $ffmpegCmd = "$ffmpegBin -i '$mp3_file' -acodec copy -ss $start_time -to $end_time '$filename' > /dev/null 2>&1";
system("$ffmpegCmd") == 0 or die "Failed to run $ffmpegCmd\n";
}