cur.execute(f"""
INSERT INTO critters
- (id, title, album, artist, year, link, info, category, playing, intime, outtime)
+ (id, title, album, tracknumber, artist, year, link, info, category, playing, intime, outtime)
VALUES (
{commit_id},
'{request.form["title"]}',
'{request.form["album"]}',
+ '{request.form["tracknumber"]}',
'{request.form["artist"]}',
'{request.form["year"]}',
'{request.form["link"]}',
else:
if "delete" in request.form:
+
+ for f in [
+ f"{audio_path}{request.form['id']}.mp3",
+ f"{audio_path}{request.form['id']}-front.mp3",
+ f"{audio_path}{request.form['id']}-back.mp3",
+ f"{cover_path}{request.form['id']}.png",
+ f"{icon_path}{request.form['id']}.png",
+ ]:
+ if os.path.exists(f):
+ os.remove(f)
+
cur.execute(f"DELETE FROM critters WHERE id={request.form['id']};")
con.commit()
-
con.close()
+
return ""
else:
UPDATE critters SET
title = '{request.form["title"]}',
album = '{request.form["album"]}',
+ tracknumber = '{request.form["tracknumber"]}',
artist = '{request.form["artist"]}',
year = '{request.form["year"]}',
link = '{request.form["link"]}',
server_data = { # The value for each of the keys is the position in the database columns that peice of data can be found
"id": 0, # (Note 1)
"title": 1,
- "artist": 3,
- "intime": 9,
- "outtime": 10
+ "artist": 4,
+ "intime": 10,
+ "outtime": 11
}
with current_track_id.get_lock(): # Lock for entire function
"id": 0,
"title": "Unknown",
"album": "Unknown",
+ "tracknumber": "1",
"artist": "Unknown",
"year": "Unknown",
"link": "https://treecritters.bandcamp.com",
"id": 0,
"title": "Unknown",
"album": "Unknown",
+ "tracknumber": "1",
"artist": "Unknown",
"year": "Unknown",
"link": "https://treecritters.bandcamp.com",