added logos

This commit is contained in:
sose 2021-04-07 04:02:26 +00:00
parent f6317ef3f0
commit 9831e76d69
7 changed files with 64 additions and 33 deletions

34
gemhltv
View File

@ -1,29 +1,37 @@
#!/bin/sh
CGI_BIN="/var/gemini/cgi-bin"
LOGO_FILE="/var/gemini-data/logos/gemhltv_main"
# ^^^^^^^^ path to file containing the text to be displayed at the top of the
# page
CGI_BIN="/var/gemini/cgi-bin"
# ^^^^^ parent folder of `gemhltv_matches` and `gemhltv_news`
print_header() {
echo "20 text/gemini"
echo '```'
cat $LOGO_FILE
echo '```'
echo ""
echo "=> ?news NEWS"
echo "=> ?matches MATCHES"
echo ""
}
echo "20 text/gemini"
echo '```'
echo ' ____ _____ __ __ _ _ _ _______ __'
echo ' / ___| ____| \/ | | | | | |_ _\ \ / /'
echo '| | _| _| | |\/| | |_| | | | | \ \ / / '
echo '| |_| | |___| | | | _ | |___| | \ V / '
echo ' \____|_____|_| |_|_| |_|_____|_| \_/ '
echo '```'
echo ""
echo "=> ?news NEWS"
echo "=> ?matches MATCHES"
if [ "$QUERY_STRING" = "news" ]
then
print_header
/var/gemini/cgi-bin/gemhltv_news
elif [ "$QUERY_STRING" = "matches" ]
then
print_header
$CGI_BIN/gemhltv_matches
elif [ "$QUERY_STRING" = "reload" ]
then
curl "https://illegaldrugs.net/skor?reload" >/dev/null
$CGI_BIN/gemhltv_matches
echo "30 ?matches"
else
print_header
$CGI_BIN/gemhltv_matches
fi

View File

@ -6,15 +6,15 @@ import pytz
from datetime import datetime, timedelta
from pytz import timezone
print("```")
print(" _ _ ")
print(" _____ ___| |_ ___| |_ ___ ___ ")
print("| | .'| _| _| | -_|_ -|")
print("|_|_|_|__,|_| |___|_|_|___|___|")
print("```")
print("")
CURRENT_TZ = timezone('US/Pacific')
# ^^^^^^^^ timezone to use for match start times
current_tz = timezone('US/Pacific')
LOGO_FILE = "/var/gemini-data/logos/gemhltv_matches"
# ^^^^^^^ path to file containing the text to be displayed at the top of the
# page
with open(LOGO_FILE, "r") as logo:
print("```\n" + logo.read() + "\n```")
def print_matches(match_list):
for match in match_list:
@ -63,7 +63,7 @@ def print_matches(match_list):
else: # match is upcoming, start time will always be an int here
start_time = int(match["start_time"]) // 1000 # convert ms unix time to normal
start_time = datetime.utcfromtimestamp(start_time)
start_time = pytz.utc.localize(start_time).astimezone(current_tz)
start_time = pytz.utc.localize(start_time).astimezone(CURRENT_TZ)
start_time = start_time.strftime("%I:%M %p")
print(
"{}\nVS.\n{}".format(

View File

@ -2,13 +2,18 @@
<?php
# its in php because I got lazy and just stripped down news.php
# cool language tho it gets too much hate
$abs_path = "gemini://" . getenv("SERVER_NAME") . getenv("SCRIPT_NAME");
$LOGO_FILE = "/var/gemini-data/logos/gemhltv_news";
# ^^^^^^^^ path to file containing the text to be displayed at the top of the
# page
$READER_LINK = dirname($abs_path) . "/reader";
# ^^^^^^^ uri path to an instance of reader.php
# ^^^^^^^^^^ uri path to an instance of reader.php
# the default is relative, and assumes you have one in the same directory as
# this script
$abs_path = "gemini://" . getenv("SERVER_NAME") . getenv("SCRIPT_NAME");
$abs_path = "gemini://"
. getenv("SERVER_NAME")
@ -21,9 +26,7 @@ $feed->open("https://hltv.org/news.rss.php");
$feed->read();
echo "```\n";
echo " ___ ___ _ _ _ ___ \n";
echo "| | -_| | | |_ -|\n";
echo "|_|_|___|_____|___|\n";
echo file_get_contents($LOGO_FILE);
echo "```\n";
while ($feed->read()) {
if ( $feed->name === "item") {

6
logos/gemhltv_main Normal file
View File

@ -0,0 +1,6 @@
██████╗ ███████╗███╗ ███╗██╗ ██╗██╗ ████████╗██╗ ██╗
██╔════╝ ██╔════╝████╗ ████║██║ ██║██║ ╚══██╔══╝██║ ██║
██║ ███╗█████╗ ██╔████╔██║███████║██║ ██║ ██║ ██║
██║ ██║██╔══╝ ██║╚██╔╝██║██╔══██║██║ ██║ ╚██╗ ██╔╝
╚██████╔╝███████╗██║ ╚═╝ ██║██║ ██║███████╗██║ ╚████╔╝
╚═════╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═══╝

3
logos/gemhltv_matches Normal file
View File

@ -0,0 +1,3 @@
░█▄█░█▀█░▀█▀░█▀▀░█░█░█▀▀░█▀▀
░█░█░█▀█░░█░░█░░░█▀█░█▀▀░▀▀█
░▀░▀░▀░▀░░▀░░▀▀▀░▀░▀░▀▀▀░▀▀▀

3
logos/gemhltv_news Normal file
View File

@ -0,0 +1,3 @@
░█▀█░█▀▀░█░█░█▀▀
░█░█░█▀▀░█▄█░▀▀█
░▀░▀░▀▀▀░▀░▀░▀▀▀

View File

@ -13,15 +13,23 @@ a gemini mirror of hltv.org
- clone this repo
- cd to this repo
- `pip3 install pytz`
- change `$CGI_BIN` at the top of `gemhltv` if the scripts are
somewhere else
- put all the scripts in your cgi-bin
- put the logos folder in `/var/gemini-data`
## config
- change `LOGO_FILE` at the top of all the scripts if the logos folder is
somewhere other than `/var/gemini-data/logos`
- change `CGI_BIN` at the top of `gemhltv` if the scripts are
somewhere other than `/var/gemini/cgi-bin`
- change `READER_LINK` at the top of gemhltv\_news to point to your
instance of reader.php
- change the current\_tz at the top of the gemhltv\_matches file to match
yours
- a list of valid timezones is available [here](https://gist.githubusercontent.com/heyalexej/8bf688fd67d7199be4a1682b3eec7568/raw/daacf0e4496ccc60a36e493f0252b7988bceb143/pytz-time-zones.py)
- change `$READER_LINK` at the top of gemhltv\_news to point to your
instance of reader.php
- put all the scripts in your cgi-bin
- navigate to gemini://example.com/cgi-bin/gemhltv
- you can edit the files in the `logos` folder to change the logos displayed at
the top of each page/section
## notes
- rip c9