diff --git a/backups/archive/channels_20250627_222923.gz b/backups/archive/channels_20250627_222923.gz new file mode 100644 index 0000000..d90ca54 Binary files /dev/null and b/backups/archive/channels_20250627_222923.gz differ diff --git a/backups/archive/channels_20250627_225834.gz b/backups/archive/channels_20250627_225834.gz new file mode 100644 index 0000000..f04589c Binary files /dev/null and b/backups/archive/channels_20250627_225834.gz differ diff --git a/backups/channels_20250627_222923.txt b/backups/channels_20250627_222923.txt deleted file mode 100644 index e69de29..0000000 diff --git a/backups/channels_20250627_224445.txt b/backups/channels_20250627_224445.txt deleted file mode 100644 index 1a9d5ba..0000000 --- a/backups/channels_20250627_224445.txt +++ /dev/null @@ -1,5 +0,0 @@ -Group = Sports -Stream name = Sky Sports Mix FHD -Logo = https://i.ibb.co/7kYj5gc/sky-mix.png -EPG id = SkySp.Mix.HD.uk -Stream URL = https://a1xs.vip/2000008 \ No newline at end of file diff --git a/backups/channels_20250627_224445.txt.gz b/backups/channels_20250627_224445.txt.gz new file mode 100644 index 0000000..883a00d Binary files /dev/null and b/backups/channels_20250627_224445.txt.gz differ diff --git a/backups/channels_20250627_225834.txt b/backups/channels_20250627_225834.txt deleted file mode 100644 index 13999fd..0000000 --- a/backups/channels_20250627_225834.txt +++ /dev/null @@ -1,11 +0,0 @@ -Group = ๐Ÿ‡ฌ๐Ÿ‡ง United Kingdom -Stream name = Sky Sports Mix FHD -Logo = https://i.ibb.co/7kYj5gc/sky-mix.png -EPG id = SkySp.Mix.HD.uk -Stream URL = https://a1xs.vip/2000008 - -Group = Sports -Stream name = Sky Sports Mix FHD -Logo = https://i.ibb.co/7kYj5gc/sky-mix.png -EPG id = SkySp.Mix.HD.uk -Stream URL = https://a1xs.vip/2000008 \ No newline at end of file diff --git a/backups/channels_20250627_230205.txt b/backups/channels_20250627_230205.txt deleted file mode 100644 index 00a07d4..0000000 --- a/backups/channels_20250627_230205.txt +++ /dev/null @@ -1,11 +0,0 @@ -Group = ๐Ÿ‡ฌ๐Ÿ‡ง United Kingdom -Stream name = Sky Sports Mix FHD -Logo = https://i.ibb.co/7kYj5gc/sky-mix.png -EPG id = SkySp.Mix.HD.uk -Stream URL = https://a1xs.vip/2000008 - -Group = ๐Ÿ‡ฌ๐Ÿ‡ง United Kingdom -Stream name = Sky Sports Mix FHD -Logo = https://i.ibb.co/7kYj5gc/sky-mix.png -EPG id = SkySp.Mix.HD.uk -Stream URL = https://a1xs.vip/2000008 \ No newline at end of file diff --git a/backups/channels_20250627_230205.txt.gz b/backups/channels_20250627_230205.txt.gz new file mode 100644 index 0000000..bac4f63 Binary files /dev/null and b/backups/channels_20250627_230205.txt.gz differ diff --git a/backups/channels_20250628_002450.txt b/backups/channels_20250628_002450.txt deleted file mode 100644 index 00a07d4..0000000 --- a/backups/channels_20250628_002450.txt +++ /dev/null @@ -1,11 +0,0 @@ -Group = ๐Ÿ‡ฌ๐Ÿ‡ง United Kingdom -Stream name = Sky Sports Mix FHD -Logo = https://i.ibb.co/7kYj5gc/sky-mix.png -EPG id = SkySp.Mix.HD.uk -Stream URL = https://a1xs.vip/2000008 - -Group = ๐Ÿ‡ฌ๐Ÿ‡ง United Kingdom -Stream name = Sky Sports Mix FHD -Logo = https://i.ibb.co/7kYj5gc/sky-mix.png -EPG id = SkySp.Mix.HD.uk -Stream URL = https://a1xs.vip/2000008 \ No newline at end of file diff --git a/backups/channels_20250628_002450.txt.gz b/backups/channels_20250628_002450.txt.gz new file mode 100644 index 0000000..8302ae6 Binary files /dev/null and b/backups/channels_20250628_002450.txt.gz differ diff --git a/comprehensive_cleanup.py b/comprehensive_cleanup.py deleted file mode 100644 index bbb6c85..0000000 --- a/comprehensive_cleanup.py +++ /dev/null @@ -1,260 +0,0 @@ -#!/usr/bin/env python3 -""" -Web Interface: Comprehensive IPTV Repository Cleanup -This script will be run automatically by the workflow -""" - -import os -import shutil -import gzip -from pathlib import Path -from datetime import datetime, timedelta - -def cleanup_repository(): - """Main cleanup function for web interface.""" - print("๐ŸŽฏ IPTV Repository Comprehensive Cleanup") - print("=" * 50) - - root_path = Path.cwd() - cleaned = [] - - print(f"๐Ÿ“ Working in: {root_path}") - print("๐Ÿš€ Starting cleanup...") - - try: - # 1. Create proper directory structure - print("๐Ÿ“ Creating directory structure...") - directories = [ - 'data/archive', - 'reports/logs', 'reports/daily', 'reports/archive', - 'backups/archive', - 'templates' - ] - - for directory in directories: - (root_path / directory).mkdir(parents=True, exist_ok=True) - cleaned.append(f"Created: {directory}/") - - # 2. Clean up backups folder - print("๐Ÿ’พ Cleaning backups folder...") - backups_dir = root_path / 'backups' - - if backups_dir.exists(): - backup_files = sorted(backups_dir.glob('channels_*.txt'), - key=lambda x: x.stat().st_mtime, reverse=True) - - if len(backup_files) > 3: - # Keep 3 most recent, compress the rest - for old_backup in backup_files[3:]: - try: - archive_dir = backups_dir / 'archive' - archive_dir.mkdir(exist_ok=True) - compressed_path = archive_dir / f"{old_backup.stem}.gz" - with open(old_backup, 'rb') as f_in: - with gzip.open(compressed_path, 'wb') as f_out: - shutil.copyfileobj(f_in, f_out) - old_backup.unlink() - cleaned.append(f"Compressed & archived: {old_backup.name}") - except Exception as e: - print(f" Warning: {e}") - - # Compress remaining backups - for backup_file in backups_dir.glob('channels_*.txt'): - try: - compressed_path = backup_file.with_suffix('.txt.gz') - if not compressed_path.exists(): - with open(backup_file, 'rb') as f_in: - with gzip.open(compressed_path, 'wb') as f_out: - shutil.copyfileobj(f_in, f_out) - backup_file.unlink() - cleaned.append(f"Compressed: {backup_file.name}") - except Exception as e: - print(f" Warning: {e}") - - # 3. Organize reports - print("๐Ÿ“‹ Organizing reports...") - reports_dir = root_path / 'reports' - - # Move scattered report files to daily/ - for report_file in reports_dir.glob('playlist_report_*.md'): - try: - daily_dir = reports_dir / 'daily' - daily_dir.mkdir(exist_ok=True) - new_path = daily_dir / report_file.name - shutil.move(str(report_file), str(new_path)) - cleaned.append(f"Moved: {report_file.name} โ†’ reports/daily/") - except Exception as e: - print(f" Warning: {e}") - - # Archive old reports (older than 7 days) - cutoff_date = datetime.now() - timedelta(days=7) - daily_dir = reports_dir / 'daily' - - if daily_dir.exists(): - for report_file in daily_dir.glob('*.md'): - try: - file_date = datetime.fromtimestamp(report_file.stat().st_mtime) - if file_date < cutoff_date: - month_folder = reports_dir / 'archive' / file_date.strftime('%Y-%m') - month_folder.mkdir(parents=True, exist_ok=True) - new_path = month_folder / report_file.name - shutil.move(str(report_file), str(new_path)) - cleaned.append(f"Archived: {report_file.name}") - except Exception as e: - print(f" Warning: {e}") - - # 4. Remove Python cache completely - print("๐Ÿ Removing Python cache...") - for cache_dir in root_path.rglob('__pycache__'): - if cache_dir.is_dir(): - try: - shutil.rmtree(cache_dir) - cleaned.append(f"Removed: {cache_dir.relative_to(root_path)}") - except Exception as e: - print(f" Warning: {e}") - - for pyc_file in list(root_path.rglob('*.pyc')) + list(root_path.rglob('*.pyo')): - try: - pyc_file.unlink() - cleaned.append(f"Removed: {pyc_file.relative_to(root_path)}") - except Exception as e: - print(f" Warning: {e}") - - # 5. Clean scripts folder - print("๐Ÿ”ง Cleaning scripts folder...") - scripts_dir = root_path / 'scripts' - - # Remove scripts/config if it exists and move files to main config - scripts_config = scripts_dir / 'config' - if scripts_config.exists(): - try: - main_config = root_path / 'config' - main_config.mkdir(exist_ok=True) - for config_file in scripts_config.rglob('*'): - if config_file.is_file(): - new_path = main_config / config_file.name - if not new_path.exists(): - shutil.move(str(config_file), str(new_path)) - cleaned.append(f"Moved: {config_file.name} from scripts/config/") - shutil.rmtree(scripts_config) - cleaned.append("Removed: scripts/config/ directory") - except Exception as e: - print(f" Warning: {e}") - - # Ensure __init__.py exists - init_file = scripts_dir / '__init__.py' - if not init_file.exists(): - with open(init_file, 'w') as f: - f.write('# IPTV Scripts Package\n') - cleaned.append("Created: scripts/__init__.py") - - # 6. Clean root directory - print("๐Ÿงน Cleaning root directory...") - - # Remove setup scripts from root - for setup_file in root_path.glob('setup_*.py'): - try: - setup_file.unlink() - cleaned.append(f"Removed: {setup_file.name}") - except Exception as e: - print(f" Warning: {e}") - - # Move log files to proper location - logs_dir = reports_dir / 'logs' - logs_dir.mkdir(exist_ok=True) - - for log_file in root_path.glob('*.log'): - try: - new_path = logs_dir / log_file.name - shutil.move(str(log_file), str(new_path)) - cleaned.append(f"Moved: {log_file.name} โ†’ reports/logs/") - except Exception as e: - print(f" Warning: {e}") - - # Remove temporary files - patterns = ['*_temp*', '*.tmp', '*~', '*.swp', '*.swo'] - for pattern in patterns: - for temp_file in root_path.glob(pattern): - if temp_file.is_file(): - try: - temp_file.unlink() - cleaned.append(f"Removed: {temp_file.name}") - except Exception as e: - print(f" Warning: {e}") - - # 7. Create data snapshot - print("๐Ÿ“Š Creating data snapshot...") - channels_file = root_path / 'channels.txt' - if channels_file.exists(): - try: - today = datetime.now() - data_dir = root_path / 'data' / today.strftime('%Y-%m') - data_dir.mkdir(parents=True, exist_ok=True) - - snapshot_name = f"channels_{today.strftime('%Y%m%d')}.txt" - snapshot_path = data_dir / snapshot_name - - if not snapshot_path.exists(): - shutil.copy2(channels_file, snapshot_path) - cleaned.append(f"Created: data snapshot {snapshot_name}") - except Exception as e: - print(f" Warning: {e}") - - # 8. Remove this cleanup script after running - cleanup_script = root_path / 'comprehensive_cleanup.py' - if cleanup_script.exists(): - try: - cleanup_script.unlink() - cleaned.append("Removed: comprehensive_cleanup.py (cleanup complete)") - except Exception as e: - print(f" Warning: Could not remove cleanup script: {e}") - - print(f"\nโœ… Cleanup complete! Processed {len(cleaned)} items") - - if cleaned: - print("\n๐Ÿ”ง Actions taken:") - for item in cleaned[:10]: # Show first 10 - print(f" โœ… {item}") - if len(cleaned) > 10: - print(f" ... and {len(cleaned) - 10} more items") - - # Repository status - print(f"\n๐Ÿ“Š Repository status:") - try: - total_files = len(list(root_path.rglob('*'))) - repo_size = sum(f.stat().st_size for f in root_path.rglob('*') - if f.is_file() and '.git' not in str(f)) - repo_size_mb = repo_size / (1024 * 1024) - - print(f" ๐Ÿ“ Total files: {total_files}") - print(f" ๐Ÿ’พ Repository size: {repo_size_mb:.1f} MB") - - # Check cleanliness - cache_dirs = len(list(root_path.rglob('__pycache__'))) - temp_files = len(list(root_path.rglob('*.tmp'))) - log_files_root = len(list(root_path.glob('*.log'))) - - print(f" ๐Ÿงน Cache directories: {cache_dirs}") - print(f" ๐Ÿ—‘๏ธ Temp files: {temp_files}") - print(f" ๐Ÿ“‹ Root log files: {log_files_root}") - - if cache_dirs == 0 and temp_files == 0 and log_files_root == 0: - print(" โœ… Repository is now clean!") - else: - print(" ๐ŸŸก Some cleanup items remain") - - except Exception as e: - print(f" Could not calculate stats: {e}") - - return True - - except Exception as e: - print(f"โŒ Error during cleanup: {e}") - return False - -if __name__ == "__main__": - success = cleanup_repository() - if success: - print("\n๐ŸŽ‰ Repository cleanup successful!") - else: - print("\nโš ๏ธ Repository cleanup completed with warnings") \ No newline at end of file diff --git a/reports/playlist_report_20250627_221302.md b/reports/daily/playlist_report_20250627_221302.md similarity index 100% rename from reports/playlist_report_20250627_221302.md rename to reports/daily/playlist_report_20250627_221302.md diff --git a/reports/playlist_report_20250627_222923.md b/reports/daily/playlist_report_20250627_222923.md similarity index 100% rename from reports/playlist_report_20250627_222923.md rename to reports/daily/playlist_report_20250627_222923.md diff --git a/reports/playlist_report_20250627_224445.md b/reports/daily/playlist_report_20250627_224445.md similarity index 100% rename from reports/playlist_report_20250627_224445.md rename to reports/daily/playlist_report_20250627_224445.md diff --git a/reports/playlist_report_20250627_225834.md b/reports/daily/playlist_report_20250627_225834.md similarity index 100% rename from reports/playlist_report_20250627_225834.md rename to reports/daily/playlist_report_20250627_225834.md diff --git a/reports/playlist_report_20250627_230205.md b/reports/daily/playlist_report_20250627_230205.md similarity index 100% rename from reports/playlist_report_20250627_230205.md rename to reports/daily/playlist_report_20250627_230205.md diff --git a/reports/playlist_report_20250628_002450.md b/reports/daily/playlist_report_20250628_002450.md similarity index 100% rename from reports/playlist_report_20250628_002450.md rename to reports/daily/playlist_report_20250628_002450.md diff --git a/reports/daily/report_20250628_011019.md b/reports/daily/report_20250628_011019.md new file mode 100644 index 0000000..57f54c7 --- /dev/null +++ b/reports/daily/report_20250628_011019.md @@ -0,0 +1,4 @@ +# Playlist Report - Sat Jun 28 01:10:19 UTC 2025 +- Channels: 1 +- Size: 4.0K +- Generated: Sat Jun 28 01:10:19 UTC 2025 diff --git a/reports/playlist_report_20250628_011018.md b/reports/playlist_report_20250628_011018.md new file mode 100644 index 0000000..c5a4e81 --- /dev/null +++ b/reports/playlist_report_20250628_011018.md @@ -0,0 +1,19 @@ +# IPTV Playlist Generation Report +**Generated:** 2025-06-28 01:10:18 + +## Summary Statistics +- **Total channels processed:** 2 +- **Valid channels:** 1 +- **Duplicates removed:** 1 +- **New channels imported:** 0 +- **Countries detected:** 1 + +## Channel Distribution by Country +- **๐Ÿ‡ฌ๐Ÿ‡ง United Kingdom:** 1 channels + +## Configuration +- **Remove duplicates:** True +- **Auto country detection:** True +- **Quality detection:** True +- **Adult content filtering:** True +- **Health check enabled:** False diff --git a/scripts/__pycache__/channel_processor.cpython-311.pyc b/scripts/__pycache__/channel_processor.cpython-311.pyc deleted file mode 100644 index 6f8b290..0000000 Binary files a/scripts/__pycache__/channel_processor.cpython-311.pyc and /dev/null differ diff --git a/scripts/__pycache__/config_manager.cpython-311.pyc b/scripts/__pycache__/config_manager.cpython-311.pyc deleted file mode 100644 index 246f45f..0000000 Binary files a/scripts/__pycache__/config_manager.cpython-311.pyc and /dev/null differ diff --git a/scripts/__pycache__/file_manager.cpython-311.pyc b/scripts/__pycache__/file_manager.cpython-311.pyc deleted file mode 100644 index 509b5e8..0000000 Binary files a/scripts/__pycache__/file_manager.cpython-311.pyc and /dev/null differ diff --git a/scripts/__pycache__/health_checker.cpython-311.pyc b/scripts/__pycache__/health_checker.cpython-311.pyc deleted file mode 100644 index 9af5b02..0000000 Binary files a/scripts/__pycache__/health_checker.cpython-311.pyc and /dev/null differ diff --git a/scripts/__pycache__/playlist_builder.cpython-311.pyc b/scripts/__pycache__/playlist_builder.cpython-311.pyc deleted file mode 100644 index 40dbff7..0000000 Binary files a/scripts/__pycache__/playlist_builder.cpython-311.pyc and /dev/null differ diff --git a/scripts/__pycache__/report_generator.cpython-311.pyc b/scripts/__pycache__/report_generator.cpython-311.pyc deleted file mode 100644 index 61fac71..0000000 Binary files a/scripts/__pycache__/report_generator.cpython-311.pyc and /dev/null differ diff --git a/scripts/config/group_overrides.json b/scripts/config/group_overrides.json deleted file mode 100644 index 1e3851b..0000000 --- a/scripts/config/group_overrides.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "example_keyword": "๐Ÿ‡บ๐Ÿ‡ธ United States", - "another_keyword": "๐Ÿ‡ฌ๐Ÿ‡ง United Kingdom" -} \ No newline at end of file diff --git a/scripts/config/patterns.json b/scripts/config/patterns.json deleted file mode 100644 index 7ea4c79..0000000 --- a/scripts/config/patterns.json +++ /dev/null @@ -1,600 +0,0 @@ -{ - "country_patterns": { - "๐Ÿ‡บ๐Ÿ‡ธ United States": [ - "cbs", - "nbc", - "abc", - "fox", - "espn", - "cnn", - "hbo", - " usa", - " us ", - ".us", - "america", - "nfl" - ], - "๐Ÿ‡ฌ๐Ÿ‡ง United Kingdom": [ - "bbc", - "itv", - "sky", - "channel 4", - "e4", - " uk", - ".uk", - "british", - "premier league" - ], - "๐Ÿ‡จ๐Ÿ‡ฆ Canada": [ - "cbc", - "ctv", - "global", - "canada", - "canadian", - " ca ", - ".ca" - ], - "๐Ÿ‡ฉ๐Ÿ‡ช Germany": [ - "ard", - "zdf", - "rtl", - "sat.1", - "pro7", - "germany", - "german", - " de ", - ".de" - ], - "๐Ÿ‡ซ๐Ÿ‡ท France": [ - "tf1", - "france 2", - "m6", - "canal+", - "france", - "french", - " fr ", - ".fr" - ], - "๐Ÿ‡ช๐Ÿ‡ธ Spain": [ - "tve", - "antena 3", - "telecinco", - "spain", - "spanish", - " es ", - ".es" - ], - "๐Ÿ‡ฎ๐Ÿ‡น Italy": [ - "rai", - "mediaset", - "canale 5", - "italy", - "italian", - " it ", - ".it" - ], - "๐Ÿ‡ณ๐Ÿ‡ฑ Netherlands": [ - "npo", - "rtl nl", - "netherlands", - "dutch", - "holland", - " nl ", - ".nl" - ], - "๐Ÿ‡ง๐Ÿ‡ช Belgium": [ - "vtm", - "รฉรฉn", - "canvas", - "belgium", - "belgian", - " be ", - ".be" - ], - "๐Ÿ‡จ๐Ÿ‡ญ Switzerland": [ - "srf", - "rts", - "switzerland", - "swiss", - " ch ", - ".ch" - ], - "๐Ÿ‡ฆ๐Ÿ‡น Austria": [ - "orf", - "austria", - "austrian", - " at ", - ".at" - ], - "๐Ÿ‡ต๐Ÿ‡น Portugal": [ - "rtp", - "sic", - "tvi", - "portugal", - "portuguese", - " pt ", - ".pt" - ], - "๐Ÿ‡ฎ๐Ÿ‡ช Ireland": [ - "rte", - "tg4", - "ireland", - "irish", - " ie ", - ".ie" - ], - "๐Ÿ‡ธ๐Ÿ‡ช Sweden": [ - "svt", - "tv4", - "sweden", - "swedish", - " se ", - ".se" - ], - "๐Ÿ‡ณ๐Ÿ‡ด Norway": [ - "nrk", - "tv 2 no", - "norway", - "norwegian", - " no ", - ".no" - ], - "๐Ÿ‡ฉ๐Ÿ‡ฐ Denmark": [ - "dr", - "tv2 dk", - "denmark", - "danish", - " dk ", - ".dk" - ], - "๐Ÿ‡ซ๐Ÿ‡ฎ Finland": [ - "yle", - "mtv3", - "finland", - "finnish", - " fi ", - ".fi" - ], - "๐Ÿ‡ฎ๐Ÿ‡ธ Iceland": [ - "ruv", - "iceland", - "icelandic", - " is ", - ".is" - ], - "๐Ÿ‡ท๐Ÿ‡บ Russia": [ - "channel one", - "rossiya", - "ntv", - "russia", - "russian", - " ru ", - ".ru" - ], - "๐Ÿ‡ต๐Ÿ‡ฑ Poland": [ - "tvp", - "polsat", - "tvn", - "poland", - "polish", - " pl ", - ".pl" - ], - "๐Ÿ‡จ๐Ÿ‡ฟ Czech Republic": [ - "ct", - "nova", - "prima", - "czech", - " cz ", - ".cz" - ], - "๐Ÿ‡ธ๐Ÿ‡ฐ Slovakia": [ - "rtvs", - "markiza", - "slovakia", - "slovak", - " sk ", - ".sk" - ], - "๐Ÿ‡ญ๐Ÿ‡บ Hungary": [ - "mtv hu", - "rtl klub", - "hungary", - "hungarian", - " hu ", - ".hu" - ], - "๐Ÿ‡บ๐Ÿ‡ฆ Ukraine": [ - "1+1", - "inter", - "ictv", - "ukraine", - "ukrainian", - " ua ", - ".ua" - ], - "๐Ÿ‡ท๐Ÿ‡ด Romania": [ - "tvr", - "pro tv", - "romania", - "romanian", - " ro ", - ".ro" - ], - "๐Ÿ‡ง๐Ÿ‡ฌ Bulgaria": [ - "btv", - "nova bg", - "bulgaria", - "bulgarian", - " bg ", - ".bg" - ], - "๐Ÿ‡ญ๐Ÿ‡ท Croatia": [ - "hrt", - "nova tv hr", - "croatia", - "croatian", - " hr ", - ".hr" - ], - "๐Ÿ‡ท๐Ÿ‡ธ Serbia": [ - "rts", - "pink", - "serbia", - "serbian", - " rs ", - ".rs" - ], - "๐Ÿ‡ฌ๐Ÿ‡ท Greece": [ - "ert", - "mega gr", - "greece", - "greek", - " gr ", - ".gr" - ], - "๐Ÿ‡ง๐Ÿ‡ท Brazil": [ - "globo", - "band", - "sbt", - "brazil", - "brasil", - " br ", - ".br" - ], - "๐Ÿ‡ฆ๐Ÿ‡ท Argentina": [ - "telefe", - "canal 13", - "argentina", - " ar ", - ".ar" - ], - "๐Ÿ‡ฒ๐Ÿ‡ฝ Mexico": [ - "televisa", - "tv azteca", - "mexico", - "mรฉxico", - " mx ", - ".mx" - ], - "๐Ÿ‡จ๐Ÿ‡ฑ Chile": [ - "tvn", - "mega", - "chile", - "chilean", - " cl ", - ".cl" - ], - "๐Ÿ‡จ๐Ÿ‡ด Colombia": [ - "caracol", - "rcn", - "colombia", - "colombian", - " co ", - ".co" - ], - "๐Ÿ‡ต๐Ÿ‡ช Peru": [ - "america tv pe", - "peru", - "peruvian", - " pe ", - ".pe" - ], - "๐Ÿ‡ป๐Ÿ‡ช Venezuela": [ - "venevision", - "venezuela", - "venezuelan", - " ve ", - ".ve" - ], - "๐Ÿ‡จ๐Ÿ‡ณ China": [ - "cctv", - "phoenix", - "china", - "chinese", - " cn ", - ".cn" - ], - "๐Ÿ‡ฏ๐Ÿ‡ต Japan": [ - "nhk", - "fuji", - "tv asahi", - "japan", - "japanese", - " jp ", - ".jp" - ], - "๐Ÿ‡ฐ๐Ÿ‡ท South Korea": [ - "kbs", - "sbs kr", - "mbc kr", - "korea", - "korean", - " kr ", - ".kr" - ], - "๐Ÿ‡ฐ๐Ÿ‡ต North Korea": [ - "kctv", - "north korea", - "dprk" - ], - "๐Ÿ‡น๐Ÿ‡ผ Taiwan": [ - "cts", - "ctv", - "tvbs", - "taiwan", - "taiwanese", - " tw ", - ".tw" - ], - "๐Ÿ‡ญ๐Ÿ‡ฐ Hong Kong": [ - "tvb", - "atv", - "hong kong", - "hongkong", - " hk ", - ".hk" - ], - "๐Ÿ‡น๐Ÿ‡ญ Thailand": [ - "ch3", - "ch7", - "thai pbs", - "thailand", - "thai", - " th ", - ".th" - ], - "๐Ÿ‡ป๐Ÿ‡ณ Vietnam": [ - "vtv", - "htv", - "vietnam", - "vietnamese", - " vn ", - ".vn" - ], - "๐Ÿ‡ฎ๐Ÿ‡ฉ Indonesia": [ - "tvri", - "sctv", - "rcti", - "indonesia", - "indonesian", - " id ", - ".id" - ], - "๐Ÿ‡ฒ๐Ÿ‡พ Malaysia": [ - "tv1", - "tv3", - "astro", - "malaysia", - "malaysian", - " my ", - ".my", - "my:" - ], - "๐Ÿ‡ธ๐Ÿ‡ฌ Singapore": [ - "channel 5", - "channel 8", - "singapore", - " sg ", - ".sg" - ], - "๐Ÿ‡ต๐Ÿ‡ญ Philippines": [ - "abs-cbn", - "gma", - "philippines", - "filipino", - " ph ", - ".ph" - ], - "๐Ÿ‡ฎ๐Ÿ‡ณ India": [ - "star plus", - "zee tv", - "colors", - "sony tv", - "india", - "indian", - "hindi", - " in ", - ".in" - ], - "๐Ÿ‡ต๐Ÿ‡ฐ Pakistan": [ - "ptv", - "geo tv", - "ary", - "pakistan", - "pakistani", - " pk ", - ".pk" - ], - "๐Ÿ‡ง๐Ÿ‡ฉ Bangladesh": [ - "btv", - "channel i", - "bangladesh", - "bangladeshi", - " bd ", - ".bd" - ], - "๐Ÿ‡ฑ๐Ÿ‡ฐ Sri Lanka": [ - "rupavahini", - "sirasa", - "sri lanka", - " lk ", - ".lk" - ], - "๐Ÿ‡ณ๐Ÿ‡ต Nepal": [ - "nepal tv", - "kantipur", - "nepal", - "nepali", - " np ", - ".np" - ], - "๐Ÿ‡ฆ๐Ÿ‡ซ Afghanistan": [ - "rta", - "tolo tv", - "afghanistan", - "afghan", - " af ", - ".af" - ], - "๐Ÿ‡ฆ๐Ÿ‡บ Australia": [ - "abc au", - "seven", - "nine", - "ten", - "australia", - "australian", - "aussie", - " au ", - ".au" - ], - "๐Ÿ‡ณ๐Ÿ‡ฟ New Zealand": [ - "tvnz", - "tvnz 1", - "tvnz 2", - "three nz", - "tvnz duke", - "new zealand", - "kiwi", - " nz ", - ".nz" - ], - "๐Ÿ‡ธ๐Ÿ‡ฆ Arabic": [ - "al jazeera", - "mbc", - "lbc", - "dubai tv", - "arabic", - "arab", - "qatar", - "dubai", - "saudi" - ], - "๐Ÿ‡ฎ๐Ÿ‡ฑ Israel": [ - "kan", - "keshet 12", - "israel", - "israeli", - "hebrew", - " il ", - ".il" - ], - "๐Ÿ‡น๐Ÿ‡ท Turkey": [ - "trt", - "atv", - "kanal d", - "turkey", - "turkish", - " tr ", - ".tr", - "tr |" - ], - "๐Ÿ‡ฎ๐Ÿ‡ท Iran": [ - "irib", - "press tv", - "iran", - "iranian", - "persian", - " ir ", - ".ir" - ], - "๐Ÿ‡ช๐Ÿ‡ฌ Egypt": [ - "nile tv", - "cbc egypt", - "egypt", - "egyptian", - " eg ", - ".eg" - ], - "๐Ÿ‡ฟ๐Ÿ‡ฆ South Africa": [ - "sabc", - "etv", - "mnet", - "south africa", - " za ", - ".za" - ], - "๐Ÿ‡ณ๐Ÿ‡ฌ Nigeria": [ - "nta", - "channels tv", - "nigeria", - "nigerian", - " ng ", - ".ng" - ] - }, - "country_prefixes": { - "๐Ÿ‡บ๐Ÿ‡ฆ Ukraine": [ - "ua |" - ], - "๐Ÿ‡ต๐Ÿ‡ฑ Poland": [ - "pl |" - ], - "๐Ÿ‡น๐Ÿ‡ท Turkey": [ - "tr |" - ], - "๐Ÿ‡ฒ๐Ÿ‡พ Malaysia": [ - "my:", - "my |" - ], - "๐Ÿ‡ฌ๐Ÿ‡ง United Kingdom": [ - "uk:", - "uk |" - ], - "๐Ÿ‡บ๐Ÿ‡ธ United States": [ - "us:", - "us |" - ] - }, - "quality_patterns": { - "4K": [ - "4k", - "uhd", - "2160p" - ], - "FHD": [ - "fhd", - "1080p", - "1080" - ], - "HD": [ - "hd", - "720p", - "720" - ], - "SD": [ - "sd", - "480p", - "360p" - ] - }, - "adult_keywords": [ - "xxx", - "adult", - "porn", - "sex", - "erotic", - "playboy", - "18+" - ] -} \ No newline at end of file diff --git a/scripts/config/settings.json b/scripts/config/settings.json deleted file mode 100644 index fdfbb87..0000000 --- a/scripts/config/settings.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "remove_duplicates": true, - "sort_channels": true, - "backup_before_import": true, - "auto_cleanup_import": true, - "auto_detect_country": true, - "detect_quality": true, - "skip_adult_content": true, - "min_channel_name_length": 2, - "max_workers": 4, - "enable_health_check": false, - "health_check_timeout": 5, - "create_backup": true, - "max_backups": 5, - "log_level": "INFO" -} \ No newline at end of file diff --git a/setup_clean_repo.py b/setup_clean_repo.py deleted file mode 100644 index 2e6b8fe..0000000 --- a/setup_clean_repo.py +++ /dev/null @@ -1,552 +0,0 @@ -#!/usr/bin/env python3 -""" -Complete IPTV Repository Setup & Cleanup -This script will set up all the cleanup automation and organize your repository -""" - -import os -import shutil -import subprocess -from pathlib import Path -from datetime import datetime - -def run_command(cmd, description): - """Run a command and show the result.""" - print(f"๐Ÿ”ง {description}...") - try: - result = subprocess.run(cmd, shell=True, capture_output=True, text=True) - if result.returncode == 0: - print(f" โœ… Success") - return True - else: - print(f" โš ๏ธ Warning: {result.stderr.strip()}") - return False - except Exception as e: - print(f" โŒ Error: {e}") - return False - -def create_file(file_path, content, description): - """Create a file with given content.""" - print(f"๐Ÿ“ Creating {description}...") - try: - file_path.parent.mkdir(parents=True, exist_ok=True) - with open(file_path, 'w', encoding='utf-8') as f: - f.write(content) - print(f" โœ… Created: {file_path}") - return True - except Exception as e: - print(f" โŒ Error creating {file_path}: {e}") - return False - -def main(): - """Set up complete repository cleanup and automation.""" - print("๐ŸŽฏ IPTV Repository Complete Setup") - print("=" * 50) - print("This will set up automated cleanup and organization for your repository") - print() - - root_path = Path.cwd() - - # Check if we're in the right directory - if not (root_path / 'scripts').exists(): - print("โŒ Error: Please run this script from your repository root directory") - print(" (The directory should contain a 'scripts' folder)") - return - - print(f"๐Ÿ“ Working in: {root_path}") - print() - - # Step 1: Create enhanced .gitignore - gitignore_content = """# IPTV Playlist Generator - Enhanced .gitignore - -# ===== PYTHON ===== -__pycache__/ -*.py[cod] -*$py.class -*.so -.Python -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -wheels/ -*.egg-info/ -.installed.cfg -*.egg - -# ===== LOGS & TEMPORARY FILES ===== -*.log -*.tmp -*_temp* -*.backup.* -temp_* -.temp/ - -# Specific log patterns -playlist_update.log -import_*.log -health_check_*.log - -# ===== BACKUP FILES ===== -# Keep backups directory but ignore temporary backups -backups/temp_* -backups/*.tmp -*.backup -*~ - -# ===== DEVELOPMENT & TESTING ===== -.pytest_cache/ -.coverage -htmlcov/ -.tox/ -.nox/ -.cache -nosetests.xml -coverage.xml -*.cover -.hypothesis/ - -# ===== IDE & EDITOR FILES ===== -.vscode/ -.idea/ -*.swp -*.swo -*~ -.DS_Store -Thumbs.db - -# ===== ENVIRONMENT & CONFIG ===== -.env -.env.local -.env.*.local -venv/ -env/ -ENV/ - -# ===== IPTV SPECIFIC ===== -# Temporary import files (keep the main one) -bulk_import_temp.m3u -import_temp_*.m3u -*_processing.m3u - -# Large test files -test_large_*.m3u -sample_*.m3u - -# Generated temporary playlists -playlist_temp.m3u -temp_playlist_*.m3u - -# ===== DOCUMENTATION BUILDS ===== -docs/_build/ -site/ - -# ===== ARCHIVE & COMPRESSED ===== -*.tar.gz -*.zip -*.rar -logs_archive_*.tar.gz - -# ===== SYSTEM FILES ===== -.DS_Store -.DS_Store? -._* -.Spotlight-V100 -.Trashes -ehthumbs.db -Thumbs.db""" - - create_file(root_path / '.gitignore', gitignore_content, "Enhanced .gitignore") - - # Step 2: Create repository health monitor - repo_health_content = '''#!/usr/bin/env python3 -""" -Repository Health Monitor - Simplified for immediate use -""" - -import os -import shutil -import logging -from datetime import datetime, timedelta -from pathlib import Path -import gzip - -class SimpleRepoCleanup: - """Simplified repository cleanup for immediate use.""" - - def __init__(self): - self.root_path = Path.cwd() - self.cleaned_items = [] - - def run_cleanup(self): - """Run complete cleanup.""" - print("๐Ÿงน Starting repository cleanup...") - - # 1. Remove Python cache - self._clean_python_cache() - - # 2. Remove temporary files - self._clean_temp_files() - - # 3. Organize log files - self._organize_logs() - - # 4. Compress old backups - self._compress_backups() - - # 5. Ensure directory structure - self._ensure_directories() - - # 6. Clean import file - self._clean_import_file() - - print(f"\\nโœ… Cleanup complete! {len(self.cleaned_items)} items processed") - - return self.cleaned_items - - def _clean_python_cache(self): - """Remove Python cache files.""" - print(" ๐Ÿ Cleaning Python cache...") - - # Remove __pycache__ directories - for cache_dir in self.root_path.rglob('__pycache__'): - if cache_dir.is_dir(): - try: - shutil.rmtree(cache_dir) - self.cleaned_items.append(f"Removed cache: {cache_dir.relative_to(self.root_path)}") - except Exception: - pass - - # Remove .pyc and .pyo files - for pyc_file in list(self.root_path.rglob('*.pyc')) + list(self.root_path.rglob('*.pyo')): - try: - pyc_file.unlink() - self.cleaned_items.append(f"Removed: {pyc_file.relative_to(self.root_path)}") - except Exception: - pass - - def _clean_temp_files(self): - """Remove temporary files.""" - print(" ๐Ÿ—‘๏ธ Cleaning temporary files...") - - patterns = ['*_temp*', '*.tmp', '*~', '*.swp', '*.swo'] - - for pattern in patterns: - for temp_file in self.root_path.rglob(pattern): - if temp_file.is_file() and '.git' not in str(temp_file): - try: - temp_file.unlink() - self.cleaned_items.append(f"Removed temp: {temp_file.relative_to(self.root_path)}") - except Exception: - pass - - def _organize_logs(self): - """Organize log files.""" - print(" ๐Ÿ“‹ Organizing log files...") - - logs_dir = self.root_path / 'reports' / 'logs' - logs_dir.mkdir(parents=True, exist_ok=True) - - for log_file in self.root_path.glob('*.log'): - try: - new_location = logs_dir / log_file.name - shutil.move(str(log_file), str(new_location)) - self.cleaned_items.append(f"Moved log: {log_file.name} โ†’ reports/logs/") - except Exception: - pass - - def _compress_backups(self): - """Compress old backup files.""" - print(" ๐Ÿ—œ๏ธ Compressing old backups...") - - backup_dir = self.root_path / 'backups' - if backup_dir.exists(): - cutoff_date = datetime.now() - timedelta(days=7) - - for backup_file in backup_dir.glob('*.txt'): - try: - file_date = datetime.fromtimestamp(backup_file.stat().st_mtime) - if file_date < cutoff_date: - # Compress with gzip - with open(backup_file, 'rb') as f_in: - with gzip.open(f"{backup_file}.gz", 'wb') as f_out: - shutil.copyfileobj(f_in, f_out) - backup_file.unlink() - self.cleaned_items.append(f"Compressed: {backup_file.name}") - except Exception: - pass - - def _ensure_directories(self): - """Ensure proper directory structure.""" - print(" ๐Ÿ“ Ensuring directory structure...") - - directories = [ - 'config', - 'backups', - 'reports/logs', - 'reports/archive', - 'templates' - ] - - for directory in directories: - (self.root_path / directory).mkdir(parents=True, exist_ok=True) - - def _clean_import_file(self): - """Clean the import file if needed.""" - print(" ๐Ÿ“ฅ Checking import file...") - - import_file = self.root_path / 'bulk_import.m3u' - if import_file.exists(): - try: - with open(import_file, 'r', encoding='utf-8') as f: - content = f.read().strip() - - lines = content.split('\\n') - if len(lines) > 2 or any('#EXTINF' in line for line in lines): - with open(import_file, 'w', encoding='utf-8') as f: - f.write('#EXTM3U\\n') - self.cleaned_items.append("Cleared bulk_import.m3u (ready for next import)") - except Exception: - pass - -def main(): - """Run the cleanup.""" - cleanup = SimpleRepoCleanup() - cleanup.run_cleanup() - -if __name__ == "__main__": - main() -''' - - create_file(root_path / 'scripts' / 'quick_cleanup.py', repo_health_content, "Quick cleanup script") - - # Step 3: Create the enhanced workflow - workflow_content = """name: Generate M3U Playlist with Auto-Cleanup - -on: - push: - branches: - - main - workflow_dispatch: - -jobs: - build-and-cleanup: - runs-on: ubuntu-22.04 - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - - name: Configure Git - run: | - git config --local user.email "actions@forgejo.plainrock127.xyz" - git config --local user.name "IPTV Playlist Bot" - - - name: Auto-Cleanup Repository - run: | - echo "=== Auto-Cleanup Phase ===" - - # Remove Python cache thoroughly - find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true - find . -name "*.pyc" -delete 2>/dev/null || true - find . -name "*.pyo" -delete 2>/dev/null || true - - # Remove temporary files - find . -name "*_temp*" -type f -delete 2>/dev/null || true - find . -name "*.tmp" -delete 2>/dev/null || true - find . -name "*~" -delete 2>/dev/null || true - - # Clean backup files older than 30 days - find backups -name "*.txt" -type f -mtime +30 -delete 2>/dev/null || true - - # Organize log files - mkdir -p reports/logs reports/archive - find . -maxdepth 1 -name "*.log" -exec mv {} reports/logs/ \\; 2>/dev/null || true - - # Compress old backups (older than 7 days) - find backups -name "*.txt" -type f -mtime +7 -exec gzip {} \\; 2>/dev/null || true - - echo "โœ… Cleanup completed" - - - name: Setup Directories - run: | - echo "=== Directory Setup ===" - mkdir -p config backups reports/logs reports/archive templates - - # Create scripts/__init__.py if missing - if [ ! -f scripts/__init__.py ]; then - echo '# Scripts package' > scripts/__init__.py - fi - - - name: Run Playlist Generation - run: | - echo "=== Playlist Generation ===" - python scripts/generate_playlist.py - - - name: Post-Generation Analysis - run: | - echo "=== Results Analysis ===" - - if [ -f playlist.m3u ]; then - CHANNEL_COUNT=$(grep -c "^#EXTINF" playlist.m3u 2>/dev/null || echo "0") - FILE_SIZE=$(du -h playlist.m3u | cut -f1) - echo "โœ… playlist.m3u: $CHANNEL_COUNT channels ($FILE_SIZE)" - else - echo "โŒ playlist.m3u not generated" - fi - - - name: Final Cleanup & Organization - run: | - echo "=== Final Organization ===" - - # Ensure bulk_import.m3u is clean - if [ -f bulk_import.m3u ]; then - LINE_COUNT=$(wc -l < bulk_import.m3u) - if [ "$LINE_COUNT" -gt 2 ]; then - echo '#EXTM3U' > bulk_import.m3u - echo '' >> bulk_import.m3u - echo "๐Ÿงน Cleaned bulk_import.m3u" - fi - fi - - - name: Commit Changes - run: | - echo "=== Committing Changes ===" - - # Add specific files only - git add bulk_import.m3u || true - git add channels.txt || true - git add playlist.m3u || true - git add scripts/ || true - git add config/ || true - git add reports/ || true - git add backups/*.gz || true - git add templates/ || true - git add .forgejo/ || true - git add README.md || true - git add .gitignore || true - - if ! git diff --staged --quiet; then - CHANNEL_COUNT="0" - if [ -f playlist.m3u ]; then - CHANNEL_COUNT=$(grep -c "^#EXTINF" playlist.m3u 2>/dev/null || echo "0") - fi - - git commit -m "๐Ÿ“บ Updated playlist: $CHANNEL_COUNT channels ($(date '+%Y-%m-%d %H:%M')) - Auto-cleaned" - git push - echo "โœ… Repository updated and cleaned" - else - echo "โ„น๏ธ No changes to commit" - fi""" - - workflow_dir = root_path / '.forgejo' / 'workflows' - create_file(workflow_dir / 'generate-m3u.yml', workflow_content, "Enhanced Forgejo workflow") - - # Step 4: Run immediate cleanup - print("\n" + "=" * 50) - print("๐Ÿงน IMMEDIATE CLEANUP") - print("=" * 50) - - # Import and run the cleanup - import sys - sys.path.insert(0, str(root_path / 'scripts')) - - try: - exec(repo_health_content) - cleanup = SimpleRepoCleanup() - cleaned_items = cleanup.run_cleanup() - except Exception as e: - print(f"Running manual cleanup instead: {e}") - - # Manual cleanup - print("๐Ÿงน Running manual cleanup...") - cleaned_items = [] - - # Remove Python cache - for cache_dir in root_path.rglob('__pycache__'): - if cache_dir.is_dir(): - try: - shutil.rmtree(cache_dir) - cleaned_items.append(f"Removed: {cache_dir.relative_to(root_path)}") - except: - pass - - # Remove temp files - patterns = ['*.pyc', '*.pyo', '*_temp*', '*.tmp', '*~'] - for pattern in patterns: - for file_path in root_path.rglob(pattern): - if file_path.is_file() and '.git' not in str(file_path): - try: - file_path.unlink() - cleaned_items.append(f"Removed: {file_path.relative_to(root_path)}") - except: - pass - - # Organize logs - logs_dir = root_path / 'reports' / 'logs' - logs_dir.mkdir(parents=True, exist_ok=True) - - for log_file in root_path.glob('*.log'): - try: - shutil.move(str(log_file), str(logs_dir / log_file.name)) - cleaned_items.append(f"Moved: {log_file.name} โ†’ reports/logs/") - except: - pass - - # Step 5: Setup git hooks (optional) - print("\n" + "=" * 50) - print("๐Ÿ”ง OPTIONAL GIT SETUP") - print("=" * 50) - - # Check if this is a git repository - if (root_path / '.git').exists(): - print("๐Ÿ“ Setting up git configuration...") - - # Add files to git - run_command("git add .gitignore", "Adding .gitignore") - run_command("git add scripts/quick_cleanup.py", "Adding cleanup script") - run_command("git add .forgejo/workflows/generate-m3u.yml", "Adding enhanced workflow") - - print(" โœ… Files staged for commit") - else: - print(" โ„น๏ธ Not a git repository, skipping git setup") - - # Step 6: Final summary - print("\n" + "=" * 50) - print("โœ… SETUP COMPLETE!") - print("=" * 50) - - print(f"๐Ÿ“Š Summary:") - print(f" - Cleaned {len(cleaned_items)} items") - print(f" - Created enhanced .gitignore") - print(f" - Added quick cleanup script") - print(f" - Updated Forgejo workflow") - print(f" - Organized directory structure") - - print(f"\n๐ŸŽฏ What's New:") - print(f" ๐Ÿ“ reports/logs/ - All logs organized here") - print(f" ๐Ÿงน scripts/quick_cleanup.py - Manual cleanup tool") - print(f" ๐Ÿ”„ Enhanced workflow - Automatic cleanup on push") - print(f" ๐Ÿšซ .gitignore - Prevents future clutter") - - print(f"\n๐Ÿš€ Next Steps:") - print(f" 1. Commit these changes: git commit -m 'Setup automated cleanup'") - print(f" 2. Push to trigger workflow: git push") - print(f" 3. For manual cleanup: python scripts/quick_cleanup.py") - print(f" 4. Your repository will now stay clean automatically!") - - print(f"\n๐ŸŽ‰ Your IPTV repository is now clean and organized!") - -if __name__ == "__main__": - main() \ No newline at end of file