aboutsummarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorfelinae982020-10-14 16:14:55 +0800
committerfelinae982020-10-14 16:14:55 +0800
commit750481d55d92f182d7fb7d562629c819c97db23a (patch)
tree59594841a1e560050cad12c15f2e46fc9ad159b7
parent2565780914e1b09e2813ad8fffe9ef8d9b67ee23 (diff)
downloadaur-750481d55d92f182d7fb7d562629c819c97db23a.tar.gz
update mmdb fail will not exit
-rw-r--r--.SRCINFO2
-rw-r--r--PKGBUILD2
-rwxr-xr-xclashup35
3 files changed, 21 insertions, 18 deletions
diff --git a/.SRCINFO b/.SRCINFO
index fa54f4d7d39c..9509739811e9 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -10,7 +10,7 @@ pkgbase = clashup
depends = python-requests
source = clashup
source = clashup.conf
- md5sums = e1a19cb6d725946a94aac9134b33b584
+ md5sums = 5e36f15996e69f68037964573b20dd64
md5sums = 177338346005e11d33e27edc1f8ab780
pkgname = clashup
diff --git a/PKGBUILD b/PKGBUILD
index bea77573539d..3fba1054ed5f 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -14,5 +14,5 @@ package() {
install -Dm755 clashup ${pkgdir}/usr/bin/clashup
install -Dm644 clashup.conf ${pkgdir}/etc/systemd/user/clash.service.d/clashup.conf
}
-md5sums=('e1a19cb6d725946a94aac9134b33b584'
+md5sums=('5e36f15996e69f68037964573b20dd64'
'177338346005e11d33e27edc1f8ab780')
diff --git a/clashup b/clashup
index 0bcbf124937c..d85002e7cb2d 100755
--- a/clashup
+++ b/clashup
@@ -93,25 +93,28 @@ class ClashUp:
parsed_clash_conf = self.parse_config(raw_clash_conf)
self.save(parsed_clash_conf)
logging.info('Update Finish')
- except self.session.exceptions.RequestException:
+ except requests.exceptions.RequestException:
logging.warning('Update Fail')
def update_mmdb(self):
- resp = self.session.get(self.config['mmdb_version_url'], proxies={'http': None, 'https': None})
- resp.raise_for_status()
- current_version = resp.text
- if os.path.isfile(self.mmdb_version_file):
- with open(self.mmdb_version_file, 'r') as f:
- if current_version == f.read():
- logging.info('pass mmdb update')
- return
- resp = self.session.get(self.config['mmdb_file_url'], proxies={'http': None, 'https': None})
- resp.raise_for_status()
- with open(self.mmdb_file_path, 'wb') as f:
- f.write(resp.content)
- with open(self.mmdb_version_file, 'w') as f:
- f.write(current_version)
- logging.info('update mmdb')
+ try:
+ resp = self.session.get(self.config['mmdb_version_url'], proxies={'http': None, 'https': None})
+ resp.raise_for_status()
+ current_version = resp.text
+ if os.path.isfile(self.mmdb_version_file):
+ with open(self.mmdb_version_file, 'r') as f:
+ if current_version == f.read():
+ logging.info('pass mmdb update')
+ return
+ resp = self.session.get(self.config['mmdb_file_url'], proxies={'http': None, 'https': None})
+ resp.raise_for_status()
+ with open(self.mmdb_file_path, 'wb') as f:
+ f.write(resp.content)
+ with open(self.mmdb_version_file, 'w') as f:
+ f.write(current_version)
+ logging.info('update mmdb')
+ except requests.exceptions.RequestException:
+ logging.warning('update mmdb failed')
def update_time_cache(self):
if not os.path.isfile(self.cache_file_path):