Skip to content

Commit

Permalink
Update migration script
Browse files Browse the repository at this point in the history
  • Loading branch information
DerouineauNicolas committed Jun 18, 2024
1 parent fdb3841 commit c0b9dda
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions backend/StreamServerApp/migrations/0026_auto_20240618_0917.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,29 @@
from StreamServerApp.media_management.cover_downloader import cover_downloader
import os

cvdwnld = cover_downloader()

def get_cover(apps, schema_editor):

if os.getenv('TMBD_KEY'):

movies = Movie.objects.all()
for movie in movies:
movie.video_set
output_file = "/usr/src/static/{}.jpeg".format(movie.title)
cover_downloader.download_cover(serie.title, output_file, True)

output_file = "/usr/static/{}.jpeg".format(movie.title)
ret = cvdwnld.download_cover(movie.title, output_file, True)
if ret > 0:
videos = movie.video_set.all()
for video in videos:
video.thumbnail = "/static/{}.jpeg".format(movie.title)
video.save()


series = Series.objects.all()
for serie in series:
output_file = "/usr/src/static/{}.jpeg".format(serie.title)
ret = cover_downloader.download_cover(serie.title, output_file, True)
if ret:
serie.thumbnail = output_file
output_file = "/usr/static/{}.jpeg".format(serie.title)
ret = cvdwnld.download_cover(serie.title, output_file, True)
if ret > 0:
serie.thumbnail = "/static/{}.jpeg".format(serie.title)
serie.save()


Expand Down

0 comments on commit c0b9dda

Please sign in to comment.