sdk 0.63.0. add dht enabled flag.
This commit is contained in:
parent
c2a2ca2167
commit
09b5b8f78c
7 changed files with 28 additions and 14 deletions
|
@ -39,7 +39,7 @@ version.filename = %(source.dir)s/main.py
|
||||||
|
|
||||||
# (list) Application requirements
|
# (list) Application requirements
|
||||||
# comma seperated e.g. requirements = sqlite3,kivy
|
# comma seperated e.g. requirements = sqlite3,kivy
|
||||||
requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, prometheus_client==0.7.1, "git+https://github.com/lbryio/lbry-sdk@v0.62.0#egg=lbry"
|
requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, prometheus_client==0.7.1, "git+https://github.com/lbryio/lbry-sdk@v0.63.0#egg=lbry"
|
||||||
|
|
||||||
# (str) Custom source folders for requirements
|
# (str) Custom source folders for requirements
|
||||||
# Sets custom source for any requirements with recipes
|
# Sets custom source for any requirements with recipes
|
||||||
|
|
|
@ -39,7 +39,7 @@ version.filename = %(source.dir)s/main.py
|
||||||
|
|
||||||
# (list) Application requirements
|
# (list) Application requirements
|
||||||
# comma seperated e.g. requirements = sqlite3,kivy
|
# comma seperated e.g. requirements = sqlite3,kivy
|
||||||
requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, prometheus_client==0.7.1, "git+https://github.com/lbryio/lbry-sdk@v0.62.0#egg=lbry"
|
requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, prometheus_client==0.7.1, "git+https://github.com/lbryio/lbry-sdk@v0.63.0#egg=lbry"
|
||||||
|
|
||||||
# (str) Custom source folders for requirements
|
# (str) Custom source folders for requirements
|
||||||
# Sets custom source for any requirements with recipes
|
# Sets custom source for any requirements with recipes
|
||||||
|
|
|
@ -39,7 +39,7 @@ version.filename = %(source.dir)s/main.py
|
||||||
|
|
||||||
# (list) Application requirements
|
# (list) Application requirements
|
||||||
# comma seperated e.g. requirements = sqlite3,kivy
|
# comma seperated e.g. requirements = sqlite3,kivy
|
||||||
requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, prometheus_client==0.7.1, "git+https://github.com/lbryio/lbry-sdk@v0.62.0#egg=lbry"
|
requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, prometheus_client==0.7.1, "git+https://github.com/lbryio/lbry-sdk@v0.63.0#egg=lbry"
|
||||||
|
|
||||||
# (str) Custom source folders for requirements
|
# (str) Custom source folders for requirements
|
||||||
# Sets custom source for any requirements with recipes
|
# Sets custom source for any requirements with recipes
|
||||||
|
|
|
@ -39,7 +39,7 @@ version.filename = %(source.dir)s/main.py
|
||||||
|
|
||||||
# (list) Application requirements
|
# (list) Application requirements
|
||||||
# comma seperated e.g. requirements = sqlite3,kivy
|
# comma seperated e.g. requirements = sqlite3,kivy
|
||||||
requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, prometheus_client==0.7.1, "git+https://github.com/lbryio/lbry-sdk@v0.62.0#egg=lbry"
|
requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13.3, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, defusedxml, git+https://github.com/lbryio/aioupnp.git@ab7ef0048bbce6404e463d20e8a15046ea6941f0#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, prometheus_client==0.7.1, "git+https://github.com/lbryio/lbry-sdk@v0.63.0#egg=lbry"
|
||||||
|
|
||||||
# (str) Custom source folders for requirements
|
# (str) Custom source folders for requirements
|
||||||
# Sets custom source for any requirements with recipes
|
# Sets custom source for any requirements with recipes
|
||||||
|
|
|
@ -74,10 +74,12 @@ public final class LbrynetService extends PythonService {
|
||||||
|
|
||||||
public static LbrynetService serviceInstance;
|
public static LbrynetService serviceInstance;
|
||||||
|
|
||||||
|
private static boolean DHTEnabled;
|
||||||
|
|
||||||
private static final int SDK_POLL_INTERVAL = 1000; // 1 second
|
private static final int SDK_POLL_INTERVAL = 1000; // 1 second
|
||||||
|
|
||||||
private PendingIntent pendingContextIntent;
|
private PendingIntent pendingContextIntent;
|
||||||
|
|
||||||
private BroadcastReceiver stopServiceReceiver;
|
private BroadcastReceiver stopServiceReceiver;
|
||||||
|
|
||||||
private BroadcastReceiver downloadReceiver;
|
private BroadcastReceiver downloadReceiver;
|
||||||
|
@ -134,28 +136,28 @@ public final class LbrynetService extends PythonService {
|
||||||
};
|
};
|
||||||
registerReceiver(downloadReceiver, downloadFilter);
|
registerReceiver(downloadReceiver, downloadFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPendingContextIntent(PendingIntent pendingIntent) {
|
public void setPendingContextIntent(PendingIntent pendingIntent) {
|
||||||
this.pendingContextIntent = pendingIntent;
|
this.pendingContextIntent = pendingIntent;
|
||||||
|
|
||||||
// update the notification with the context intent
|
// update the notification with the context intent
|
||||||
Notification notification = buildNotification();
|
Notification notification = buildNotification();
|
||||||
NotificationManager notificationManager =
|
NotificationManager notificationManager =
|
||||||
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||||
notificationManager.notify(1, notification);
|
notificationManager.notify(1, notification);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Notification buildNotification() {
|
private Notification buildNotification() {
|
||||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(this, NOTIFICATION_CHANNEL_ID);
|
NotificationCompat.Builder builder = new NotificationCompat.Builder(this, NOTIFICATION_CHANNEL_ID);
|
||||||
if (pendingContextIntent != null) {
|
if (pendingContextIntent != null) {
|
||||||
builder.setContentIntent(pendingContextIntent);
|
builder.setContentIntent(pendingContextIntent);
|
||||||
}
|
}
|
||||||
|
|
||||||
Intent stopIntent = new Intent(ACTION_STOP_SERVICE);
|
Intent stopIntent = new Intent(ACTION_STOP_SERVICE);
|
||||||
PendingIntent stopPendingIntent = PendingIntent.getBroadcast(this, 0, stopIntent, 0);
|
PendingIntent stopPendingIntent = PendingIntent.getBroadcast(this, 0, stopIntent, 0);
|
||||||
|
|
||||||
String serviceDescription = "The LBRY service is running in the background.";
|
String serviceDescription = "The LBRY service is running in the background.";
|
||||||
Notification notification = builder.setColor(ContextCompat.getColor(this, R.color.lbryGreen))
|
Notification notification = builder.setColor(ContextCompat.getColor(this, R.color.lbryGreen))
|
||||||
.setContentText(serviceDescription)
|
.setContentText(serviceDescription)
|
||||||
.setGroup(GROUP_SERVICE)
|
.setGroup(GROUP_SERVICE)
|
||||||
.setWhen(System.currentTimeMillis())
|
.setWhen(System.currentTimeMillis())
|
||||||
|
@ -568,4 +570,12 @@ public final class LbrynetService extends PythonService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setDHTEnabled(boolean enabled) {
|
||||||
|
DHTEnabled = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isDHTEnabled() {
|
||||||
|
return DHTEnabled;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,8 @@ log = logging.getLogger(__name__)
|
||||||
log.setLevel(logging.DEBUG)
|
log.setLevel(logging.DEBUG)
|
||||||
|
|
||||||
lbrynet_android_utils = autoclass('io.lbry.lbrysdk.Utils')
|
lbrynet_android_utils = autoclass('io.lbry.lbrysdk.Utils')
|
||||||
service = autoclass('io.lbry.lbrysdk.LbrynetService').serviceInstance
|
service_class = autoclass('io.lbry.lbrysdk.LbrynetService')
|
||||||
|
service = service_class.serviceInstance
|
||||||
platform.platform = lambda: 'Android %s (API %s)' % (lbrynet_android_utils.getAndroidRelease(), lbrynet_android_utils.getAndroidSdk())
|
platform.platform = lambda: 'Android %s (API %s)' % (lbrynet_android_utils.getAndroidRelease(), lbrynet_android_utils.getAndroidSdk())
|
||||||
build_info.BUILD = 'dev' if lbrynet_android_utils.isDebug() else 'release'
|
build_info.BUILD = 'dev' if lbrynet_android_utils.isDebug() else 'release'
|
||||||
|
|
||||||
|
@ -76,13 +77,16 @@ def start():
|
||||||
keyring.set_keyring(LbryAndroidKeyring())
|
keyring.set_keyring(LbryAndroidKeyring())
|
||||||
private_storage_dir = lbrynet_android_utils.getAppInternalStorageDir(service.getApplicationContext())
|
private_storage_dir = lbrynet_android_utils.getAppInternalStorageDir(service.getApplicationContext())
|
||||||
configured_download_dir = lbrynet_android_utils.getConfiguredDownloadDirectory(service.getApplicationContext())
|
configured_download_dir = lbrynet_android_utils.getConfiguredDownloadDirectory(service.getApplicationContext())
|
||||||
|
components_to_skip = []
|
||||||
|
if not service_class.isDHTEnabled():
|
||||||
|
components_to_skip = [DHT_COMPONENT, HASH_ANNOUNCER_COMPONENT, PEER_PROTOCOL_SERVER_COMPONENT]
|
||||||
|
|
||||||
conf = Config(
|
conf = Config(
|
||||||
data_dir=f'{private_storage_dir}/lbrynet',
|
data_dir=f'{private_storage_dir}/lbrynet',
|
||||||
wallet_dir=f'{private_storage_dir}/lbryum',
|
wallet_dir=f'{private_storage_dir}/lbryum',
|
||||||
download_dir=configured_download_dir,
|
download_dir=configured_download_dir,
|
||||||
blob_lru_cache_size=32,
|
blob_lru_cache_size=32,
|
||||||
components_to_skip=[DHT_COMPONENT, HASH_ANNOUNCER_COMPONENT, PEER_PROTOCOL_SERVER_COMPONENT],
|
components_to_skip=components_to_skip,
|
||||||
save_blobs=False,
|
save_blobs=False,
|
||||||
save_files=False,
|
save_files=False,
|
||||||
share_usage_data=True,
|
share_usage_data=True,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# going forward, this should match sdk version
|
# going forward, this should match sdk version
|
||||||
__version__ = "0.62.0"
|
__version__ = "0.63.0"
|
||||||
|
|
||||||
class ServiceApp(App):
|
class ServiceApp(App):
|
||||||
def build(self):
|
def build(self):
|
||||||
|
|
Loading…
Reference in a new issue