Add stems_link support for Pingvin-Share-X delivery
This commit is contained in:
parent
02f1d05301
commit
d02d0b3d25
4 changed files with 48 additions and 4 deletions
27
app.py
27
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:
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -178,6 +178,20 @@
|
|||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- Stems / Extras Link -->
|
||||
<div class="section">
|
||||
<h2>Stems / Extras Link</h2>
|
||||
<p class="copy-hint">Paste a self-hosted file share link (e.g. from Pingvin Share). It will appear on the customer player page once delivered.</p>
|
||||
<form method="POST">
|
||||
<input type="hidden" name="action" value="save_stems_link">
|
||||
<label for="stems_link">Share link</label>
|
||||
<input type="url" id="stems_link" name="stems_link" value="{{ req.stems_link or '' }}" placeholder="https://files.dionysismedia.ca/share/...">
|
||||
<div class="actions">
|
||||
<button type="submit" class="secondary">Save Link</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- RIGHT COLUMN -->
|
||||
|
|
|
|||
|
|
@ -166,7 +166,13 @@
|
|||
{% elif req.status == 'paid' %}
|
||||
<p>Payment recorded. Your files are being prepared.</p>
|
||||
{% elif req.status == 'delivered' %}
|
||||
<p>Delivered! Check your email for the MP3 attachment(s).</p>
|
||||
<p>Delivered! Check your email for the MP3 attachment(s).</p>
|
||||
{% if req.stems_link %}
|
||||
<p style="margin-top:.8rem">
|
||||
<a href="{{ req.stems_link }}" target="_blank" rel="noopener noreferrer" style="display:inline-block;padding:.7rem 1rem;background:#10b981;color:#000;border-radius:.5rem;text-decoration:none;font-weight:700;">Download stems / extras →</a>
|
||||
</p>
|
||||
<p style="font-size:.9rem;color:#9ca3af;">This link expires 3 months after delivery. Download soon.</p>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
|
|
|
|||
Reference in a new issue