patch against 1671 to report simple errors

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1787

    hi Ron,

    i’ve noticed a couple of ppl (myself included) wonder why some of our files don’t get included in the db scans and its almost always invariably linked to permissioning errors; when you pointed this out to me, i ended up patching the 1586 src and it was really useful for me.

    below is a patch against the 1671 src that tells us explicitly when a dir/file wasnt put into the db etc

    can you consider merging this?
    thanks
    ray

    diff -r -u mt-daapd-svn-1671/src/mp3-scanner.c mt-daapd-svn-1671-ray/src/mp3-scanner.c
    — mt-daapd-svn-1671/src/mp3-scanner.c 2007-10-02 12:54:00.000000000 +0100
    +++ mt-daapd-svn-1671-ray/src/mp3-scanner.c 2007-10-02 13:08:53.000000000 +0100
    @@ -271,6 +271,8 @@
    int err=0;
    int index=0;
    char resolved_path[PATH_MAX];
    + unsigned int plen = 0;
    + const char* p = NULL;

    DPRINTF(E_DBG,L_SCAN,”Starting scan_initn”);

    @@ -284,8 +286,24 @@
    while((patharray[index] != NULL) && (!util_must_exit())) {
    DPRINTF(E_DBG,L_SCAN,”Scanning for MP3s in %sn”,patharray[index]);
    realpath(patharray[index],resolved_path);
    – err=scan_path(resolved_path);
    – index++;
    +
    + plen = strlen(resolved_path);
    + if (resolved_path[plen-1] == ‘/’) {
    + resolved_path[plen-1] = NULL;
    + }
    + if ( (p = strrchr(resolved_path, ‘/’)) == NULL) {
    + p = resolved_path-1;
    + }
    + ++p;
    +
    + if ( strcmp(p, “lost+found”) == 0) {
    + DPRINTF(E_DBG,L_SCAN,”ignoring %sn”,patharray[index]);
    + }
    + else {
    + err=scan_path(resolved_path);
    + }
    +
    + ++index;
    }

    if(util_must_exit() || db_end_song_scan())
    @@ -344,11 +362,29 @@
    int is_compdir;
    int follow_symlinks = 0;

    + /* really for the unices out there.. don’t follow the lost+found to avoid
    + * spuious error being logged
    + */
    + const char* p;
    + size_t plen = strlen(path);
    + if (path[plen-1] == ‘/’) {
    + path[plen-1] = NULL;
    + }
    + if ( (p = strrchr(path, ‘/’)) == NULL) {
    + p = path-1;
    + }
    + ++p;
    +
    + if ( strcmp(p, “lost+found”) == 0) {
    + return 0;
    + }
    +
    +
    follow_symlinks = conf_get_int(“scanning”,”follow_symlinks”,1);
    extensions = conf_alloc_string(“general”,”extensions”,”.mp3,.m4a,.m4p”);

    if((current_dir=opendir(path)) == NULL) {
    – DPRINTF(E_WARN,L_SCAN,”opendir: %sn”,strerror(errno));
    + DPRINTF(E_WARN,L_SCAN,”scanning (opendir) failed for %s – %sn”, path, strerror(errno));
    free(extensions);
    return -1;
    }
    @@ -392,7 +428,7 @@
    realpath(relative_path,mp3_path);
    DPRINTF(E_DBG,L_SCAN,”Found %sn”,relative_path);
    if(os_stat(mp3_path,&sb)) {
    – DPRINTF(E_INF,L_SCAN,”Error statting %s: %sn”,mp3_path,strerror(errno));
    + DPRINTF(E_WARN,L_SCAN,”Error statting (relative path=%s) %s: %s – ignoringn”,relative_path, mp3_path,strerror(errno));
    } else {
    if(S_ISDIR(sb.st_mode)) { /* follow dir */
    if(conf_get_int(“scanning”,”ignore_appledouble”,1) &&
    @@ -440,7 +476,7 @@

    DPRINTF(E_WARN,L_SCAN|L_PL,”Processing static playlist: %sn”,path);
    if(os_stat(path,&sb)) {
    – DPRINTF(E_INF,L_SCAN,”Error statting %s: %sn”,path,strerror(errno));
    + DPRINTF(E_WARN,L_SCAN,”Error statting file: %s – %s; ignoringn”, path, strerror(errno));
    return FALSE;
    }

    diff -r -u mt-daapd-svn-1671/src/scan-mp3.c mt-daapd-svn-1671-ray/src/scan-mp3.c
    — mt-daapd-svn-1671/src/scan-mp3.c 2007-10-02 13:11:21.000000000 +0100
    +++ mt-daapd-svn-1671-ray/src/scan-mp3.c 2007-10-02 13:22:55.000000000 +0100
    @@ -308,7 +308,7 @@

    pid3file=id3_file_open(file,ID3_FILE_MODE_READONLY);
    if(!pid3file) {
    – DPRINTF(E_WARN,L_SCAN,”Cannot open %sn”,file);
    + DPRINTF(E_WARN,L_SCAN,”Cannot open %s – %sn”,file, strerror(errno));
    return FALSE;
    }

    #12795

    appologies, heres something that will display properly


    diff -r -u mt-daapd-svn-1671/src/mp3-scanner.c mt-daapd-svn-1671-ray/src/mp3-scanner.c
    --- mt-daapd-svn-1671/src/mp3-scanner.c 2007-10-02 12:54:00.000000000 +0100
    +++ mt-daapd-svn-1671-ray/src/mp3-scanner.c 2007-10-02 13:08:53.000000000 +0100
    @@ -271,6 +271,8 @@
    int err=0;
    int index=0;
    char resolved_path[PATH_MAX];
    + unsigned int plen = 0;
    + const char* p = NULL;

    DPRINTF(E_DBG,L_SCAN,"Starting scan_initn");

    @@ -284,8 +286,24 @@
    while((patharray[index] != NULL) && (!util_must_exit())) {
    DPRINTF(E_DBG,L_SCAN,"Scanning for MP3s in %sn",patharray[index]);
    realpath(patharray[index],resolved_path);
    - err=scan_path(resolved_path);
    - index++;
    +
    + plen = strlen(resolved_path);
    + if (resolved_path[plen-1] == '/') {
    + resolved_path[plen-1] = NULL;
    + }
    + if ( (p = strrchr(resolved_path, '/')) == NULL) {
    + p = resolved_path-1;
    + }
    + ++p;
    +
    + if ( strcmp(p, "lost+found") == 0) {
    + DPRINTF(E_DBG,L_SCAN,"ignoring %sn",patharray[index]);
    + }
    + else {
    + err=scan_path(resolved_path);
    + }
    +
    + ++index;
    }

    if(util_must_exit() || db_end_song_scan())
    @@ -344,11 +362,29 @@
    int is_compdir;
    int follow_symlinks = 0;

    + /* really for the unices out there.. don't follow the lost+found to avoid
    + * spuious error being logged
    + */
    + const char* p;
    + size_t plen = strlen(path);
    + if (path[plen-1] == '/') {
    + path[plen-1] = NULL;
    + }
    + if ( (p = strrchr(path, '/')) == NULL) {
    + p = path-1;
    + }
    + ++p;
    +
    + if ( strcmp(p, "lost+found") == 0) {
    + return 0;
    + }
    +
    +
    follow_symlinks = conf_get_int("scanning","follow_symlinks",1);
    extensions = conf_alloc_string("general","extensions",".mp3,.m4a,.m4p");

    if((current_dir=opendir(path)) == NULL) {
    - DPRINTF(E_WARN,L_SCAN,"opendir: %sn",strerror(errno));
    + DPRINTF(E_WARN,L_SCAN,"scanning (opendir) failed for %s - %sn", path, strerror(errno));
    free(extensions);
    return -1;
    }
    @@ -392,7 +428,7 @@
    realpath(relative_path,mp3_path);
    DPRINTF(E_DBG,L_SCAN,"Found %sn",relative_path);
    if(os_stat(mp3_path,&sb)) {
    - DPRINTF(E_INF,L_SCAN,"Error statting %s: %sn",mp3_path,strerror(errno));
    + DPRINTF(E_WARN,L_SCAN,"Error statting (relative path=%s) %s: %s - ignoringn",relative_path, mp3_path,strerror(errno));
    } else {
    if(S_ISDIR(sb.st_mode)) { /* follow dir */
    if(conf_get_int("scanning","ignore_appledouble",1) &&
    @@ -440,7 +476,7 @@

    DPRINTF(E_WARN,L_SCAN|L_PL,"Processing static playlist: %sn",path);
    if(os_stat(path,&sb)) {
    - DPRINTF(E_INF,L_SCAN,"Error statting %s: %sn",path,strerror(errno));
    + DPRINTF(E_WARN,L_SCAN,"Error statting file: %s - %s; ignoringn", path, strerror(errno));
    return FALSE;
    }

    diff -r -u mt-daapd-svn-1671/src/scan-mp3.c mt-daapd-svn-1671-ray/src/scan-mp3.c
    --- mt-daapd-svn-1671/src/scan-mp3.c 2007-10-02 13:11:21.000000000 +0100
    +++ mt-daapd-svn-1671-ray/src/scan-mp3.c 2007-10-02 13:22:55.000000000 +0100
    @@ -308,7 +308,7 @@

    pid3file=id3_file_open(file,ID3_FILE_MODE_READONLY);
    if(!pid3file) {
    - DPRINTF(E_WARN,L_SCAN,"Cannot open %sn",file);
    + DPRINTF(E_WARN,L_SCAN,"Cannot open %s - %sn",file, strerror(errno));
    return FALSE;
    }

    #12796
    rpedde
    Participant

    @whatdoineed2do-again wrote:

    appologies, heres something that will display properly

    Not a bad idea. I think there is a more trivial patch at about line 397, though.

    I’ll add that.

    Good observation — thanks.

    — Ron

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Nightlies Feedback’ is closed to new topics and replies.