diff --git a/resources/web/epg_mapping.js b/resources/web/epg_mapping.js
index 8e50fa4..0c2b3a6 100644
--- a/resources/web/epg_mapping.js
+++ b/resources/web/epg_mapping.js
@@ -23,6 +23,9 @@ class EPGMappingManager {
}
async loadProviders() {
+ // Only load once
+ if (this.initialized) return;
+
try {
const response = await fetch(`${this.apiBase}/api/providers`);
if (!response.ok) throw new Error('Failed to load providers');
diff --git a/service.py b/service.py
index a2c4f01..88138cf 100644
--- a/service.py
+++ b/service.py
@@ -81,7 +81,7 @@ class UltimateService:
css_path = os.path.join(web_dir, 'config.css')
js_path = os.path.join(web_dir, 'config.js')
- # NEW: EPG mapping files
+ # EPG mapping files
epg_css_path = os.path.join(web_dir, 'epg_mapping.css')
epg_js_path = os.path.join(web_dir, 'epg_mapping.js')
fuzzyset_path = os.path.join(web_dir, 'lib', 'fuzzyset.js')
@@ -96,7 +96,7 @@ class UltimateService:
with open(css_path, 'r', encoding='utf-8') as f:
css = f.read()
- # NEW: Load EPG CSS
+ # Load EPG CSS
with open(epg_css_path, 'r', encoding='utf-8') as f:
epg_css = f.read()
@@ -104,7 +104,7 @@ class UltimateService:
with open(js_path, 'r', encoding='utf-8') as f:
js = f.read()
- # NEW: Load EPG JS and libraries
+ # Load EPG JS and libraries
with open(epg_js_path, 'r', encoding='utf-8') as f:
epg_js = f.read()
@@ -118,30 +118,34 @@ class UltimateService:
combined_css = f"{css}\n\n/* EPG Mapping CSS */\n{epg_css}"
# Combine all JS (with proper order)
- combined_js = f"""{debounce_js}
+ combined_js = f"""
+ /* Debounce Utility */
+ {debounce_js}
+
/* FuzzySet Library */
{fuzzyset_js}
-
+
/* Main Config JS */
{js}
-
+
/* EPG Mapping JS */
{epg_js}
"""
- # Replace in HTML
+ # Replace CSS in HTML
html = html.replace('',
f'')
- html = html.replace('',
- f'')
+ # Inject JavaScript before