diff --git a/canciones-updater.php b/canciones-updater.php new file mode 100644 index 0000000..6d99309 --- /dev/null +++ b/canciones-updater.php @@ -0,0 +1,37 @@ +"; +passthru("$cmd 2>&1", $return_code); +echo ""; + +if ($return_code) { + http_response_code(500); + echo "An error occurred!
See the data below
"; + echo "The return code was $return_code
"; + echo "Command:
$cmd
"; + exit(); +} + +?> + + + + + + +You can see the result here. + + diff --git a/res/static/misa/editor.html b/res/static/misa/editor.html index 6d71f01..f1e26da 100644 --- a/res/static/misa/editor.html +++ b/res/static/misa/editor.html @@ -21,7 +21,6 @@ function changed() { if (lastNum.value) { inputs.push(lastNum) lastNum.name = "song[]" - lastNum.onchange = lastNum.removeAttribute("onchange") lastNum.removeAttribute("onkeyup") lastNum.removeAttribute("id") @@ -44,12 +43,15 @@ function changed() {

Editor

+

Números de las canciones

+

Índice

+
- \ No newline at end of file + diff --git a/res/static/misa/generar.php b/res/static/misa/generar.php deleted file mode 100644 index 7d1aa03..0000000 --- a/res/static/misa/generar.php +++ /dev/null @@ -1,21 +0,0 @@ - diff --git a/res/static/misa/update_index.php b/res/static/misa/update_index.php new file mode 100644 index 0000000..fa46d14 --- /dev/null +++ b/res/static/misa/update_index.php @@ -0,0 +1,24 @@ + + + + + + + +You can see the result here. + + diff --git a/src/create_songbook.py b/src/create_songbook.py index 5a2cc26..68e90c4 100644 --- a/src/create_songbook.py +++ b/src/create_songbook.py @@ -2,14 +2,15 @@ import latex_scanner from os.path import join from django.template import Engine, Context from django.conf import settings +import pickle -def generate_songbook(song_loader, song_numbers, out_file, dj_engine): +def generate_songbook(songs, song_numbers, out_file, dj_engine): # Build the list of songs song_list = [] for n in song_numbers: found = None - for song in song_loader.songs: + for song in songs: if song.number == n: found = song break @@ -32,9 +33,19 @@ def create_argparser(): if __name__ == '__main__': args = create_argparser().parse_args() - loader = latex_scanner.SongLoader(args.latex[0], args.audios[0]) - if args.other_latex: - loader.scan_others(args.other_latex[0], args.other_index[0]) + try: + with open("songs.dat", "rb") as f: + songs = pickle.load(f) + except: + loader = latex_scanner.SongLoader(args.latex[0]) + if args.other_latex: + loader.scan_others(args.other_latex[0], args.other_index[0]) + songs = loader.songs + try: + with open("songs.dat", "wb") as f: + pickle.dump(songs, f) + except: + pass settings.configure(USE_TZ=False, USE_I18N=False) e = Engine(dirs=["res/templates/"]) - generate_songbook(loader, args.songs, join(args.output_dir[0], args.output_file[0]), e) \ No newline at end of file + generate_songbook(songs, args.songs, join(args.output_dir[0], args.output_file[0]), e) diff --git a/src/latex_scanner.py b/src/latex_scanner.py index b6bbe95..26d9f6c 100644 --- a/src/latex_scanner.py +++ b/src/latex_scanner.py @@ -35,12 +35,13 @@ def extra_put(extra, index, the_type, data=None): class SongLoader: - def __init__(self, latex_file, audio_dir): + def __init__(self, latex_file, audio_dir=None): self.index = 1 self.category = None self.categories = [] self.songs = [] - self.audio_dir = audio_dir + if audio_dir: + self.audio_dir = audio_dir self.scan(latex_file) def scan(self, latex_file):