diff --git a/app.py b/app.py index b00d903..d6d5ffa 100644 --- a/app.py +++ b/app.py @@ -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: diff --git a/models.py b/models.py index 1c0787f..83d5b58 100644 --- a/models.py +++ b/models.py @@ -49,7 +49,8 @@ CREATE TABLE IF NOT EXISTS requests ( player_token TEXT NOT NULL UNIQUE, revision_count INTEGER DEFAULT 0, revision_note TEXT, - operator_notes TEXT + operator_notes TEXT, + stems_link TEXT ); CREATE INDEX IF NOT EXISTS idx_requests_status ON requests(status); diff --git a/templates/admin/request.html b/templates/admin/request.html index 9153641..cbf47be 100644 --- a/templates/admin/request.html +++ b/templates/admin/request.html @@ -178,6 +178,20 @@ + + +
Paste a self-hosted file share link (e.g. from Pingvin Share). It will appear on the customer player page once delivered.
+ +Payment recorded. Your files are being prepared.
{% elif req.status == 'delivered' %} -Delivered! Check your email for the MP3 attachment(s).
+Delivered! Check your email for the MP3 attachment(s).
+ {% if req.stems_link %} ++ Download stems / extras ā +
+This link expires 3 months after delivery. Download soon.
+ {% endif %} {% endif %}