diff --git a/backend/videoflix/content/tests.py b/backend/videoflix/content/tests.py index fe57dfe..d2887a6 100644 --- a/backend/videoflix/content/tests.py +++ b/backend/videoflix/content/tests.py @@ -11,10 +11,10 @@ class VideoTasksTest(TestCase): Tests whether the HLS conversion script is called correctly and the correct parameters are passed. """ mock_subprocess_run.return_value = MagicMock() - convert_video_to_hls('test/source.mp4', '1080', 1) + convert_video_to_hls('test/source.mp4', '1920x1080', 1) mock_subprocess_run.assert_called_once() self.assertIn('-i', mock_subprocess_run.call_args[0][0]) - self.assertIn('hd1080', mock_subprocess_run.call_args[0][0]) + self.assertIn('1920x1080', mock_subprocess_run.call_args[0][0]) @patch('os.remove') def test_delete_original_video(self, mock_os_remove): diff --git a/frontend/src/app/components/auth/auth.component.ts b/frontend/src/app/components/auth/auth.component.ts index 0655034..2902814 100644 --- a/frontend/src/app/components/auth/auth.component.ts +++ b/frontend/src/app/components/auth/auth.component.ts @@ -17,6 +17,7 @@ export class AuthComponent { authData = { mail: '', }; + constructor( private router: Router, public errorService: ErrorService, diff --git a/frontend/src/app/components/auth/forgot-password/forgot-password.component.ts b/frontend/src/app/components/auth/forgot-password/forgot-password.component.ts index e75f11d..9cd4c1b 100644 --- a/frontend/src/app/components/auth/forgot-password/forgot-password.component.ts +++ b/frontend/src/app/components/auth/forgot-password/forgot-password.component.ts @@ -1,5 +1,5 @@ import { CommonModule } from '@angular/common'; -import { Component } from '@angular/core'; +import { Component, OnInit } from '@angular/core'; import { BtnLargeComponent } from '../../../shared/components/buttons/btn-large/btn-large.component'; import { FormsModule, NgForm } from '@angular/forms'; import { ActivatedRoute, RouterLink } from '@angular/router'; @@ -13,7 +13,7 @@ import { ErrorService } from '../../../services/error.service'; templateUrl: './forgot-password.component.html', styleUrl: './forgot-password.component.scss', }) -export class ForgotPasswordComponent { +export class ForgotPasswordComponent implements OnInit { authData = { mail: '', token: '', diff --git a/frontend/src/app/components/auth/register/register.component.ts b/frontend/src/app/components/auth/register/register.component.ts index 15f5f9f..52e4ad9 100644 --- a/frontend/src/app/components/auth/register/register.component.ts +++ b/frontend/src/app/components/auth/register/register.component.ts @@ -1,4 +1,4 @@ -import { Component } from '@angular/core'; +import { Component, OnInit } from '@angular/core'; import { BtnLargeComponent } from '../../../shared/components/buttons/btn-large/btn-large.component'; import { FormsModule, NgForm } from '@angular/forms'; import { ActivatedRoute, Router, RouterLink } from '@angular/router'; @@ -13,7 +13,7 @@ import { ErrorService } from '../../../services/error.service'; templateUrl: './register.component.html', styleUrl: './register.component.scss', }) -export class RegisterComponent { +export class RegisterComponent implements OnInit { authData = { mail: '', password: '', diff --git a/frontend/src/app/components/home/browse/categories/categories.component.ts b/frontend/src/app/components/home/browse/categories/categories.component.ts index 63aeba2..f7a34e3 100644 --- a/frontend/src/app/components/home/browse/categories/categories.component.ts +++ b/frontend/src/app/components/home/browse/categories/categories.component.ts @@ -1,5 +1,6 @@ import { CommonModule } from '@angular/common'; import { + AfterViewInit, Component, EventEmitter, HostListener, @@ -15,7 +16,7 @@ import { environment } from '../../../../environments/environment'; templateUrl: './categories.component.html', styleUrl: './categories.component.scss', }) -export class CategoriesComponent { +export class CategoriesComponent implements AfterViewInit { @Input() movies: any[] = []; @Input() currentMovie: number = 0; @Input() favoriteMovies: any[] = []; diff --git a/frontend/src/app/components/home/browse/hero-banner/hero-banner.component.ts b/frontend/src/app/components/home/browse/hero-banner/hero-banner.component.ts index d68d570..75617ec 100644 --- a/frontend/src/app/components/home/browse/hero-banner/hero-banner.component.ts +++ b/frontend/src/app/components/home/browse/hero-banner/hero-banner.component.ts @@ -4,6 +4,7 @@ import { ElementRef, EventEmitter, Input, + OnChanges, Output, SimpleChanges, } from '@angular/core'; @@ -20,7 +21,7 @@ import { UserService } from '../../../../services/user.service'; templateUrl: './hero-banner.component.html', styleUrl: './hero-banner.component.scss', }) -export class HeroBannerComponent { +export class HeroBannerComponent implements OnChanges { @Input() currentMovie: any[] = []; @Input() screenWidth: boolean = false; @Input() favoriteMovies: any[] = []; @@ -43,19 +44,6 @@ export class HeroBannerComponent { public userService: UserService ) {} - toggleLikeMovie(movieId: number): void { - if (this.favoriteMovies.includes(movieId)) { - this.favoriteMovies = this.favoriteMovies.filter((id) => id !== movieId); - } else { - this.favoriteMovies.push(movieId); - } - this.favoriteMovieChange.emit(this.favoriteMovies); - } - - checkLikeMovies(videoId: number) { - return this.favoriteMovies.includes(videoId); - } - ngOnChanges(changes: SimpleChanges) { if (changes['currentMovie'] && this.currentMovie.length > 0) { const movieId = this.currentMovie[0]?.id; @@ -70,6 +58,19 @@ export class HeroBannerComponent { } } + toggleLikeMovie(movieId: number): void { + if (this.favoriteMovies.includes(movieId)) { + this.favoriteMovies = this.favoriteMovies.filter((id) => id !== movieId); + } else { + this.favoriteMovies.push(movieId); + } + this.favoriteMovieChange.emit(this.favoriteMovies); + } + + checkLikeMovies(videoId: number) { + return this.favoriteMovies.includes(videoId); + } + isAnyResolutionUploaded(): boolean { return ( this.movieIsUploaded['320'] ||