Files
CrawlFlix-Front/src/app/video-processing.service.ts
Joris Bertomeu a750b52832
All checks were successful
ci / Image build (push) Successful in 2m14s
ci / Deployment (push) Successful in 6s
Fix dl issue
2025-08-26 20:10:45 +02:00

41 lines
1.2 KiB
TypeScript

import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
import { environment } from '../environments/environment';
@Injectable({
providedIn: 'root'
})
export class VideoProcessingService {
private apiUrl = environment.serviceEndpoint;
constructor(private http: HttpClient) { }
startProcess(data: any): Observable<{ jobId: string }> {
return this.http.post<{ jobId: string }>(`${this.apiUrl}/start-process`, data);
}
load(data: any): Observable<any> {
return this.http.post<any>(`${this.apiUrl}/processMPD`, data);
}
getJobsStatus(): Observable<Array<any>> {
return this.http.get<Array<any>>(`${this.apiUrl}/jobs-status`);
}
hello(): Observable<Array<any>> {
return this.http.get<any>(`${this.apiUrl}/hello`);
}
processUpdate(data: any): Observable<any> {
return this.http.post<any>(`${this.apiUrl}/processUpdate`, data);
}
downloadFile(filename: string): Observable<Blob> {
return this.http.get(`${this.apiUrl}/download?filename=${encodeURIComponent(filename)}`, { responseType: 'blob' });
}
flushQueue(): Observable<any> {
return this.http.delete<any>(`${this.apiUrl}/jobs/completed`, {});
}
}