This commit is contained in:
Cody Cook 2025-06-15 21:20:30 -07:00
commit 095bf52a2f
29 changed files with 2494 additions and 758 deletions

View file

@ -15,7 +15,7 @@ def index():
"""
# Get current settings
settings = Settings.query.first()
# If no settings exist, create default settings
if not settings:
settings = Settings(
@ -27,7 +27,7 @@ def index():
)
db.session.add(settings)
db.session.commit()
if request.method == 'POST':
# Update settings
download_path = request.form.get('download_path')
@ -35,7 +35,7 @@ def index():
auto_download = 'auto_download' in request.form
max_downloads = int(request.form.get('max_downloads', 5))
delete_after_days = int(request.form.get('delete_after_days', 30))
# Validate download path
if not os.path.exists(download_path):
try:
@ -45,22 +45,22 @@ def index():
return render_template('settings/index.html',
title='Settings',
settings=settings)
# Update settings
settings.download_path = download_path
settings.naming_format = naming_format
settings.auto_download = auto_download
settings.max_downloads = max_downloads
settings.delete_after_days = delete_after_days
db.session.commit()
# Update application config
current_app.config['DOWNLOAD_PATH'] = download_path
flash('Settings updated successfully!', 'success')
return redirect(url_for('settings.index'))
return render_template('settings/index.html',
title='Settings',
settings=settings)
@ -71,7 +71,7 @@ def naming_preview():
Preview the naming format.
"""
naming_format = request.form.get('naming_format', '')
# Example data for preview
example_data = {
'podcast_title': 'Example Podcast',
@ -79,10 +79,10 @@ def naming_preview():
'published_date': '2023-01-01',
'episode_number': '1'
}
try:
# Format the example data with the naming format
preview = naming_format.format(**example_data)
return {'preview': preview}
except Exception as e:
return {'error': str(e)}
return {'error': str(e)}