X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=mood.c;h=9074581c6c8d40741a99c3c1772716381e03f2a4;hb=28afc7781a88734d8954cab3665eb3eacd11c284;hp=a8d87cde122c9bc03d6cab301695fe97bf2896e8;hpb=c2ac39f76d245816a919d94790672fb66e9a7253;p=paraslash.git diff --git a/mood.c b/mood.c index a8d87cde..9074581c 100644 --- a/mood.c +++ b/mood.c @@ -1047,10 +1047,14 @@ int reload_current_mood(void) int ret; char *mood_name; + PARA_NOTICE_LOG("reloading current mood\n"); if (!current_mood) return 1; mood_name = para_strdup(current_mood->name); close_current_mood(); + ret = clear_score_table(); + if (ret < 0) + return ret; ret = change_current_mood(mood_name); free(mood_name); return ret; @@ -1060,10 +1064,22 @@ int moods_event_handler(enum afs_events event, 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);