From 7ef9fd8d01f96a816bdce6d33f231909f0d4f692 Mon Sep 17 00:00:00 2001 From: funix Date: Tue, 5 Oct 2021 23:31:58 +0200 Subject: [PATCH] ddg image + layouts --- layout/.DS_Store | Bin 6148 -> 8196 bytes layout/index.html | 2 +- layout/nltking.py | 37 ++++++++++++++++++++++ layout/nuovo.html | 47 ++++++++++++++++++++++++++++ layout/picDownload.py | 71 ++++++++++++++++++++++++++++++++++++++++++ layout/picLinks.py | 49 +++++++++++++++++++++++++++++ layout/styles/1.css | 17 +++++----- layout/styles/2.css | 35 +++++++++++++++------ layout/styles/3.css | 18 ++++++----- todo.txt | 3 +- 10 files changed, 253 insertions(+), 26 deletions(-) create mode 100644 layout/nltking.py create mode 100644 layout/nuovo.html create mode 100644 layout/picDownload.py create mode 100644 layout/picLinks.py diff --git a/layout/.DS_Store b/layout/.DS_Store index 39297fd14d39b2db26e9722bd9a6828ef62931bf..146a27ca7c6aa70bd1c7f1b144094aa95d3a6673 100644 GIT binary patch literal 8196 zcmeHMO>h)N6n<|BWM=qD2VoMHh^sLIA%XnCCJ4Cs;ZMY%n~(sJWp-ysrktG#JF^=? z3>8X`_*edwT2?9L4J=Q1(1RB(waO~Bq)OD%iw6&0yn3+ob@yz_EO5Ysf=*X;zwUnT zb@zMy&AffH0Dyf(vmKxw02Hd6vZd5qr*J;6*OXW|Q%w{}AHdH}`IA}4%U&ZJO++4u zJP>&x@<8N)$OE^A2PkIqqTC?vOK#Lg9*8{fzw`iqKP0GfnhNQhq~g^<@XKGv7C|hiz*r!&dcsZeZB1RS?RyX_3g-i0zu*RG(LLO<$~& zmJCHv6*a@^XJ)o0J6aN*?On4iiJ4@wttHXbxovhDY+$5+dDtZGa3J$v_Q8Md-SS2s8r*q-YjwhBJc46E_!y7%Wi_fWy&{E?jJ z6!Wg1VYNBK$rT+VuzDRQZJ)9H(ZD(#@ZM41D+K*QaMUJUK9^yv=v$9kq+pk<0aEiB zsu!27j^EX|p|vBqqxZ`46*a7OrKTMvRJehC(zXi2Q??mQ95MWy<(jrTK2oxMJL_0O zu93HDW235ig{`PruGi^n6xOJW7PI!Lq8&_&wbnN1+L%c@9rR4Tn#nFJs^BCVbp06T z^cO5@O+^vY_crO;kWYtYMku(kS<{9dC)hHdw&DleyhYQ89V2Tw%v7aXXP2grl%&Vl zfpD_BN7F}hUOrEz__f#)PVd~M>&N-d4;g+iIBB_bs!wTqVMT*JpeRQ;x7Rf3RE?<( z657Jt##EaesT4Zbz-9`R`(TVvJPFfq9-e_`;dOW$-i6EXA$$U#!x!)+dSEa5bs z!5MrCU%;2}WqbwS#JBJQUcz_qJ^TPal1Gb`pUDU1xZL8$)T;z#_~9^i{Cc2_@7}Zb zUjpT~%On!-ShadxThFVixRSC|L*A#D76c&@5*7z2c@XHoSUWeAD5K`G< z$xUiKDq)#bN$w79mqL(bOC+~f>sR?x#o*?#cL6TK`-Ho%;VPl+C-{Z%_8VcX8fyjC z)?x#$!}Wx>X556WxDAuoLzwHw0m9r~JcN&68i(*OWq0`uQxUb xuq - + Booklet diff --git a/layout/nltking.py b/layout/nltking.py new file mode 100644 index 0000000..847eb89 --- /dev/null +++ b/layout/nltking.py @@ -0,0 +1,37 @@ +import nltk + +with open('speech.txt','r') as result: + r = result.read() + +r = r.replace('','').replace('\n','. ') + +l=nltk.word_tokenize(r) +pos = nltk.pos_tag(l) + +html = ''' + + + + + + + + Booklet + + +''' + +for x in pos: + if x[0] == '.': + html += ".
\n" + else: + html += " "+x[0]+"\n" + + +html += ''' +''' + +html = html.replace(' .','.').replace(" '", "'") + +with open('index.html','w') as index: + index.write(html) diff --git a/layout/nuovo.html b/layout/nuovo.html new file mode 100644 index 0000000..9003f6d --- /dev/null +++ b/layout/nuovo.html @@ -0,0 +1,47 @@ + + + + + + + + + Booklet + + +ok let's talk in English for awhile what are we eating + +or not so it is starting again + +ok navigate + +you need to rest sometimes + +also implemented that implementing + +he's a sentence and we are not interested + +remember + +so basically sentence + +where is to go a couple and then you put the adult + +a bit easier to understand + +actually maybe people just don't just + +I'm just thinking it's not the centres don't put the dot and just put a couple + +because then + +they are talking they are a booklet but they are not writing + +so it is just fine + +so are you done + +and now is f***** up + + + \ No newline at end of file diff --git a/layout/picDownload.py b/layout/picDownload.py new file mode 100644 index 0000000..45ecb0d --- /dev/null +++ b/layout/picDownload.py @@ -0,0 +1,71 @@ +import DuckDuckGoImages as ddg +import os +import shutil + +with open('speech.txt','r') as speech: + qq = speech.readlines() + +html = '' + +html = ''' + + + + + + + + Booklet + + +''' + +if os.path.isdir('./images/') is True: + shutil.rmtree('./images/') + +os.mkdir('./images/') + + +for q in qq: + if q == '''''': + continue + + qDDG = q.replace(' ','+') + qBinded = q.replace(' ','') + print(qDDG) + qBinded = qBinded.replace("\n","") + os.mkdir(f'./images/{qBinded}') + ddg.download(qDDG, folder= f"./images/{qBinded}/", max_urls=10, thumbnails=True) + normalize = os.listdir(f"./images/{qBinded}/") + + print(len(os.listdir(f"./images/{qBinded}/"))) + + if len(os.listdir(f"./images/{qBinded}/")) == 0: + html += f'{q}

' + os.rmdir(f'./images/{qBinded}/') + continue + + + print('NORMALIZE', normalize) + normalize = normalize[0] + + splitExtension = os.path.splitext(normalize) + print('ESTENSIONE', splitExtension) + + + os.rename(f'./images/{qBinded}/{normalize}', f'./images/{qBinded}/{qBinded}') + os.replace(f'./images/{qBinded}/{qBinded}', f'./images/{qBinded}.jpg') + shutil.rmtree(f'./images/{qBinded}/') + + html += f"""{q}""" + html += f"""""" + + + +html += ''' +''' + +html = html.replace(' .','.').replace(" '", "'") + +with open('picindex.html','w') as index: + index.write(html) \ No newline at end of file diff --git a/layout/picLinks.py b/layout/picLinks.py new file mode 100644 index 0000000..2a15c64 --- /dev/null +++ b/layout/picLinks.py @@ -0,0 +1,49 @@ +import DuckDuckGoImages as ddg +from duckduckgo_images_api import search +import os +import shutil + +with open('speech.txt','r') as speech: + qq = speech.readlines() + +html = '' + +html = ''' + + + + + + + + Booklet + + +''' + + + +for q in qq: + q = q.strip() + if q == '''''': + continue + + q = q.replace("\n","") + + qDDG = q.replace(' ','+') + + results = search(q, max_results=1) + r = results["results"][0]["thumbnail"] + + html += f""" {q} \n""" + html += f"""\n""" + + + +html += ''' +''' + +html = html.replace(' .','.').replace(" '", "'") + +with open('nuovo.html','w') as index: + index.write(html) \ No newline at end of file diff --git a/layout/styles/1.css b/layout/styles/1.css index 2628598..fa34b8e 100644 --- a/layout/styles/1.css +++ b/layout/styles/1.css @@ -28,12 +28,20 @@ } body{ - font-size: 1.5vw; + font-size: 2vw; text-align: justify; text-justify: inter-word; line-height: 1.8vw; color: rgb(0,0,0) } + + span{ + color: rgba(0,0,0,0.5) + } + + /* .dot{ + color: black; + } */ span.CC{ @@ -180,9 +188,6 @@ background-color: #008080 } - .dot{ - color: black; - } /* Rules for everything */ @@ -197,9 +202,7 @@ } -span{ - color: white -} + } \ No newline at end of file diff --git a/layout/styles/2.css b/layout/styles/2.css index bbfc119..6086055 100644 --- a/layout/styles/2.css +++ b/layout/styles/2.css @@ -26,6 +26,31 @@ } + + body{ + font-size: 1.5vw; + text-align: justify; + text-justify: inter-word; + line-height: 1.8vw; + /* color: rgb(0,0,0) */ + } + + span{ + color: white + } + + span.CC{ + font-size: 3vw; + color: chartreuse; + } + + span.VB{ + color: black; + } + + .dot{ + color: black; + } /* Rules for everything */ @@ -40,15 +65,7 @@ } - p{ - text-align: left; - font-size: 12px; - line-height: 15.5px; - } - - h1{ - text-align: center; - } + } \ No newline at end of file diff --git a/layout/styles/3.css b/layout/styles/3.css index bbfc119..46f6008 100644 --- a/layout/styles/3.css +++ b/layout/styles/3.css @@ -6,6 +6,7 @@ size: 148mm 210mm; marks: crop cross; bleed: 5mm; + margin: 1cm; } /* Custom font */ @@ -39,16 +40,17 @@ box-sizing: border-box; } - - p{ - text-align: left; - font-size: 12px; - line-height: 15.5px; + span{ + font-size: 20px; + line-height: 60px; } - h1{ - text-align: center; + img { + margin: 0 5px; + height: 50px; + vertical-align:middle; + } - + } \ No newline at end of file diff --git a/todo.txt b/todo.txt index f6b26f6..f43f8bb 100644 --- a/todo.txt +++ b/todo.txt @@ -1,4 +1,3 @@ -> rendering css capire cosa e non cosa > preparare domande x parte teorica > prep mail da mandare in anticipo con istru git @@ -7,8 +6,10 @@ > prep cose fatte in precedenza da fa vedere + info su git vscode py + nltk console chrome :( +easybooklet \ No newline at end of file