Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
CSDN 技术社区
topn_race
提交
57caaa36
T
topn_race
项目概览
CSDN 技术社区
/
topn_race
通知
455
Star
15
Fork
18
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
topn_race
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
57caaa36
编写于
12月 30, 2021
作者:
F
feilong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
添加是否覆盖询问
上级
69a74f45
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
37 addition
and
3 deletion
+37
-3
src/top.py
src/top.py
+37
-3
未找到文件。
src/top.py
浏览文件 @
57caaa36
...
...
@@ -75,6 +75,8 @@ class Top:
self
.
y_label
=
output
.
y_label
self
.
month_count
=
output
.
month_count
self
.
override_all_gif
=
False
def
build
(
self
):
self
.
__load_dataframe
()
# self.__exit()
...
...
@@ -94,16 +96,31 @@ class Top:
self
.
df
=
df
[
i
:
end
]
filename
=
os
.
path
.
join
(
self
.
output
,
f
'
{
j
}
.
{
self
.
ext
}
'
)
#
self.__build_race(filename)
self
.
__build_race
(
filename
)
gifs
.
append
(
filename
)
i
+=
step
j
+=
1
# 合并 gif 生成mp4
all
=
f
'
{
self
.
output
}
.mp4'
# concat_gif_list(gifs, all)
if
os
.
path
.
exists
(
all
):
ret
=
input
(
f
"文件:
{
all
}
已存在,是否覆盖?[y/n]:"
)
if
ret
==
'y'
:
concat_gif_list
(
gifs
,
all
)
else
:
concat_gif_list
(
gifs
,
all
)
# 合成 mp4 和 音频
if
self
.
audio
is
not
None
:
all_with_audio
=
f
'
{
self
.
output
}
_with_audio.mp4'
merge_video_audio
(
all
,
self
.
audio
,
all_with_audio
)
if
os
.
path
.
exists
(
all_with_audio
):
ret
=
input
(
f
"文件:
{
all_with_audio
}
已存在,是否覆盖?[y/n]:"
)
if
ret
==
'y'
:
merge_video_audio
(
all
,
self
.
audio
,
all_with_audio
)
else
:
merge_video_audio
(
all
,
self
.
audio
,
all_with_audio
)
else
:
print
(
f
"音频文件
{
self
.
audio
}
不存在,请自行准备一个合适的音频文件。"
)
def
__load_dataframe
(
self
):
if
self
.
input_type
==
'json_dir'
:
...
...
@@ -178,6 +195,23 @@ class Top:
matplotlib
.
rc
(
"font"
,
family
=
'FZFangSong-Z02'
)
def
__build_race
(
self
,
filename
):
build
=
False
if
self
.
override_all_gif
:
build
=
True
else
:
if
os
.
path
.
exists
(
filename
):
ret
=
input
(
f
"文件:
{
filename
}
已存在,是否覆盖?[a/y/n]:"
)
if
ret
==
'y'
:
build
=
True
elif
ret
==
'a'
:
build
=
True
self
.
override_all_gif
=
True
else
:
build
=
True
if
not
build
:
return
bar_chart_race
(
df
=
self
.
df
,
filename
=
filename
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录