Merge branch 'refs/heads/t/immediate-si-update'
authorAndre Noll <maan@tuebingen.mpg.de>
Sun, 26 Apr 2015 12:11:56 +0000 (14:11 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Sun, 26 Apr 2015 12:11:56 +0000 (14:11 +0200)
Cooking in next for four weeks.

* aft: Store resolved paths when adding files.
* aft: Update mtime and file size on afhi changes.
* aft: Update status items on afs events.
* aft.c: Pass struct ls_data pointer to make_status_items().
* afs: Simplify open_next_audio_file().

Conflicts:
aft.c

1  2 
NEWS
afs.c
aft.c
command.c
server.h

diff --cc NEWS
--- 1/NEWS
--- 2/NEWS
+++ b/NEWS
@@@ -7,10 -7,8 +7,12 @@@ current master branch "magnetic momentu
        - On Linux systems, local sockets are now created in the
          abstract name space by default. This allows to get rid of
          the socket specials in /var/paraslash.
 +      - New autoconf macros to avoid duplication in configure.ac.
++      - Status items (as shown by para_gui) are updated correctly
++        when the meta information of the current audio changes.
  
  Download: ./releases/paraslash-git.tar.bz2 (tarball)
++
  ------------------------------------------
  0.5.4 (2015-01-23) "exponential alignment"
  ------------------------------------------
diff --cc afs.c
Simple merge
diff --cc aft.c
--- 1/aft.c
--- 2/aft.c
+++ b/aft.c
@@@ -1120,35 -1119,40 +1116,40 @@@ again
                AFTCOL_CHUNKS, &chunk_table_obj));
        if (ret < 0)
                return ret;
-       ret = mmap_full_file(path, O_RDONLY, &map.data, &map.size, &afd->fd);
+       ret = mmap_full_file(d->path, O_RDONLY, &map.data, &map.size, &afd->fd);
        if (ret < 0)
 -              goto err;
 +              goto out;
        hash_function(map.data, map.size, file_hash);
-       ret = hash_compare(file_hash, aft_hash);
+       ret = hash_compare(file_hash, d->hash);
        para_munmap(map.data, map.size);
        if (ret) {
                ret = -E_HASH_MISMATCH;
 -              goto err;
 +              goto out;
        }
-       new_afsi = old_afsi;
+       new_afsi = d->afsi;
        new_afsi.num_played++;
        new_afsi.last_played = time(NULL);
        save_afsi(&new_afsi, &afsi_obj); /* in-place update */
  
-       afd->audio_format_id = old_afsi.audio_format_id;
+       afd->audio_format_id = d->afsi.audio_format_id;
        load_chunk_table(&afd->afhi, chunk_table_obj.data);
-       ret = make_status_items(afd, &old_afsi, path, score, file_hash);
-       if (ret < 0)
-               goto out;
-       aced.aft_row = aft_row;
-       aced.old_afsi = &old_afsi;
+       aced.aft_row = current_aft_row;
+       aced.old_afsi = &d->afsi;
+       /*
+        * No need to update the status items as the AFSI_CHANGE event will
+        * recreate them.
+        */
        afs_event(AFSI_CHANGE, NULL, &aced);
        ret = save_afd(afd);
 -err:
 +out:
        free(afd->afhi.chunk_table);
        osl_close_disk_object(&chunk_table_obj);
-       if (ret < 0)
-               PARA_ERROR_LOG("%s: %s\n", path, para_strerror(-ret));
+       if (ret < 0) {
+               PARA_ERROR_LOG("%s: %s\n", d->path, para_strerror(-ret));
+               ret = score_delete(current_aft_row);
+               if (ret >= 0)
+                       goto again;
+       }
        return ret;
  }
  
diff --cc command.c
Simple merge
diff --cc server.h
Simple merge