Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[danmu方面]求改进和新增一点修改 #414

Open
8MiYile opened this issue Dec 12, 2022 · 1 comment
Open

[danmu方面]求改进和新增一点修改 #414

8MiYile opened this issue Dec 12, 2022 · 1 comment

Comments

@8MiYile
Copy link

8MiYile commented Dec 12, 2022

import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--url','-l',nargs='+')
args=parser.parse_args()
print(args.url)

这块是直接从命令行读取地址 比如

python3 main.py -l "https://live.bilibili.com/9510613" "https://huya.com/8mi.tech"

那么这家伙会以数组的方式 返回这两串内容

['https://live.bilibili.com/9510613', 'https://huya.com/8mi.tech']

还有还有,传入参数后就不要再问输入地址了

if args.url:
    a=args.url
else:
    a = input('请输入直播间地址:\n')
asyncio.run(main(a))

然后我希望的是 这个程序能多线程的形式 同时处理多个平台的弹幕

可以用参数来判断是否开启多平台模式

if len(args.url) > 1:
multi_live=true

并且我希望说 输出的格式是这样的

print("["+str(datetime.datetime.now())+"] ["+platform+"] "+f'{m["name"]}{m["content"]}')

而这个platform这个参数 对应弹幕来源 比如从bilibili发送的弹幕 输出的是

[2022-12-12 23:44:21.236815] [bili] [勋章名称|等级]八蓝米科技Company:测试弹幕

总结,我要的效果就是说
输入命令

python3 main.py -l "https://live.bilibili.com/9510613" "https://huya.com/8mi.tech"

输出的结果是(仅限multi_live=true的情况下这样输出)

[2022-12-12 23:44:21.236815] [bili] [八蓝米|18]八蓝米科技Company:测试弹幕
[2022-12-12 23:44:21.236815] [huya] [勋章名称|等级]8yl丶以勒:测试弹幕

因为我不太会实现,毕竟你的代码,我也不太好动

@8MiYile
Copy link
Author

8MiYile commented Dec 12, 2022

并且建议 这个项目的danmu文件夹迁移到其他仓库 分开来会比较好点(个人觉得)

@8MiYile 8MiYile changed the title 求改进和新增一点修改 [danmu方面]求改进和新增一点修改 Dec 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant