Consider the following scenario:
add /foo.mp3
add /bar.mp3 # assume foo and bar differ
cp /foo.mp3 /bar.mp3
add /bar.mp3
In the last add command, the path being added (/bar.mp3) already exists
in the audio file table, and its hash also exists for a different path
(/foo.mp3).
The code in aft.c is smart enough to detect this. It first removes
the existing entry for /bar.mp3 and then considers the addition of
/bar.mp3 as a file rename /foo.mp3 -> /bar.mp3.
Unfortunately, we miss to generate the remove event in this case. This
patch should fix it. It also improves the message a bit.
struct osl_object obj;
if (pb) { /* hs trumps pb, remove pb */
if (flags & ADD_FLAG_VERBOSE) {
- ret = para_printf(&msg, "removing path brother\n");
+ ret = para_printf(&msg, "removing %s\n", path);
if (ret < 0)
goto out;
}
+ afs_event(AUDIO_FILE_REMOVE, &msg, pb);
ret = osl(osl_del_row(audio_file_table, pb));
if (ret < 0)
goto out;