Browse Source

Display player only if song processing is finished

Dashie der otter 1 month ago
parent
commit
e544a7be59
Signed by: Dashie <dashie@sigpipe.me> GPG Key ID: C2D57B325840B755
3 changed files with 11 additions and 2 deletions
  1. 0
    2
      TODO.org
  2. 3
    0
      models.py
  3. 8
    0
      templates/sound/show.jinja2

+ 0
- 2
TODO.org View File

@@ -20,8 +20,6 @@
20 20
 -> profile UPDATE not handled yet (littleboxes don't handle UPDATE) upstream
21 21
 
22 22
 ~~~~~~~~~ VARIOUS ~~~~~~~~~~~~
23
-Also do not show player until processing is done, and waveform done
24
-
25 23
 Check for sentry in:
26 24
  - waitress (web)
27 25
  - celery (workers)

+ 3
- 0
models.py View File

@@ -251,6 +251,9 @@ class Sound(db.Model):
251 251
     def processing_done(self):
252 252
         return self.transcode_state == self.TRANSCODE_DONE
253 253
 
254
+    def is_ready(self):
255
+        return self.processing_done() and self.sound_infos.done_basic
256
+
254 257
 
255 258
 class Album(db.Model):
256 259
     __tablename__ = "album"

+ 8
- 0
templates/sound/show.jinja2 View File

@@ -48,6 +48,7 @@
48 48
     {% endif %}
49 49
 
50 50
 <div class="row">
51
+{% if sound.is_ready() %}
51 52
     <div class="col-lg-7 col-lg-offset-1">
52 53
         <div class="row"><div class="col-lg-12">
53 54
             <div id="waveform"></div>
@@ -77,6 +78,10 @@
77 78
             </p>
78 79
         </div></div>
79 80
     </div>
81
+{%  else %}
82
+    <div class="col-lg-7 col-lg-offset-1"></div>
83
+{% endif %}
84
+
80 85
     <div class="col-lg-3 offset-1">
81 86
         <table class="table table-sm table-hoverable">
82 87
                 <tr>
@@ -152,6 +157,7 @@
152 157
 
153 158
 {% block scripts %}
154 159
     <script>
160
+    {% if sound.is_ready() %}
155 161
     opts = {
156 162
         backend: 'MediaElement',
157 163
         container: '#waveform',
@@ -193,9 +199,11 @@
193 199
         var duration_time = wavesurfer.getDuration();
194 200
         $('#player-time-tot').html(secondsTimeSpanToMS(duration_time));
195 201
     });
202
+    {% endif %}
196 203
 
197 204
     $(function () {
198 205
         $('[data-toggle="popover"]').popover();
199 206
     });
200 207
     </script>
201 208
 {% endblock %}
209
+

Loading…
Cancel
Save