Support remote and playlist files in archive

This commit is contained in:
Willy-JL
2023-07-03 02:40:26 +02:00
parent 964f3cf78e
commit 0ccdc60921
8 changed files with 39 additions and 4 deletions
@@ -27,6 +27,9 @@ static const char* known_ext[] = {
[ArchiveFileTypeSubGhz] = ".sub",
[ArchiveFileTypeLFRFID] = ".rfid",
[ArchiveFileTypeInfrared] = ".ir",
[ArchiveFileTypeSubghzPlaylist] = ".txt",
[ArchiveFileTypeSubghzRemote] = ".txt",
[ArchiveFileTypeInfraredRemote] = ".txt",
[ArchiveFileTypeBadKb] = ".txt",
[ArchiveFileTypeU2f] = "?",
[ArchiveFileTypeApplication] = ".fap",
@@ -1,6 +1,9 @@
#include "archive_files.h"
#include "archive_apps.h"
#include "archive_browser.h"
#include <applications/external/subghz_playlist/playlist_file.h>
#include <applications/external/subghz_remote/subghz_remote_app_i.h>
#include <applications/external/ir_remote/infrared_remote.h>
#define TAG "Archive"
@@ -16,11 +19,26 @@ void archive_set_file_type(ArchiveFile_t* file, const char* path, bool is_folder
for(size_t i = 0; i < COUNT_OF(known_ext); i++) {
if((known_ext[i][0] == '?') || (known_ext[i][0] == '*')) continue;
if(furi_string_search(file->path, known_ext[i], 0) != FURI_STRING_FAILURE) {
if(i == ArchiveFileTypeBadKb) {
if(furi_string_search(file->path, archive_get_default_path(ArchiveTabBadKb)) ==
0) {
// Check for .txt containing folder
if(strcmp(known_ext[i], ".txt") == 0) {
const char* path = NULL;
switch(i) {
case ArchiveFileTypeSubghzPlaylist:
path = PLAYLIST_FOLDER;
break;
case ArchiveFileTypeSubghzRemote:
path = SUBREM_APP_FOLDER;
break;
case ArchiveFileTypeInfraredRemote:
path = IR_REMOTE_PATH;
break;
case ArchiveFileTypeBadKb:
path = archive_get_default_path(ArchiveTabBadKb);
break;
}
if(path != NULL && furi_string_search(file->path, path) == 0) {
file->type = i;
return; // *.txt file is a BadKB script only if it is in BadKB folder
return;
}
} else {
file->type = i;
@@ -15,6 +15,9 @@ typedef enum {
ArchiveFileTypeSubGhz,
ArchiveFileTypeLFRFID,
ArchiveFileTypeInfrared,
ArchiveFileTypeSubghzPlaylist,
ArchiveFileTypeSubghzRemote,
ArchiveFileTypeInfraredRemote,
ArchiveFileTypeBadKb,
ArchiveFileTypeU2f,
ArchiveFileTypeApplication,
@@ -23,6 +23,12 @@ const char* archive_get_flipper_app_name(ArchiveFileTypeEnum file_type) {
return "RFID";
case ArchiveFileTypeInfrared:
return "Infrared";
case ArchiveFileTypeSubghzPlaylist:
return EXT_PATH("apps/Sub-Ghz/subghz_playlist.fap");
case ArchiveFileTypeSubghzRemote:
return EXT_PATH("apps/Sub-Ghz/subghz_remote.fap");
case ArchiveFileTypeInfraredRemote:
return EXT_PATH("apps/Tools/ir_remote.fap");
case ArchiveFileTypeBadKb:
return "Bad KB";
case ArchiveFileTypeU2f:
@@ -29,6 +29,9 @@ static const Icon* ArchiveItemIcons[] = {
[ArchiveFileTypeSubGhz] = &I_sub1_10px,
[ArchiveFileTypeLFRFID] = &I_125_10px,
[ArchiveFileTypeInfrared] = &I_ir_10px,
[ArchiveFileTypeSubghzPlaylist] = &I_subplaylist_10px,
[ArchiveFileTypeSubghzRemote] = &I_subrem_10px,
[ArchiveFileTypeInfraredRemote] = &I_ir_scope_10px,
[ArchiveFileTypeBadKb] = &I_badkb_10px,
[ArchiveFileTypeU2f] = &I_u2f_10px,
[ArchiveFileTypeApplication] = &I_Apps_10px,
Binary file not shown.

After

Width:  |  Height:  |  Size: 169 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

+2
View File
@@ -3456,6 +3456,7 @@ Variable,+,I_iButtonDolphinVerySuccess_108x52,Icon,
Variable,+,I_iButtonKey_49x44,Icon,
Variable,+,I_ibutt_10px,Icon,
Variable,+,I_ir_10px,Icon,
Variable,+,I_ir_scope_10px,Icon,
Variable,+,I_keyboard_10px,Icon,
Variable,+,I_loading_10px,Icon,
Variable,+,I_music_10px,Icon,
@@ -3464,6 +3465,7 @@ Variable,+,I_passport_bad_46x49,Icon,
Variable,+,I_passport_happy_46x49,Icon,
Variable,+,I_passport_okay_46x49,Icon,
Variable,+,I_sub1_10px,Icon,
Variable,+,I_subplaylist_10px,Icon,
Variable,+,I_subrem_10px,Icon,
Variable,+,I_u2f_10px,Icon,
Variable,+,I_unknown_10px,Icon,
1 entry status name type params
3456 Variable + I_iButtonKey_49x44 Icon
3457 Variable + I_ibutt_10px Icon
3458 Variable + I_ir_10px Icon
3459 Variable + I_ir_scope_10px Icon
3460 Variable + I_keyboard_10px Icon
3461 Variable + I_loading_10px Icon
3462 Variable + I_music_10px Icon
3465 Variable + I_passport_happy_46x49 Icon
3466 Variable + I_passport_okay_46x49 Icon
3467 Variable + I_sub1_10px Icon
3468 Variable + I_subplaylist_10px Icon
3469 Variable + I_subrem_10px Icon
3470 Variable + I_u2f_10px Icon
3471 Variable + I_unknown_10px Icon