diff --git a/backend/video_app/signals.py b/backend/video_app/signals.py index a09bd08..5e2f8ef 100644 --- a/backend/video_app/signals.py +++ b/backend/video_app/signals.py @@ -51,9 +51,9 @@ def delete_converted_files(video_file_path): """ Delete all converted video files related to the original video file. """ - resolutions = ["360", "720", "1080"] + resolutions = ["360p", "720p", "1080p"] for resolution in resolutions: - converted_video_path = video_file_path + f'_{resolution}p.mp4' + converted_video_path = video_file_path + f'_{resolution}.mp4' converted_video_path = remove_first_mp4(converted_video_path) if os.path.isfile(converted_video_path): os.remove(converted_video_path) diff --git a/backend/video_app/views.py b/backend/video_app/views.py index 88e47ab..3ce53f0 100644 --- a/backend/video_app/views.py +++ b/backend/video_app/views.py @@ -30,7 +30,7 @@ def check_video_resolutions(request, id): """ Check if a specific video exists in different resolutions (360p, 720p, 1080p). """ - resolutions = ['360', '720', '1080'] + resolutions = ['360p', '720p', '1080p'] result = {} try: @@ -41,7 +41,7 @@ def check_video_resolutions(request, id): video_dir = os.path.join(settings.MEDIA_ROOT, 'videos', str(id)) for res in resolutions: - video_file_name = f"{video.file_name}_{res}p.m3u8" + video_file_name = f"{video.file_name}_{res}.m3u8" video_file_path = os.path.join(video_dir, video_file_name) result[res] = os.path.exists(video_file_path) diff --git a/frontend/src/app/components/home/hero-banner/hero-banner.component.ts b/frontend/src/app/components/home/hero-banner/hero-banner.component.ts index 0ff436a..9fedb71 100644 --- a/frontend/src/app/components/home/hero-banner/hero-banner.component.ts +++ b/frontend/src/app/components/home/hero-banner/hero-banner.component.ts @@ -42,9 +42,9 @@ export class HeroBannerComponent implements OnChanges { playUrl: string = ''; environmentBaseUrl: string = environment.baseUrl; movieIsUploaded: { [resolution: string]: boolean } = { - '320': true, - '720': true, - '1080': true, + '320p': true, + '720p': true, + '1080p': true, }; constructor( private movieService: MovieService, @@ -123,9 +123,9 @@ export class HeroBannerComponent implements OnChanges { isAnyResolutionUploaded(): boolean { return ( - this.movieIsUploaded['320'] || - this.movieIsUploaded['720'] || - this.movieIsUploaded['1080'] + this.movieIsUploaded['320p'] || + this.movieIsUploaded['720p'] || + this.movieIsUploaded['1080p'] ); } diff --git a/frontend/src/app/components/home/home.component.html b/frontend/src/app/components/home/home.component.html index 2d50e67..ca1be50 100644 --- a/frontend/src/app/components/home/home.component.html +++ b/frontend/src/app/components/home/home.component.html @@ -44,52 +44,30 @@
+ + @for (resolution of availableResolutions; track $index) { - - + }
-

+ + @if (isAnyResolutionUnavailable()) { +

(If a button cannot be selected, the video will be converted, which may take a few seconds.)

+ }