Browse Source

A few more changes

spesk1 4 years ago
parent
commit
19f7f7a6d5
2 changed files with 8 additions and 1 deletions
  1. 7 1
      sanitize_tl.pl
  2. 1 0
      yt-track-split

+ 7 - 1
sanitize_tl.pl

@@ -15,12 +15,18 @@ my $file = shift(@ARGV);
 
 foreach my $line ( split("\n", `cat $file`) ) {
 	chomp $line;
-	if ( $line =~ m/([0-9]{2}:[0-9]{2})/ ) {
+	if ( $line =~ m/([0-9]{2}:[0-9]{2}|[0-9]{1,2}:[0-9]{2}:[0-9]{2})/ ) {
 		my $time_code = $1;
 		$line =~ s/ $time_code//g;
 		$line = $line . " " . $time_code;
 	}
 
+	if ( $line !~ m/^[0-9]{1,2}\./ ) {
+		$line =~ s/^([0-9]{1,2})//g;
+		my $track_number = $1;
+		$line = "$track_number" . "." . "$line";
+	}
+
 	my $sanitized_line;
 	open(my $fh, ">>", \$sanitized_line);
 	my @line_chars = split("",$line);

+ 1 - 0
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 ( $end_time_val < 0 ) { $end_time_val = 0; }
 		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);