1
0
Fork 0
forked from len0rd/rockbox

plugins: extract redundant functionality from stats/properties

Also:

- Enables cpu boosting for Stats
(*much* faster on some players)

- Displays file size in Stats

Change-Id: I888ba054e1f8c2985fbf8dca36e11e6ef130e7ca
This commit is contained in:
Christian Soffke 2024-07-25 20:49:20 +02:00
parent 6d19214eeb
commit 545271c4de
5 changed files with 252 additions and 337 deletions

View file

@ -21,7 +21,39 @@
#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 */