Add podgrab featureset
This commit is contained in:
parent
095bf52a2f
commit
233dd5b5c0
33 changed files with 2315 additions and 125 deletions
|
@ -22,6 +22,7 @@ class Podcast(db.Model):
|
|||
auto_download = db.Column(db.Boolean, default=False)
|
||||
naming_format = db.Column(db.String(255), nullable=True) # If null, use global settings
|
||||
episode_ordering = db.Column(db.String(20), default='absolute') # 'absolute' or 'season_episode'
|
||||
tags = db.Column(db.String(512), nullable=True) # Comma-separated list of tags
|
||||
|
||||
# Relationships
|
||||
episodes = db.relationship('Episode', backref='podcast', lazy='dynamic', cascade='all, delete-orphan')
|
||||
|
@ -45,9 +46,49 @@ class Podcast(db.Model):
|
|||
'last_checked': self.last_checked.isoformat() if self.last_checked else None,
|
||||
'auto_download': self.auto_download,
|
||||
'naming_format': self.naming_format,
|
||||
'tags': self.tags.split(',') if self.tags else [],
|
||||
'episode_count': self.episodes.count()
|
||||
}
|
||||
|
||||
def get_tags(self):
|
||||
"""
|
||||
Get the list of tags for this podcast.
|
||||
|
||||
Returns:
|
||||
list: List of tags.
|
||||
"""
|
||||
return [tag.strip() for tag in self.tags.split(',')] if self.tags else []
|
||||
|
||||
def add_tag(self, tag):
|
||||
"""
|
||||
Add a tag to this podcast.
|
||||
|
||||
Args:
|
||||
tag (str): Tag to add.
|
||||
"""
|
||||
if not tag:
|
||||
return
|
||||
|
||||
tags = self.get_tags()
|
||||
if tag not in tags:
|
||||
tags.append(tag)
|
||||
self.tags = ','.join(tags)
|
||||
|
||||
def remove_tag(self, tag):
|
||||
"""
|
||||
Remove a tag from this podcast.
|
||||
|
||||
Args:
|
||||
tag (str): Tag to remove.
|
||||
"""
|
||||
if not tag:
|
||||
return
|
||||
|
||||
tags = self.get_tags()
|
||||
if tag in tags:
|
||||
tags.remove(tag)
|
||||
self.tags = ','.join(tags) if tags else None
|
||||
|
||||
class Episode(db.Model):
|
||||
"""
|
||||
Model representing a podcast episode.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue