Spaces:
Running on Zero
Running on Zero
feat(enterprise): fullstack performance optimizations, cloudflare image pipeline, and edge hardening
e91bc61 Download scripts/make_surah_data.py from sahihislam/superadmin: direct link, hf CLI and curl.
- Browser
- Download file 1.21 kB
-
https://huggingface.co/spaces/sahihislam/superadmin/resolve/main/scripts/make_surah_data.py
- Command line
-
hf download hf://spaces/sahihislam/superadmin/scripts/make_surah_data.py
-
curl -L -o make_surah_data.py https://huggingface.co/spaces/sahihislam/superadmin/resolve/main/scripts/make_surah_data.py
1.21 kB
| import json | |
| data = json.load(open('BACKEND/quran.json', encoding='utf-8')) | |
| lines = [ | |
| '// =============================================================', | |
| '// SAHIH ISLAM - STATIC QURAN SURAH METADATA (114 SURAHS)', | |
| '// =============================================================', | |
| '// Provides instantaneous 0ms loading for Quran index screen.', | |
| '// =============================================================', | |
| '', | |
| 'const List<Map<String, dynamic>> kAllSurahsStaticData = [', | |
| ] | |
| for s in data: | |
| s_no = s['surah_no'] | |
| name_ar = s['name_arabic'].replace('"', '\\"') | |
| name_en = s['name_english'].replace('"', '\\"') | |
| trans_en = s['translation_english'].replace('"', '\\"') | |
| total = s['total_ayahs'] | |
| rev = s.get('revelation_type', '').replace('"', '\\"') | |
| lines.append(f' {{"surah_no": {s_no}, "name_arabic": "{name_ar}", "name_english": "{name_en}", "translation_english": "{trans_en}", "total_ayahs": {total}, "revelation_type": "{rev}"}},') | |
| lines.append('];') | |
| lines.append('') | |
| with open('FRONTEND/lib/models/surah_data.dart', 'w', encoding='utf-8') as f: | |
| f.write('\n'.join(lines)) | |
| print('FRONTEND/lib/models/surah_data.dart written successfully!') | |