mirror of
https://gitlab.com/parroquia-san-leandro/cancionero-web.git
synced 2025-01-02 22:14:08 +01:00
arreglar audios despues de cambiar los titulos de formato
This commit is contained in:
parent
cb2ced5d52
commit
36db883be7
6 changed files with 9 additions and 22 deletions
4
Makefile
4
Makefile
|
@ -14,11 +14,11 @@ public:
|
||||||
mkdir public
|
mkdir public
|
||||||
|
|
||||||
public/index.html: $(ALL_TEMPLATES) $(PY_SRC)
|
public/index.html: $(ALL_TEMPLATES) $(PY_SRC)
|
||||||
python3 src/latex_scanner.py --latex latex/cancionero.tex --audios audios --other-latex latex/canciones/
|
python3 src/latex_scanner.py --latex latex/cancionero.tex --audios audios/Canciones --other-latex latex/canciones/
|
||||||
|
|
||||||
public/audios: audios public
|
public/audios: audios public
|
||||||
rm -f public/audios
|
rm -f public/audios
|
||||||
ln -s ../audios public/audios
|
ln -s ../audios/Canciones public/audios
|
||||||
|
|
||||||
public/main.css: res/less/main.less res/less/colors.less
|
public/main.css: res/less/main.less res/less/colors.less
|
||||||
lessc $< $@
|
lessc $< $@
|
||||||
|
|
|
@ -14,6 +14,7 @@ h1 {
|
||||||
h2, h3 {
|
h2, h3 {
|
||||||
color: @subtitle;
|
color: @subtitle;
|
||||||
font-weight: lighter;
|
font-weight: lighter;
|
||||||
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
footer {
|
footer {
|
||||||
|
|
|
@ -106,13 +106,12 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% for audio in audios %}
|
{% for audio in song.audios %}
|
||||||
{% if forloop.first %}
|
{% if forloop.first %}
|
||||||
<h3>Audios</h3>
|
<h3>Audios</h3>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div>
|
<div>
|
||||||
Audio del {{ audio.date_text }} <a href="{{ audio.audio_file|urlencode }}"><span>Descargar</span></a>
|
<audio controls style='width: 100%;'>
|
||||||
<audio controls style='width: 100%%;'>
|
|
||||||
<source src='{{ audio.audio_file|urlencode }}' type='audio/mpeg'/>
|
<source src='{{ audio.audio_file|urlencode }}' type='audio/mpeg'/>
|
||||||
</audio>
|
</audio>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -8,7 +8,7 @@ from datetime import datetime
|
||||||
def find_audios(index, audio_dir):
|
def find_audios(index, audio_dir):
|
||||||
"""
|
"""
|
||||||
Finds all audios in a folder that match the given index.
|
Finds all audios in a folder that match the given index.
|
||||||
Audios must be in the format [index]_[YYYY]-[MM]-[DD].mp3
|
Audios must be in the format [index].[songname].mp3
|
||||||
:param index: An integer denoting the song's index
|
:param index: An integer denoting the song's index
|
||||||
:param audio_dir: The directory where the songs can be found
|
:param audio_dir: The directory where the songs can be found
|
||||||
:return: A list of matching Audio objects
|
:return: A list of matching Audio objects
|
||||||
|
@ -16,9 +16,8 @@ def find_audios(index, audio_dir):
|
||||||
res = []
|
res = []
|
||||||
for f in listdir(audio_dir):
|
for f in listdir(audio_dir):
|
||||||
full_file = join(audio_dir, f)
|
full_file = join(audio_dir, f)
|
||||||
re_date_match = re.match(r"^%03d[_ ](\d{4}-[01]\d-[0-3]\d).mp3$" % index, f)
|
re_date_match = re.match(r"^%03d\..*\.mp3$" % index, f)
|
||||||
if not isfile(full_file) or not re_date_match:
|
if not isfile(full_file) or not re_date_match:
|
||||||
continue
|
continue
|
||||||
date = datetime.strptime(re_date_match.group(1), "%Y-%m-%d")
|
res.append(Audio(join("../", full_file)))
|
||||||
res.append(Audio(date, join("../", full_file)))
|
|
||||||
return res
|
return res
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import shutil
|
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.template import Engine, Context
|
from django.template import Engine, Context
|
||||||
|
@ -141,14 +140,6 @@ class SongLoader:
|
||||||
replay_index = 0
|
replay_index = 0
|
||||||
if hasattr(self, "audio_dir"):
|
if hasattr(self, "audio_dir"):
|
||||||
for a in find_audios(self.index, self.audio_dir):
|
for a in find_audios(self.index, self.audio_dir):
|
||||||
a_split = a.audio_file.split("/")
|
|
||||||
renamed_dir = join(join(".", "audios"), "Canciones")
|
|
||||||
new_name = "%03d %s - %s - %s.mp3" % (
|
|
||||||
current_song.number,
|
|
||||||
current_song.name,
|
|
||||||
current_song.author if current_song.author else "-",
|
|
||||||
a.date.strftime("%Y-%m-%d"))
|
|
||||||
shutil.copy2("/".join(a_split[1:]), join(renamed_dir, new_name))
|
|
||||||
current_song.add_audio(a)
|
current_song.add_audio(a)
|
||||||
continue
|
continue
|
||||||
if re.match(r"\\endsong", remain):
|
if re.match(r"\\endsong", remain):
|
||||||
|
|
|
@ -200,10 +200,7 @@ class Chord:
|
||||||
|
|
||||||
|
|
||||||
class Audio:
|
class Audio:
|
||||||
def __init__(self, date, audio_file):
|
def __init__(self, audio_file):
|
||||||
assert isinstance(date, datetime)
|
|
||||||
self.date = date
|
|
||||||
self.date_text = date.strftime("%A %-d de %B del %Y")
|
|
||||||
self.audio_file = audio_file
|
self.audio_file = audio_file
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
|
Loading…
Reference in a new issue