File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 4545
4646import minidb
4747
48+ from urllib .parse import urlparse
49+
4850
4951class NoHandlerForURL (Exception ):
5052 pass
@@ -96,6 +98,7 @@ class EpisodeModelFields(minidb.Model):
9698 description_html = str
9799 episode_art_url = str
98100
101+
99102class PodcastModelFields (minidb .Model ):
100103 title = str
101104 url = str
@@ -462,6 +465,19 @@ def update_from_dict(self, episode_dict):
462465 if k in episode_dict :
463466 setattr (self , k , episode_dict [k ])
464467
468+ @property
469+ def art_file (self ):
470+ if self .episode_art_url != None and self .episode_art_url != '' :
471+ filename = self .guid
472+ try :
473+ url = urlparse (self .episode_art_url )
474+ filename = os .path .basename (url .path )
475+ except :
476+ logger .debug ('urlparse failed for episode_art_url: %s' , self .episode_art_url )
477+
478+ return os .path .join (self .podcast .save_dir , filename )
479+ return None
480+
465481
466482class PodcastChannel (PodcastModelFields , PodcastModelMixin ):
467483 _common_prefix = str
You can’t perform that action at this time.
0 commit comments