AFSI_CHANGE,
/** The afh info struct of an audio file changed. */
AFHI_CHANGE,
+ /** The vss streams a new file, implies afsi and afhi change */
+ VSS_NEW_AUDIO_FILE,
/** An audio file was renamed. */
AUDIO_FILE_RENAME,
/** An audio file was added. */
ret = -E_HASH_MISMATCH;
goto out;
}
+
old_afsi = d->afsi;
d->afsi.num_played++;
d->afsi.last_played = time(NULL);
d->afsi.last_played = old_afsi.last_played;
aced.aft_row = current_aft_row;
aced.old_afsi = &old_afsi;
-
afd.audio_format_id = d->afsi.audio_format_id;
load_chunk_table(&afd.afhi, &chunk_table_obj);
- /*
- * No need to update the status items as the AFSI_CHANGE event will
- * recreate them.
- */
- ret = afs_event(AFSI_CHANGE, NULL, &aced);
+ make_status_items();
+
+ ret = afs_event(VSS_NEW_AUDIO_FILE, NULL, &aced);
if (ret < 0)
goto out;
ret = save_afd(&afd);
all other fields are left unchanged. This mimics what happens when
the virtual streaming system selects the file for streaming.
- If the file is admissible for the current mood (or contained in the
- current playlist), its score is recomputed according to the changed
- values.
+ If the file is admissible for the current mood, its score is recomputed.
[/description]
[option numplayed]
short_opt = n
case ATTRIBUTE_RENAME:
return reload_current_mood();
/* changes to the aft only require to re-examine the audio file */
+ case VSS_NEW_AUDIO_FILE:
case AFSI_CHANGE: {
struct afsi_change_event_data *aced = data;
return mood_update_audio_file(aced->aft_row, aced->old_afsi);
};
static struct playlist_instance current_playlist;
-/**
- * Re-insert an audio file into the tree of admissible files.
- *
- * \param aft_row Determines the audio file.
- *
- * \return The return value of score_update().
- */
-static int playlist_update_audio_file(const struct osl_row *aft_row)
-{
- /* always re-insert to the top of the tree */
- return score_update(aft_row, 0);
-}
-
static int add_playlist_entry(char *path, void *data)
{
struct playlist_instance *pi = data;
int playlists_event_handler(enum afs_events event,
__a_unused struct para_buffer *pb, void *data)
{
- struct afsi_change_event_data *aced = data;
-
if (!current_playlist.name)
return 1;
switch (event) {
- case AFSI_CHANGE:
- return playlist_update_audio_file(aced->aft_row);
+ case VSS_NEW_AUDIO_FILE: { /* move the row to the end of the playlist */
+ struct afsi_change_event_data *aced = data;
+ return score_update(aced->aft_row, 0);
+ }
case AUDIO_FILE_RENAME:
case AUDIO_FILE_ADD:
return handle_audio_file_event(event, data);