Skip to content

Commit

Permalink
Update! Edits to the templates, 'generate_card.py', etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
Luqaska committed Feb 9, 2023
1 parent daa23bb commit a8b2999
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 52 deletions.
12 changes: 6 additions & 6 deletions generate_card.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def generate_card(name, text):

# Apply font
font = ImageFont.truetype("./src/fonts/archivo.ttf", 25)
wrap = textwrap.wrap(text, 33, break_long_words=True)
wrap = textwrap.wrap(text, 25, break_long_words=True)
text = "\n".join(wrap)


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


# Put text on a random spot of the screen
x = randint(10, img.width - padding - width)
#if x < 0: x = 0
y = randint(10, img.height - padding - height)
#if y < 0: y = 0
try: x = randint(10, img.width - padding - width)
except: x = 0
try: y = randint(10, img.height - padding - height)
except: y = 0
draw.text(
(x, y),
text,
Expand Down Expand Up @@ -76,4 +76,4 @@ def generate_card(name, text):
# Convert into JPEG image and save
jpg = Image.new("RGB", img.size, (255, 255, 255))
jpg.paste(img, mask=img.split()[3])
jpg.save(name, "JPEG")
jpg.save(name, "JPEG", quality="80", optimize=True)
4 changes: 2 additions & 2 deletions src/templates/_footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
<p>
<b>&copy;2023 Weird Radio Messages</b>
<br />
<span class="sb">/</span> wrm.neocities.org <span class="sb">/</span>
- wrm.neocities.org -
<br /><br />
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).
</p>
</div>
</body>
</html>
</html>
4 changes: 2 additions & 2 deletions src/templates/about_me.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<h2>About me</h2>
<div style="text-align:center;"><img src="icon.jpg" style="background: black; width: auto; height: 100px;" /></div>
<div style="text-indent: 2em;">
<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>
<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>
</div>
$footer;
$footer;
6 changes: 3 additions & 3 deletions src/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ <h2>Introduction</h2>
<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>
<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>
<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>
<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>
<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>
</div>
<p style="text-align: center;">If you have any clue of what this could be, please try tagging the account.</p>
$footer;
<p style="text-align: center;">==&gt; If you have any clue of what this could be, please try tagging the account. &lt;==</p>
$footer;
6 changes: 3 additions & 3 deletions src/templates/not_found.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$header;
<h2>404</h2>
<p style="text-align: center;">Page not found.</p>
$footer;
<h2>HTTP code: 404</h2>
<p style="text-align: center;">The page you have requested unfortunately, was not found.</p>
$footer;
11 changes: 7 additions & 4 deletions src/templates/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,16 @@ body {
}
#gallery li {
float: left;
width: 33%;
width: 32.60%;
height: 200px;
overflow-y: auto;
overflow-wrap: break-word;
text-align: center;
border: solid 1px white;
}
#gallery img {
min-width: 90px;
max-width: 150px;
width: 150px;
height: auto;
}

@media only screen and (max-width: 1000px) {
Expand All @@ -39,4 +42,4 @@ body {
@media only screen and (max-width: 500px) {
html { padding: 3px 3px; }
#gallery li { width: 97.50%; }
}
}
4 changes: 2 additions & 2 deletions src/templates/transmissions.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ <h2>Transmissions</h2>
<p id="loading" style="text-align: center;"></p>

<script>
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=""}
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=""}
</script>
$footer;
$footer;
11 changes: 7 additions & 4 deletions src/templates/transmissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ async function getNewData () {
// Store data into the 'data' function when gotten
getNewData().then(contents => {
data = contents;
data.reverse();
document.getElementById("more").style = "display: block;";
renderMore();
});
Expand Down Expand Up @@ -41,15 +42,17 @@ function renderMore () {
var info = data[already];
var note = info["note"];
if (note !== "") { note = "<br />Note: <i>" + note + "</i>"; }
var date = new Date(info["date"].toString());
// Parse date
var date = new Date(info["date"].toString()).toUTCString();
// Add to the gallery
document.getElementById("gallery").innerHTML += `
<li>
<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>
<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
Date: ${date}
${note}
</span>
</li>
Expand All @@ -61,4 +64,4 @@ function renderMore () {
already++; // Count!
}
document.getElementById("loading").innerHTML = "";
}
}
33 changes: 10 additions & 23 deletions src/twrt.nim
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
const doc = """
The Weird Radio Transmitter
| This software is open-source!
| This software is open source!
| https://github.com/exitcas/twrt.git
Usage: twrt --help
twrt --version
twrt post <caption>...
twrt build
Try: twrt post "Lorem Impsum"
twrt build
Usage:
twrt --help Displays list of currently available commands.
twrt --version Displays the current version and date of release.
twrt post <caption>... Generates a new image, 'transmissions.json' file and a Mastodon post with the caption.
twrt build Generates the rest of the website using the templates on 'src/templates'.
Try:
twrt post "Lorem Impsum"
twrt build
"""

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



var args = docopt(doc)
#echo args

#if args["-v"]:
# #echo unicode.capitalize(repeat("very ", args["-v"].len - 1) & "verbose")
# echo args["-v"]

if args["--version"]:
echo "The Weird Radio Transmitter\nv1.0.0\n2023-02-07"
var args = docopt(doc, help=true, version="The Weird Radio Transmitter\nv1.0.1\n2023-02-09")

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


if args["build"]:
Expand All @@ -65,8 +57,3 @@ if args["build"]:
buildWebsite()
echo "Uploading..."
uploadWebsite()

#echo @(args["--text"])

#for path in @(args["--text"]):
# echo read_file(path)
6 changes: 3 additions & 3 deletions twrt.nimble
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Package

version = "0.1.0"
version = "1.0.1"
author = "exitcas"
description = "The software powering the 'Weird Radio Message' Mastodon account and website."
description = "The software powering the 'Weird Radio Messages' Mastodon account and website."
license = "MIT"
srcDir = "src"
bin = @["twrt"]
Expand All @@ -13,4 +13,4 @@ bin = @["twrt"]
requires "nim >= 1.4.8"
requires "docopt >= 0.6.7"
requires "nimpy >= 0.2.0"
requires "regex >= 0.11.1"
requires "regex >= 0.11.1"

0 comments on commit a8b2999

Please sign in to comment.