view decodeurl.cpp @ 133:0d8eabdd12ab default tip

create: write H:MM:SS timestamps, add option to fill with gaussian-blur instead of black many albums are longer than one hour so writing H:MM:SS is a necessity. if anything there will just be verbose info that isn't important for my use-case. however the gaussian-blur is simply broken. It works, and it plays locally just fine, but YouTube in particular elongates the video to fit the full width. I'm not entirely sure why it does this, but it makes it useless and ugly.
author Paper <paper@tflc.us>
date Sat, 03 Jan 2026 20:25:38 -0500
parents b3d9104ad918
children
line wrap: on
line source

// requires libcurl
#include <curl/curl.h>
#include <iostream>
#include <string.h>
#include <fstream>

int main(int argc, char * argv[]) {
    if (argc != 3) {
        std::cout << "usage: " << argv[0] << " <input> <output>";
        return 0;
    }
    std::string encoded;
    CURL * curl = curl_easy_init();
    char somedata[256];
    std::ifstream in (argv[1], std::ios:: in | std::ios::binary);
    if (in) {
        in .seekg(0, std::ios::end);
        encoded.resize( in .tellg()); in .seekg(0, std::ios::beg); in .read( & encoded[0], encoded.size()); in .close();
    }
    int outlength;
    char * cres = curl_easy_unescape(curl, encoded.c_str(), encoded.length(), & outlength);
    std::string res(cres, cres + outlength);
    curl_free(cres);
    curl_easy_cleanup(curl);
    std::ofstream myfile2;
    myfile2.open(argv[2]);
    myfile2 << res;
    myfile2.close();
    return 0;
}