A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita
audio
rust
zig
deno
mpris
rockbox
mpd
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2023 Christian Soffke
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#ifndef MUL_ID3_H
22#define MUL_ID3_H
23
24struct dir_stats {
25 char dirname[MAX_PATH];
26 unsigned int dir_count;
27 unsigned int file_count;
28 unsigned int audio_file_count;
29 unsigned int m3u_file_count;
30 unsigned int img_file_count;
31 unsigned int vid_file_count;
32 unsigned int max_files_in_dir;
33 unsigned long long byte_count;
34 bool count_all;
35 bool canceled;
36};
37
38/* create mp3entry that contains matching metadata from multiple tracks */
39void collect_id3(struct mp3entry *id3, bool is_first_track);
40void finalize_id3(struct mp3entry *id3);
41
42/* Traverse directory, collecting stats/track metadata.
43 *
44 * 1) If id3_cb is null, dir_properties calculates all dir stats, including the
45 * audio file count.
46 *
47 * 2) If id3_cb points to a function, dir_properties will call it for every audio
48 * file encountered, to allow the file's metadata to be collected. The displayed
49 * progress bar's maximum value is set to the audio file count.
50 * Stats are assumed to have already been generated by a preceding run.
51 *
52 * If the count_all parameter is set to false, images and videos are not counted,
53 * nor is the playlist, image, video or max file in dir count displayed.
54 */
55bool collect_dir_stats(struct dir_stats *stats, bool (*id3_cb)(const char*));
56void display_dir_stats(struct dir_stats *stats);
57unsigned long human_size(unsigned long long byte_count, int32_t *unit_lang_id);
58
59#endif /* MUL_ID3_H */