Skip to content

Commit ba7522a

Browse files
committed
add midistream
1 parent 09dd550 commit ba7522a

3 files changed

Lines changed: 50 additions & 1 deletion

File tree

buildozer.spec

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ package.domain = me.herethere
1212
# indicate where the source code is living
1313
source.dir = pythonhere
1414
source.include_exts = py,png,kv,rst,rsa,ttf,atlas
15-
#p4a.local_recipes = ../
15+
p4a.local_recipes = ./recipes
1616

1717
# search the version information into the source code
1818
version.regex = __version__ = "(.*)"
@@ -44,6 +44,8 @@ requirements =
4444
pyjnius==1.3.0,
4545
plyer==2.0.0,
4646
able_recipe,
47+
https://github.com/b3b/midistream/archive/master.zip,
48+
mididriver,
4749
Pillow,
4850
requests==2.24.0,
4951
urllib3==1.25.9,

recipes/__init__.py

Whitespace-only changes.

recipes/mididriver/__init__.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
from os.path import exists, join, isdir
2+
3+
import sh
4+
from pythonforandroid.logger import shprint, info
5+
from pythonforandroid.recipe import NDKRecipe
6+
from pythonforandroid.util import current_directory
7+
8+
9+
class MididriverRecipe(NDKRecipe):
10+
"""Download and exract Midi Driver compiled libraries."""
11+
name = "mididriver"
12+
generated_libraries = ["libmidi.so"]
13+
url = "https://github.com/b3b/mididriver/releases/download/v{version}/MidiDriver-v{version}.aar"
14+
version = "1.19py31"
15+
sha256sum = "152003f72a8cc6adb77219b1edc4e5a6c7c32bfe853b31ef4d734e847f1f2e73"
16+
17+
def unpack(self, arch):
18+
build_dir = self.get_build_container_dir(arch)
19+
filename = self.versioned_url.split("/")[-1]
20+
21+
with current_directory(build_dir):
22+
directory_name = self.get_build_dir(arch)
23+
24+
if not exists(directory_name) or not isdir(directory_name):
25+
extraction_filename = join(
26+
self.ctx.packages_path, self.name, filename)
27+
try:
28+
sh.unzip(extraction_filename)
29+
except (sh.ErrorReturnCode_1, sh.ErrorReturnCode_2):
30+
# return code 1 means unzipping had
31+
# warnings but did complete,
32+
# apparently happens sometimes with
33+
# github zips
34+
pass
35+
shprint(sh.mv, "jni", directory_name)
36+
else:
37+
info("{} is already unpacked, skipping".format(self.name))
38+
39+
def build_arch(self, arch, *extra_args):
40+
with current_directory(self.get_build_dir(arch.arch)):
41+
self.install_libs(
42+
arch,
43+
join(arch.arch, "libmidi.so"),
44+
)
45+
46+
47+
recipe = MididriverRecipe()

0 commit comments

Comments
 (0)