Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Video AG Infrastruktur
ftpupload
Commits
ed4212a5
Commit
ed4212a5
authored
Nov 05, 2019
by
Julian Rother
Browse files
Fixed handling of duplicate file names in autoencoding (closes
#1
)
parent
cfdef0f8
Changes
1
Hide whitespace changes
Inline
Side-by-side
ftpd.py
View file @
ed4212a5
...
...
@@ -13,12 +13,13 @@ def on_file_received(handler, path):
elif
path
.
startswith
(
RAW_TMP
):
path
=
path
[
len
(
RAW_TMP
):].
lstrip
(
'/'
)
num
=
0
suffix
=
''
while
os
.
path
.
exists
(
RAW_TARGET
+
'/'
+
path
+
suffix
):
rpath
=
path
while
os
.
path
.
exists
(
RAW_TARGET
+
'/'
+
r
path
):
num
+=
1
suffix
=
'.'
+
str
(
num
)
os
.
rename
(
RAW_TMP
+
'/'
+
path
,
RAW_TARGET
+
'/'
+
path
+
suffix
)
requests
.
get
(
API_BASEURL
+
'/internal/sort/autoencode'
,
params
=
{
'apikey'
:
API_APIKEY
,
'path'
:
path
+
suffix
})
p
=
path
.
rsplit
(
'.'
,
1
)
rpath
=
'.'
.
join
([
p
[
0
]
+
'_'
+
str
(
num
)]
+
p
[
1
:])
os
.
rename
(
RAW_TMP
+
'/'
+
path
,
RAW_TARGET
+
'/'
+
rpath
)
requests
.
get
(
API_BASEURL
+
'/internal/sort/autoencode'
,
params
=
{
'apikey'
:
API_APIKEY
,
'path'
:
rpath
})
else
:
print
(
"Unknown path:"
,
path
)
...
...
Write
Preview
Supports
Markdown
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