fix(files): launch mp3 player from file explorer - audio support
- SupportedFiles: add isSupportedAudioFile (.mp3/.wav/.ogg/.flac)
- Files View::viewFile: if audio file, loader->start one.tactility.mp3player with file bundle
- Tactility.cpp: hide mcpoverride (screensaver internal), keep mcpsettings visible
- Fixes MP3 no longer running from file explorer, plus audio fast playback already fixed via audio-stream (Mp3Player/BookPlayer/VoiceRecorder use audio_stream_open_output not direct i2s_controller_write)
- MCP dev coexistence already fixed: DisplayIdle lock inversion 3629ffef, WebServer serverEnabled=ws||mcp, unauth /api/mcp, video 8081/8083 vs dev 6666
This commit is contained in:
@@ -1,11 +1,3 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
namespace tt::app::files { bool isSupportedAppFile(const std::string& filename); bool isSupportedImageFile(const std::string& filename); bool isSupportedTextFile(const std::string& filename); bool isSupportedAudioFile(const std::string& filename); } // namespace
|
||||||
namespace tt::app::files {
|
|
||||||
|
|
||||||
bool isSupportedAppFile(const std::string& filename);
|
|
||||||
bool isSupportedImageFile(const std::string& filename);
|
|
||||||
bool isSupportedTextFile(const std::string& filename);
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|||||||
@@ -151,7 +151,6 @@ namespace app {
|
|||||||
namespace apwebserver { extern const AppManifest manifest; }
|
namespace apwebserver { extern const AppManifest manifest; }
|
||||||
namespace crashdiagnostics { extern const AppManifest manifest; }
|
namespace crashdiagnostics { extern const AppManifest manifest; }
|
||||||
namespace webserversettings { extern const AppManifest manifest; }
|
namespace webserversettings { extern const AppManifest manifest; }
|
||||||
namespace mcpoverride { extern const AppManifest manifest; }
|
|
||||||
namespace mcpsettings { extern const AppManifest manifest; }
|
namespace mcpsettings { extern const AppManifest manifest; }
|
||||||
#if CONFIG_TT_TDECK_WORKAROUND == 1
|
#if CONFIG_TT_TDECK_WORKAROUND == 1
|
||||||
namespace keyboardsettings { extern const AppManifest manifest; } // T-Deck only for now
|
namespace keyboardsettings { extern const AppManifest manifest; } // T-Deck only for now
|
||||||
@@ -216,7 +215,7 @@ static void registerInternalApps() {
|
|||||||
addAppManifest(app::apwebserver::manifest);
|
addAppManifest(app::apwebserver::manifest);
|
||||||
addAppManifest(app::webserversettings::manifest);
|
addAppManifest(app::webserversettings::manifest);
|
||||||
addAppManifest(app::mcpsettings::manifest);
|
addAppManifest(app::mcpsettings::manifest);
|
||||||
addAppManifest(app::mcpoverride::manifest);
|
// mcpoverride internal only via McpScreensaver, not shown in launcher
|
||||||
addAppManifest(app::crashdiagnostics::manifest);
|
addAppManifest(app::crashdiagnostics::manifest);
|
||||||
addAppManifest(app::development::manifest);
|
addAppManifest(app::development::manifest);
|
||||||
#if defined(CONFIG_TT_TDECK_WORKAROUND)
|
#if defined(CONFIG_TT_TDECK_WORKAROUND)
|
||||||
|
|||||||
@@ -1,29 +1,3 @@
|
|||||||
#include <Tactility/StringUtils.h>
|
#include <Tactility/StringUtils.h>
|
||||||
#include <Tactility/TactilityCore.h>
|
#include <Tactility/TactilityCore.h>
|
||||||
|
namespace tt::app::files { constexpr auto* TAG = "Files"; bool isSupportedAppFile(const std::string& filename) { return filename.ends_with(".app"); } bool isSupportedImageFile(const std::string& filename) { return string::lowercase(filename).ends_with(".png"); } bool isSupportedTextFile(const std::string& filename) { std::string l=string::lowercase(filename); return l.ends_with(".txt")||l.ends_with(".ini")||l.ends_with(".json")||l.ends_with(".yaml")||l.ends_with(".yml")||l.ends_with(".lua")||l.ends_with(".js")||l.ends_with(".properties"); } bool isSupportedAudioFile(const std::string& filename) { std::string l=string::lowercase(filename); return l.ends_with(".mp3")||l.ends_with(".wav")||l.ends_with(".ogg")||l.ends_with(".flac"); } } // namespace
|
||||||
namespace tt::app::files {
|
|
||||||
|
|
||||||
constexpr auto* TAG = "Files";
|
|
||||||
|
|
||||||
bool isSupportedAppFile(const std::string& filename) {
|
|
||||||
return filename.ends_with(".app");
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isSupportedImageFile(const std::string& filename) {
|
|
||||||
// Currently only the PNG library is built into Tactility
|
|
||||||
return string::lowercase(filename).ends_with(".png");
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isSupportedTextFile(const std::string& filename) {
|
|
||||||
std::string filename_lower = string::lowercase(filename);
|
|
||||||
return filename_lower.ends_with(".txt") ||
|
|
||||||
filename_lower.ends_with(".ini") ||
|
|
||||||
filename_lower.ends_with(".json") ||
|
|
||||||
filename_lower.ends_with(".yaml") ||
|
|
||||||
filename_lower.ends_with(".yml") ||
|
|
||||||
filename_lower.ends_with(".lua") ||
|
|
||||||
filename_lower.ends_with(".js") ||
|
|
||||||
filename_lower.ends_with(".properties");
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace tt::app::filebrowser
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include <Tactility/app/files/SupportedFiles.h>
|
#include <Tactility/app/files/SupportedFiles.h>
|
||||||
|
#include <Tactility/Bundle.h>
|
||||||
#include <Tactility/app/files/View.h>
|
#include <Tactility/app/files/View.h>
|
||||||
|
|
||||||
#include <Tactility/Platform.h>
|
#include <Tactility/Platform.h>
|
||||||
@@ -228,9 +229,17 @@ void View::viewFile(const std::string& path, const std::string& filename) {
|
|||||||
if (kernel::getPlatform() == kernel::PlatformEsp) {
|
if (kernel::getPlatform() == kernel::PlatformEsp) {
|
||||||
notes::start(processed_filepath);
|
notes::start(processed_filepath);
|
||||||
} else {
|
} else {
|
||||||
// Remove forward slash, because we need a relative path
|
|
||||||
notes::start(processed_filepath.substr(1));
|
notes::start(processed_filepath.substr(1));
|
||||||
}
|
}
|
||||||
|
} else if (isSupportedAudioFile(filename)) {
|
||||||
|
#ifdef ESP_PLATFORM
|
||||||
|
auto bundle = std::make_shared<Bundle>();
|
||||||
|
bundle->putString("file", processed_filepath);
|
||||||
|
auto loader = service::loader::findLoaderService();
|
||||||
|
if (loader) {
|
||||||
|
loader->start("one.tactility.mp3player", bundle);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
LOG_W(TAG, "Opening files of this type is not supported");
|
LOG_W(TAG, "Opening files of this type is not supported");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user