猿神,启动!


前两天尝试写一个给jellyfin服务器添加演员信息的程序,读issue和参考别人的代码的时候发现很多验证的步骤比较过时,故自己写一点留档参考。
swagger api文档 http://localhost:8096/api-docs/swagger
在请求头添加验证 https://gist.github.com/nielsvanvelzen/ea047d9028f676185832e51ffaf12a6f
服务端创建api密钥 http://localhost:8096/web/#/dashboard/keys
userId获取 http://localhost:8096/web/#/dashboard/users 点击你想获得userId的用户并在url的query部分查看
例如 http://192.168.2.202:8096/web/#/dashboard/users/profile?userId=99e7058d92d34f74bd369728f432a0e2
import requests
import json
jellyfin_apiKey = "3287930a2ab9422eaa6e1dc4a5f23c24"
jellyfin_host = "http://192.168.2.202:8096"
jellyfin_userId = "99e7058d92d34f74bd369728f432a0e2"
jellyfin_headers = {
'accept': '*/*',
"Authorization": f'MediaBrowser Token="{jellyfin_apiKey}"',
"Content-Type": "application/json",
}
# 获取全部演员信息,返回json
response = requests.get(f'{jellyfin_host}/Persons?userId={jellyfin_userId}',headers=jellyfin_headers)
dict = response.json()
print(dict)
# 获取单个演员信息
actor_name = '*****'
response = requests.get(f'{jellyfin_host}/Persons/{actor_name}?userId={jellyfin_userId}',headers=jellyfin_headers)
dict = response.json()
print(dict)
# 修改演员Overview并提交
actor_id = dict["Id"]
# Overview支持html标签
dict["Overview"] = """1988年5月24日生まれ<br>
身長<b>163cm</b><br>
<b>B88cm</b><br>
<b>W59cm</b><br>
<b>H85cm</b><br>
ブラ <b>Eカップ</b>"""
response = requests.post(f'{jellyfin_host}/Items/{actor_id}?userId={jellyfin_userId}', headers=jellyfin_headers,json=dict)
# 成功返回204
print(response.status_code)

注意: 有些使用DD重装脚本安装的Debian bookworm 没有开启 bookworm-security源,需要手动开启。
Ubuntu发行版的终端广告(Bug #1950692)和snap(Mint Blog中的观点)一直是令人诟病的内容,也是我切换到Debian的原因。
但是,今天还是要注册一下Ubuntu Pro,毕竟还有一些以前安装的机器在运行着已经EOL的Ubuntu版本,需要安装一些安全补丁。
打开Ubuntu Pro的网站 https://ubuntu.com/pro
点击Get Ubuntu Pro now并选择Myself,点击Register登录帐号确认。
获取Token,复制下面的命令。

这里以**Ubuntu 18.04 LTS (Bionic Beaver)**为例:
在查看Python代码中,经常会看到类似这样的代码:
# module.py
def example() -> None:
print("This is an example.")
if __name__ == '__main__':
example()
这里直接运行文件可以获得输出内容:
$ python3 module.py
This is an example.
现在我们在另一个文件中将module.py作为模块导入并运行:
# main.py
from module import example
example()
$ python3 main.py
This is an example.
我们修改module.py文件,在测试中我们经常会这么写:
# module.py
def example() -> None:
print("This is an example.")
example()
分别运行module.py main.py:
Traceback (most recent call last):
File "/home/duzhuo/src/scraper-test/.venv/bin/sqlacodegen", line 5, in <module>
from sqlacodegen.main import main
File "/home/duzhuo/src/scraper-test/.venv/lib/python3.11/site-packages/sqlacodegen/main.py", line 11, in <module>
from sqlacodegen.codegen import CodeGenerator
File "/home/duzhuo/src/scraper-test/.venv/lib/python3.11/site-packages/sqlacodegen/codegen.py", line 9, in <module>
from inspect import ArgSpec
ImportError: cannot import name 'ArgSpec' from 'inspect' (/usr/lib/python3.11/inspect.py)
来自GPT的错误分析:您遇到的错误消息是由于 inspect.ArgSpec 类在 Python 3.11 中被移除了。ArgSpec 类在 Python 3.5 中已被弃用,并在 Python 3.11 中被移除。
当前使用的sqlacodegen版本为2.3.0.post1。是pypi上面的默认release版本。
编辑 .venv/lib/python3.11/site-packages/sqlacodegen/codegen.py
找到from inspect import ArgSpec替换成from inspect import FullArgSpec as ArgSpec
或者升级sqlacodegen版本到3.0.0 rc3以上。来源:https://github.com/agronholm/sqlacodegen/issues/239#issuecomment-1871370700
以下内容来自于 AOSP文档
通用系统映像 (GSI) 是指已针对 Android 设备调整配置的系统映像。GSI 被视为“纯 Android”实现,它包含未经修改的 Android 开源项目 (AOSP) 代码,任何搭载 Android 9 或更高版本的 Android 设备都能顺利运行这种代码。
GSI 用于运行 VTS 和 CTS-on-GSI 测试。为确保运行最新版 Android 的设备正确实现供应商接口,您需要将 Android 设备的系统映像替换为 GSI,然后使用供应商测试套件 (VTS) 和兼容性测试套件 (CTS) 来测试设备。
注意!!! 进行一下操作前需要刷入官方国际版20230818固件,否则可能会无限重启
spflashtools 降级刷入工具
mtk_usb_all 联发科驱动