annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
05978f04869b Add files via upload
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
1 // requires libcurl
05978f04869b Add files via upload
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
2 #include <curl/curl.h>
05978f04869b Add files via upload
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
3 #include <iostream>
05978f04869b Add files via upload
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
4 #include <string.h>
05978f04869b Add files via upload
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
5 #include <fstream>
05978f04869b Add files via upload
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
6
6
aac9a23bd027 pretty print the c++ files
Paper <Paper@BIGMAC>
parents: 1
diff changeset
7 int main(int argc, char * argv[]) {
aac9a23bd027 pretty print the c++ files
Paper <Paper@BIGMAC>
parents: 1
diff changeset
8 if (argc != 3) {
aac9a23bd027 pretty print the c++ files
Paper <Paper@BIGMAC>
parents: 1
diff changeset
9 std::cout << "usage: " << argv[0] << " <input> <output>";
aac9a23bd027 pretty print the c++ files
Paper <Paper@BIGMAC>
parents: 1
diff changeset
10 return 0;
aac9a23bd027 pretty print the c++ files
Paper <Paper@BIGMAC>
parents: 1
diff changeset
11 }
aac9a23bd027 pretty print the c++ files
Paper <Paper@BIGMAC>
parents: 1
diff changeset
12 std::string encoded;
aac9a23bd027 pretty print the c++ files
Paper <Paper@BIGMAC>
parents: 1
diff changeset
13 CURL * curl = curl_easy_init();
aac9a23bd027 pretty print the c++ files
Paper <Paper@BIGMAC>
parents: 1
diff changeset
14 char somedata[256];
aac9a23bd027 pretty print the c++ files
Paper <Paper@BIGMAC>
parents: 1
diff changeset
15 std::ifstream in (argv[1], std::ios:: in | std::ios::binary);
aac9a23bd027 pretty print the c++ files
Paper <Paper@BIGMAC>
parents: 1
diff changeset
16 if (in) {
aac9a23bd027 pretty print the c++ files
Paper <Paper@BIGMAC>
parents: 1
diff changeset
17 in .seekg(0, std::ios::end);
aac9a23bd027 pretty print the c++ files
Paper <Paper@BIGMAC>
parents: 1
diff changeset
18 encoded.resize( in .tellg()); in .seekg(0, std::ios::beg); in .read( & encoded[0], encoded.size()); in .close();
aac9a23bd027 pretty print the c++ files
Paper <Paper@BIGMAC>
parents: 1
diff changeset
19 }
aac9a23bd027 pretty print the c++ files
Paper <Paper@BIGMAC>
parents: 1
diff changeset
20 int outlength;
aac9a23bd027 pretty print the c++ files
Paper <Paper@BIGMAC>
parents: 1
diff changeset
21 char * cres = curl_easy_unescape(curl, encoded.c_str(), encoded.length(), & outlength);
1
05978f04869b Add files via upload
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
22 std::string res(cres, cres + outlength);
05978f04869b Add files via upload
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
23 curl_free(cres);
05978f04869b Add files via upload
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents:
diff changeset
24 curl_easy_cleanup(curl);
6
aac9a23bd027 pretty print the c++ files
Paper <Paper@BIGMAC>
parents: 1
diff changeset
25 std::ofstream myfile2;
aac9a23bd027 pretty print the c++ files
Paper <Paper@BIGMAC>
parents: 1
diff changeset
26 myfile2.open(argv[2]);
aac9a23bd027 pretty print the c++ files
Paper <Paper@BIGMAC>
parents: 1
diff changeset
27 myfile2 << res;
aac9a23bd027 pretty print the c++ files
Paper <Paper@BIGMAC>
parents: 1
diff changeset
28 myfile2.close();
aac9a23bd027 pretty print the c++ files
Paper <Paper@BIGMAC>
parents: 1
diff changeset
29 return 0;
8
b3d9104ad918 Rename decode.cpp to decodeurl.cpp
Paper <37962225+mrpapersonic@users.noreply.github.com>
parents: 6
diff changeset
30 }