FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
ScripturesStudio/export.py at main · ReubenInstitute/ScripturesStudio · GitHub
ReubenInstitute
/
ScripturesStudio
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
ScripturesStudio
/
export.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
83 lines (68 loc) · 2.76 KB
Breadcrumbs
ScripturesStudio
/
export.py
Copy path
File metadata and controls
83 lines (68 loc) · 2.76 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/usr/bin/env python3
"""
Export psalm audio and videos.
Run from the Studio/ folder with:
PYTHONPATH=/root/WORK/Libraries:/root/WORK/MediaLibraries:/root/WORK/Scriptures:/root/WORK/StyledScriptures python3 export.py [type] psalm... [--cache]
export.py 8 46 75 --cache all four files of each psalm, the batch
export.py score 117 only the vertical video with music (the smallest one)
export.py library 117 only the landscape video, no music (YouTube)
export.py score-audio 117 only the mp3 with music → output/psalms+/
export.py library-audio 117 only the bare narration mp3 → output/psalms/
Without a type all four are exported. Files are overwritten, unless --cache is
given: then a file that already exists is skipped, so an interrupted batch can
be started again with the same command and continues where it stopped.
Files are written as name.part.ext and renamed when complete, so a file that
exists is a finished one.
"""
import
sys
from
pathlib
import
Path
from
Bible
import
Bible
from
Psalms
import
Psalms
import
Asset
from
Audio
import
PsalmAudio
from
Video
import
PsalmVideo
from
Overlay
import
PsalmCover
import
Media
TYPES
=
(
"score"
,
"library"
,
"score-audio"
,
"library-audio"
)
def
usage
(
message
):
sys
.
exit
(
f"
{
message
}
\n
usage: export.py [
{
'|'
.
join
(
TYPES
)
}
] psalm... [--cache]"
)
def
main
():
args
=
sys
.
argv
[
1
:]
cache
=
"--cache"
in
args
args
=
[
arg
for
arg
in
args
if
arg
!=
"--cache"
]
types
=
TYPES
if
args
and
not
args
[
0
].
isdigit
():
if
args
[
0
]
not
in
TYPES
:
usage
(
f"unknown type '
{
args
[
0
]
}
'"
)
types
=
(
args
.
pop
(
0
),)
if
not
args
:
usage
(
"no psalm numbers"
)
if
not
all
(
arg
.
isdigit
()
and
1
<=
int
(
arg
)
<=
150
for
arg
in
args
):
usage
(
"psalm numbers go from 1 to 150"
)
bible
=
Bible
()
psalms
=
Psalms
(
bible
)
for
num
in
map
(
int
,
args
):
print
(
f"
\n
── Psalm
{
num
}
──"
)
psalm
=
psalms
[
num
-
1
]
if
"score-audio"
in
types
or
"library-audio"
in
types
:
PsalmCover
(
psalm
,
Media
.
SD
).
export
()
items
=
[]
for
music
,
folder
in
((
False
,
Asset
.
LIBRARY_AUDIO_FOLDER
), (
True
,
Asset
.
SCORE_AUDIO_FOLDER
)):
audio
=
PsalmAudio
(
psalm
,
music
=
music
)
items
.
append
((
"score-audio"
if
music
else
"library-audio"
,
"Score audio"
if
music
else
"Library audio"
,
Path
(
folder
)
/
f"
{
audio
.
basename
}
.mp3"
,
audio
))
library
=
PsalmVideo
(
psalm
,
size
=
Media
.
HDH
)
score
=
PsalmVideo
(
psalm
,
size
=
Media
.
SDV
,
music
=
True
)
items
.
append
((
"library"
,
"Library H"
,
library
.
filename
,
library
))
items
.
append
((
"score"
,
"Score V"
,
score
.
filename
,
score
))
for
type
,
name
,
filename
,
item
in
items
:
if
type
not
in
types
:
continue
if
cache
and
Path
(
filename
).
exists
():
print
(
f"
{
name
}
already exists, skipping"
)
continue
print
(
f" Generating
{
name
}
…"
)
item
.
export
()
print
(
"
\n
✅ Export complete."
)
if
__name__
==
"__main__"
:
main
()
Back
|
FazBrowse Home
|
New Git URL