Skip to content

Commit a8b2999

Browse files
author
Luqaska
committed
Update! Edits to the templates, 'generate_card.py', etc.
1 parent daa23bb commit a8b2999

10 files changed

+45
-52
lines changed

generate_card.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def generate_card(name, text):
2020

2121
# Apply font
2222
font = ImageFont.truetype("./src/fonts/archivo.ttf", 25)
23-
wrap = textwrap.wrap(text, 33, break_long_words=True)
23+
wrap = textwrap.wrap(text, 25, break_long_words=True)
2424
text = "\n".join(wrap)
2525

2626

@@ -38,10 +38,10 @@ def generate_card(name, text):
3838

3939

4040
# Put text on a random spot of the screen
41-
x = randint(10, img.width - padding - width)
42-
#if x < 0: x = 0
43-
y = randint(10, img.height - padding - height)
44-
#if y < 0: y = 0
41+
try: x = randint(10, img.width - padding - width)
42+
except: x = 0
43+
try: y = randint(10, img.height - padding - height)
44+
except: y = 0
4545
draw.text(
4646
(x, y),
4747
text,
@@ -76,4 +76,4 @@ def generate_card(name, text):
7676
# Convert into JPEG image and save
7777
jpg = Image.new("RGB", img.size, (255, 255, 255))
7878
jpg.paste(img, mask=img.split()[3])
79-
jpg.save(name, "JPEG")
79+
jpg.save(name, "JPEG", quality="80", optimize=True)

src/templates/_footer.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
<p>
44
<b>&copy;2023 Weird Radio Messages</b>
55
<br />
6-
<span class="sb">/</span> wrm.neocities.org <span class="sb">/</span>
6+
- wrm.neocities.org -
77
<br /><br />
88
I stole the background from <a href="https://anlucas.neocities.org/">AN Lucas</a> and my profile picture and icon from <a href="https://pixabay.com/vectors/transmitter-antenna-radio-36027/">Clker-Free-Vector-Images</a> (Pixabay).
99
</p>
1010
</div>
1111
</body>
12-
</html>
12+
</html>

src/templates/about_me.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
<h2>About me</h2>
33
<div style="text-align:center;"><img src="icon.jpg" style="background: black; width: auto; height: 100px;" /></div>
44
<div style="text-indent: 2em;">
5-
<p>As I don't know who made is sending this messages, I have decided to stay as anonymous as I can for know, but you can refer to me as "WRM-Admin". I was born and currently live happilly on [place]. I have a crush for computers, radio and all types of geeky stuff. I'm a huge fan of retro-aesthetics.</p>
5+
<p>As I don't know who made is sending this messages, I have decided to stay as anonymous as I can for know, but you can refer to me as "WRM-Admin". All the messages were received near Seattle, WA. I have a crush for computers, radio and all types of geeky stuff. I'm a huge fan of retro-aesthetics.</p>
66
</div>
7-
$footer;
7+
$footer;

src/templates/index.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ <h2>Introduction</h2>
88
<p>I think it was interesting so I setup my phone all the night waiting for that misterious radio to transmit again, to see if this was a one-off thing or if this was something else. And sure as it was, I've recibied another similar image, but with another text: 'No Real. Request failed successfully. Modify and try again later'.</p>
99
<p>I don't know what this could be. Maybe it could be a radioafficionate using this signal as its personal feed to send very bizarre shitpost all day, maybe it could be some kind of spy station made by some strange goverment agencies, or even aliens? Maybe? But I honestly have no idea.</p>
1010
<p>I've created this website in order to document this strange occurrance, gather as much information as I can and try to solve this rather enigmatic mystery.</p>
11-
<p>I'll leave a dedicated device to recive and convert this signals to images and I'll setup a Python script that will recolect all of the images that I have and then update the <a href="transmissions.html" rel="me">'Transmissions'</a> section of this website with a transcription and then just post that transcription to a <a href="https://koyu.space/@WRM">dedicated Mastodon account</a>.</p>
11+
<p>I'll leave a dedicated device to recive and convert this signals to images and I'll setup a Python script that will recolect all of the images that I have and then update the <a href="transmissions.html">'Transmissions'</a> section of this website with a transcription and then just post that transcription to a <a rel="me" href="https://koyu.space/@WRM">dedicated Mastodon account</a>.</p>
1212
</div>
13-
<p style="text-align: center;">If you have any clue of what this could be, please try tagging the account.</p>
14-
$footer;
13+
<p style="text-align: center;">==&gt; If you have any clue of what this could be, please try tagging the account. &lt;==</p>
14+
$footer;

src/templates/not_found.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
$header;
2-
<h2>404</h2>
3-
<p style="text-align: center;">Page not found.</p>
4-
$footer;
2+
<h2>HTTP code: 404</h2>
3+
<p style="text-align: center;">The page you have requested unfortunately, was not found.</p>
4+
$footer;

src/templates/style.css

+7-4
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,16 @@ body {
2222
}
2323
#gallery li {
2424
float: left;
25-
width: 33%;
25+
width: 32.60%;
26+
height: 200px;
27+
overflow-y: auto;
28+
overflow-wrap: break-word;
2629
text-align: center;
2730
border: solid 1px white;
2831
}
2932
#gallery img {
30-
min-width: 90px;
31-
max-width: 150px;
33+
width: 150px;
34+
height: auto;
3235
}
3336

3437
@media only screen and (max-width: 1000px) {
@@ -39,4 +42,4 @@ body {
3942
@media only screen and (max-width: 500px) {
4043
html { padding: 3px 3px; }
4144
#gallery li { width: 97.50%; }
42-
}
45+
}

src/templates/transmissions.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ <h2>Transmissions</h2>
2222
<p id="loading" style="text-align: center;"></p>
2323

2424
<script>
25-
const page=12;var already=0;var data=[];var bottom=false;async function getNewData(){document.getElementById("loading").style="display: block;";const resp=await fetch("transmissions.json");const json=await resp.json();return json}getNewData().then(contents=>{data=contents;document.getElementById("more").style="display: block;";renderMore()});function scapeTags(text){text=text.toString();text=text.split("<");text=text.join("&lt;");text=text.split(">");text=text.join("&gt;");return text}function bottomReached(){document.getElementById("more").style="display: none;";bottom=true}function renderMore(){if(data.length===0){document.getElementById("gallery").innerHTML="No images :/";return}for(var i=0;i<page;i+=1){console.log(data[already+1]);var info=data[already];var note=info["note"];if(note!==""){note="<br />Note: <i>"+note+"</i>"}var date=new Date(info["date"].toString());document.getElementById("gallery").innerHTML+=`<li><a href="imgs/${info["id"].toString()}.jpg" target="_blank"><img alt="${scapeTags(info["caption"])}" title="Click to open!" src="imgs/${info["id"].toString()}.jpg" /></a><br /><span>Caption: <i>${scapeTags(info["caption"])}</i><br />Date: ${date.getUTCFullYear()}/${date.getUTCMonth()}/${date.getUTCDay()} ${date.getUTCHours()}:${date.getUTCMinutes()}hs UTC${note}</span></li>`;if(typeof data[already+1]==="undefined"){bottomReached();break}already+=1;}document.getElementById("loading").innerHTML=""}
25+
const page=12;var already=0;var data=[];var bottom=false;async function getNewData(){document.getElementById("loading").style="display: block;";const resp=await fetch("transmissions.json");const json=await resp.json();return json}getNewData().then(contents=>{data=contents;data.reverse();document.getElementById("more").style="display: block;";renderMore()});function scapeTags(text){text=text.toString();text=text.split("<");text=text.join("&lt;");text=text.split(">");text=text.join("&gt;");return text}function bottomReached(){document.getElementById("more").style="display: none;";bottom=true}function renderMore(){if(data.length===0){document.getElementById("gallery").innerHTML="No images :/";return}for(var i=0;i<page;i++){console.log(data[already+1]);var info=data[already];var note=info["note"];if(note!==""){note="<br />Note: <i>"+note+"</i>"}var date=new Date(info["date"].toString()).toUTCString();document.getElementById("gallery").innerHTML+=`<li><a href="imgs/${info["id"].toString()}.jpg" target="_blank"><img alt="${scapeTags(info["caption"])}" title="Click to open!" src="imgs/${info["id"].toString()}.jpg" /></a><br /><span>Caption: <i>${scapeTags(info["caption"])}</i><br />Date: ${date}${note}</span></li>`;if(typeof data[already+1]==="undefined"){bottomReached();break}already++;}document.getElementById("loading").innerHTML=""}
2626
</script>
27-
$footer;
27+
$footer;

src/templates/transmissions.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ async function getNewData () {
1313
// Store data into the 'data' function when gotten
1414
getNewData().then(contents => {
1515
data = contents;
16+
data.reverse();
1617
document.getElementById("more").style = "display: block;";
1718
renderMore();
1819
});
@@ -41,15 +42,17 @@ function renderMore () {
4142
var info = data[already];
4243
var note = info["note"];
4344
if (note !== "") { note = "<br />Note: <i>" + note + "</i>"; }
44-
var date = new Date(info["date"].toString());
45+
// Parse date
46+
var date = new Date(info["date"].toString()).toUTCString();
47+
// Add to the gallery
4548
document.getElementById("gallery").innerHTML += `
4649
<li>
47-
<a href="imgs/${info["id"].toString()}.png" target="_blank"><img alt="${scapeTags(info["caption"])}" title="Click to open!" src="imgs/${info["id"].toString()}.png" /></a>
50+
<a href="imgs/${info["id"].toString()}.jpg" target="_blank"><img alt="${scapeTags(info["caption"])}" title="Click to open!" src="imgs/${info["id"].toString()}.jpg" /></a>
4851
<br />
4952
<span>
5053
Caption: <i>${scapeTags(info["caption"])}</i>
5154
<br />
52-
Date: ${date.getUTCFullYear()}/${date.getUTCMonth()}/${date.getUTCDay()} ${date.getUTCHours()}:${date.getUTCMinutes()}hs UTC
55+
Date: ${date}
5356
${note}
5457
</span>
5558
</li>
@@ -61,4 +64,4 @@ function renderMore () {
6164
already++; // Count!
6265
}
6366
document.getElementById("loading").innerHTML = "";
64-
}
67+
}

src/twrt.nim

+10-23
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
const doc = """
22
The Weird Radio Transmitter
33
4-
| This software is open-source!
4+
| This software is open source!
55
| https://github.com/exitcas/twrt.git
66
7-
Usage: twrt --help
8-
twrt --version
9-
twrt post <caption>...
10-
twrt build
11-
Try: twrt post "Lorem Impsum"
12-
twrt build
7+
Usage:
8+
twrt --help Displays list of currently available commands.
9+
twrt --version Displays the current version and date of release.
10+
twrt post <caption>... Generates a new image, 'transmissions.json' file and a Mastodon post with the caption.
11+
twrt build Generates the rest of the website using the templates on 'src/templates'.
12+
Try:
13+
twrt post "Lorem Impsum"
14+
twrt build
1315
"""
1416

1517
import
@@ -27,15 +29,7 @@ let generate_card = pyImport("generate_card")
2729

2830

2931

30-
var args = docopt(doc)
31-
#echo args
32-
33-
#if args["-v"]:
34-
# #echo unicode.capitalize(repeat("very ", args["-v"].len - 1) & "verbose")
35-
# echo args["-v"]
36-
37-
if args["--version"]:
38-
echo "The Weird Radio Transmitter\nv1.0.0\n2023-02-07"
32+
var args = docopt(doc, help=true, version="The Weird Radio Transmitter\nv1.0.1\n2023-02-09")
3933

4034
if args["post"]:
4135
var caption = args["<caption>"][0]
@@ -55,8 +49,6 @@ if args["post"]:
5549
uploadTransmission(id)
5650
echo "Posting to Mastodon..."
5751
postStatus(caption)
58-
#for kind, path in walkDir("export/imgs"):
59-
# echo path
6052

6153

6254
if args["build"]:
@@ -65,8 +57,3 @@ if args["build"]:
6557
buildWebsite()
6658
echo "Uploading..."
6759
uploadWebsite()
68-
69-
#echo @(args["--text"])
70-
71-
#for path in @(args["--text"]):
72-
# echo read_file(path)

twrt.nimble

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Package
22

3-
version = "0.1.0"
3+
version = "1.0.1"
44
author = "exitcas"
5-
description = "The software powering the 'Weird Radio Message' Mastodon account and website."
5+
description = "The software powering the 'Weird Radio Messages' Mastodon account and website."
66
license = "MIT"
77
srcDir = "src"
88
bin = @["twrt"]
@@ -13,4 +13,4 @@ bin = @["twrt"]
1313
requires "nim >= 1.4.8"
1414
requires "docopt >= 0.6.7"
1515
requires "nimpy >= 0.2.0"
16-
requires "regex >= 0.11.1"
16+
requires "regex >= 0.11.1"

0 commit comments

Comments
 (0)