def create_apps(book_id):
    """
    Celery queued task that creates tt_apps and tt1 tasks

    :arg book_id: Internet archive book id
    :returns: book indicating if the applications were created
    :rtype: bool

    """

    try:
        imgs = meb_util.get_tt_images(book_id)
        bookInfo = meb_util.get_archive_book_data(book_id)
        
        app_tt_select = Apptt_select(short_name=book_id + "_tt1", title=bookInfo['title'], book_info=bookInfo)
        app_tt_meta = Apptt_meta(short_name=book_id + "_tt2", title=bookInfo['title'])
        app_tt_struct = Apptt_struct(short_name=book_id + "_tt3", title=bookInfo['title'])
        app_tt_transcribe = Apptt_transcribe(short_name=book_id + "_tt4", title=bookInfo['title'])
        
        app_tt_select.add_app_infos(bookInfo)
        app_tt_meta.add_app_infos(bookInfo)
        app_tt_struct.add_app_infos(bookInfo)
        app_tt_transcribe.add_app_infos(bookInfo)
        
        if len(app_tt_select.get_tasks()) == 0:
            for img in imgs:
                task = app_tt_select.add_task(img)
                workflow_transaction_info = dict(task_id_1=task.id, task_id_2=None, task_id_3=None, task_id_4=None)
                data_mngr.record_workflow_transaction(workflow_transaction_info)

        return True

    except Exception as e:
        return False
 def test_get_tt_images_02(self):
     try:
         book_id = "rdi1821balano"
         imgs = meb_util.get_tt_images(book_id)
         
         self.assertTrue(len(imgs), 75)
         
         for i in range(0, 74):
             self.assertEquals(imgs[i]["url_m"], "http://www.archive.org/download/%s/page/n%d_w%d_h%d" % (book_id, i, 550, 700))
             self.assertEquals(imgs[i]["url_b"], "http://www.archive.org/download/%s/page/n%d" % (book_id, i))
         
     except Exception as e:
         print e
         assert False