Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
spider
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
selection-new
spider
Commits
0c4f4ead
Commit
0c4f4ead
authored
Dec 18, 2025
by
Peng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
b1700260
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
10 deletions
+14
-10
upload_pic.py
...ts/picture_material/stock_summery/new_stock/upload_pic.py
+14
-10
No files found.
wangjing_projects/projects/picture_material/stock_summery/new_stock/upload_pic.py
View file @
0c4f4ead
...
...
@@ -215,12 +215,14 @@ class UploadPicture():
image_extensions
=
[
'.jpg'
,
'.jpeg'
,
'.png'
]
# 获取文件夹中所有支持的图像文件,并按最后修改时间排序
files
=
[]
for
file_name
in
os
.
listdir
(
folder_path
):
if
any
(
file_name
.
lower
()
.
endswith
(
ext
)
for
ext
in
image_extensions
):
file_path
=
os
.
path
.
join
(
folder_path
,
file_name
)
mtime
=
os
.
path
.
getmtime
(
file_path
)
files
.
append
((
file_name
,
mtime
))
try
:
for
file_name
in
os
.
listdir
(
folder_path
):
if
any
(
file_name
.
lower
()
.
endswith
(
ext
)
for
ext
in
image_extensions
):
file_path
=
os
.
path
.
join
(
folder_path
,
file_name
)
mtime
=
os
.
path
.
getmtime
(
file_path
)
files
.
append
((
file_name
,
mtime
))
except
:
return
'null'
# 按文件的最后修改时间排序
files_sorted
=
sorted
(
files
,
key
=
lambda
x
:
x
[
1
])
# 成功后转移
...
...
@@ -240,7 +242,7 @@ class UploadPicture():
print
(
'转移到上传成功的文件夹中'
)
shutil
.
move
(
file_path
,
os
.
path
.
join
(
all_pic_success_dir
,
file_name
))
pass
return
1
def
run
(
self
):
folder_path_list
=
[
...
...
@@ -279,7 +281,7 @@ class UploadPicture():
if
9
<=
datetime
.
now
()
.
hour
<
16
:
print
(
f
"当前时间 {datetime.now().hour} 点,超出运行时段 18:00–08:00,退出循环。"
)
break
print
(
f
"当前时间 {datetime.now().hour} 点,开始处理账户 {account_id}
。
"
)
print
(
f
"当前时间 {datetime.now().hour} 点,开始处理账户 {account_id}"
)
if
'@'
in
account_id
:
account_id_tmp
=
account_id
.
split
(
'@'
)[
0
]
else
:
...
...
@@ -288,9 +290,11 @@ class UploadPicture():
print
(
'folder_path:::'
,
folder_path
)
# 带重试地执行上传目录
success
=
False
for
attempt
in
range
(
1
):
# 最多重试3次
for
attempt
in
range
(
3
):
# 最多重试3次
try
:
self
.
upload_dir
(
folder_path
)
str_null
=
self
.
upload_dir
(
folder_path
)
if
str_null
==
'null'
:
break
success
=
True
break
except
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment