mirror of
https://gitlab.com/parroquia-san-leandro/cancionero-web.git
synced 2025-07-11 07:46:59 +02:00
minor corrections and distribution of the generated file
This commit is contained in:
parent
6535d4d7dd
commit
890c2397e3
6 changed files with 85 additions and 31 deletions
|
@ -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)
|
||||
generate_songbook(songs, args.songs, join(args.output_dir[0], args.output_file[0]), e)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue