55 lines
1.6 KiB
Python
Executable File
55 lines
1.6 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
|
|
|
|
# Add src to path so we can import our modules
|
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'src'))
|
|
|
|
from config import 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()
|