From 68a2ca80978eb75e326e5f14016e9dcb5b62eeb2 Mon Sep 17 00:00:00 2001
From: ZareMate <0.zaremate@gmail.com>
Date: Fri, 24 Jan 2025 22:56:03 +0100
Subject: [PATCH] Add script to generate file listing and update readme.md
---
auto list.py | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++++
readme.md | 22 ++++++++++++
2 files changed, 119 insertions(+)
create mode 100644 auto list.py
diff --git a/auto list.py b/auto list.py
new file mode 100644
index 0000000..a4e69e5
--- /dev/null
+++ b/auto list.py
@@ -0,0 +1,97 @@
+from pathlib import Path
+from datetime import datetime
+from collections import defaultdict
+import re
+
+
+def process_build_version(name):
+ """Put Build/v and everything after them in brackets and make game name bold"""
+ # Handle "Build" pattern
+ build_pattern = r'^(.+?)(Build\s*[\d.]+\s*.+)$'
+ name = re.sub(build_pattern, lambda m: f'**{m.group(1).strip()}** [{m.group(2)}]', name)
+
+ # Handle "v#" pattern (where # is any number)
+ version_pattern = r'^(.+?)(v[\d.]+\s*.+)$'
+ name = re.sub(version_pattern, lambda m: f'**{m.group(1).strip()}** [{m.group(2)}]', name)
+
+ # If no version/build info, make entire name bold
+ if '[' not in name:
+ name = f'**{name.strip()}**'
+
+ return name
+
+def clean_filename(name):
+ """Remove -OFME and file extension from filename"""
+ name = name.rsplit('.', 1)[0] # Remove extension
+ name = name.replace('-OFME', '')
+
+ # Find and temporarily protect version/build number dots
+ build_matches = re.finditer(r'Build\s*[\d.]+', name)
+ version_matches = re.finditer(r'v[\d.]+', name)
+
+ # Replace protected sections with temporary markers
+ protected_sections = []
+ for match in list(build_matches) + list(version_matches):
+ protected_sections.append(match.group(0))
+ name = name.replace(match.group(0), f'@@{len(protected_sections)-1}@@')
+
+ # Replace remaining dots with spaces
+ name = name.replace('.', ' ')
+
+ # Restore protected sections
+ for i, section in enumerate(protected_sections):
+ name = name.replace(f'@@{i}@@', section)
+
+ # Process build/version patterns
+ name = process_build_version(name)
+ return name
+
+def get_file_listing():
+ root_dir = Path('.')
+ categories = defaultdict(lambda: defaultdict(list))
+
+ try:
+ # Scan directories, excluding dot folders and root
+ for item in root_dir.glob('**/'):
+ if item == root_dir or any(part.startswith('.') for part in item.parts):
+ continue
+
+ if item.is_dir():
+ # Split path into main category and subcategory
+ parts = item.relative_to(root_dir).parts
+ if len(parts) >= 2:
+ main_cat, sub_cat = parts[0], parts[1]
+
+ # Get files in this directory
+ for file in item.glob('*'):
+ if file.is_file():
+ clean_name = clean_filename(file.name)
+ rel_path = file.relative_to(root_dir).as_posix()
+ categories[main_cat][sub_cat].append((clean_name, rel_path))
+
+ # Generate markdown output
+ with open('readme.md', 'w', encoding='utf-8') as f:
+ f.write(f'# File Listing\n')
+
+ total_files = 0
+ for main_cat in sorted(categories.keys()):
+ main_count = sum(len(files) for files in categories[main_cat].values())
+ f.write(f'## {main_cat} ({main_count})\n')
+
+ for sub_cat in sorted(categories[main_cat].keys()):
+ files = categories[main_cat][sub_cat]
+ if files:
+ total_files += len(files)
+ f.write(f'### {sub_cat} ({len(files)})\n')
+ for filename, rel_path in sorted(files):
+ f.write(f'- [{filename}]({rel_path})\n')
+ f.write('\n')
+
+ f.write(f'
\n\n## Info\n- **Generated: {datetime.now().strftime("%Y-%m-%d %H:%M")}**\n')
+ f.write(f'- **Total Files: {total_files}**')
+
+ except Exception as e:
+ print(f"Error: {str(e)}")
+
+if __name__ == '__main__':
+ get_file_listing()
\ No newline at end of file
diff --git a/readme.md b/readme.md
index e69de29..09e20ad 100644
--- a/readme.md
+++ b/readme.md
@@ -0,0 +1,22 @@
+# File Listing
+## Games (11)
+### PC (5)
+- [**Dale and Dawson Stationery Supplies** [v1.0.13]](Games/PC/Dale.and.Dawson.Stationery.Supplies.v1.0.13-OFME.torrent)
+- [**Green Hell** [v2.7.2]](Games/PC/Green.Hell.v2.7.2-OFME.torrent)
+- [**Nuclear Nightmare** [Build.28102024]](Games/PC/Nuclear.Nightmare.Build.28102024-OFME.torrent)
+- [**Sons Of The Forest** [Build.20062024]](Games/PC/Sons.Of.The.Forest.Build.20062024-OFME.torrent)
+- [**Stationeers** [v0.2.4677.21598]](Games/PC/Stationeers.v0.2.4677.21598-OFME.torrent)
+
+### PCVR (6)
+- [**Among Us VR** [Build.14102022]](Games/PCVR/Among.Us.VR.Build.14102022-OFME.torrent)
+- [**Bullet Roulette VR** [Build.10092020]](Games/PCVR/Bullet.Roulette.VR.Build.10092020-OFME.torrent)
+- [**Crossfire Sierra Squad** [v53476]](Games/PCVR/Crossfire.Sierra.Squad.v53476-OFME.torrent)
+- [**Deisim**](Games/PCVR/Deisim.torrent)
+- [**Real VR Fishing** [v2.560]](Games/PCVR/Real.VR.Fishing.v2.560-OFME.torrent)
+- [**VTOL VR** [Build.29122023]](Games/PCVR/VTOL.VR.Build.29122023-OFME.torrent)
+
+
+
+## Info
+- **Generated: 2025-01-24 22:55**
+- **Total Files: 11**
\ No newline at end of file