Compare commits

...

5 Commits

Author SHA1 Message Date
831672957a update splayer 2025-09-27 20:12:51 +08:00
3ce949af99 update qqmusic 2025-09-27 20:12:50 +08:00
f8ad5d523a refactor: save packages info to file 2025-09-27 20:12:50 +08:00
611e165f5d fix: limit the number of parameters 2025-09-27 20:12:50 +08:00
14d95b7492 add mqttx 2025-09-27 20:12:50 +08:00
17 changed files with 111 additions and 88 deletions

View File

@ -72,6 +72,7 @@
| [Joplin](https://github.com/laurent22/joplin) | joplin | ✅ | | | [Joplin](https://github.com/laurent22/joplin) | joplin | ✅ | |
| [SPlayer](https://github.com/imsyy/SPlayer) | splayer | ✅ | | | [SPlayer](https://github.com/imsyy/SPlayer) | splayer | ✅ | |
| [Tiny RDM](https://github.com/tiny-craft/tiny-rdm) | tinyrdm | ✅ | | | [Tiny RDM](https://github.com/tiny-craft/tiny-rdm) | tinyrdm | ✅ | |
| [MQTTX](https://github.com/emqx/MQTTX) | mqttx | ✅ | ✅ |
#### Gitee #### Gitee

View File

@ -4,9 +4,11 @@ import os
import sqlite3 import sqlite3
import sys import sys
import logging import logging
import re
from threading import Lock from threading import Lock
BASE_DIR = "deb" DEB_BASE_DIR = "deb"
PACKAGES_DIR = "packages"
DB_DIR = "data" DB_DIR = "data"
USER_AGENT = "Debian APT-HTTP/1.3 (2.6.1)" # from Debian 12 USER_AGENT = "Debian APT-HTTP/1.3 (2.6.1)" # from Debian 12
@ -19,28 +21,65 @@ logging.basicConfig(
) )
def download(url): def download(url, file_path) -> bool:
"""Download file using curl with APT User-Agent.""" """Download file using curl with APT User-Agent."""
file_path = os.path.join(BASE_DIR, url.split("?")[0]) curl_process = subprocess.run(
os.makedirs(os.path.dirname(file_path), exist_ok=True) ["curl", "-H", f"User-Agent: {USER_AGENT}", "-fsLo", file_path, url]
subprocess.run(["curl", "-H", f"User-Agent: {USER_AGENT}", "-fsLo", file_path, url]) )
if curl_process.returncode or not os.path.exists(file_path):
logging.error(f"Failed to download {url}")
return False
return True
def check_download(name, version, url, arch="amd64"): def scan(name, arch, url, file_path) -> bool:
scan_process = subprocess.run(
["apt-ftparchive", "packages", file_path], capture_output=True
)
package = scan_process.stdout.decode()
package = re.sub(
r"^(Filename: ).*", f"\\1{url}", package, flags=re.MULTILINE
) # 替换 Filename 开头的行
package_file_path = os.path.join(PACKAGES_DIR, arch, f"{name}.package")
try:
with open(package_file_path, "w") as f:
f.write(package)
return True
except IOError as e:
logging.error(f"Failed to write package file for {name}: {e}")
return False
def check_download(name, version, url, arch):
"""Check and handle package download/update.""" """Check and handle package download/update."""
logging.info("%s:%s = %s", name, arch, version) logging.info("%s:%s = %s", name, arch, version)
db_path = os.path.join("data", f"{BASE_DIR}.db") file_path = os.path.join(DEB_BASE_DIR, arch, f"{name}_{version}_{arch}.deb")
local_version = None
db_path = os.path.join("data", f"{DEB_BASE_DIR}.db")
# get local version # get local version
with version_lock, sqlite3.connect(db_path) as conn: with version_lock, sqlite3.connect(db_path) as conn:
res = conn.execute( res = conn.execute(
f"SELECT version, url FROM '{arch}' WHERE name = ?", (name,) f"SELECT version FROM '{arch}' WHERE name = ?", (name,)
).fetchone() ).fetchone()
if res: if res:
local_version, local_url = res local_version = res[0]
if local_version != version: if local_version == version:
return
# download and scan
logging.info(f"Downloading {name}:{arch} ({version})")
os.makedirs(os.path.join(DEB_BASE_DIR, arch), exist_ok=True)
if not download(url, file_path):
return
os.makedirs(os.path.join(PACKAGES_DIR, arch), exist_ok=True)
if not scan(name, arch, url, file_path):
return
if res:
print(f"Update: {name}:{arch} ({local_version} -> {version})") print(f"Update: {name}:{arch} ({local_version} -> {version})")
download(url)
# update database # update database
with version_lock, sqlite3.connect(db_path) as conn: with version_lock, sqlite3.connect(db_path) as conn:
conn.execute( conn.execute(
@ -49,13 +88,11 @@ def check_download(name, version, url, arch="amd64"):
) )
conn.commit() conn.commit()
# remove old version # remove old version
if local_url != url: # 防止固定下载链接 old_file_path = os.path.join(DEB_BASE_DIR, f"{name}_{local_version}_{arch}.deb")
old_file_path = os.path.join(BASE_DIR, local_url.split("?")[0])
if os.path.exists(old_file_path): if os.path.exists(old_file_path):
os.remove(old_file_path) os.remove(old_file_path)
else: else:
print(f"AddNew: {name}:{arch} ({version})") print(f"AddNew: {name}:{arch} ({version})")
download(url)
# update database # update database
with version_lock, sqlite3.connect(db_path) as conn: with version_lock, sqlite3.connect(db_path) as conn:
conn.execute( conn.execute(
@ -67,11 +104,11 @@ def check_download(name, version, url, arch="amd64"):
if __name__ == "__main__": if __name__ == "__main__":
args = sys.argv args = sys.argv
if len(args) in (4, 5): if len(args) == 5:
check_download(*args[1:]) check_download(*args[1:])
elif len(args) > 1: elif len(args) > 1:
logging.error(f"Unknown Args: {args[1:]}") logging.error(f"Unknown Args: {args[1:]}")
else: else:
print(f"Usage: {args[0]} <package_name> <version> <url> [arch]") print(f"Usage: {args[0]} <package_name> <version> <url> <arch>")
print("options:") print("options:")
print(" arch: amd64, arm64, all. default is amd64") print(" arch: amd64, arm64, all.")

View File

@ -131,5 +131,18 @@
"file_list": { "file_list": {
"amd64": "tiny-rdm_{version}_linux_amd64_webkit2_41.deb" "amd64": "tiny-rdm_{version}_linux_amd64_webkit2_41.deb"
} }
},
"mqttx": {
"repo": "emqx/MQTTX",
"file_list": {
"amd64": "MQTTX_{version}_amd64.deb",
"arm64": "MQTTX_{version}_arm64.deb"
}
},
"splayer": {
"repo": "imsyy/SPlayer",
"file_list": {
"amd64": "splayer_{version}_amd64.deb"
}
} }
} }

View File

@ -1,6 +1,6 @@
JSON=$(curl -s "https://pan.baidu.com/disk/cmsdata?do=client") JSON=$(curl -s "https://pan.baidu.com/disk/cmsdata?do=client")
VERSION=$(echo $JSON | jq -r ".linux.version" | cut -d "V" -f 2) VERSION=$(echo $JSON | jq -r ".linux.version" | cut -d "V" -f 2)
X64_URL=$(echo $JSON | jq -r ".linux.url_1") AMD64_URL=$(echo $JSON | jq -r ".linux.url_1")
./check_downloader.py baidunetdisk $VERSION $X64_URL ./check_downloader.py baidunetdisk $VERSION $AMD64_URL amd64

View File

@ -1,6 +1,6 @@
JSON=$(curl -s https://active.browser.360.net/api/v1/web-version) JSON=$(curl -s https://active.browser.360.net/api/v1/web-version)
VERSION=$(echo $JSON | jq -r ".data.web_version") VERSION=$(echo $JSON | jq -r ".data.web_version")
X64_URL="https://gedown.360safe.com/gc/browser360-cn-stable_"$VERSION"-1_amd64.deb" AMD64_URL="https://gedown.360safe.com/gc/browser360-cn-stable_"$VERSION"-1_amd64.deb"
./check_downloader.py browser360-cn-stable $VERSION $X64_URL ./check_downloader.py browser360-cn-stable $VERSION $AMD64_URL amd64

View File

@ -4,7 +4,7 @@ VERSIONS_JSON=$(curl -fs "https://www.feishu.cn/api/downloads")
# "version_number": "Linux-x64-deb@V7.22.9" # "version_number": "Linux-x64-deb@V7.22.9"
AMD64_VERSION=$(echo $VERSIONS_JSON | jq -r ".versions.Linux_deb_x64.version_number" | cut -d 'V' -f 2) AMD64_VERSION=$(echo $VERSIONS_JSON | jq -r ".versions.Linux_deb_x64.version_number" | cut -d 'V' -f 2)
AMD64_URL=$(echo $VERSIONS_JSON | jq -r ".versions.Linux_deb_x64.download_link") AMD64_URL=$(echo $VERSIONS_JSON | jq -r ".versions.Linux_deb_x64.download_link")
./check_downloader.py bytedance-feishu-stable $AMD64_VERSION $AMD64_URL ./check_downloader.py bytedance-feishu-stable $AMD64_VERSION $AMD64_URL amd64
# ARM64 # ARM64
ARM64_VERSION=$(echo $VERSIONS_JSON | jq -r ".versions.Linux_deb_arm.version_number" | cut -d 'V' -f 2) ARM64_VERSION=$(echo $VERSIONS_JSON | jq -r ".versions.Linux_deb_arm.version_number" | cut -d 'V' -f 2)

View File

@ -1,6 +1,6 @@
X64_URL=$(curl -sw %{redirect_url} https://www.dingtalk.com/win/d/qd=linux_amd64) AMD64_URL=$(curl -sw %{redirect_url} https://www.dingtalk.com/win/d/qd=linux_amd64)
VERSION=$(echo $X64_URL | sed 's#.*/##g' | cut -d '_' -f 2) VERSION=$(echo $AMD64_URL | sed 's#.*/##g' | cut -d '_' -f 2)
./check_downloader.py com.alibabainc.dingtalk $VERSION $X64_URL ./check_downloader.py com.alibabainc.dingtalk $VERSION $AMD64_URL amd64
ARM64_URL=$(curl -sw %{redirect_url} https://www.dingtalk.com/win/d/qd=linux_arm64) ARM64_URL=$(curl -sw %{redirect_url} https://www.dingtalk.com/win/d/qd=linux_arm64)
VERSION=$(echo $ARM64_URL | sed 's#.*/##g' | cut -d '_' -f 2) VERSION=$(echo $ARM64_URL | sed 's#.*/##g' | cut -d '_' -f 2)

View File

@ -1,7 +1,7 @@
X64_URL=$(curl -sI "https://dida365.com/static/getApp/download?type=linux_deb_x64" | grep location | cut -d ' ' -f 2 | tr -d '\r') AMD64_URL=$(curl -sI "https://dida365.com/static/getApp/download?type=linux_deb_x64" | grep location | cut -d ' ' -f 2 | tr -d '\r')
# https://cdn.dida365.cn/download/linux/linux_deb_x64/dida-6.0.0-amd64.deb # https://cdn.dida365.cn/download/linux/linux_deb_x64/dida-6.0.0-amd64.deb
VERSION=$(echo $X64_URL | cut -d "-" -f 2) VERSION=$(echo $AMD64_URL | cut -d "-" -f 2)
./check_downloader.py dida $VERSION $X64_URL ./check_downloader.py dida $VERSION $AMD64_URL amd64
# ARM64 # ARM64
ARM64_URL=$(curl -sI "https://dida365.com/static/getApp/download?type=linux_deb_arm64" | grep location | cut -d ' ' -f 2 | tr -d '\r') ARM64_URL=$(curl -sI "https://dida365.com/static/getApp/download?type=linux_deb_arm64" | grep location | cut -d ' ' -f 2 | tr -d '\r')

View File

@ -1,6 +1,6 @@
WEB_CONTENT=$(curl -s "https://y.qq.com/download/download.html") WEB_CONTENT=$(curl -s "https://y.qq.com/download/download.html")
VERSION=$(echo $WEB_CONTENT | grep -o "Linux <span class=\"product_list__version\">最新版:[0-9\.]*" | cut -d ':' -f 2) VERSION=$(echo $WEB_CONTENT | grep -o "Linux <span class=\"product_list__version\">最新版:[0-9\.]*" | cut -d ':' -f 2)
X64_URL=$(echo $WEB_CONTENT | grep -o "https://[0-9a-z/\._]*amd64\.deb" | head -n 1) AMD64_URL=$(echo $WEB_CONTENT | grep -o "https://[^\"]*amd64\.deb[^\"]*" | head -n 1)
./check_downloader.py qqmusic $VERSION $X64_URL ./check_downloader.py qqmusic $VERSION $AMD64_URL amd64

View File

@ -1,6 +1,6 @@
JSON=$(curl -fs "https://client-webapi.oray.com/softwares/SUNLOGIN_X_LINUX?x64=1") JSON=$(curl -fs "https://client-webapi.oray.com/softwares/SUNLOGIN_X_LINUX?x64=1")
VERSION=$(echo "$JSON" | jq -r '.versionno') VERSION=$(echo "$JSON" | jq -r '.versionno')
X64_URL=$(echo $JSON | jq -r '.downloadurl') AMD64_URL=$(echo $JSON | jq -r '.downloadurl')
./check_downloader.py sunloginclient $VERSION $X64_URL ./check_downloader.py sunloginclient $VERSION $AMD64_URL amd64

View File

@ -1,6 +1,6 @@
X64_URL=$(curl -s https://www.todesk.com/linux.html | grep -o "https://[0-9a-zA-Z_\/\.\-]*.deb" | head -n 1) AMD64_URL=$(curl -s https://www.todesk.com/linux.html | grep -o "https://[0-9a-zA-Z_\/\.\-]*.deb" | head -n 1)
# X64_URL=https:/ /dl.todesk.com/linux/todesk-v4.7.2.0-amd64.deb # AMD64_URL=https:/ /dl.todesk.com/linux/todesk-v4.7.2.0-amd64.deb
VERSION=$(echo $X64_URL | cut -d '-' -f 2) VERSION=$(echo $AMD64_URL | cut -d '-' -f 2)
./check_downloader.py todesk $VERSION $X64_URL ./check_downloader.py todesk $VERSION $AMD64_URL amd64

View File

@ -1,8 +1,8 @@
WEB_CONTENT=$(curl -s "https://www.u-tools.cn/download/") WEB_CONTENT=$(curl -s "https://www.u-tools.cn/download/")
X64_URL=$(echo $WEB_CONTENT | grep -o "https://[^ ]*amd64\.deb") AMD64_URL=$(echo $WEB_CONTENT | grep -o "https://[^ ]*amd64\.deb")
# https://open.u-tools.cn/download/utools_5.2.1_amd64.deb # https://open.u-tools.cn/download/utools_5.2.1_amd64.deb
VERSION=$(echo $X64_URL | cut -d '_' -f 2) VERSION=$(echo $AMD64_URL | cut -d '_' -f 2)
./check_downloader.py utools $VERSION $X64_URL ./check_downloader.py utools $VERSION $AMD64_URL amd64

View File

@ -1,13 +1,13 @@
WEB_CONTENT=$(curl -s "https://linux.weixin.qq.com/") WEB_CONTENT=$(curl -s "https://linux.weixin.qq.com/")
# X64 # AMD64
X64_URL=$(echo $WEB_CONTENT | grep -o 'https:[0-9a-zA-Z/\._]*x86_64\.deb') AMD64_URL=$(echo $WEB_CONTENT | grep -o 'https:[0-9a-zA-Z/\._]*x86_64\.deb')
Last_Modified=$(curl -sI $X64_URL | grep "Last-Modified") Last_Modified=$(curl -sI $AMD64_URL | grep "Last-Modified")
# Last-Modified: Wed, 06 Nov 2024 02:08:50 GMT # Last-Modified: Wed, 06 Nov 2024 02:08:50 GMT
VERSION=$(echo $Last_Modified | cut -d ' ' -f 3-6 | sed 's/ /-/g') VERSION=$(echo $Last_Modified | cut -d ' ' -f 3-6 | sed 's/ /-/g')
# 06-Nov-2024-02:08:50 # 06-Nov-2024-02:08:50
./check_downloader.py wechat $VERSION $X64_URL ./check_downloader.py wechat $VERSION $AMD64_URL amd64
# ARM64 # ARM64
ARM64_URL=$(echo $WEB_CONTENT | grep -o 'https:[0-9a-zA-Z/\._]*arm64\.deb') ARM64_URL=$(echo $WEB_CONTENT | grep -o 'https:[0-9a-zA-Z/\._]*arm64\.deb')

View File

@ -13,8 +13,8 @@ download_list_url="https://meeting.tencent.com/web-service/query-download-info?q
JSON=$(curl -s $download_list_url) JSON=$(curl -s $download_list_url)
VERSION=$(echo $JSON | jq -r '."info-list"[0].version') VERSION=$(echo $JSON | jq -r '."info-list"[0].version')
X64_URL=$(echo $JSON | jq -r '."info-list"[0].url') AMD64_URL=$(echo $JSON | jq -r '."info-list"[0].url')
./check_downloader.py wemeet $VERSION $X64_URL ./check_downloader.py wemeet $VERSION $AMD64_URL amd64
# ARM64 # ARM64
VERSION=$(echo $JSON | jq -r '."info-list"[1].version') VERSION=$(echo $JSON | jq -r '."info-list"[1].version')

View File

@ -1,6 +1,6 @@
X64_URL=$(curl -sI "https://xmind.cn/zen/download/linux_deb/" | grep location | cut -d ' ' -f 2 | tr -d '\r') AMD64_URL=$(curl -sI "https://xmind.cn/zen/download/linux_deb/" | grep location | cut -d ' ' -f 2 | tr -d '\r')
# https://dl3.xmind.cn/Xmind-for-Linux-amd64bit-24.04.10311-202405240010.deb # https://dl3.xmind.cn/Xmind-for-Linux-amd64bit-24.04.10311-202405240010.deb
VERSION=$(echo $X64_URL | cut -d '-' -f 5) VERSION=$(echo $AMD64_URL | cut -d '-' -f 5)
./check_downloader.py xmind-vana $VERSION $X64_URL ./check_downloader.py xmind-vana $VERSION $AMD64_URL amd64

View File

@ -1,21 +0,0 @@
Package: splayer
Architecture: amd64
Version: 3.0.0~beta.1
Priority: optional
Section: default
Maintainer: imsyy.top
Installed-Size: 387552
Depends: libgtk-3-0, libnotify4, libnss3, libxss1, libxtst6, xdg-utils, libatspi2.0-0, libuuid1, libsecret-1-0
Recommends: libappindicator3-1
Filename: https://github.com/imsyy/SPlayer/releases/download/v3.0.0-beta.1/splayer_3.0.0-beta.1_amd64.deb
Size: 98165414
MD5sum: 36a196fea2751680f03b7a3dad1045fd
SHA1: bed49a7ee405b1af3383e1096e38c9626e9040d6
SHA256: 2c58224c7630a6f31b577e9109be7a4e5c092984d76642d4928b88e28cbce6f6
SHA512: 8bb9334f00eb07a410c4ab0b543cfd31d94953696bfe43bdc9795ff0391dc44418a0db5d9e9f837f26ccef0f2b19ac987c67196d55435336e02138ee7a55225b
Homepage: https://github.com/imsyy/SPlayer#readme
Description:
A minimalist music player
License: AGPL-3.0
Vendor: imsyy.top

9
run.sh
View File

@ -7,15 +7,8 @@ find get -type f -name "*.sh" -exec sh {} \;
# generate the html # generate the html
./gen-list-html.py ./gen-list-html.py
# generate the Packages file
## generate the local Packages file
cd deb
apt-ftparchive packages . > tmpPackages
sed -i "s|\./\(https\?\):/|\1://|g" tmpPackages
cd ..
## merge the Packages file from local package ## merge the Packages file from local package
cat $(find packages -name "*.package") >> deb/tmpPackages cat $(find packages -name "*.package") > deb/tmpPackages
## merge the Packages files from third-party repositories ## merge the Packages files from third-party repositories
./merge-apt-repo.py --local deb/tmpPackages ./merge-apt-repo.py --local deb/tmpPackages