Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
C
cp_video_dokku
Project
Project
Details
Activity
Releases
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
Alexandr Dzehil
cp_video_dokku
Commits
c874faa8
You need to sign in or sign up before continuing.
Commit
c874faa8
authored
Apr 06, 2023
by
Ilya Simonov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
revert
2d933ac7
parent
4f134d45
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
5 deletions
+4
-5
utils.py
apps/core/utils.py
+4
-5
No files found.
apps/core/utils.py
View file @
c874faa8
...
...
@@ -26,20 +26,17 @@ def download_file(url):
def
handle_uploaded_file
(
f
,
file_name
):
chunk_count
=
0
with
open
(
file_name
,
'wb+'
)
as
destination
:
for
chunk
in
f
.
chunks
(
chunk_size
=
4097152
):
print
(
'chunk'
)
destination
.
write
(
chunk
)
chunk_count
+=
1
print
(
'chunk_count'
,
chunk_count
)
def
generate_thumbnail
(
video_path
,
video_name
):
clip
=
VideoFileClip
(
video_path
)
log
.
info
(
'get clip successfully!'
)
thumbnail_name
=
video_name
.
split
(
'.'
)[
0
]
thumbnail_name
=
f
'{thumbnail_name}.jpg'
thumbnail_name
=
f
'{
settings.MEDIA_ROOT}{
thumbnail_name}.jpg'
log
.
info
(
f
'thumbnail name: {thumbnail_name}'
)
clip
.
save_frame
(
thumbnail_name
,
t
=
1.00
)
log
.
info
(
'create frame successfully!'
)
...
...
@@ -47,6 +44,8 @@ def generate_thumbnail(video_path, video_name):
thumbnail
=
open
(
thumbnail_name
,
'rb'
)
log
.
info
(
'open thumbnail successfully!'
)
thumbnail_name
=
thumbnail_name
.
split
(
'/'
)[
-
1
]
return
thumbnail
,
thumbnail_name
...
...
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