summaryrefslogtreecommitdiffstats
path: root/apps/plugins/lib/mul_id3.h
blob: 1bb311c441dc733df005866b527cc27ceaff3a60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/***************************************************************************
 *             __________               __   ___.
 *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
 *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
 *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
 *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
 *                     \/            \/     \/    \/            \/
 * $Id$
 *
 * 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 */