Initial commit
This commit is contained in:
commit
e86ab53de5
35 changed files with 2638 additions and 0 deletions
25
init_db.py
Normal file
25
init_db.py
Normal file
|
@ -0,0 +1,25 @@
|
|||
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!")
|
Loading…
Add table
Add a link
Reference in a new issue