Add stems_link support for Pingvin-Share-X delivery

This commit is contained in:
Troll (Hermes Agent) 2026-08-04 01:10:15 +00:00
parent 02f1d05301
commit d02d0b3d25
4 changed files with 48 additions and 4 deletions

27
app.py
View file

@ -833,6 +833,11 @@ def admin_request(rid):
flash('Operator notes saved.', 'success')
return redirect(url_for('admin_request', rid=rid))
elif action == 'save_stems_link':
update_request(rid, stems_link=request.form.get('stems_link', '').strip())
flash('Stems share link saved.', 'success')
return redirect(url_for('admin_request', rid=rid))
elif action == 'save_prompt':
# Store the generated title/style/lyrics and mark prompt ready.
update_request(rid,
@ -899,8 +904,26 @@ def admin_request(rid):
if p.exists():
attachments.append((str(p), p.name))
# Compute 3-month expiry date for any stems share link.
from datetime import datetime, timedelta
expiry_date = (datetime.utcnow() + timedelta(days=90)).strftime('%B %d, %Y')
player_link = f"{current_app.config['PUBLIC_BASE_URL']}/play/{req['player_token']}"
body = f"Hi {req['name']},\n\nThanks for your payment! Your selected song(s) are attached to this email.\n\nYou can also keep streaming them here: {player_link}\n\nEnjoy!\n\n{current_app.config['BOOTH_NAME']}"
body_lines = [
f"Hi {req['name']},",
"",
"Thanks for your payment! Your selected song(s) are attached to this email.",
f"You can also keep streaming them here: {player_link}",
"",
"Enjoy!",
"",
f"{current_app.config['BOOTH_NAME']}"
]
if req.get('stems_link'):
body_lines.insert(4, f"Your stems / extras are available here: {req['stems_link']}")
body_lines.insert(5, f"This share link expires on {expiry_date} (3 months from today). Please download before then.")
body_lines.insert(6, "")
body = '\n'.join(body_lines)
try:
send_email(req['email'], 'Your theme song files are here!', body, attachments=attachments, inline_images=build_signature_images())
update_request(rid, delivery_sent_at=now_utc())
@ -1018,7 +1041,7 @@ def admin_settings():
'style_genre', 'extra_requests', 'vocal_gender', 'status', 'suno_title', 'suno_style',
'suno_lyrics', 'song_a_path', 'song_b_path', 'customer_approved',
'approval_notified_at', 'preview_sent_at', 'delivery_sent_at',
'square_payment_ref', 'admin_alert_email', 'player_token', 'revision_note', 'revision_count', 'operator_notes'
'square_payment_ref', 'admin_alert_email', 'player_token', 'revision_note', 'revision_count', 'operator_notes', 'stems_link'
}
health = {'ok': True, 'missing_columns': [], 'message': 'Database schema looks good.'}
try: