Package: shntool
Version: 3.0.7-1
Severity: normal
Tags: patch

I want to be able to use shntool split even if there is no split points
(i.e. there is only one track in cue sheet) but I can't. It's not so
pointless as it may seem to be - this may be useful when running
cue2tracks script for multiple albums and some of them may contain only
one track.

The patch introduces flag -F to force splitting:
--- src/mode_split.c    2008-02-19 02:25:14.000000000 +0300
+++ src/mode_split.c    2012-03-10 16:58:44.000000000 +0400
@@ -57,6 +57,7 @@
 static char *leadout = NULL;
 static char *extract_tracks = NULL;
 static char *manipulate_chars = NULL;
+static int force_split = 0;
 
 typedef struct _cue_info {
   /* global */
@@ -101,6 +102,7 @@
   st_info("          (%%p = performer, %%a = album, %%t = track title, %%n = 
track number)\n");
   st_info("  -u len  postfix each track with len amount of lead-out from next 
track (*)\n");
   st_info("  -x list only extract tracks in list (comma-separated, may contain 
ranges)\n");
+  st_info("  -F force split even if no split points are given (outputs one 
file)\n");
   st_info("\n");
   st_info("          (*) len must be in bytes, m:ss, m:ss.ff or m:ss.nnn 
format\n");
   st_info("\n");
@@ -116,7 +118,7 @@
   st_ops.output_prefix = SPLIT_PREFIX;
   cueinfo.format = NULL;
 
-  while ((c = st_getopt(argc,argv,"c:e:f:l:n:m:t:u:x:")) != -1) {
+  while ((c = st_getopt(argc,argv,"c:e:f:l:n:m:t:u:x:F")) != -1) {
     switch (c) {
       case 'c':
         if (NULL == optarg)
@@ -168,6 +170,9 @@
           st_error("missing track numbers to extract");
         extract_tracks = optarg;
         break;
+      case 'F':
+        force_split = 1;
+        break;
     }
   }
 
@@ -736,8 +741,14 @@
   if (split_point_file)
     fclose(fd);
 
-  if (1 == numfiles)
-    st_error("no split points given -- nothing to do");
+  if (1 == numfiles) {
+    if (force_split) {
+      st_warning("no split points given");
+    } 
+    else {
+      st_error("no split points given -- nothing to do");
+    }
+  }
 
   if (SPLIT_INPUT_CUE == input_type && cueinfo.format) {
     if (cueinfo.trackno < numfiles)
@@ -860,16 +871,16 @@
   else
     read_split_points_file(info);
 
-  if (files[numfiles-2]->beginning_byte > info->data_size)
+  if (numfiles > 1 && files[numfiles-2]->beginning_byte > info->data_size)
     st_error("split points go beyond input file's data size");
 
-  if (files[numfiles-2]->beginning_byte == info->data_size) {
+  if (numfiles > 1 && files[numfiles-2]->beginning_byte == info->data_size) {
     st_free(files[numfiles-1]);
     numfiles--;
   }
   else {
     files[numfiles-1]->beginning_byte = info->data_size;
-    files[numfiles-1]->data_size = info->data_size - 
files[numfiles-2]->beginning_byte;
+    files[numfiles-1]->data_size = info->data_size - (numfiles > 1 ? 
files[numfiles-2]->beginning_byte : 0);
 
     adjust_splitfile(numfiles-1);
   }


-- System Information:
Debian Release: 6.0.3
  APT prefers stable
  APT policy: (700, 'stable'), (400, 'testing'), (100, 'unstable'), (1, 
'experimental')
Architecture: i386 (i686)

Kernel: Linux 3.1.0-1-686-pae (SMP w/2 CPU cores)
Locale: LANG=ru_RU.UTF-8, LC_CTYPE=ru_RU.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages shntool depends on:
ii  libc6                         2.13-21    Embedded GNU C Library: Shared lib

shntool recommends no packages.

Versions of packages shntool suggests:
ii  cuetools                     1.3.1-9     tools for manipulating CUE/TOC fil
ii  flac                         1.2.1-2+b1  Free Lossless Audio Codec - comman
ii  sox                          14.3.2-2+b1 Swiss army knife of sound processi

-- no debconf information



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to