Skip to content

Commit a8007ba

Browse files
author
SM_SAYEED
committed
potentially unnecessary routes deleted
1 parent 230739d commit a8007ba

File tree

1 file changed

+0
-44
lines changed

1 file changed

+0
-44
lines changed

app.py

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1598,50 +1598,6 @@ def download(table):
15981598
return send_from_directory(UPLOAD_FOLDER, f"{table}.csv", as_attachment=True)
15991599
##############################################################################################################################################################
16001600

1601-
@app.route('/migrate_csv_to_db')
1602-
def migrate_csv_to_db():
1603-
if not session.get('admin'):
1604-
return "❌ Admin login required", 403
1605-
1606-
import os
1607-
csv_path = '/data/drive_music.csv' if os.path.exists('/data/drive_music.csv') else 'drive_music.csv'
1608-
1609-
try:
1610-
with sqlite3.connect(DB_NAME) as conn:
1611-
c = conn.cursor()
1612-
1613-
# Step 1: Drop and recreate table
1614-
c.execute("DROP TABLE IF EXISTS music_clips")
1615-
c.execute('''
1616-
CREATE TABLE music_clips (
1617-
id INTEGER PRIMARY KEY AUTOINCREMENT,
1618-
filename TEXT,
1619-
title TEXT,
1620-
description TEXT
1621-
)
1622-
''')
1623-
1624-
# Step 2: Insert from CSV
1625-
with open(csv_path, encoding='utf-8') as f:
1626-
reader = csv.DictReader(f)
1627-
for row in reader:
1628-
title = row.get('title', '').strip()
1629-
description = row.get('description', '').strip()
1630-
preview = row.get('preview_url', '').strip()
1631-
download = row.get('download_url', '').strip()
1632-
if preview and download:
1633-
db_value = f"{preview}||{download}"
1634-
c.execute(
1635-
"INSERT INTO music_clips (filename, title, description) VALUES (?, ?, ?)",
1636-
(db_value, title, description)
1637-
)
1638-
1639-
conn.commit()
1640-
return "✅ Table recreated and data loaded from CSV!"
1641-
except Exception as e:
1642-
return f"❌ Error: {e}"
1643-
##############################################################################################################################################################
1644-
16451601
# --- Delete a catalog row (safe for Drive items) ---
16461602
@app.route('/delete_dataset_file/<property_name>/<tab>/<path:filename>', methods=['POST'])
16471603
def delete_dataset_file(property_name, tab, filename):

0 commit comments

Comments
 (0)