diff options
author | dec05eba <dec05eba@protonmail.com> | 2022-02-16 21:54:47 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2022-02-17 19:18:34 +0100 |
commit | d4cd63129ae5dff8fd69525424e0f8cb9ae1a905 (patch) | |
tree | 957c957f0ca1796105318b7595545dcfc7e04af7 /src/plugins | |
parent | 5061e1ad912bccf89df25258e7dd8b386b0a7239 (diff) |
Wip: fix video duration not working for some analyzed files, get frame in middle of video instead of first frame for thumbnail
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/LocalAnime.cpp | 42 | ||||
-rw-r--r-- | src/plugins/Matrix.cpp | 4 |
2 files changed, 44 insertions, 2 deletions
diff --git a/src/plugins/LocalAnime.cpp b/src/plugins/LocalAnime.cpp new file mode 100644 index 0000000..4bc296a --- /dev/null +++ b/src/plugins/LocalAnime.cpp @@ -0,0 +1,42 @@ +#include "../../plugins/LocalAnime.hpp" +#include "../../include/Config.hpp" +#include "../../include/Storage.hpp" +#include "../../include/Notification.hpp" + +namespace QuickMedia { + static bool validate_local_anime_dir_config_is_set() { + if(get_config().local_anime.directory.empty()) { + show_notification("QuickMedia", "local_anime.directory config is not set", Urgency::CRITICAL); + return false; + } + + if(get_file_type(get_config().local_anime.directory) != FileType::DIRECTORY) { + show_notification("QuickMedia", "local_anime.directory config is not set to a valid directory", Urgency::CRITICAL); + return false; + } + + return true; + } + + PluginResult LocalAnimeSearchPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) { + if(!validate_local_anime_dir_config_is_set()) + return PluginResult::OK; + + return PluginResult::ERR; + } + + PluginResult LocalAnimeSearchPage::lazy_fetch(BodyItems &result_items) { + if(!validate_local_anime_dir_config_is_set()) + return PluginResult::OK; + + return PluginResult::ERR; + } + + std::shared_ptr<BodyItem> LocalAnimeSearchPage::get_bookmark_body_item(BodyItem *selected_item) { + return nullptr; + } + + void LocalAnimeSearchPage::toggle_read(BodyItem *selected_item) { + // TODO: + } +}
\ No newline at end of file diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp index 6b61aed..367c777 100644 --- a/src/plugins/Matrix.cpp +++ b/src/plugins/Matrix.cpp @@ -3690,7 +3690,7 @@ namespace QuickMedia { PluginResult Matrix::upload_file(RoomData *room, const std::string &filepath, UploadInfo &file_info, UploadInfo &thumbnail_info, std::string &err_msg, bool upload_thumbnail) { FileAnalyzer file_analyzer; - if(!file_analyzer.load_file(filepath.c_str())) { + if(!file_analyzer.load_file(filepath.c_str(), true)) { err_msg = "Failed to load " + filepath; return PluginResult::ERR; } @@ -3722,7 +3722,7 @@ namespace QuickMedia { char tmp_filename[] = "/tmp/quickmedia_video_frame_XXXXXX"; int tmp_file = mkstemp(tmp_filename); if(tmp_file != -1) { - if(video_get_first_frame(filepath.c_str(), tmp_filename, thumbnail_max_size.x, thumbnail_max_size.y)) { + if(video_get_first_frame(file_analyzer, tmp_filename, thumbnail_max_size.x, thumbnail_max_size.y)) { UploadInfo upload_info_ignored; // Ignore because it wont be set anyways. Thumbnails dont have thumbnails. PluginResult upload_thumbnail_result = upload_file(room, tmp_filename, thumbnail_info, upload_info_ignored, err_msg, false); if(upload_thumbnail_result != PluginResult::OK) { |