diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-02-07 08:29:09 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-02-07 08:29:09 +0100 |
commit | 8c7e64991b6c05d57aaa8dda2df2dc53d789d6c4 (patch) | |
tree | 20fe0960166fa8842b69a4d36f0ca6d7a80054dc | |
parent | 0d4b8bacce933e34a41769b1051b25f82f922201 (diff) |
Dont download video with --no-video option, ignore events with state_key set if the event is not a m.room.member type
-rw-r--r-- | input.conf | 2 | ||||
-rw-r--r-- | src/VideoPlayer.cpp | 6 | ||||
-rw-r--r-- | src/plugins/Matrix.cpp | 12 |
3 files changed, 14 insertions, 6 deletions
@@ -1,5 +1,5 @@ Ctrl+c ignore -Backspace ignore +BS ignore q ignore WHEEL_UP ignore WHEEL_DOWN ignore diff --git a/src/VideoPlayer.cpp b/src/VideoPlayer.cpp index 4653c5b..3b93c44 100644 --- a/src/VideoPlayer.cpp +++ b/src/VideoPlayer.cpp @@ -91,7 +91,11 @@ namespace QuickMedia { create_directory_recursive(mpv_watch_later_dir); std::string watch_later_dir = "--watch-later-directory=" + mpv_watch_later_dir.data; - std::string ytdl_format = "--ytdl-format=bestvideo[height<=?" + std::to_string(monitor_height) + "]+bestaudio/best"; + std::string ytdl_format; + if(no_video) + ytdl_format = "--ytdl-format=bestaudio/best"; + else + ytdl_format = "--ytdl-format=bestvideo[height<=?" + std::to_string(monitor_height) + "]+bestaudio/best"; // TODO: Resume playback if the last video played matches the first video played next time QuickMedia is launched args.insert(args.end(), { diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp index 3a2c02c..9a785b6 100644 --- a/src/plugins/Matrix.cpp +++ b/src/plugins/Matrix.cpp @@ -1732,9 +1732,17 @@ namespace QuickMedia { if(!sender_json->IsString()) return nullptr; + const rapidjson::Value &type_json = GetMember(event_item_json, "type"); + if(!type_json.IsString()) + return nullptr; + bool sent_by_somebody_else = false; const rapidjson::Value *state_key_json = &GetMember(event_item_json, "state_key"); if(state_key_json->IsString() && state_key_json->GetStringLength() != 0) { + if(strcmp(type_json.GetString(), "m.room.member") != 0) { + fprintf(stderr, "Matrix: received state key %s but event type is %s, expected m.room.member\n", type_json.GetString(), state_key_json->GetString()); + return nullptr; + } if(strcmp(sender_json->GetString(), state_key_json->GetString()) != 0) sent_by_somebody_else = true; sender_json = state_key_json; @@ -1768,10 +1776,6 @@ namespace QuickMedia { if(origin_server_ts.IsInt64()) timestamp = origin_server_ts.GetInt64(); - const rapidjson::Value &type_json = GetMember(event_item_json, "type"); - if(!type_json.IsString()) - return nullptr; - bool provisional = false; const rapidjson::Value &unsigned_json = GetMember(event_item_json, "unsigned"); if(unsigned_json.IsObject()) { |