From 4daa57f6d139f51a62ea4bcffa738bd5035df33a Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 5 Nov 2022 15:53:28 +0100 Subject: Support as many emoji as possible, using separate emoji images in text --- src/QuickMedia.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src/QuickMedia.cpp') diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index e31b846..bbff6c6 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -387,7 +387,7 @@ namespace QuickMedia { bool no_dialog = false; for(int i = 1; i < argc; ++i) { - if(!plugin_name) { + if(!plugin_name && argv[i][0] != '-') { std::string youtube_url_converted = invidious_url_to_youtube_url(argv[i]); std::string youtube_channel_id; std::string youtube_video_id_dummy; @@ -407,6 +407,12 @@ namespace QuickMedia { break; } } + + if(!plugin_name) { + fprintf(stderr, "\"%s\" is not a valid plugin/youtube url\n", argv[i]); + usage(); + return -1; + } } if(strcmp(argv[i], "--no-video") == 0) { @@ -6986,10 +6992,12 @@ namespace QuickMedia { if(clipboard_success && !clipboard_text.empty() && get_file_type(clipboard_text) == FileType::REGULAR) { const time_t now = time(nullptr); - const struct tm *t = localtime(&now); - char filename[256]; - strftime(filename, sizeof(filename)-1, "Clipboard_%Y-%m-%d_%H-%M-%S", t); - strcat(filename, file_ext.c_str()); + struct tm t; + localtime_r(&now, &t); + char filename[256] = {0}; + const int num_bytes_written = strftime(filename, sizeof(filename)-1, "Clipboard_%Y-%m-%d_%H-%M-%S", &t); + if((int)sizeof(filename) - (num_bytes_written + file_ext.size()) >= 1) + strcat(filename, file_ext.c_str()); upload_file(clipboard_text, filename); } -- cgit v1.2.3