FMHYedit/.github/add-headers.py

97 lines
3.5 KiB
Python
Raw Normal View History

import os
2023-11-26 11:50:44 +00:00
2023-11-12 18:28:49 +00:00
headers = {
2023-11-26 11:50:44 +00:00
"AdblockVPNGuide.md": [
"Adblocking / Privacy",
"Adblocking, Privacy, VPN's, Proxies, Antivirus",
],
"AI.md": [
"Artificial Intelligence",
"Chat Bots, Text Generators, Image Generators, ChatGPT Tools",
],
"Android-iOSGuide.md": ["Android / iOS", "Apps, Jailbreaking, Android Emulators"],
"AudioPiracyGuide.md": [
"Music / Podcasts / Radio",
"Stream Audio, Download Audio, Torrent Audio",
],
"Beginners-Guide.md": ["Beginners Guide", "A Guide for Beginners to Piracy"],
"DownloadPiracyGuide.md": [
"Downloading",
"Download Sites, Software Sites, Open Directories",
],
"EDUPiracyGuide.md": ["Educational", "Courses, Documentaries, Learning Resources"],
"GamingPiracyGuide.md": [
"Gaming / Emulation",
"Download Games, ROMs, Gaming Tools",
],
"LinuxGuide.md": ["Linux / MacOS", "Apps, Software Sites, Gaming"],
"MISCGuide.md": ["Miscellaneous", "Extensions, Indexes, News, Health, Food, Fun"],
"NSFWPiracy.md": ["NSFW", "NSFW Indexes, Streaming, Downloading"],
"Non-English.md": ["Non-English", "International Piracy Sites"],
"ReadingPiracyGuide.md": [
"Books / Comics / Manga",
"Books, Comics, Magazines, Newspapers",
],
2024-05-01 03:20:49 +00:00
"Game-Tools.md": ["Gaming Tools", "Git, Hosting, App Dev, Software Dev"],
2023-11-26 11:50:44 +00:00
"DEVTools.md": ["Developer Tools", "Git, Hosting, App Dev, Software Dev"],
"img-tools.md": ["Image Tools", "Image Editors, Generators, Compress"],
"Audio-Tools.md": [
"Audio Tools",
"Audio Players, Audio Editors, Audio Downloaders",
],
"System-Tools.md": [
"System Tools",
"System Tools, Hardware Tools, Windows ISOs, Customization",
],
"File-Tools.md": ["File Tools", "Download Managers, File Hosting, File Archivers"],
"Video-Tools.md": [
"Video Tools",
"Video Players, Video Editors, Live Streaming, Animation",
],
"Text-Tools.md": ["Text Tools", "Text Editors, Pastebins, Fonts, Translators"],
2023-12-21 11:38:43 +00:00
# "Internet-Tools.md": ["Internet Tools", "Browsers, Extensions, Search Engines"],
"Social-Media-Tools.md": [
"Social Media Tools",
"Discord Tools, Reddit Tools, YouTube Tools",
],
2023-11-27 21:08:28 +00:00
"STORAGE.md": ["Storage", "Sections too big to fit on main pages"],
2023-11-26 11:50:44 +00:00
"TorrentPiracyGuide.md": ["Torrenting", "Torrent Clients, Torrent Sites, Trackers"],
"VideoPiracyGuide.md": [
"Movies / TV / Anime",
"Stream Videos, Download Videos, Torrent Videos",
],
"base64.md": ["Base64", "Base64 storage"],
"UnsafeSites.md": ["Unsafe Sites", "Unsafe/harmful sites to avoid."],
}
2024-02-04 13:16:04 +00:00
title = '<div class="space-y-2 not-prose"><h1 class="text-4xl font-extrabold tracking-tight text-primary underline lg:text-5xl lg:leading-[3.5rem]">'
2024-02-04 13:13:18 +00:00
description = '<p class="text-black dark:text-text-2">'
2023-11-26 11:50:44 +00:00
2023-11-12 18:28:49 +00:00
def getHeader(page: str):
data = headers[page]
header = "---\n"
header += f'title: "{data[0]}"\n'
header += f"description: {data[1]}\n"
header += "---\n"
2024-02-04 13:16:04 +00:00
header += f"{title}{data[0]}</h1>\n"
header += f"{description}{data[1]}</p></div>\n\n"
return header
2023-11-26 11:50:44 +00:00
2023-11-12 18:28:49 +00:00
def main():
2023-11-26 11:50:44 +00:00
files = os.listdir(".")
for file in files:
2023-11-12 18:28:49 +00:00
if file in headers:
2023-11-26 11:50:44 +00:00
with open(file, "r", encoding="utf-8") as f:
content = f.read()
2023-11-26 11:50:44 +00:00
if not content.startswith("---"):
with open(file, "w", encoding="utf-8") as f2:
2023-11-12 18:28:49 +00:00
header = getHeader(file)
2023-11-26 11:50:44 +00:00
f2.write(header + content)
2023-11-12 18:28:49 +00:00
main()