-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathdefault.py
executable file
·82 lines (65 loc) · 1.81 KB
/
default.py
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
##
## Copyright (C) 2025 Smx <[email protected]>
##
import os
import sys
from csharp.bridge import Bridge
import platform
me = os.path.abspath(os.path.dirname(__file__))
build_dir = os.path.join(me, 'build', 'out')
def getKodiInterop():
return {
'dir' : os.path.join(build_dir, 'bin', 'KodiInterop'),
'file': 'KodiInterop.dll',
}
def getTestPlugin():
return {
'dir' : os.path.join(build_dir, 'bin', 'TestPlugin'),
'file': 'TestPlugin.dll'
}
def getSpeechRecognizerPlugin():
return {
'dir': os.path.join(build_dir, 'bin', 'SpeechRecognizerPlugin'),
'file': 'SpeechRecognizerPlugin.dll'
}
def getClrHost():
return {
'dir': build_dir,
'file': 'CLRHost.{}'.format(getNativeLibSuffix())
}
def getNativeLibSuffix():
if sys.platform.startswith('win'):
return 'dll'
if 'darwin' in sys.platform:
return 'dylib'
return 'so'
def getMonoHost():
return {
'dir': os.path.join('KodiInterop', 'Mono', 'build'),
'file': 'libMonoHost.{}'.format(getNativeLibSuffix())
}
def getPath(me, obj):
publish = 'publish' if len(obj.get('rid', '')) > 0 else ''
return os.path.join(me,
obj.get('dir', ''),
obj.get('arch', ''),
# Debug
obj.get('config', ''),
# netstandard2.0
obj.get('fwk', ''),
obj.get('rid', ''),
publish,
obj.get('file', '')
)
#### Config
use_mono = False
enable_debug = False
assembly_path = getPath(me, getTestPlugin())
#assembly_path = getPath(me, getSpeechRecognizerPlugin())
if use_mono:
lib_path = os.path.join(build_dir, 'lib', 'libMonoHost.{}'.format(getNativeLibSuffix()))
else:
lib_path = os.path.join(build_dir, 'lib', 'libcoreclrhost.{}'.format(getNativeLibSuffix()))
interop_path = getPath(me, getKodiInterop())
bridge = Bridge(lib_path, interop_path, assembly_path, enable_debug)
bridge.run()