Skip to content

Commit

Permalink
refactor: linting :)
Browse files Browse the repository at this point in the history
  • Loading branch information
escaped committed Nov 15, 2020
1 parent 2f5e16b commit 5e865f3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
4 changes: 2 additions & 2 deletions video_encoding/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from django.core.files import File

from video_encoding.utils import get_fieldfile_local_path

from .backends import get_backend


Expand Down Expand Up @@ -43,8 +44,7 @@ def _get_video_info(self):
if not hasattr(self, '_info_cache'):
encoding_backend = get_backend()

local_path, local_tmp_file = \
get_fieldfile_local_path(fieldfile=self)
local_path, local_tmp_file = get_fieldfile_local_path(fieldfile=self)

info_cache = encoding_backend.get_media_info(local_path)

Expand Down
1 change: 1 addition & 0 deletions video_encoding/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from django.core.files import File

from video_encoding.utils import get_fieldfile_local_path

from .backends import get_backend
from .config import settings
from .exceptions import VideoEncodingError
Expand Down
12 changes: 3 additions & 9 deletions video_encoding/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,13 @@ def get_fieldfile_local_path(fieldfile):
storage = fieldfile.storage
try:
# Try to access with path
storage_local_path = storage.path(
fieldfile.path
)
storage_local_path = storage.path(fieldfile.path)
except (NotImplementedError, AttributeError):
# Storage doesnt support absolute paths, download
# file to a temp local dir
storage_file = storage.open(
fieldfile.name, 'r'
)
storage_file = storage.open(fieldfile.name, 'r')

local_temp_file = tempfile.NamedTemporaryFile(
delete=False
)
local_temp_file = tempfile.NamedTemporaryFile(delete=False)
local_temp_file.write(storage_file.read())
local_temp_file.seek(0)

Expand Down

0 comments on commit 5e865f3

Please sign in to comment.