def run(self):
        while True:
            url,tone_name= self.q.get()

            doc = pq(url)
            download_url = pq(doc.find("a#xiazai")[0]).attr("href")
            BeanManager.add_bean(bt = "ring_tone" , url = url , filename = tone_name)

            self.q.task_done()
            print "I am robot %s, %s done" %(self.name , tone_name)
Exemple #2
0
 def collect_diary(self,diary_type):
     print "init reader"
     reader = ReaderFactory.getReader(diary_type)
     print "begin reading"
     beans = reader.read()
     bm = BeanManager()
     print "adding beans"
     for b in beans:
         print "adding",b
         bm.add_bean(**b)
def download_tone(url,tone_name):
    doc = pq(url)
    download_url = pq(doc.find("a#xiazai")[0]).attr("href")
    BeanManager.add_bean(bt = "ring_tone" , url = download_url , filename = tone_name)