Esempio n. 1
0
def create_individual_pdfs(revue):
    path = revue.conf["Paths"]

    # Create front pages for individual actors, if they don't already exist:
    frontpages_list = []

    for actor in revue.actors:
        file_name = "forside-{}.pdf".format(actor.name)
        if not os.path.isfile(os.path.join(path["pdf cache"], file_name)):
            tex = TeX(revue)
            tex.create_frontpage(subtitle=actor.name)
            frontpages_list.append([tex, file_name])

    # Create front pages:
    conv = cv.Converter()
    conv.parallel_textopdf(frontpages_list, outputdir=path["pdf cache"])

    total_list = []
    for actor in revue.actors:
        individual_list = (os.path.join(path["pdf cache"], "forside-{}.pdf".format(actor.name)),
                             os.path.join(path["pdf"],"aktoversigt.pdf"),
                             os.path.join(path["pdf"],"rolleliste.pdf"),
                             actor,
                             os.path.join(path["pdf"],"rekvisitliste.pdf"))
        total_list.append((individual_list,
                           os.path.join(path["individual pdf"],
                                       "{}.pdf".format(actor.name))))

    pdf = PDF()
    pdf.parallel_pdfmerge(total_list)
Esempio n. 2
0
def create_individual_pdfs(revue):
    path = revue.conf["Paths"]

    ## Create front pages for individual actors, if they don't already exist:
    # frontpages_list = []

    # for actor in revue.actors:
    #     file_name = "forside-{}.pdf".format(actor.name)
    #     if not os.path.isfile(os.path.join(path["pdf cache"], file_name)):
    #         tex = TeX(revue)
    #         tex.create_frontpage(subtitle=actor.name)
    #         frontpages_list.append([tex, file_name])

    # Det burde ordne sig selv nu:
    def tex_for_front_page(name):
        tex = TeX(revue)
        tex.create_frontpage(subtitle=name)
        return tex

    frontpages_list = [[
        tex_for_front_page(actor.name), "forside-{}.pdf".format(actor.name)
    ] for actor in revue.actors]

    # Create front pages:
    conv = cv.Converter()
    conv.parallel_textopdf(frontpages_list, outputdir=path["pdf cache"])

    total_list = []
    for actor in revue.actors:
        individual_list = ((os.path.join(path["pdf cache"],
                                         "forside-{}.pdf".format(actor.name)),
                            "Forside"), (os.path.join(path["pdf"],
                                                      "aktoversigt.pdf"),
                                         "Aktoversigt"),
                           (os.path.join(path["pdf"], "rolleliste.pdf"),
                            "Rolleliste"), actor,
                           (os.path.join(path["pdf"],
                                         "kontaktliste.pdf"), "Kontaktliste"))
        total_list.append((individual_list,
                           os.path.join(path["individual pdf"],
                                        "{}.pdf".format(actor.name))))

    pdf = PDF()
    pdf.parallel_pdfmerge(total_list)