~luisbg/flickbook/trunk

« back to all changes in this revision

Viewing changes to src/flickroll/core.py

  • Committer: Luis de Bethencourt
  • Date: 2008-03-12 11:24:36 UTC
  • Revision ID: bethencourt@gmail.com-20080312112436-7u6qf1ew9hrcjfsc
if network falls flicbook continues and keeps trying

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
import random
21
21
import threading
22
22
import download
 
23
import time
23
24
 
24
25
class FlickRoll(threading.Thread):
25
26
    def __init__(self):
67
68
 
68
69
                self.tag_list = self.flickr_api.tags_getListPhoto(photo_id=self.id)
69
70
                self.search_photo()
 
71
            except IOError:
 
72
                print 'network down'
70
73
            except:
71
74
                self.get_first_photo()
72
75
                self.get_next_photo(filename, size)
73
76
        try:
74
 
            if threading.activeCount() < 3:
 
77
            if threading.activeCount() < 42:
75
78
                threading.Thread(target=get_next_photo_in_thread).start()
76
79
        except:
77
80
            pass
81
84
    flickroll.get_first_photo()
82
85
    for element in (range(42)):
83
86
        flickroll.get_next_photo('%d.jpg' % element, 'large')
 
87
        time.sleep(1)
84
88
        print element