-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathomnianalysis.py
86 lines (58 loc) · 2.54 KB
/
omnianalysis.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
from src.analisisppt import PPTXProcessor
from src.pdfanalysis import PDFProcessor
#from ppttopdf import PPTtoPDFConverter
from src.analisiswiki import WikiAnalysis
from src.scrapingpaginas import WikiAllPageScraper
from src.getdocuments import WikiDownloader
from src.ppttopttx import PPTtoPPTXConverter
import yaml
#Dando los datos de usuario y las rutas descarga todo
#Para cambiar la base de datos, ver el fichero de pineconeupload
def open_file(filepath):
with open(filepath, 'r', encoding='utf-8') as infile:
return infile.read()
#username = open_file('./textos/username_oeg.txt')
#password = open_file('./textos/password_oeg.txt')
with open('config.yaml', 'r') as yaml_file:
config = yaml.safe_load(yaml_file)
username = config["config"]["credentials"]["oeg"]["username"]
password = config["config"]["credentials"]["oeg"]["password"]
libreoffice_path = config["config"]["paths"]["libreoffice"]
paginas_path = "./textos/paginas.txt"
presentaciones_link_path = "./textos/enlaces_presentaciones.txt"
documents_path = "./documentosnexo/"
driver_path = config["config"]["paths"]["driver"]
wiki_urls = [
"https://delicias.dia.fi.upm.es/wiki/index.php/Special:AllPages",
"https://delicias.dia.fi.upm.es/wiki/index.php?title=Special:AllPages&from=Licencias"
]
mi_scraper_all = WikiAllPageScraper(username, password, driver_path, paginas_path)
miWikiAnalysis= WikiAnalysis(username, password, driver_path, paginas_path, presentaciones_link_path)
miWikiDownloader = WikiDownloader(username, password, driver_path, documents_path)
if not mi_scraper_all.login():
print("Error en el inicio de sesión")
else:
print("Inicio de sesión exitoso")
mi_scraper_all.scrape_and_save_urls(wiki_urls)
mi_scraper_all.close()
if not miWikiAnalysis.login():
print("Error en el inicio de sesión")
else:
miWikiAnalysis.scrape_pages()
miWikiAnalysis.close()
if not miWikiDownloader.login():
print("Error en el inicio de sesión")
else:
urls = miWikiDownloader.load_urls_from_file(presentaciones_link_path)
miWikiDownloader.download_files_from_urls(urls)
miWikiDownloader.close()
#miPDFconverter = PPTtoPDFConverter(documents_path)
miPPTXConverter= PPTtoPPTXConverter(documents_path, libreoffice_path)
miPPTXProcessor= PPTXProcessor(documents_path)
miPDFProcessor= PDFProcessor(documents_path)
#miPDFconverter.convert_to_pdf()
#miPDFconverter.close()
miPPTXConverter.convert_to_pttx()
miPPTXProcessor.analyze_and_upload()
miPDFProcessor.analyze_and_upload()
print("\n\nFIN\n\n")