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
a28213c8
Commit
a28213c8
authored
2 years ago
by
Ilya Simonov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix generate_thumbnail
parent
e8f7cc25
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
8 deletions
+8
-8
utils.cpython-39.pyc
apps/core/__pycache__/utils.cpython-39.pyc
+0
-0
tasks.py
apps/core/tasks.py
+3
-1
utils.py
apps/core/utils.py
+5
-7
No files found.
apps/core/__pycache__/utils.cpython-39.pyc
View file @
a28213c8
No preview for this file type
This diff is collapsed.
Click to expand it.
apps/core/tasks.py
View file @
a28213c8
...
...
@@ -32,7 +32,9 @@ def send_video_to_s3(video_id=None):
try
:
log
.
info
(
'Generating thumbnail...'
)
local_video
.
thumbnail
=
generate_thumbnail
(
file_path
,
video_name
)
thumbnail
,
thumbnail_name
=
generate_thumbnail
(
file_path
,
video_name
)
key_thumbnail
=
f
'videos/thumbnail/{thumbnail_name}'
local_video
.
thumbnail
=
upload_file
(
thumbnail
,
key_thumbnail
,
'image/jpeg'
)
log
.
info
(
'Thumbnail generated successfully!'
)
except
Exception
as
e
:
log
.
error
(
e
)
...
...
This diff is collapsed.
Click to expand it.
apps/core/utils.py
View file @
a28213c8
...
...
@@ -8,8 +8,6 @@ from moviepy.editor import VideoFileClip
from
.models
import
Video
,
Playlist
,
TagToObject
,
DYNAMIC
,
PlaylistVideo
from
cp_video.utils
import
asset_upload
log
=
logging
.
getLogger
(
'send_video_to_s3'
)
...
...
@@ -35,16 +33,16 @@ def handle_uploaded_file(f, file_name):
def
generate_thumbnail
(
video_path
,
video_name
):
clip
=
VideoFileClip
(
video_path
)
print
(
'get clip successfully!'
)
log
.
info
(
'get clip successfully!'
)
thumbnail_name
=
video_name
.
split
(
'.'
)[
0
]
thumbnail_name
=
f
'{settings.DOMAIN_NAME}{settings.MEDIA_ROOT}{thumbnail_name}.jpg'
print
(
'thumbnail big name'
,
thumbnail_name
)
thumbnail_name
=
f
'{settings.MEDIA_ROOT}{thumbnail_name}.jpg'
clip
.
save_frame
(
thumbnail_name
,
t
=
1.00
)
thumbnail
=
open
(
thumbnail_name
,
'rb'
)
thumbnail_name
=
thumbnail_name
.
split
(
'/'
)[
-
1
]
print
(
'thumbnail_name'
,
thumbnail_name
)
return
thumbnail_name
return
thumbnail
,
thumbnail
_name
def
add_video_to_playlist
(
video
):
...
...
This diff is collapsed.
Click to expand it.
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