Spaces:
Paused
Paused
update
Browse files
toolbox/bilibili/video/video_manager.py
CHANGED
|
@@ -119,7 +119,7 @@ class BilibiliVideoUploader(BilibiliClient):
|
|
| 119 |
"total": filesize,
|
| 120 |
}
|
| 121 |
|
| 122 |
-
process_bar = tqdm("bilibili_upload_video", total=chunks)
|
| 123 |
for chunknum in range(chunks):
|
| 124 |
start = fileio.tell()
|
| 125 |
batchbytes = fileio.read(chunk_size)
|
|
@@ -136,7 +136,7 @@ class BilibiliVideoUploader(BilibiliClient):
|
|
| 136 |
)
|
| 137 |
if response.status_code != 200:
|
| 138 |
raise AssertionError(f"request failed; status_code: {response.status_code}, text: {response.text}")
|
| 139 |
-
process_bar.update(1)
|
| 140 |
|
| 141 |
@retry(
|
| 142 |
wait=wait_fixed(10),
|
|
|
|
| 119 |
"total": filesize,
|
| 120 |
}
|
| 121 |
|
| 122 |
+
process_bar = tqdm(desc="bilibili_upload_video", total=chunks)
|
| 123 |
for chunknum in range(chunks):
|
| 124 |
start = fileio.tell()
|
| 125 |
batchbytes = fileio.read(chunk_size)
|
|
|
|
| 136 |
)
|
| 137 |
if response.status_code != 200:
|
| 138 |
raise AssertionError(f"request failed; status_code: {response.status_code}, text: {response.text}")
|
| 139 |
+
process_bar.update(n=1)
|
| 140 |
|
| 141 |
@retry(
|
| 142 |
wait=wait_fixed(10),
|
toolbox/porter/tasks/douyin_live_record_task.py
CHANGED
|
@@ -74,13 +74,12 @@ class DouyinLiveRecordTask(BaseTask):
|
|
| 74 |
def get_video_info(self, title):
|
| 75 |
tz = ZoneInfo("Asia/Shanghai")
|
| 76 |
now = datetime.now(tz)
|
| 77 |
-
create_time_str = now.strftime("%Y%m%
|
| 78 |
-
|
| 79 |
-
video_id = create_time_str
|
| 80 |
title = f"{title}({video_id}直播)"
|
| 81 |
tags = ["Douyin", self.room_name]
|
| 82 |
filename = self.output_video_dir / f"{title[:50]}.flv"
|
| 83 |
-
return create_time_str, filename, title, tags, video_id
|
| 84 |
|
| 85 |
def get_streamlink_session(self):
|
| 86 |
session = streamlink.session.Streamlink({
|
|
@@ -244,7 +243,7 @@ class DouyinLiveRecordTask(BaseTask):
|
|
| 244 |
"title": title,
|
| 245 |
"desc": "",
|
| 246 |
"tags": tags,
|
| 247 |
-
"url_list": [
|
| 248 |
|
| 249 |
"video_id": video_id,
|
| 250 |
}
|
|
|
|
| 74 |
def get_video_info(self, title):
|
| 75 |
tz = ZoneInfo("Asia/Shanghai")
|
| 76 |
now = datetime.now(tz)
|
| 77 |
+
create_time_str = now.strftime("%Y%m%dT%H%M%S")
|
| 78 |
+
video_id = now.strftime("%Y%m%d_%H%M%S")
|
|
|
|
| 79 |
title = f"{title}({video_id}直播)"
|
| 80 |
tags = ["Douyin", self.room_name]
|
| 81 |
filename = self.output_video_dir / f"{title[:50]}.flv"
|
| 82 |
+
return create_time_str, filename.as_posix(), title, tags, video_id
|
| 83 |
|
| 84 |
def get_streamlink_session(self):
|
| 85 |
session = streamlink.session.Streamlink({
|
|
|
|
| 243 |
"title": title,
|
| 244 |
"desc": "",
|
| 245 |
"tags": tags,
|
| 246 |
+
"url_list": [live_url],
|
| 247 |
|
| 248 |
"video_id": video_id,
|
| 249 |
}
|
toolbox/porter/tasks/video_to_bilibili_task.py
CHANGED
|
@@ -137,7 +137,8 @@ class VideoToBilibiliTask(BaseTask):
|
|
| 137 |
continue
|
| 138 |
logger.info(f"{self.flag}上传视频:{filename}")
|
| 139 |
video_id = await asyncio.to_thread(
|
| 140 |
-
self.bilibili_video_manager.upload_video_draft_and_publish,
|
|
|
|
| 141 |
filename=filename,
|
| 142 |
metadata=metadata,
|
| 143 |
)
|
|
|
|
| 137 |
continue
|
| 138 |
logger.info(f"{self.flag}上传视频:{filename}")
|
| 139 |
video_id = await asyncio.to_thread(
|
| 140 |
+
# self.bilibili_video_manager.upload_video_draft_and_publish,
|
| 141 |
+
self.bilibili_video_manager.upload_video_and_publish,
|
| 142 |
filename=filename,
|
| 143 |
metadata=metadata,
|
| 144 |
)
|
toolbox/porter/tasks/video_to_youtube_task.py
CHANGED
|
@@ -51,7 +51,7 @@ class VideoToYoutubeTask(BaseTask):
|
|
| 51 |
check_interval: int,
|
| 52 |
video_info_file: str,
|
| 53 |
remove_after_upload: bool = False,
|
| 54 |
-
remove_after_upload_delay: float =
|
| 55 |
playlist_title: str = None,
|
| 56 |
playlist_id: str = None,
|
| 57 |
min_date: str = None,
|
|
|
|
| 51 |
check_interval: int,
|
| 52 |
video_info_file: str,
|
| 53 |
remove_after_upload: bool = False,
|
| 54 |
+
remove_after_upload_delay: float = 0.1,
|
| 55 |
playlist_title: str = None,
|
| 56 |
playlist_id: str = None,
|
| 57 |
min_date: str = None,
|