Initial commit
This commit is contained in:
commit
e86ab53de5
35 changed files with 2638 additions and 0 deletions
33
app/models/settings.py
Normal file
33
app/models/settings.py
Normal file
|
@ -0,0 +1,33 @@
|
|||
"""
|
||||
Settings model for Podcastrr.
|
||||
"""
|
||||
from app.models.database import db
|
||||
|
||||
class Settings(db.Model):
|
||||
"""
|
||||
Model representing application settings.
|
||||
"""
|
||||
__tablename__ = 'settings'
|
||||
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
download_path = db.Column(db.String(512), nullable=False)
|
||||
naming_format = db.Column(db.String(255), nullable=False, default="{podcast_title}/{episode_title}")
|
||||
auto_download = db.Column(db.Boolean, default=False)
|
||||
max_downloads = db.Column(db.Integer, default=5)
|
||||
delete_after_days = db.Column(db.Integer, default=30)
|
||||
|
||||
def __repr__(self):
|
||||
return f'<Settings id={self.id}>'
|
||||
|
||||
def to_dict(self):
|
||||
"""
|
||||
Convert settings to dictionary for API responses.
|
||||
"""
|
||||
return {
|
||||
'id': self.id,
|
||||
'download_path': self.download_path,
|
||||
'naming_format': self.naming_format,
|
||||
'auto_download': self.auto_download,
|
||||
'max_downloads': self.max_downloads,
|
||||
'delete_after_days': self.delete_after_days
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue