Skip to content

Commit

Permalink
add midistream
Browse files Browse the repository at this point in the history
  • Loading branch information
b3b committed Jan 18, 2021
1 parent 09dd550 commit ba7522a
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 1 deletion.
4 changes: 3 additions & 1 deletion buildozer.spec
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ package.domain = me.herethere
# indicate where the source code is living
source.dir = pythonhere
source.include_exts = py,png,kv,rst,rsa,ttf,atlas
#p4a.local_recipes = ../
p4a.local_recipes = ./recipes

# search the version information into the source code
version.regex = __version__ = "(.*)"
Expand Down Expand Up @@ -44,6 +44,8 @@ requirements =
pyjnius==1.3.0,
plyer==2.0.0,
able_recipe,
https://github.com/b3b/midistream/archive/master.zip,
mididriver,
Pillow,
requests==2.24.0,
urllib3==1.25.9,
Expand Down
Empty file added recipes/__init__.py
Empty file.
47 changes: 47 additions & 0 deletions recipes/mididriver/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
from os.path import exists, join, isdir

import sh
from pythonforandroid.logger import shprint, info
from pythonforandroid.recipe import NDKRecipe
from pythonforandroid.util import current_directory


class MididriverRecipe(NDKRecipe):
"""Download and exract Midi Driver compiled libraries."""
name = "mididriver"
generated_libraries = ["libmidi.so"]
url = "https://github.com/b3b/mididriver/releases/download/v{version}/MidiDriver-v{version}.aar"
version = "1.19py31"
sha256sum = "152003f72a8cc6adb77219b1edc4e5a6c7c32bfe853b31ef4d734e847f1f2e73"

def unpack(self, arch):
build_dir = self.get_build_container_dir(arch)
filename = self.versioned_url.split("/")[-1]

with current_directory(build_dir):
directory_name = self.get_build_dir(arch)

if not exists(directory_name) or not isdir(directory_name):
extraction_filename = join(
self.ctx.packages_path, self.name, filename)
try:
sh.unzip(extraction_filename)
except (sh.ErrorReturnCode_1, sh.ErrorReturnCode_2):
# return code 1 means unzipping had
# warnings but did complete,
# apparently happens sometimes with
# github zips
pass
shprint(sh.mv, "jni", directory_name)
else:
info("{} is already unpacked, skipping".format(self.name))

def build_arch(self, arch, *extra_args):
with current_directory(self.get_build_dir(arch.arch)):
self.install_libs(
arch,
join(arch.arch, "libmidi.so"),
)


recipe = MididriverRecipe()

0 comments on commit ba7522a

Please sign in to comment.