/***************************************************************************
 *             __________               __   ___.
 *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
 *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
 *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
 *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
 *                     \/            \/     \/    \/            \/
 *
 * Copyright (C) 2023 Christian Soffke
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
 * KIND, either express or implied.
 *
 ****************************************************************************/
#ifndef MUL_ID3_H
#define MUL_ID3_H

struct dir_stats {
    char dirname[MAX_PATH];
    unsigned int dir_count;
    unsigned int file_count;
    unsigned int audio_file_count;
    unsigned int m3u_file_count;
    unsigned int img_file_count;
    unsigned int vid_file_count;
    unsigned int max_files_in_dir;
    unsigned long long byte_count;
    bool count_all;
    bool canceled;
};

/* create mp3entry that contains matching metadata from multiple tracks */
void collect_id3(struct mp3entry *id3, bool is_first_track);
void finalize_id3(struct mp3entry *id3);

/* Traverse directory, collecting stats/track metadata.
 *
 * 1) If id3_cb is null, dir_properties calculates all dir stats, including the
 * audio file count.
 *
 * 2) If id3_cb points to a function, dir_properties will call it for every audio
 * file encountered, to allow the file's metadata to be collected. The displayed
 * progress bar's maximum value is set to the audio file count.
 * Stats are assumed to have already been generated by a preceding run.
 *
 * If the count_all parameter is set to false, images and videos are not counted,
 * nor is the playlist, image, video or max file in dir count displayed.
 */
bool collect_dir_stats(struct dir_stats *stats, bool (*id3_cb)(const char*));
void display_dir_stats(struct dir_stats *stats);
unsigned long human_size(unsigned long long byte_count, int32_t *unit_lang_id);

#endif /* MUL_ID3_H */
