Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
jovuit
funkwhale
Commits
f54038ca
Commit
f54038ca
authored
Jun 05, 2020
by
Agate
💬
Browse files
Resolve "CLI in-place import impossible with virtualenv with python3.5"
parent
96f6b1e1
Changes
4
Hide whitespace changes
Inline
Side-by-side
api/funkwhale_api/music/management/commands/import_files.py
View file @
f54038ca
...
...
@@ -27,7 +27,8 @@ def crawl_dir(dir, extensions, recursive=True, ignored=[]):
if
os
.
path
.
isfile
(
dir
):
yield
dir
return
with
os
.
scandir
(
dir
)
as
scanner
:
try
:
scanner
=
os
.
scandir
(
dir
)
for
entry
in
scanner
:
if
entry
.
is_file
():
for
e
in
extensions
:
...
...
@@ -38,6 +39,9 @@ def crawl_dir(dir, extensions, recursive=True, ignored=[]):
yield
from
crawl_dir
(
entry
,
extensions
,
recursive
=
recursive
,
ignored
=
ignored
)
finally
:
if
hasattr
(
scanner
,
"close"
):
scanner
.
close
()
def
batch
(
iterable
,
n
=
1
):
...
...
api/tests/files/nested/valid.ogg
0 → 100644
View file @
f54038ca
File added
api/tests/test_import_audio_file.py
View file @
f54038ca
...
...
@@ -352,3 +352,17 @@ def test_handle_modified_update_existing_path_if_found_and_attributed_to(
event
=
event
,
stdout
=
stdout
,
library
=
library
,
in_place
=
True
,
)
update_track_metadata
.
assert_not_called
()
def
test_import_files
(
factories
,
capsys
):
# smoke test to ensure the command run properly
library
=
factories
[
"music.Library"
](
actor__local
=
True
)
call_command
(
"import_files"
,
str
(
library
.
uuid
),
DATA_DIR
,
interactive
=
False
,
recursive
=
True
)
captured
=
capsys
.
readouterr
()
imported
=
library
.
uploads
.
filter
(
import_status
=
"finished"
).
count
()
assert
imported
>
0
assert
"Successfully imported {} new tracks"
.
format
(
imported
)
in
captured
.
out
assert
"For details, please refer to import reference"
in
captured
.
out
changes/changelog.d/1048.bugfix
0 → 100644
View file @
f54038ca
Fixed recursive CLI importing crashing under Python 3.5 (#1148, #1147)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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