Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
XianxinMao
Yt Dlp
提交
2e4585da
Y
Yt Dlp
项目概览
XianxinMao
/
Yt Dlp
11 个月 前同步成功
通知
27
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Y
Yt Dlp
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
2e4585da
编写于
5月 12, 2022
作者:
P
pukkandan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[cookies] Throttle progress-bar
Closes #3710
上级
8dcce6a8
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
10 addition
and
4 deletion
+10
-4
yt_dlp/cookies.py
yt_dlp/cookies.py
+10
-4
未找到文件。
yt_dlp/cookies.py
浏览文件 @
2e4585da
...
...
@@ -7,6 +7,7 @@
import
subprocess
import
sys
import
tempfile
import
time
from
datetime
import
datetime
,
timedelta
,
timezone
from
enum
import
Enum
,
auto
from
hashlib
import
pbkdf2_hmac
...
...
@@ -49,6 +50,14 @@ def error(self, message):
if
self
.
_ydl
:
self
.
_ydl
.
report_error
(
message
)
class
ProgressBar
(
MultilinePrinter
):
_DELAY
,
_timer
=
0.1
,
0
def
print
(
self
,
message
):
if
time
.
time
()
-
self
.
_timer
>
self
.
_DELAY
:
self
.
print_at_line
(
f
'[Cookies]
{
message
}
'
,
0
)
self
.
_timer
=
time
.
time
()
def
progress_bar
(
self
):
"""Return a context manager with a print method. (Optional)"""
# Do not print to files/pipes, loggers, or when --no-progress is used
...
...
@@ -60,10 +69,7 @@ def progress_bar(self):
return
except
BaseException
:
return
printer
=
MultilinePrinter
(
file
,
preserve_output
=
False
)
printer
.
print
=
lambda
message
:
printer
.
print_at_line
(
f
'[Cookies]
{
message
}
'
,
0
)
return
printer
return
self
.
ProgressBar
(
file
,
preserve_output
=
False
)
def
_create_progress_bar
(
logger
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录