ddg image + layouts

master
funix 3 years ago
parent af85f78f1f
commit 7ef9fd8d01

BIN
layout/.DS_Store vendored

Binary file not shown.

@ -4,7 +4,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="pagedjs_files/interface.css"> <link rel="stylesheet" href="pagedjs_files/interface.css">
<script src="pagedjs_files/paged.polyfill.js"></script> <script src="pagedjs_files/paged.polyfill.js"></script>
<link rel="stylesheet" href="styles/1.css"> <link rel="stylesheet" href="styles/2.css">
<meta charset="utf-8"/> <meta charset="utf-8"/>
<title>Booklet</title> <title>Booklet</title>
</head> </head>

@ -0,0 +1,37 @@
import nltk
with open('speech.txt','r') as result:
r = result.read()
r = r.replace('<span class="interim"></span>','').replace('\n','. ')
l=nltk.word_tokenize(r)
pos = nltk.pos_tag(l)
html = '''
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="pagedjs_files/interface.css">
<script src="pagedjs_files/paged.polyfill.js"></script>
<link rel="stylesheet" href="styles/1.css">
<meta charset="utf-8"/>
<title>Booklet</title>
</head>
<body>
'''
for x in pos:
if x[0] == '.':
html += "<span class='dot'>.</span><br> \n"
else:
html += "<span class='"+x[1]+"'> "+x[0]+"</span>\n"
html += '''</body>
</html>'''
html = html.replace(' .','.').replace(" '", "'")
with open('index.html','w') as index:
index.write(html)

@ -0,0 +1,47 @@
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="pagedjs_files/interface.css">
<script src="pagedjs_files/paged.polyfill.js"></script>
<link rel="stylesheet" href="styles/3.css">
<meta charset="utf-8"/>
<title>Booklet</title>
</head>
<body>
<span>ok let's talk in English for awhile what are we eating</span>
<img src='https://tse3.mm.bing.net/th?id=OIP.URkqiGHddaNVnvoUtMflQQHaF0&pid=Api'>
<span>or not so it is starting again</span>
<img src='https://tse3.mm.bing.net/th?id=OIP.w2KDA__F4lQ1NyTt5FOjIgAAAA&pid=Api'>
<span>ok navigate</span>
<img src='https://tse3.mm.bing.net/th?id=OIF.y9XMU%2b2gdAWMj7VXDE%2ft%2fQ&pid=Api'>
<span>you need to rest sometimes</span>
<img src='https://tse4.mm.bing.net/th?id=OIP.GbFGas-ayDWMUd_9vgedSwHaGO&pid=Api'>
<span>also implemented that implementing</span>
<img src='https://tse3.mm.bing.net/th?id=OIF.GJKQxrJERpdrEixc86Aylg&pid=Api'>
<span>he's a sentence and we are not interested</span>
<img src='https://tse2.mm.bing.net/th?id=OIP.B8V15Vgwb4WSIBCh_DBKAAHaEK&pid=Api'>
<span>remember</span>
<img src='https://tse4.mm.bing.net/th?id=OIP.FIpqGxb0o5Qhs7F6FsmLUwHaJ4&pid=Api'>
<span>so basically sentence</span>
<img src='https://tse4.mm.bing.net/th?id=OIP.R-Aq7zQgyXkEkqHsRpd_fQHaK5&pid=Api'>
<span>where is to go a couple and then you put the adult</span>
<img src='https://tse3.mm.bing.net/th?id=OIP.-zezO3MYsykMDFXKr5BN4gHaFT&pid=Api'>
<span>a bit easier to understand</span>
<img src='https://tse2.mm.bing.net/th?id=OIP.dAOU1dmcC7DcOHjdZWnsOAHaFj&pid=Api'>
<span>actually maybe people just don't just</span>
<img src='https://tse3.mm.bing.net/th?id=OIP.lN80mz6v0-Og5Hy4rBFDBgHaFj&pid=Api'>
<span>I'm just thinking it's not the centres don't put the dot and just put a couple</span>
<img src='https://tse2.mm.bing.net/th?id=OIP.soE-jIhLUlXXcsImI9dSAgHaDE&pid=Api'>
<span>because then</span>
<img src='https://tse4.mm.bing.net/th?id=OIP._isREjX53ak2ahph2VOozgHaIM&pid=Api'>
<span>they are talking they are a booklet but they are not writing</span>
<img src='https://tse2.mm.bing.net/th?id=OIP.-utvaIFVP4SIM9E9Am3efAHaEZ&pid=Api'>
<span>so it is just fine</span>
<img src='https://tse3.mm.bing.net/th?id=OIP.6d-LRDAm986tLKsRdmxAFwHaC_&pid=Api'>
<span>so are you done</span>
<img src='https://tse1.mm.bing.net/th?id=OIF.GUCE7OkP722hk6eZcjJckQ&pid=Api'>
<span>and now is f***** up</span>
<img src='https://tse4.mm.bing.net/th?id=OIP.Z_JLWGz4XfBuc0lzMmTUggHaEQ&pid=Api'>
</body>
</html>

@ -0,0 +1,71 @@
import DuckDuckGoImages as ddg
import os
import shutil
with open('speech.txt','r') as speech:
qq = speech.readlines()
html = ''
html = '''
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="pagedjs_files/interface.css">
<script src="pagedjs_files/paged.polyfill.js"></script>
<link rel="stylesheet" href="styles/3.css">
<meta charset="utf-8"/>
<title>Booklet</title>
</head>
<body>
'''
if os.path.isdir('./images/') is True:
shutil.rmtree('./images/')
os.mkdir('./images/')
for q in qq:
if q == '''<span class="interim"></span>''':
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'<span class="{qBinded}">{q}</span><br><br>'
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"""<span class="{qBinded}">{q}</span>"""
html += f"""<span><img src="./images/{qBinded}.jpg"></span>"""
html += '''</body>
</html>'''
html = html.replace(' .','.').replace(" '", "'")
with open('picindex.html','w') as index:
index.write(html)

@ -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 = '''
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="pagedjs_files/interface.css">
<script src="pagedjs_files/paged.polyfill.js"></script>
<link rel="stylesheet" href="styles/3.css">
<meta charset="utf-8"/>
<title>Booklet</title>
</head>
<body>
'''
for q in qq:
q = q.strip()
if q == '''<span class="interim"></span>''':
continue
q = q.replace("\n","")
qDDG = q.replace(' ','+')
results = search(q, max_results=1)
r = results["results"][0]["thumbnail"]
html += f"""<span> {q} </span>\n"""
html += f"""<img src='{r}'>\n"""
html += '''</body>
</html>'''
html = html.replace(' .','.').replace(" '", "'")
with open('nuovo.html','w') as index:
index.write(html)

@ -28,13 +28,21 @@
} }
body{ body{
font-size: 1.5vw; font-size: 2vw;
text-align: justify; text-align: justify;
text-justify: inter-word; text-justify: inter-word;
line-height: 1.8vw; line-height: 1.8vw;
color: rgb(0,0,0) color: rgb(0,0,0)
} }
span{
color: rgba(0,0,0,0.5)
}
/* .dot{
color: black;
} */
span.CC{ span.CC{
background-color:#333300 background-color:#333300
@ -180,9 +188,6 @@
background-color: #008080 background-color: #008080
} }
.dot{
color: black;
}
/* Rules for everything */ /* Rules for everything */
@ -197,9 +202,7 @@
} }
span{
color: white
}
} }

@ -27,6 +27,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 */ /* Rules for everything */
body{ body{
@ -40,15 +65,7 @@
} }
p{
text-align: left;
font-size: 12px;
line-height: 15.5px;
}
h1{
text-align: center;
}
} }

@ -6,6 +6,7 @@
size: 148mm 210mm; size: 148mm 210mm;
marks: crop cross; marks: crop cross;
bleed: 5mm; bleed: 5mm;
margin: 1cm;
} }
/* Custom font */ /* Custom font */
@ -39,15 +40,16 @@
box-sizing: border-box; box-sizing: border-box;
} }
span{
p{ font-size: 20px;
text-align: left; line-height: 60px;
font-size: 12px;
line-height: 15.5px;
} }
h1{ img {
text-align: center; margin: 0 5px;
height: 50px;
vertical-align:middle;
} }

@ -1,4 +1,3 @@
> rendering css capire cosa e non cosa
> preparare domande x parte teorica > preparare domande x parte teorica
> prep mail da mandare in anticipo con istru git > prep mail da mandare in anticipo con istru git
@ -7,8 +6,10 @@
> prep cose fatte in precedenza da fa vedere > prep cose fatte in precedenza da fa vedere
info su git info su git
vscode vscode
py + nltk py + nltk
console console
chrome :( chrome :(
easybooklet
Loading…
Cancel
Save