From d0825fda7155b7d14506abf048d993618194b6cf Mon Sep 17 00:00:00 2001
From: Chris Fulljames
Date: Sun, 18 Jan 2026 14:11:40 -0500
Subject: [PATCH] Add dreams importer UI
---
src/littlesongplace/__init__.py | 5 +-
src/littlesongplace/dreams_importer.py | 15 ++++
.../templates/dreams-importer.html | 62 +++++++++++++
src/littlesongplace/templates/edit-song.html | 87 +++++++++++++------
4 files changed, 141 insertions(+), 28 deletions(-)
create mode 100644 src/littlesongplace/dreams_importer.py
create mode 100644 src/littlesongplace/templates/dreams-importer.html
diff --git a/src/littlesongplace/__init__.py b/src/littlesongplace/__init__.py
index e07807c..abd9426 100644
--- a/src/littlesongplace/__init__.py
+++ b/src/littlesongplace/__init__.py
@@ -11,8 +11,8 @@ from flask import Flask, render_template, request, redirect, g, session, abort,
send_from_directory, flash, get_flashed_messages
from werkzeug.middleware.proxy_fix import ProxyFix
-from . import activity, auth, colors, comments, datadir, db, jams, playlists, \
- profiles, push_notifications, songs, users
+from . import activity, auth, colors, comments, datadir, db, dreams_importer, \
+ jams, playlists, profiles, push_notifications, songs, users
from .logutils import flash_and_log
# Logging
@@ -32,6 +32,7 @@ app.config["MAX_CONTENT_LENGTH"] = 1 * 1024 * 1024 * 1024
app.register_blueprint(activity.bp)
app.register_blueprint(auth.bp)
app.register_blueprint(comments.bp)
+app.register_blueprint(dreams_importer.bp)
app.register_blueprint(jams.bp)
app.register_blueprint(playlists.bp)
app.register_blueprint(profiles.bp)
diff --git a/src/littlesongplace/dreams_importer.py b/src/littlesongplace/dreams_importer.py
new file mode 100644
index 0000000..fcd07cc
--- /dev/null
+++ b/src/littlesongplace/dreams_importer.py
@@ -0,0 +1,15 @@
+from datetime import datetime, timezone
+
+from flask import abort, Blueprint, get_flashed_messages, session, redirect, \
+ render_template, request
+
+from . import db
+from .logutils import flash_and_log
+
+bp = Blueprint("dreams-importer", __name__, url_prefix="/dreams-importer")
+
+@bp.get("")
+@bp.get("/")
+def dreams_importer():
+ return render_template("dreams-importer.html")
+
diff --git a/src/littlesongplace/templates/dreams-importer.html b/src/littlesongplace/templates/dreams-importer.html
new file mode 100644
index 0000000..374e5e0
--- /dev/null
+++ b/src/littlesongplace/templates/dreams-importer.html
@@ -0,0 +1,62 @@
+{% extends "base.html" %}
+{% block title %}Dreams Importer{% endblock %}
+{% block body %}
+
+dreams importer
+
+how it works
+
+The Dreams importer is a script that runs on my PC. It automates interactions
+with littlesong.place, indreams.me, and Dreams running on my PS5.
+
+
+This means that my PC and PS5 need to be turned on and connected for the
+importer to work. Generally, I will try to make sure it runs at least once a
+week (usually on weekends) when there are songs in the import queue. I will
+also make sure to run it the day of the little song jam to upload any jam
+entries.
+
+
+If more than one weekend has passed and it still hasn't run, please send me an
+email at
+littlesongplace@gmail.com.
+
+
+The script performs the following sequence for each song in the queue:
+
+ - Connect to LSP and get the song's InDreams URL
+ - Load the InDreams URL and click the "Play Later" button
+ - Remix the element in Dreams
+ - Play the song without recording to make sure all samples are loaded
+ - Play the song again, recording the audio
+ - Upload the song to LSP
+
+
+
+
+(For the audio nerds: The audio is recorded through a pair of high-quality USB
+audio interfaces, one connected to the PS5 and one to my PC. Both interfaces
+operate at 24 bits/48 kHz. The audio signal gets converted from digital to
+analog and back again, so there will be some inherent losses in this process.
+But in general it should be better than the lossy compressed audio you get from
+most HDMI capture cards or a screen recording.)
+
+
+
+tips for imports
+For best results:
+
+ - Make sure your timeline doesn't loop if it isn't supposed to.
+ - If it is supposed to loop, use the Fade Out option in the
+ importer to fade out the last 10 seconds of the recording.
+ - I have all three audio settings in Dreams turned all the way up. Make
+ sure your song sounds correct in this configuration.
+ - When setting the duration in the importer, make sure to leave enough
+ time for any reverb/effect trails at the end. If in doubt, add extra
+ time - any extra silence at the end will be removed automatically.
+ - Remember that the Dreams timeline's duration timer will be wrong if you
+ use keyframes to change the tempo - make sure to add extra time to
+ compensate.
+
+
+{% endblock %}
diff --git a/src/littlesongplace/templates/edit-song.html b/src/littlesongplace/templates/edit-song.html
index d360ef8..2495139 100644
--- a/src/littlesongplace/templates/edit-song.html
+++ b/src/littlesongplace/templates/edit-song.html
@@ -4,35 +4,49 @@
{% block body %}
-
-Handy Tip:
-If you upload a video (e.g. a PS4/PS5 capture file), the audio will be extracted automatically!
-Most standard audio/video formats are supported - .wav, .mp3, .ogg, .mp4, etc.
-
+{% if song %}Edit Song{% else %}Upload a New Song{% endif %}
{% if song %}