+
+int moods_event_handler(enum afs_events event, __a_unused struct para_buffer *pb,
+ void *data)
+{
+ switch(event) {
+ /*
+ * The three blob events might change the set of admissible files,
+ * so we must reload the score list.
+ */
+ case BLOB_RENAME:
+ case BLOB_REMOVE:
+ case BLOB_ADD:
+ if (data == moods_table || data == playlists_table)
+ return 1; /* no reload necessary for these */
+ return reload_current_mood();
+ /* these also require reload of the score table */
+ case ATTRIBUTE_ADD:
+ case ATTRIBUTE_REMOVE:
+ case ATTRIBUTE_RENAME:
+ return reload_current_mood();
+ /* changes to the aft only require to re-examine the audio file */
+ case AFSI_CHANGE: {
+ struct afsi_change_event_data *aced = data;
+ return mood_update_audio_file(aced->aft_row, aced->old_afsi);
+ }
+ case AFHI_CHANGE:
+ case AUDIO_FILE_RENAME:
+ case AUDIO_FILE_ADD:
+ return mood_update_audio_file(data, NULL);
+ case AUDIO_FILE_REMOVE:
+ return mood_delete_audio_file(data);
+ default:
+ return 1;
+ }
+}
+