{{ currentMovie[0].title }}
+ {{ currentVideo[0].title }}
- } } @if (!isLoading && movies.length === 0) {
+ } } @if (!isLoading && videos.length === 0) {
@@ -85,12 +85,12 @@
-@if (uploadMovieOverview) {
-
+@if (uploadVideoOverview) {
+
}
diff --git a/frontend/src/app/components/home/home.component.ts b/frontend/src/app/components/home/home.component.ts
index 8e7d31d..20ae1c1 100644
--- a/frontend/src/app/components/home/home.component.ts
+++ b/frontend/src/app/components/home/home.component.ts
@@ -6,7 +6,7 @@ import { VideoService } from '../../services/video.service';
import { CommonModule } from '@angular/common';
import { VideoPlayerComponent } from './video-player/video-player.component';
import { BtnSmallComponent } from '../../shared/components/buttons/btn-small/btn-small.component';
-import { UploadMovieComponent } from './upload-movie/upload-movie.component';
+import { UploadVideoComponent } from './upload-video/upload-video.component';
import { UserService } from '../../services/user.service';
import { ResolutionService } from '../../services/resolution.service';
@@ -20,24 +20,24 @@ import { ResolutionService } from '../../services/resolution.service';
CategoriesComponent,
VideoPlayerComponent,
BtnSmallComponent,
- UploadMovieComponent,
+ UploadVideoComponent,
],
templateUrl: './home.component.html',
styleUrl: './home.component.scss',
})
export class HomeComponent implements OnInit {
@ViewChild(VideoPlayerComponent) videoPlayer!: VideoPlayerComponent;
- movies: any[] = [];
- favoriteMovies: number[] = [];
- watchedMovies: number[] = [];
- currentMovie: any[] = [];
- playMovie: string = '';
+ videos: any[] = [];
+ favoriteVideos: number[] = [];
+ watchedVideos: number[] = [];
+ currentVideo: any[] = [];
+ playVideo: string = '';
isLoading: boolean = true;
- uploadMovieOverview: boolean = false;
+ uploadVideoOverview: boolean = false;
availableResolutions: string[];
currentResolution: string;
- movieIsUploaded: { [resolution: string]: boolean };
+ videoIsUploaded: { [resolution: string]: boolean };
constructor(
private videoService: VideoService,
@@ -47,46 +47,46 @@ export class HomeComponent implements OnInit {
this.availableResolutions =
this.resolutionService.getAvailableResolutions();
this.currentResolution = this.resolutionService.getDefaultResolution();
- this.movieIsUploaded = this.resolutionService.initMovieIsUploaded();
+ this.videoIsUploaded = this.resolutionService.initVideoIsUploaded();
}
async ngOnInit() {
- this.loadLikedAndWatchedMovies();
- await this.loadAllMovies();
+ this.loadLikedAndWatchedVideos();
+ await this.loadAllVideos();
if (this.isWideScreen()) {
- this.currentMovie.length === 0 ? this.loadRandomMovie() : null;
+ this.currentVideo.length === 0 ? this.loadRandomVideo() : null;
}
}
- async loadLikedAndWatchedMovies() {
+ async loadLikedAndWatchedVideos() {
try {
- const userData = await this.userService.getLikedAndWatchedMovies();
- this.favoriteMovies = userData.liked_videos;
- this.watchedMovies = userData.watched_videos;
+ const userData = await this.userService.getLikedAndWatchedVideos();
+ this.favoriteVideos = userData.liked_videos;
+ this.watchedVideos = userData.watched_videos;
} catch (error) {
console.error(error);
}
}
- updateLikeMovies() {
+ updateLikeVideos() {
const body = {
- liked_videos: this.favoriteMovies,
+ liked_videos: this.favoriteVideos,
};
- this.userService.updateLikedMovies(body);
+ this.userService.updateLikedVideos(body);
}
- onRefreshPage(updatedMovies: any[]) {
- this.currentMovie = [];
+ onRefreshPage(updatedVideos: any[]) {
+ this.currentVideo = [];
setTimeout(() => {
- this.currentMovie = updatedMovies;
+ this.currentVideo = updatedVideos;
}, 1);
}
- onMoviesChange(updatedMovies: any[]) {
+ onVideosChange(updatedVideos: any[]) {
if (this.isWideScreen()) {
- this.loadRandomMovie();
+ this.loadRandomVideo();
} else {
- this.currentMovie = updatedMovies;
+ this.currentVideo = updatedVideos;
}
}
@@ -94,60 +94,60 @@ export class HomeComponent implements OnInit {
return window.innerWidth > 600;
}
- onMovieIsUploadedChange(newStatus: { [resolution: string]: boolean }) {
- this.movieIsUploaded = newStatus;
+ onVideoIsUploadedChange(newStatus: { [resolution: string]: boolean }) {
+ this.videoIsUploaded = newStatus;
}
- onFavoriteMovieChange(favoriteMovies: any) {
- this.favoriteMovies = favoriteMovies;
- this.updateLikeMovies();
+ onFavoriteVideoChange(favoriteVideos: any) {
+ this.favoriteVideos = favoriteVideos;
+ this.updateLikeVideos();
}
changeResolution(resolution: string) {
- if (this.videoPlayer && this.movieIsUploaded[resolution]) {
+ if (this.videoPlayer && this.videoIsUploaded[resolution]) {
this.videoPlayer.switchResolution(resolution);
this.currentResolution = resolution;
}
}
- async loadAllMovies() {
+ async loadAllVideos() {
this.isLoading = true;
try {
- this.movies = await this.videoService.getAllVideos();
+ this.videos = await this.videoService.getAllVideos();
} finally {
this.isLoading = false;
}
}
closeVideo(): void {
- this.playMovie = '';
+ this.playVideo = '';
}
- playVideo(videoPath: string) {
+ playVideoPath(videoPath: string) {
this.currentResolution = '720p';
- this.playMovie = videoPath;
+ this.playVideo = videoPath;
}
- loadRandomMovie(): void {
- const randomIndex = Math.floor(Math.random() * this.movies.length);
- this.currentMovie = [this.movies[randomIndex]];
+ loadRandomVideo(): void {
+ const randomIndex = Math.floor(Math.random() * this.videos.length);
+ this.currentVideo = [this.videos[randomIndex]];
}
- currentMovieId(movieId: number) {
- let index = this.movies.findIndex((movie) => movie.id === movieId);
+ currentVideoId(videoId: number) {
+ let index = this.videos.findIndex((video) => video.id === videoId);
if (index !== -1) {
- this.currentMovie = [];
- this.currentMovie.push(this.movies[index]);
+ this.currentVideo = [];
+ this.currentVideo.push(this.videos[index]);
}
}
isAnyResolutionUnavailable(): boolean {
return this.availableResolutions.some(
- (resolution) => !this.movieIsUploaded[resolution]
+ (resolution) => !this.videoIsUploaded[resolution]
);
}
- toggleUploadMovieOverview(value: any) {
- this.uploadMovieOverview = value;
+ toggleUploadVideoOverview(value: any) {
+ this.uploadVideoOverview = value;
}
}
diff --git a/frontend/src/app/components/home/upload-movie/upload-movie.component.html b/frontend/src/app/components/home/upload-video/upload-video.component.html
similarity index 79%
rename from frontend/src/app/components/home/upload-movie/upload-movie.component.html
rename to frontend/src/app/components/home/upload-video/upload-video.component.html
index a5f57e9..87d08a4 100644
--- a/frontend/src/app/components/home/upload-movie/upload-movie.component.html
+++ b/frontend/src/app/components/home/upload-video/upload-video.component.html
@@ -1,10 +1,10 @@
-
-@if(movieData.send){
+@if(videoData.send){
}
diff --git a/frontend/src/app/components/home/upload-movie/upload-movie.component.scss b/frontend/src/app/components/home/upload-video/upload-video.component.scss
similarity index 100%
rename from frontend/src/app/components/home/upload-movie/upload-movie.component.scss
rename to frontend/src/app/components/home/upload-video/upload-video.component.scss
diff --git a/frontend/src/app/components/home/upload-movie/upload-movie.component.spec.ts b/frontend/src/app/components/home/upload-video/upload-video.component.spec.ts
similarity index 52%
rename from frontend/src/app/components/home/upload-movie/upload-movie.component.spec.ts
rename to frontend/src/app/components/home/upload-video/upload-video.component.spec.ts
index 5dd490b..21188b4 100644
--- a/frontend/src/app/components/home/upload-movie/upload-movie.component.spec.ts
+++ b/frontend/src/app/components/home/upload-video/upload-video.component.spec.ts
@@ -1,16 +1,16 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
-import { UploadMovieComponent } from './upload-movie.component';
+import { UploadVideoComponent } from './upload-video.component';
-describe('UploadMovieComponent', () => {
- let component: UploadMovieComponent;
- let fixture: ComponentFixture;
+describe('UploadVideoComponent', () => {
+ let component: UploadVideoComponent;
+ let fixture: ComponentFixture;
beforeEach(async () => {
await TestBed.configureTestingModule({
- imports: [UploadMovieComponent],
+ imports: [UploadVideoComponent],
}).compileComponents();
- fixture = TestBed.createComponent(UploadMovieComponent);
+ fixture = TestBed.createComponent(UploadVideoComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
diff --git a/frontend/src/app/components/home/upload-movie/upload-movie.component.ts b/frontend/src/app/components/home/upload-video/upload-video.component.ts
similarity index 73%
rename from frontend/src/app/components/home/upload-movie/upload-movie.component.ts
rename to frontend/src/app/components/home/upload-video/upload-video.component.ts
index d48c58f..2ad1044 100644
--- a/frontend/src/app/components/home/upload-movie/upload-movie.component.ts
+++ b/frontend/src/app/components/home/upload-video/upload-video.component.ts
@@ -7,7 +7,7 @@ import { VideoService } from '../../../services/video.service';
import { LoadingDialogComponent } from '../../../shared/components/loading-dialog/loading-dialog.component';
@Component({
- selector: 'app-upload-movie',
+ selector: 'app-upload-video',
standalone: true,
imports: [
CommonModule,
@@ -15,15 +15,15 @@ import { LoadingDialogComponent } from '../../../shared/components/loading-dialo
BtnLargeComponent,
LoadingDialogComponent,
],
- templateUrl: './upload-movie.component.html',
- styleUrl: './upload-movie.component.scss',
+ templateUrl: './upload-video.component.html',
+ styleUrl: './upload-video.component.scss',
})
-export class UploadMovieComponent {
- @Output() toggleUploadMovieOverview = new EventEmitter();
+export class UploadVideoComponent {
+ @Output() toggleUploadVideoOverview = new EventEmitter();
errorMsgFileSize: string | null = null;
maxFileSizeMB = 20;
- movieData = {
+ videoData = {
title: '',
description: '',
filmGenre: '',
@@ -40,8 +40,8 @@ export class UploadMovieComponent {
event.stopPropagation();
}
- closeMovieUploadOverview() {
- this.toggleUploadMovieOverview.emit(false);
+ closeVideoUploadOverview() {
+ this.toggleUploadVideoOverview.emit(false);
}
onFileChange(event: any) {
@@ -52,7 +52,7 @@ export class UploadMovieComponent {
isOneFile(event: any) {
const file = event.target.files[0];
if (file) {
- this.movieData.videoFile = file;
+ this.videoData.videoFile = file;
}
}
isFileSize(event: any) {
@@ -72,12 +72,12 @@ export class UploadMovieComponent {
if (!ngForm.submitted || !ngForm.form.valid) return;
try {
- this.movieData.send = true;
+ this.videoData.send = true;
let formData = this.createFormData();
await this.videoService.uploadVideo(formData);
ngForm.resetForm();
- this.closeMovieUploadOverview();
- this.movieData.send = false;
+ this.closeVideoUploadOverview();
+ this.videoData.send = false;
window.location.reload();
this.errorService.clearError();
} catch (error) {
@@ -87,11 +87,11 @@ export class UploadMovieComponent {
private createFormData(): FormData {
const formData = new FormData();
- formData.append('title', this.movieData.title);
- formData.append('description', this.movieData.description);
- formData.append('film_genre', this.movieData.filmGenre);
- if (this.movieData.videoFile) {
- formData.append('video_file', this.movieData.videoFile);
+ formData.append('title', this.videoData.title);
+ formData.append('description', this.videoData.description);
+ formData.append('film_genre', this.videoData.filmGenre);
+ if (this.videoData.videoFile) {
+ formData.append('video_file', this.videoData.videoFile);
}
return formData;
}
diff --git a/frontend/src/app/components/home/video-player/video-player.component.ts b/frontend/src/app/components/home/video-player/video-player.component.ts
index a3b6ec4..88cf2ec 100644
--- a/frontend/src/app/components/home/video-player/video-player.component.ts
+++ b/frontend/src/app/components/home/video-player/video-player.component.ts
@@ -10,7 +10,7 @@ import Hls from 'hls.js';
styleUrls: ['./video-player.component.scss'],
})
export class VideoPlayerComponent implements OnInit, OnDestroy {
- @Input() playMovie: string = '';
+ @Input() playVideo: string = '';
private hls: Hls | null = null;
private videoElement: HTMLVideoElement | null = null;
@@ -52,7 +52,7 @@ export class VideoPlayerComponent implements OnInit, OnDestroy {
*/
private initializePlayer(): void {
this.videoElement = this.elementRef.nativeElement.querySelector('video');
- if (!this.playMovie || !this.videoElement) return;
+ if (!this.playVideo || !this.videoElement) return;
this.resolutionUrls = this.getResolutionUrls();
const defaultUrl = this.resolutionUrls[this.defaultResolution];
@@ -74,7 +74,7 @@ export class VideoPlayerComponent implements OnInit, OnDestroy {
return Object.fromEntries(
this.resolutionService
.getAvailableResolutions()
- .map((res) => [res, `${this.playMovie}_${res}.m3u8`])
+ .map((res) => [res, `${this.playVideo}_${res}.m3u8`])
);
}
diff --git a/frontend/src/app/services/resolution.service.ts b/frontend/src/app/services/resolution.service.ts
index 6ceb620..159b4ab 100644
--- a/frontend/src/app/services/resolution.service.ts
+++ b/frontend/src/app/services/resolution.service.ts
@@ -16,7 +16,7 @@ export class ResolutionService {
/**
* Initializes an object that sets all resolutions to `false`
*/
- initMovieIsUploaded(): { [resolution: string]: boolean } {
+ initVideoIsUploaded(): { [resolution: string]: boolean } {
return Object.fromEntries(
this.AVAILABLE_RESOLUTIONS.map((resolution) => [resolution, false])
);
diff --git a/frontend/src/app/services/user.service.ts b/frontend/src/app/services/user.service.ts
index f036e16..744ef87 100644
--- a/frontend/src/app/services/user.service.ts
+++ b/frontend/src/app/services/user.service.ts
@@ -14,45 +14,45 @@ export class UserService {
constructor(private apiService: ApiService) {}
/**
- * Fetch the list of movies liked and watched by the current user
+ * Fetch the list of videos liked and watched by the current user
*
* @returns a promise resolving to an object with two properties:
- * - `liked_movies`: a list of movie IDs liked by the current user
- * - `watched_movies`: a list of movie IDs watched by the current user
+ * - `liked_videos`: a list of video IDs liked by the current user
+ * - `watched_videos`: a list of video IDs watched by the current user
*/
- getLikedAndWatchedMovies(): Promise {
+ getLikedAndWatchedVideos(): Promise {
return firstValueFrom(
this.apiService.get(`/users/${this.currentUserId}/`, true)
);
}
/**
- * Update the list of liked movies for the current user
+ * Update the list of liked videos for the current user
*
- * @param likedMovies a list of movie IDs liked by the current user
+ * @param likedVideos a list of video IDs liked by the current user
* @returns a promise resolved when the update is successful
*/
- updateLikedMovies(likedMovies: any): Promise {
+ updateLikedVideos(likedVideos: any): Promise {
return firstValueFrom(
this.apiService.put(
`/users/liked/${this.currentUserId}/`,
- likedMovies,
+ likedVideos,
true
)
);
}
/**
- * Update the list of watched movies for the current user
+ * Update the list of watched videos for the current user
*
- * @param watchedMovies a list of movie IDs watched by the current user
+ * @param watchedVideos a list of video IDs watched by the current user
* @returns a promise resolved when the update is successful
*/
- updateWatchedMovies(watchedMovies: any): Promise {
+ updateWatchedVideos(watchedVideos: any): Promise {
return firstValueFrom(
this.apiService.put(
`/users/watched/${this.currentUserId}/`,
- watchedMovies,
+ watchedVideos,
true
)
);
diff --git a/frontend/src/app/shared/components/header/header.component.ts b/frontend/src/app/shared/components/header/header.component.ts
index 97c6a5d..7c7c773 100644
--- a/frontend/src/app/shared/components/header/header.component.ts
+++ b/frontend/src/app/shared/components/header/header.component.ts
@@ -13,7 +13,7 @@ import { TokenService } from '../../../services/token.service';
})
export class HeaderComponent {
@Input() showFullLogo: boolean = true;
- @Output() moviesChange = new EventEmitter();
+ @Output() videosChange = new EventEmitter();
constructor(
private authService: AuthService,
@@ -21,12 +21,12 @@ export class HeaderComponent {
) {}
/**
- * Emits the moviesChange event with the newMovies array as the payload.
- * This is used to reset the movies displayed in the movie-list component.
- * @param newMovies The new array of movies to be displayed.
+ * Emits the videosChange event with the newVideos array as the payload.
+ * This is used to reset the videos displayed in the video-list component.
+ * @param newVideos The new array of videos to be displayed.
*/
- backToOverview(newMovies: any[]) {
- this.moviesChange.emit(newMovies);
+ backToOverview(newVideos: any[]) {
+ this.videosChange.emit(newVideos);
}
/**