Compare commits

...

2 commits

5 changed files with 22 additions and 10 deletions

View file

@ -39,7 +39,7 @@ version.filename = %(source.dir)s/main.py
# (list) Application requirements
# 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.73.1#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@file-list-download-path#egg=lbry"
# (str) Custom source folders for requirements
# Sets custom source for any requirements with recipes

View file

@ -39,7 +39,7 @@ version.filename = %(source.dir)s/main.py
# (list) Application requirements
# 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.73.1#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@file-list-download-path#egg=lbry"
# (str) Custom source folders for requirements
# Sets custom source for any requirements with recipes

View file

@ -8,6 +8,7 @@ import android.content.Intent;
import android.content.Context;
import android.util.Log;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.os.Process;
import java.io.File;
@ -126,9 +127,16 @@ public class PythonService extends Service implements Runnable {
serviceEntrypoint, pythonName,
pythonHome, pythonPath,
pythonServiceArgument);
cleanupNotifications();
stopSelf();
}
public void cleanupNotifications() {
Context context = getApplicationContext();
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.cancelAll();
}
// Native part
public static native void nativeStart(
String androidPrivate, String androidArgument,

View file

@ -230,8 +230,8 @@ public final class LbrynetService extends PythonService {
params.put("page_size", 100);
params.put("reverse", true);
params.put("sort", "added_on");
/*params.put("status", "stopped");
params.put("comparison", "ne");*/
params.put("download_path", null);
params.put("comparison", "ne");
String fileList = Utils.sdkCall("file_list", params);
if (fileList != null) {
@ -481,6 +481,14 @@ public final class LbrynetService extends PythonService {
return super.onStartCommand(intent, flags, startId);
}
@Override
public void cleanupNotifications() {
Context context = getApplicationContext();
NotificationManager notificationManager =
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.cancelAll();
}
@Override
public void onDestroy() {
if (downloadReceiver != null) {
@ -493,11 +501,7 @@ public final class LbrynetService extends PythonService {
stopServiceReceiver = null;
}
Context context = getApplicationContext();
NotificationManager notificationManager =
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.cancelAll();
cleanupNotifications();
super.onDestroy();
serviceInstance = null;
}

View file

@ -353,7 +353,7 @@ public final class Utils {
if (params != null) {
JSONObject requestParams = new JSONObject();
for (Map.Entry<String, Object> entry : params.entrySet()) {
requestParams.put(entry.getKey(), entry.getValue());
requestParams.put(entry.getKey(), entry.getValue() == null ? JSONObject.NULL : entry.getValue());
}
request.put("params", requestParams);
}