25 lines
No EOL
762 B
Python
25 lines
No EOL
762 B
Python
from app.web.app import create_app
|
|
from app.models.database import db
|
|
from app.models.podcast import Podcast, Episode
|
|
from app.models.settings import Settings
|
|
|
|
app = create_app()
|
|
|
|
with app.app_context():
|
|
# Create all tables
|
|
db.create_all()
|
|
|
|
# Check if settings exist, create default if not
|
|
if not Settings.query.first():
|
|
default_settings = Settings(
|
|
download_path=app.config['DOWNLOAD_PATH'],
|
|
naming_format="{podcast_title}/{episode_title}",
|
|
auto_download=False,
|
|
max_downloads=5,
|
|
delete_after_days=30
|
|
)
|
|
db.session.add(default_settings)
|
|
db.session.commit()
|
|
print("Created default settings")
|
|
|
|
print("Database initialized successfully!") |