-
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add automated repository generation and version updates (#344)
* Add automated repository generation and version updates Implemented a new Makefile target for updating versions and generating repositories. Added a Python script for automating kodi repository XML generation. Enhanced GitHub Actions to support automatic version updates, build, and deployment to GitHub Pages. * Add Claude API integration for automated release notes
- Loading branch information
Showing
6 changed files
with
256 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/usr/bin/env python3 | ||
import hashlib | ||
import xml.etree.ElementTree as ET | ||
from pathlib import Path | ||
|
||
DIST_DIR = Path("dist") | ||
ZIPS_DIR = DIST_DIR / "zips" | ||
|
||
|
||
def generate_md5(file_path): | ||
"""Generate MD5 hash of a file.""" | ||
hash_md5 = hashlib.md5() | ||
with open(file_path, "rb") as f: | ||
for chunk in iter(lambda: f.read(4096), b""): | ||
hash_md5.update(chunk) | ||
return hash_md5.hexdigest() | ||
|
||
|
||
def generate_addons_xml(): | ||
"""Generate addons.xml file.""" | ||
addon_xmls = [] | ||
errors = [] | ||
# Get all addon.xml files from the zips directory | ||
for addon_dir in ZIPS_DIR.iterdir(): | ||
if addon_dir.is_dir(): | ||
addon_xml_path = addon_dir / "addon.xml" | ||
if addon_xml_path.exists(): | ||
try: | ||
tree = ET.parse(addon_xml_path) | ||
root = tree.getroot() | ||
# Basic validation | ||
if root.tag != "addon": | ||
raise ValueError(f"Invalid root tag in {addon_xml_path}") | ||
addon_xmls.append(root) | ||
except (ET.ParseError, ValueError) as e: | ||
errors.append(f"Error processing {addon_xml_path}: {e}") | ||
if errors: | ||
raise ValueError("\n".join(errors)) | ||
# Sort addons by ID for consistent output | ||
addon_xmls.sort(key=lambda x: x.get("id", "")) | ||
# Create addons.xml | ||
xml_root = ET.Element("addons") | ||
for addon in addon_xmls: | ||
xml_root.append(addon) | ||
# Use proper XML declaration with encoding | ||
xml_str = ET.tostring(xml_root, encoding="utf-8", xml_declaration=True) | ||
# Save addons.xml | ||
addons_xml_path = ZIPS_DIR / "addons.xml" | ||
with open(addons_xml_path, "wb") as f: | ||
f.write(xml_str) | ||
# Generate MD5 | ||
md5_path = ZIPS_DIR / "addons.xml.md5" | ||
with open(md5_path, "w") as f: | ||
f.write(generate_md5(addons_xml_path)) | ||
|
||
|
||
if __name__ == "__main__": | ||
generate_addons_xml() |
Oops, something went wrong.