clean code
This commit is contained in:
parent
3f2d4afc06
commit
5cea3b54da
6 changed files with 24 additions and 21 deletions
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ export class AuthComponent {
|
|||
authData = {
|
||||
mail: '',
|
||||
};
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
public errorService: ErrorService,
|
||||
|
|
|
|||
|
|
@ -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: '',
|
||||
|
|
|
|||
|
|
@ -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: '',
|
||||
|
|
|
|||
|
|
@ -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[] = [];
|
||||
|
|
|
|||
|
|
@ -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'] ||
|
||||
|
|
|
|||
Loading…
Reference in a new issue