Compare commits

...

2 Commits

Author SHA1 Message Date
Santi 168a2a9984 Merge branch 'main' of https://git.ieslamar.org/Santi/ProyectoFinalPython 2025-01-28 17:37:43 +01:00
Santi d8ed58b5b2 update 2025-01-28 17:34:41 +01:00
21 changed files with 40 additions and 21 deletions

View File

@ -2,9 +2,10 @@
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.venv" />
<excludeFolder url="file://$MODULE_DIR$/venv" />
</content>
<orderEntry type="jdk" jdkName="Python 3.13 (pythonProject)" jdkType="Python SDK" />
<orderEntry type="jdk" jdkName="Python 3.13 (Final)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="PyDocumentationSettings">

View File

@ -3,5 +3,5 @@
<component name="Black">
<option name="sdkName" value="Python 3.11.2 WSL (Debian): (/home/santi/.virtualenvs/Final/bin/python)" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.13 (pythonProject)" project-jdk-type="Python SDK" />
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.13 (Final)" project-jdk-type="Python SDK" />
</project>

View File

@ -152,7 +152,7 @@ frame_right.rowconfigure(0, weight=3)
frame_right.rowconfigure(1, weight=1)
frame_right.columnconfigure(0, weight=1)
# Create and place the chat frame and music player tab
# Create and place the chat frame and music player tab update
chat_frame = ChatTab(frame_chat, chat_server_url=config_manager.config["Chat"]["server"],
sender_name=config_manager.config["Chat"]["name"],
stop_event=stop_event, width=200, bg="lightgreen", refresh_rate=1)

View File

@ -33,25 +33,43 @@ class WebScrapingTab(ThreadedTab):
self.data_listbox.pack(pady=10)
def create_database(self):
# Connect to MySQL database
conn = mysql.connector.connect(
host="127.0.0.1 ",
user="santipy",
password="1234",
database="scraping_db"
)
cursor = conn.cursor()
try:
# Conectar sin especificar la base de datos
conn = mysql.connector.connect(
host="127.0.0.1",
user="santipy",
password="1234"
)
cursor = conn.cursor()
# Crear la tabla si no existe
cursor.execute("""
CREATE TABLE IF NOT EXISTS scraped_data (
id INT AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(255),
link TEXT
)
""")
conn.commit()
return conn
# Crear la base de datos si no existe
cursor.execute("CREATE DATABASE IF NOT EXISTS scraping_db CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci")
conn.commit()
# Conectar a la base de datos
conn = mysql.connector.connect(
host="127.0.0.1",
user="santipy",
password="1234",
database="scraping_db"
)
# Crear la tabla si no existe
cursor = conn.cursor()
cursor.execute("""
CREATE TABLE IF NOT EXISTS scraped_data (
id INT AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(255),
link TEXT
)
""")
conn.commit()
return conn
except mysql.connector.Error as err:
print(f"Error al conectar o crear la base de datos: {err}")
messagebox.showerror("Database Error", f"Error al conectar o crear la base de datos: {err}")
return None
def save_to_database(self):