让终端可以播放视频!
Project description
🎞️ console-player
视频播放器,但终端
📦 安装
# Windows用户没有安装FFmpeg的,或者使用其他系统的
$ pip install console-player
# Windows用户安装了FFmpeg的
$ pip install console-player-noffmpeg
❓ 用法
# 播放视频
$ consoleplay <CPVID文件>
# 生成CPVID文件
$ cpvgen # 交互生成
$ cpvgen <视频文件> <输出的CPVID文件,后缀必须是(.cpv;.cpvt;.zip)的任意一项> # 不让你选择文件的交互生成
# 在终端显示图片
$ consolepic <图片文件>
# 显示版本信息 (三选一)
$ consoleplay
$ consolepic
⚙️ API用法
from consoleplay import RGB,pic2terminal
from colorama import Style,init
init()
# 将图片打印到终端
pic2terminal("图片文件路径")
# 打印RGB颜色的字体
print(RGB(255,0,0)+"红色字体"+Style.RESET_ALL)
🔨 构建
# Windows带FFmpeg
$ python setup.py bdist_wheel --have-ffmpeg
# Windows不带FFmpeg (注意包名变成了console-player-noffmpeg)
$ python setup.py bdist_wheel
# Linux
$ python setup.py bdist_wheel --linux
# MacOS
$ python setup.py bdist_wheel --mac
🛠️ CPVID文件的手工生成
首先,你要知道CPVID本质上其实就是7z文件,只是后缀不同罢了
知道了这个特性,然后创建一个新目录,并以这个结构创建文件(夹)
你的目录
|-- manifest.json
|-- audio.mp3
|-- frames
| |-- 1.jpg
| |-- 2.jpg
| |-- ...
| |-- n.jpg
如果你要打包CPVT格式的文件的话,请你把要输出的文字放入frames/n.txt中 (或使用xz压缩后使用frames/n.txt.xz) ,以替换franes/n.jpg中的图片
然后,填充audio.mp3为你的音频
接着,往manifest.json以这个格式写入内容
{
"frames": 视频帧数,填入数字,比如3500,
"fps": 视频的帧率,填入数字,要和frames和音频长度吻合,否则播放报错,比如20,
"type": 视频类型,比如"cpvt"或"cpv",
"xz": 你的cpvt类型的文件是否使用了xz压缩,填true或false,
"height": 视频高度,暂时没有实现,比如60
}
最后,把这个目录的所有内容压缩到7z文件,把后缀一改,搞定!
📝 更新日志
1.00
- 第一次发布
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file console_player-1.0-py3-none-win_amd64.whl.
File metadata
- Download URL: console_player-1.0-py3-none-win_amd64.whl
- Upload date:
- Size: 35.1 MB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce3cd191f01a93990a2a6f1199187157d695b93a630378c6d9aaae9d1f8f35e8
|
|
| MD5 |
e4773989e69800a4cc2d97f18b4d9d4d
|
|
| BLAKE2b-256 |
8bbe8773a24b9edafd14cbfa298c3c921db5b17bf2b6d372b075e453544dd663
|
File details
Details for the file console_player-1.0-py3-none-macosx_10_9_universal2.whl.
File metadata
- Download URL: console_player-1.0-py3-none-macosx_10_9_universal2.whl
- Upload date:
- Size: 34.3 kB
- Tags: Python 3, macOS 10.9+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
99e23c3a160df91b3185fcbed51ec8ae0e411d9b45c1d71b4cc26194be3d919a
|
|
| MD5 |
20e3e58c33bcec34e4c5ae3047f7bac7
|
|
| BLAKE2b-256 |
7980ce8ad51441b6ae8c1463d8adaaab01a176d43e7557e1fb60b259ee1d726a
|