unleashed-firmware/applications/external/playlist/playlist_file.c

22 lines
601 B
C
Raw Normal View History

2022-08-09 01:12:06 +03:00
#include <furi.h>
#include <storage/storage.h>
#include <flipper_format/flipper_format_i.h>
int playlist_count_playlist_items(Storage* storage, const char* file_path) {
FlipperFormat* format = flipper_format_file_alloc(storage);
if(!flipper_format_file_open_existing(format, file_path)) {
return -1;
}
int count = 0;
2022-10-05 21:27:13 +03:00
FuriString* data;
data = furi_string_alloc();
2022-08-09 01:12:06 +03:00
while(flipper_format_read_string(format, "sub", data)) {
++count;
}
flipper_format_file_close(format);
2022-09-11 02:09:02 +03:00
flipper_format_free(format);
2022-10-05 21:27:13 +03:00
furi_string_free(data);
2022-08-09 01:12:06 +03:00
return count;
2022-08-09 02:14:28 +03:00
}