aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Body.cpp3
-rw-r--r--src/RoundedRectangle.cpp2
-rw-r--r--src/plugins/youtube/Signature.cpp6
3 files changed, 8 insertions, 3 deletions
diff --git a/src/Body.cpp b/src/Body.cpp
index df52386..3c210a8 100644
--- a/src/Body.cpp
+++ b/src/Body.cpp
@@ -708,7 +708,7 @@ namespace QuickMedia {
const float speed = 30.0f;
- const sf::Vector2f item_background_size_diff = item_background_target_size - item_background_prev_size;
+ const sf::Vector2f item_background_size_diff = sf::Vector2f(item_background_target_size.x, item_background_target_height) - item_background_prev_size;
const float item_background_size_speed = instant_move ? 1000.0f : speed;
const sf::Vector2f item_background_new_size = item_background_prev_size + (item_background_size_diff * std::min(1.0f, frame_time * item_background_size_speed));
item_background_prev_size = item_background_new_size;
@@ -941,6 +941,7 @@ namespace QuickMedia {
if(item_index == selected_item) {
item_background_target_pos = pos;
item_background_target_size = sf::Vector2f(item_width, item_height);
+ item_background_target_height = item_height;
if(target_set == TargetSetState::NOT_SET)
target_set = TargetSetState::SET;
}
diff --git a/src/RoundedRectangle.cpp b/src/RoundedRectangle.cpp
index afd733f..4aad699 100644
--- a/src/RoundedRectangle.cpp
+++ b/src/RoundedRectangle.cpp
@@ -17,6 +17,8 @@ namespace QuickMedia {
vertices[1].texCoords = sf::Vector2f(1.0f, 0.0f);
vertices[2].texCoords = sf::Vector2f(1.0f, 1.0f);
vertices[3].texCoords = sf::Vector2f(0.0f, 1.0f);
+
+ set_size(size);
}
void RoundedRectangle::set_position(sf::Vector2f pos) {
diff --git a/src/plugins/youtube/Signature.cpp b/src/plugins/youtube/Signature.cpp
index 30093d5..2460f8a 100644
--- a/src/plugins/youtube/Signature.cpp
+++ b/src/plugins/youtube/Signature.cpp
@@ -5,6 +5,7 @@
#include "../../../include/StringUtils.hpp"
#include "../../../include/Program.hpp"
#include <regex>
+#include <mutex>
#include <unistd.h>
namespace QuickMedia {
@@ -14,7 +15,8 @@ namespace QuickMedia {
};
static YoutubeSignatureDecryptor *instance = nullptr;
- static const int timeout_default_sec = 60;
+ static std::mutex update_signature_mutex;
+ static const int timeout_default_sec = 60 * 5; // 5 minutes
bool YoutubeSignatureDecryptor::js_code_to_operations(const std::string &function_body_str, const std::string &var_body_str, std::vector<DecryptFuncCall> &new_func_calls, std::map<std::string, DecryptFunction> &new_func_decls) {
std::vector<std::string> function_body;
@@ -170,6 +172,7 @@ namespace QuickMedia {
// static
YoutubeSignatureDecryptor& YoutubeSignatureDecryptor::get_instance() {
+ std::lock_guard<std::mutex> lock(update_signature_mutex);
if(!instance)
instance = new YoutubeSignatureDecryptor();
return *instance;
@@ -183,7 +186,6 @@ namespace QuickMedia {
int num_tries = 0;
const int max_tries = 30;
while(running && num_tries < max_tries && !program_is_dead_in_current_thread()) { // 6 seconds in total
- std::lock_guard<std::mutex> lock(update_signature_mutex);
if(up_to_date)
break;
++num_tries;