]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Implement add -a (add all audio files).
authorAndre Noll <maan@systemlinux.org>
Mon, 1 Oct 2007 20:23:39 +0000 (22:23 +0200)
committerAndre Noll <maan@systemlinux.org>
Mon, 1 Oct 2007 20:23:39 +0000 (22:23 +0200)
afs.cmd
aft.c
error.h
vss.c

diff --git a/afs.cmd b/afs.cmd
index e6e0d3e1bb7c8a9f828ee12e17048a5b14c5cba2..2ec7bd26c3886a1bd39aa3db2eed1f0c02166584 100644 (file)
--- a/afs.cmd
+++ b/afs.cmd
@@ -17,6 +17,9 @@ H: are added recursively.
 H:
 H: Options:
 H:
 H:
 H: Options:
 H:
+H: -a  Add all files. The default is to add only files ending in a known suffix
+H:     for a supported audio format.
+H:
 H: -l  Add files lazily. If a file already exists in the database, skip this file.
 H:     This operation is really cheap. Use it when adding large directories if only a
 H:     few files where added.
 H: -l  Add files lazily. If a file already exists in the database, skip this file.
 H:     This operation is really cheap. Use it when adding large directories if only a
 H:     few files where added.
@@ -73,7 +76,7 @@ H:            -si:  sort by image id.
 H:
 H:             -sy:  sort by lyrics id.
 H:
 H:
 H:             -sy:  sort by lyrics id.
 H:
-H:             -sb:  sort by bitrate.
+H:             -sb:  sort by bit rate.
 H:
 H:             -sd:  sort by duration.
 H:
 H:
 H:             -sd:  sort by duration.
 H:
diff --git a/aft.c b/aft.c
index 209ea525be39309ea7ea5af0479289cdc01833c3..99b132dd9d249a9991805068161fc1faf729ada5 100644 (file)
--- a/aft.c
+++ b/aft.c
@@ -1401,6 +1401,7 @@ afhi <=> force or no HS
 #define ADD_FLAG_LAZY 1
 #define ADD_FLAG_FORCE 2
 #define ADD_FLAG_VERBOSE 4
 #define ADD_FLAG_LAZY 1
 #define ADD_FLAG_FORCE 2
 #define ADD_FLAG_VERBOSE 4
+#define ADD_FLAG_ALL 8
 
 /* TODO: change log messages so that they get written to the result buffer */
 
 
 /* TODO: change log messages so that they get written to the result buffer */
 
@@ -1564,6 +1565,9 @@ static int add_one_audio_file(const char *arg, const void *private_data)
        ret = verify_path(arg, &path);
        if (ret < 0)
                goto out_free;
        ret = verify_path(arg, &path);
        if (ret < 0)
                goto out_free;
+       ret = guess_audio_format(path);
+       if (ret < 0 && !(pad->flags & ADD_FLAG_ALL))
+               goto out_free;
        query.data = path;
        query.size = strlen(path) + 1;
        ret = send_callback_request(path_brother_callback, &query, &result);
        query.data = path;
        query.size = strlen(path) + 1;
        ret = send_callback_request(path_brother_callback, &query, &result);
@@ -1649,6 +1653,10 @@ int com_add(int fd, int argc, char * const * const argv)
                        i++;
                        break;
                }
                        i++;
                        break;
                }
+               if (!strcmp(arg, "-a")) {
+                       pad.flags |= ADD_FLAG_ALL;
+                       continue;
+               }
                if (!strcmp(arg, "-l")) {
                        pad.flags |= ADD_FLAG_LAZY;
                        continue;
                if (!strcmp(arg, "-l")) {
                        pad.flags |= ADD_FLAG_LAZY;
                        continue;
diff --git a/error.h b/error.h
index b7b66c697e5c7bdb63197845892147083d3049ce..507f9e24e7700b62701bb8b489b49a329e4fddf0 100644 (file)
--- a/error.h
+++ b/error.h
@@ -391,6 +391,7 @@ extern const char **para_errlist[];
 
 
 #define VSS_ERRORS \
 
 
 #define VSS_ERRORS \
+       PARA_ERROR(BAD_AUDIO_FILE_SUFFIX, "unknown suffix"), \
        PARA_ERROR(AUDIO_FORMAT, "audio format not recognized"), \
        PARA_ERROR(CHUNK, "unable to get chunk"), \
 
        PARA_ERROR(AUDIO_FORMAT, "audio format not recognized"), \
        PARA_ERROR(CHUNK, "unable to get chunk"), \
 
diff --git a/vss.c b/vss.c
index e6cf59676fe4699b85501b5334de8c99b090a4f1..5b7ed320aaaa38885f208dda80ad51d690999b2c 100644 (file)
--- a/vss.c
+++ b/vss.c
@@ -233,7 +233,7 @@ int guess_audio_format(const char *name)
                        return i;
                }
        }
                        return i;
                }
        }
-       return -1;
+       return -E_BAD_AUDIO_FILE_SUFFIX;
 }
 
 static int get_audio_format(int omit)
 }
 
 static int get_audio_format(int omit)