- Add Dockerfile, docker-compose.yml, .dockerignore (Issue #11) - Add nginx config with CSP, HSTS, X-Frame-Options, X-Content-Type-Options headers (Issue #14) - Hide server version via server_tokens off, strip x-response-time-ms (Issues #21, #22) - Replace sys.path.insert with proper src.* imports + importlib fallback (Issue #7) - Add config.json.example template (Issue #5)
62 lines
1.8 KiB
Python
Executable File
62 lines
1.8 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""
|
|
Configuration setup script for Episode Matcher.
|
|
Use this to easily set up your TVDB API key.
|
|
"""
|
|
|
|
import sys
|
|
import os
|
|
from pathlib import Path
|
|
|
|
try:
|
|
from src.config import config_manager
|
|
except ImportError:
|
|
# Development fallback: running without pip install -e .
|
|
import importlib
|
|
_src = os.path.join(os.path.dirname(__file__), 'src')
|
|
_spec = importlib.util.spec_from_file_location(
|
|
"config", os.path.join(_src, "config.py"))
|
|
_mod = importlib.util.module_from_spec(_spec)
|
|
_spec.loader.exec_module(_mod)
|
|
config_manager = _mod.config_manager
|
|
|
|
|
|
def main():
|
|
"""Set up configuration interactively."""
|
|
print("=== Episode Matcher Configuration Setup ===\n")
|
|
|
|
config_manager.print_config_status()
|
|
print()
|
|
|
|
# API Key setup
|
|
current_key = config_manager.get_tvdb_api_key()
|
|
if current_key:
|
|
response = input("API key is already configured. Update it? (y/n): ").strip().lower()
|
|
if response not in ['y', 'yes']:
|
|
print("Configuration unchanged.")
|
|
return
|
|
|
|
print("\nTo get a TVDB API key:")
|
|
print("1. Go to https://thetvdb.com/api-information")
|
|
print("2. Create a free account")
|
|
print("3. Generate an API key")
|
|
print()
|
|
|
|
api_key = input("Enter your TVDB API key (or press Enter to skip): ").strip()
|
|
|
|
if api_key:
|
|
if config_manager.update_api_key(api_key):
|
|
print("✓ API key saved successfully!")
|
|
print("\nYou can now use the episode matcher without the --api-key argument:")
|
|
print('python episode_matcher.py "/path/to/episodes" "Show Name" 1')
|
|
else:
|
|
print("✗ Failed to save API key.")
|
|
else:
|
|
print("No API key entered. Mock data will be used.")
|
|
|
|
print("\nConfiguration setup complete!")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|