3 from optparse
import make_option
5 from mygpo
.decorators
import repeat_on_conflict
6 from mygpo
.data
import delicious
7 from mygpo
.maintenance
.management
.podcastcmd
import PodcastCommand
12 class Command(PodcastCommand
):
14 Adds tags from the webservice delicious.com to podcasts
16 Podcasts are specified either by URL or the --toplist and --random
17 parameter. The delicious webservice is queried for the podcasts' websites.
18 The returned tags are added to the podcasts for the 'delicious' source.
21 def handle(self
, *args
, **options
):
23 fetch_queue
= self
.get_podcasts()
26 if not p
or not p
.link
:
29 # we don't want to spam delicious
33 f
= urllib2
.urlopen(p
.link
)
34 except urllib2
.HTTPError
:
37 tags
= delicious
.get_tags(f
.url
)
39 self
.update(podcast
=p
, tags
=tags
)
42 def update(self
, podcast
, tags
):
43 podcast
.tags
[SOURCE
] = tags