Skip to content

Commit

Permalink
📝 v0.1.10
Browse files Browse the repository at this point in the history
🐛 fix:修复了下载卫星数据的bug
✨ feat: 支持自定义截图,命令`/s`
  • Loading branch information
yzyyz1387 committed Sep 29, 2023
1 parent 08b4fc6 commit 719dd72
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 1 deletion.
1 change: 1 addition & 0 deletions cqsat/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
CACHE_CSS = TLE_CACHE_PATH / 'css.cache'
CACHE_OTHER = TLE_CACHE_PATH / 'other.cache'
SHOOTS_OUT_PATH = LOCAL / 'shoots_out'
SHOOTS_URL_BANK = LOCAL / 'shoots_url_bank.json'
MDC_GENERATOR_PATH = LOCAL / 'mdc_generator'


Expand Down
81 changes: 81 additions & 0 deletions cqsat/sat/sat_shoot_url_bank.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# python3
# -*- coding: utf-8 -*-
# @Time : 2023-09-30 1:01
# @Author : yzyyz
# @Email : youzyyz1384@qq.com
# @File : sat_shoot_url_bank.py
# @Software: PyCharm
import json

from ..utils import *
from ..path import *
from ..config import *

if plugin_config.sat_proxy_url:
logger.info(plugin_config.sat_proxy_url)

url_bank = [
{
"url": "https://www.df2et.de/tevel/",
"cmd": ["t", "查询小火车", "小火车"],
"path": "tevel.png",
"locator": "html",
"time_out": 10
},
{
"url": "https://amsat.org/status/index.php",
"cmd": ["a", "amsat"],
"path": "amsat.png",
"locator": "xpath=/html/body/center[4]",
"time_out": 10

},
{
"url": "https://www.github.com/yzyyz1387/cqsat",
"cmd": ["home", "cqsat"],
"path": "cqsat.png",
"locator": "html",
"time_out": 5,
"proxy": plugin_config.sat_proxy_url,
"timeout": 90000,
},
{
"url": "https://sathunt.com/",
"cmd": ['css', 'cs'],
"path": "css.png",
"locator": "html",
"time_out": 0
}

]


class UrlBank:
def __init__(self):
if SHOOTS_URL_BANK.exists():
self.url_bank = json_load(SHOOTS_URL_BANK)
else:
self.url_bank = url_bank
json_upload(SHOOTS_URL_BANK, self.url_bank)

def get(self):
return json_load(SHOOTS_URL_BANK) if SHOOTS_URL_BANK.exists() else self.url_bank

def add(self, **kwargs):
self.url_bank.append(kwargs)
json_upload(SHOOTS_URL_BANK, url_bank)

def remove(self, **kwargs):
url = kwargs.get("url", None)
cmd = kwargs.get("cmd", None)
path = kwargs.get("path", None)
for item in self.url_bank:
if url in item["url"] or cmd in item["cmd"] or path in item["path"]:
self.url_bank.remove(item)
json_upload(SHOOTS_URL_BANK, self.url_bank)
return True

@staticmethod
def default():
json_upload(SHOOTS_URL_BANK, url_bank)
return True
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

setuptools.setup(
name="nonebot-plugin-cqsat",
version="0.1.9",
version="0.1.10",
author="yzyyz1387",
author_email="youzyyz1384@gmail.com",
keywords=("ham", "nonebot2", "nonebot", "radio", "nonebot_plugin"),
Expand Down

0 comments on commit 719dd72

Please sign in to comment.