X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=aft.c;h=b9db5a819fd13ebf7f780a0afdfe20d63cbc14f5;hp=46d6729280cf8b90ce47c5d9194c2cace22c2f81;hb=cd38753609763dbc55e72a7df446837792628d6d;hpb=c2ac39f76d245816a919d94790672fb66e9a7253 diff --git a/aft.c b/aft.c index 46d67292..b9db5a81 100644 --- a/aft.c +++ b/aft.c @@ -138,8 +138,10 @@ enum afsi_offsets { AFSI_LYRICS_ID_OFFSET = 24, /** Storage position of the .audio_format_id field. */ AFSI_AUDIO_FORMAT_ID_OFFSET = 28, + /** 3 bytes reserved space for future usage. */ + AFSI_AUDIO_FORMAT_UNUSED_OFFSET = 29, /** On-disk storage space needed. */ - AFSI_SIZE = 29 + AFSI_SIZE = 32 }; /** @@ -161,6 +163,7 @@ void save_afsi(struct afs_info *afsi, struct osl_object *obj) write_u32(buf + AFSI_LYRICS_ID_OFFSET, afsi->lyrics_id); write_u8(buf + AFSI_AUDIO_FORMAT_ID_OFFSET, afsi->audio_format_id); + memset(buf + AFSI_AUDIO_FORMAT_UNUSED_OFFSET, 0, 3); } /** @@ -616,6 +619,7 @@ int open_and_update_audio_file(struct osl_row *aft_row, struct audio_file_data * struct osl_object afsi_obj; struct afs_info new_afsi; int ret = get_hash_of_row(aft_row, &aft_hash); + struct afsi_change_event_data aced; if (ret < 0) return ret; @@ -645,13 +649,11 @@ int open_and_update_audio_file(struct osl_row *aft_row, struct audio_file_data * new_afsi.num_played++; new_afsi.last_played = time(NULL); save_afsi(&new_afsi, &afsi_obj); /* in-place update */ - if (afd->current_play_mode == PLAY_MODE_PLAYLIST) - ret = playlist_update_audio_file(aft_row); - else { - struct afsi_change_event_data aced = {.aft_row = aft_row, - .old_afsi = &afd->afsi}; - afs_event(AFSI_CHANGE, NULL, &aced); - } + + aced.aft_row = aft_row; + aced.old_afsi = &afd->afsi; + afs_event(AFSI_CHANGE, NULL, &aced); + return ret; err: free(afd->afhi.chunk_table); @@ -1500,8 +1502,8 @@ out: return 0; result->data = msg.buf; result->size = msg.size; + afs_event(AUDIO_FILE_ADD, &msg, aft_row); return 1; - // mood_update_audio_file(aft_row, NULL); } struct private_add_data { @@ -1965,7 +1967,7 @@ int com_afs_rm(int fd, int argc, char * const * const argv) if (ret > 0) { send_buffer(fd, (char *)result.data); free(result.data); - } else + } else if (ret < 0) send_va_buffer(fd, "%s\n", PARA_STRERROR(-ret)); return ret; }