我正在尝试开发一个用于音频指纹处理的Flutter应用程序。我正在使用Starflut来进行Python集成。这里是一个简单的示例:
//python file for using from dart
def tt(a,b) :
print (a, b)
return 666,777
g1 = 123
def yy(a,b,z) :
print(a,b,z)
return {'jack': 4098, 'sape': 4139}
class Multiply :
def __init__(self):
pass
def multiply(self, a,b):
print("multiply....",a,b)
return a * b
//dart code which uses python
void _initStarCore() async {
StarCoreFactory starcore = await Starflut.getFactory();
StarServiceClass service = await starcore.initSimple("test", "123", 0, 0, []);
srvGroup = await service["_ServiceGroup"];
bool isAndroid = await Starflut.isAndroid();
if (isAndroid == true) {
String libraryDir = await Starflut.getNativeLibraryDir();
String docPath = await Starflut.getDocumentPath();
if (libraryDir.indexOf("arm64") > 0) {
Starflut.unzipFromAssets("lib-dynload-arm64.zip", docPath, true);
} else if (libraryDir.indexOf("x86_64") > 0) {
Starflut.unzipFromAssets("lib-dynload-x86_64.zip", docPath, true);
} else if (libraryDir.indexOf("arm") > 0) {
Starflut.unzipFromAssets("lib-dynload-armeabi.zip", docPath, true);
} else {
Starflut.unzipFromAssets("lib-dynload-x86.zip", docPath, true);
}
await Starflut.copyFileFromAssets("python3.6.zip",
"flutter_assets/starfiles", null);
}
await srvGroup.initRaw("python36", service);
String resPath = await Starflut.getResourcePath();
srvGroup.loadRawModule("python", "",
resPath + "/flutter_assets/starfiles/" + "testpy.py", false);
dynamic python = await service.importRawContext("python", "", false, "");
StarObjectClass retobj = await python.call("tt", ["hello ", "world"]);
print(await retobj[0]);
print(await retobj[1]);
print(await python["g1"]);
StarObjectClass yy = await python.call("yy", ["hello ", "world", 123]);
print(await yy.call("__len__",[]));
StarObjectClass multiply = await service.importRawContext("python", "Multiply", true, "");
StarObjectClass multiply_inst = await multiply.newObject(["", "", 33, 44]);
print(await multiply_inst.getString());
print(await multiply_inst.call("multiply", [11, 22]));
await srvGroup.clearService();
await starcore.moduleExit();
}
现在我需要导入Python库Dejavu进行音频指纹识别,但我不知道该如何做。Starflut文档或其存储库中的问题中都没有任何关于此的信息。
有人遇到过同样的问题吗?或者也许有人有任何建议可以尝试解决它吗?
对于错误,抱歉,希望文本是可理解的:) 英语不是我的母语。