Add podgrab featureset

This commit is contained in:
Cody Cook 2025-06-16 23:07:36 -07:00
commit 4527504c80
5 changed files with 71 additions and 11 deletions

View file

@ -79,6 +79,16 @@ def update_podcast(podcast_id, progress_callback=None):
if not episodes:
logger.warning(f"No episodes found for podcast: {podcast.title}")
stats['feed_status'] = 'no_episodes'
else:
# Check if all episodes have download errors
error_episodes = [ep for ep in episodes if ep.get('download_error')]
if len(error_episodes) == len(episodes):
logger.warning(f"All {len(episodes)} episodes have download errors for podcast: {podcast.title}")
stats['feed_status'] = 'all_episodes_have_errors'
# Store the most common error for reporting
if error_episodes:
stats['error_message'] = error_episodes[0].get('download_error', 'Unknown error')
stats['status_code'] = error_episodes[0].get('status_code')
# Check if we need to refresh the feed URL from iTunes
if podcast.external_id:
@ -132,7 +142,9 @@ def update_podcast(podcast_id, progress_callback=None):
episode_number=episode_data.get('episode_number'),
guid=episode_data['guid'],
downloaded=False,
explicit=episode_data.get('explicit') # Explicit flag
explicit=episode_data.get('explicit'), # Explicit flag
download_error=episode_data.get('download_error'), # Error message if download failed
status_code=episode_data.get('status_code') # HTTP status code
)
db.session.add(episode)