Welcome to tools's documentation!

工具类,脚本等

pkl2csv module

将pkl转为csv格式(方便直接导入数据库等)

帮助:python pkl2csv.py -h

使用示例:python pkl2csv.py -f '/home/john/下载/dd_price_vp_20200809_20200818.pkl' -m '{"index": "datetime", "volume": "vol"}'

步骤

1,依次取得pkl文件minor_xs轴维度 as df

2,df.reset_index(),df.dropna(),df拼接为all_df

3,all_df.rename()

4,all_df.to_csv(index=False)

class pkl2csv.PKl2Csv[源代码]

基类:object

static file_path_split(filename: str) → Tuple[str, str, str][源代码]

获取文件路径、文件名、后缀

参数:filename (str) -- 文件全路径
Return tuple:文件路径、文件名、后缀
trans(file_path_pkl: str, rename_map: Dict[str, str] = None) → None[源代码]

pkl文件转为csv文件

参数:
  • file_path_pkl -- pkl文件路径
  • rename_map -- 字段映射字典(dict)

rtmp_player module

基于opencv的简易流媒体播放器

帮助:python pkl2csv.py -h

使用示例: python rtmp_player.py -u rtmp://58.200.131.2:1935/livetv/hunantv(湖南卫视的rtmp地址)

控制逻辑:

p:暂停

c:继续

f:完成(结束)

class rtmp_player.RtmpPlayer(url: str)[源代码]

基类:object

简易播放器

变量:url (str) -- 播放的视频流地址
last_frame_nowait()[源代码]

非阻塞的方式读取下一帧

Return array:最新帧
max_queue_size = 200
read()[源代码]

阻塞的方式读取下一帧

Return array:最新帧
run_status
start_capture() → None[源代码]

启动帧采集进程

class rtmp_player.RunStatus[源代码]

基类:enum.Enum

视频状态枚举类

CONTINUE = 3
FINISH = 4
NOT_START = 0
PAUSE = 2
START = 1
get_after_status = <bound method RunStatus.get_after_status of <enum 'RunStatus'>>[源代码]

valid_rtmp module

寻找过滤有效的rtmp,or,rtsp直播地址

帮助:python pkl2csv.py -h

使用示例:python valid_rtmp.py -u https://blog.csdn.net/osle123/article/details/52757886

步骤:

1,下载页面:https://blog.csdn.net/osle123/article/details/52757886(避免使用csdn等,需点击触发显示全部的网页)

2,正则匹配:rtmp://, rtsp://等地址

3,[rtmp;//xx.com,rtsp://yy.com]使用ping+cv2.read()验证有效性

class valid_rtmp.ValidRtmp[源代码]

基类:object

采集过滤有效的rtmp,or,rtsp播放地址

get_rtmp_url(url: str) → List[str][源代码]

获取url网页内容中的rtsp,rtmp地址

参数:url (str) -- 待采集的种子url地址
Return list:种子url中的rtsp,rtmp地址
headers = {'Accept': 'application/json, text/javascript, */*; q=0.01', 'Accept-Encoding': 'gzip, deflate, br', 'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8,ja;q=0.7,tr;q=0.6,fr;q=0.5,zh-TW;q=0.4', 'Connection': 'keep-alive', 'Sec-Fetch-Dest': 'empty', 'Sec-Fetch-Mode': 'cors', 'Sec-Fetch-Site': 'same-origin', 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36'}
valid(url: str) → str[源代码]

是否是合法的rtsp,rtmp地址

:param str url:待验证的url(rtsp or rtmp)地址, :return str: 如果:是,返回入参的url,如果:不是,返回空串

vnote2hexo module

vnote_md_format module

vnote2sphinx module

Indices and tables