53435579b3
* fbt, faploader: minimal app module implementation * faploader, libs: moved API hashtable core to flipper_application * example: compound api * lib: flipper_application: naming fixes, doxygen comments * fbt: changed `requires` manifest field behavior for app extensions * examples: refactored plugin apps; faploader: changed new API naming; fbt: changed PLUGIN app type meaning * loader: dropped support for debug apps & plugin menus * moved applications/plugins -> applications/external * Restored x bit on chiplist_convert.py * git: fixed free-dap submodule path * pvs: updated submodule paths * examples: example_advanced_plugins.c: removed potential memory leak on errors * examples: example_plugins: refined requires * fbt: not deploying app modules for debug/sample apps; extra validation for .PLUGIN-type apps * apps: removed cdefines for external apps * fbt: moved ext app path definition * fbt: reworked fap_dist handling; f18: synced api_symbols.csv * fbt: removed resources_paths for extapps * scripts: reworked storage * scripts: reworked runfap.py & selfupdate.py to use new api * wip: fal runner * fbt: moved file packaging into separate module * scripts: storage: fixes * scripts: storage: minor fixes for new api * fbt: changed internal artifact storage details for external apps * scripts: storage: additional fixes and better error reporting; examples: using APP_DATA_PATH() * fbt, scripts: reworked launch_app to deploy plugins; moved old runfap.py to distfap.py * fbt: extra check for plugins descriptors * fbt: additional checks in emitter * fbt: better info message on SDK rebuild * scripts: removed requirements.txt * loader: removed remnants of plugins & debug menus * post-review fixes
49 lines
1.6 KiB
C
49 lines
1.6 KiB
C
#include <furi.h>
|
|
#include <cli/cli.h>
|
|
#include <storage/storage.h>
|
|
#include "music_player_worker.h"
|
|
|
|
static void music_player_cli(Cli* cli, FuriString* args, void* context) {
|
|
UNUSED(context);
|
|
MusicPlayerWorker* music_player_worker = music_player_worker_alloc();
|
|
Storage* storage = furi_record_open(RECORD_STORAGE);
|
|
|
|
do {
|
|
if(storage_common_stat(storage, furi_string_get_cstr(args), NULL) == FSE_OK) {
|
|
if(!music_player_worker_load(music_player_worker, furi_string_get_cstr(args))) {
|
|
printf("Failed to open file %s\r\n", furi_string_get_cstr(args));
|
|
break;
|
|
}
|
|
} else {
|
|
if(!music_player_worker_load_rtttl_from_string(
|
|
music_player_worker, furi_string_get_cstr(args))) {
|
|
printf("Argument is not a file or RTTTL\r\n");
|
|
break;
|
|
}
|
|
}
|
|
|
|
printf("Press CTRL+C to stop\r\n");
|
|
music_player_worker_set_volume(music_player_worker, 1.0f);
|
|
music_player_worker_start(music_player_worker);
|
|
while(!cli_cmd_interrupt_received(cli)) {
|
|
furi_delay_ms(50);
|
|
}
|
|
music_player_worker_stop(music_player_worker);
|
|
} while(0);
|
|
|
|
furi_record_close(RECORD_STORAGE);
|
|
music_player_worker_free(music_player_worker);
|
|
}
|
|
|
|
void music_player_on_system_start() {
|
|
#ifdef SRV_CLI
|
|
Cli* cli = furi_record_open(RECORD_CLI);
|
|
|
|
cli_add_command(cli, "music_player", CliCommandFlagDefault, music_player_cli, NULL);
|
|
|
|
furi_record_close(RECORD_CLI);
|
|
#else
|
|
UNUSED(music_player_cli);
|
|
#endif
|
|
}
|