Ejemplo n.º 1
0
def word2vid(keyword):
    keys = getkeys()
    consumer_key = keys[0]
    consumer_secret = keys[1]
    access_key = keys[2]
    access_secret = keys[3]

    line = keyword
    words = line.split(',')
    q = Queue(words)
    video_num = 0
    print(q.isEmpty())
    print(q.length())
    while not q.isEmpty():
        word = q.items[0]
        image0 = "images/" + str(video_num) + "-%01d.png"
        video = word + ".avi"
        tweets = gettweets(word, consumer_key, consumer_secret, access_key,
                           access_secret)
        makeImages(video_num, tweets)
        video_num = video_num + 1
        subprocess.call(
            ['ffmpeg', '-y', '-framerate', '.1', '-i', image0, video])
        q.queuedown()
    return keyword
Ejemplo n.º 2
0
def build_queue(data_list):
    q = Queue()
    for data in data_list:
        q.enqueue(data)

    q.display()
    print(q.length())
    for i in range(1):
        # print(q.peek())
        q.enqueue(q.dequeue())

    q.display()
Ejemplo n.º 3
0
    def bfs(self):
        queue = Queue()

        queue.add(self.root)

        while(queue.length() > 0):
            p = queue.pop()

            print(p.val),

            if p.left != None:
                queue.add(p.left)

            if p.right != None:
                queue.add(p.right)