image video à la place de iframe
This commit is contained in:
parent
500b32626e
commit
b045f507d2
92 changed files with 945 additions and 656 deletions
|
|
@ -1,340 +0,0 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import {Video} from "../../interfaces/video";
|
||||
import {Playlist} from "../../interfaces/playlist";
|
||||
import {Advert} from "../../interfaces/advert";
|
||||
import {User} from "../../interfaces/user";
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
const TAB_VIDEO: Video[] = [
|
||||
{
|
||||
_id: "Mowgli",
|
||||
url: "https://www.youtube.com/watch?v=medPORJ8KO0",
|
||||
title: "PNL - Mowgli",
|
||||
description: "dans l'album Que la famille",
|
||||
views: 11,
|
||||
watched: []
|
||||
},
|
||||
{
|
||||
_id: "Mexico",
|
||||
url: "https://www.youtube.com/watch?v=LZx6oeNeoWM",
|
||||
title: "PNL - Mexico",
|
||||
description: "dans l'album Monde chico",
|
||||
views: 22,
|
||||
watched: []
|
||||
},
|
||||
{
|
||||
_id: "Luz de luna",
|
||||
url: "https://www.youtube.com/watch?v=fGoPhSV2Jic",
|
||||
title: "PNL - Luz de luna",
|
||||
description: "dans l'album Dans la legende",
|
||||
views: 33,
|
||||
watched: []
|
||||
},
|
||||
{
|
||||
_id: "Blanka",
|
||||
url: "https://www.youtube.com/watch?v=u8bHjdljyLw",
|
||||
title: "PNL - Blanka",
|
||||
description: "dans l'album Deux frères",
|
||||
views: 44,
|
||||
watched: []
|
||||
},
|
||||
{
|
||||
_id: "Mowgli 2",
|
||||
url: "https://www.dailymotion.com/video/x7ahxdn",
|
||||
title: "PNL - Mowgli",
|
||||
description: "exclu",
|
||||
views: 55,
|
||||
watched: []
|
||||
},
|
||||
{
|
||||
_id: "Etre humain",
|
||||
url: "https://www.youtube.com/watch?v=gfVo39B92Ow",
|
||||
title: "Nekfeu - Etre humain",
|
||||
description: "dans l'album feu",
|
||||
views: 66,
|
||||
watched: []
|
||||
},
|
||||
{
|
||||
_id: "Humanoide",
|
||||
url: "https://www.youtube.com/watch?v=MiyIg__WNOw",
|
||||
title: "Nekfeu - Humanoide",
|
||||
description: "dans l'album Cyborg",
|
||||
views: 77,
|
||||
watched: []
|
||||
},
|
||||
{
|
||||
_id: "Dernier soupir",
|
||||
url: "https://youtu.be/0GqjIF-4QQM?list=PLqeKQSn3LuAmpF-uIu39RIQRQkUzVol5l",
|
||||
title: "Nekfeu - Dernier soupir",
|
||||
description: "dans l'album Les etoiles vagabondes",
|
||||
views: 88,
|
||||
watched: []
|
||||
},
|
||||
{
|
||||
_id: "Dernier soupir",
|
||||
url: "https://youtu.be/0GqjIF-4QQM?list=PLqeKQSn3LuAmpF-uIu39RIQRQkUzVol5l",
|
||||
title: "Nekfeu - Dernier soupir",
|
||||
description: "dans l'album Les etoiles vagabondes",
|
||||
views: 99,
|
||||
watched: []
|
||||
},
|
||||
{
|
||||
_id: "Les prélis",
|
||||
url: "https://www.dailymotion.com/video/x4trtkd",
|
||||
title: "Columbine - Les prélis",
|
||||
description: "dans l'album Enfant terrible",
|
||||
views: 100,
|
||||
watched: []
|
||||
},
|
||||
{
|
||||
_id: "Pierre feuille ciseau",
|
||||
url: "https://www.dailymotion.com/video/x6agl6i",
|
||||
title: "Columbine - Pierre feuille ciseau",
|
||||
description: "exclu",
|
||||
views: 111,
|
||||
watched: []
|
||||
},
|
||||
];
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
const TAB_ADVERT: Advert[] = [
|
||||
{
|
||||
_id: "idNutella",
|
||||
title: "pot de nutella XXL",
|
||||
advertiser: "nutella",
|
||||
images: [
|
||||
{ url: "nutella_v_1.jpeg", description: "image nutella 1" },
|
||||
{ url: "nutella_v_2.png", description: "image nutella 2" },
|
||||
{ url: "nutella_v_3.jpg", description: "image nutella 3" }
|
||||
],
|
||||
tags: [ "bon", "petit-déjeuner", "chocolat" ],
|
||||
comment: "pub pour vacances de noêl",
|
||||
views: 5,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
isVisible: true
|
||||
},
|
||||
{
|
||||
_id: "idRolex",
|
||||
title: "Rolex",
|
||||
advertiser: "rolex",
|
||||
images: [
|
||||
{ url: "rolex_v_1.jpg", description: "rolex 1" },
|
||||
{ url: "rolex_v_2.png", description: "rolex 2" },
|
||||
],
|
||||
tags: [ "montre", "luxe", "suisse" ],
|
||||
comment: "pub pour cette année",
|
||||
views: 2,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
isVisible: true
|
||||
},
|
||||
];
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
const USER: User = {
|
||||
_id: "ririId",
|
||||
login: "Riri",
|
||||
hashPass: "agourgroou",
|
||||
mail: "riri@gmail.com",
|
||||
role: {
|
||||
name: "user",
|
||||
permission: 0,
|
||||
},
|
||||
profilePictureUrl: "https://www.figurines-goodies.com/1185-thickbox_default/huey-duck-tales-disney-funko-pop.jpg",
|
||||
dateOfBirth: new Date(),
|
||||
gender: "man",
|
||||
interests: ["foot", "jeux-vidéo"],
|
||||
isActive: true,
|
||||
isAccepted: true,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
lastConnexion: new Date()
|
||||
};
|
||||
|
||||
const ADVERTISER: User = {
|
||||
_id: "fifiId",
|
||||
login: "Fifi",
|
||||
hashPass: "agourgroou",
|
||||
mail: "fifi@gmail.com",
|
||||
role: {
|
||||
name: "advertiser",
|
||||
permission: 5,
|
||||
},
|
||||
profilePictureUrl: "https://www.figurines-goodies.com/1188-large_default/dewey-duck-tales-disney-funko-pop.jpg",
|
||||
dateOfBirth: null,
|
||||
gender: "",
|
||||
interests: [],
|
||||
isActive: true,
|
||||
isAccepted: true,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
lastConnexion: new Date()
|
||||
};
|
||||
|
||||
const ADMIN: User = {
|
||||
_id: "loulouId",
|
||||
login: "Loulou",
|
||||
hashPass: "agourgroou",
|
||||
mail: "loulou@gmail.com",
|
||||
role: {
|
||||
name: "admin",
|
||||
permission: 5,
|
||||
},
|
||||
profilePictureUrl: "https://www.reference-gaming.com/assets/media/product/41195/figurine-pop-duck-tales-n-309-loulou.jpg?format=product-cover-large&k=1519639530",
|
||||
dateOfBirth: null,
|
||||
gender: "",
|
||||
interests: [],
|
||||
isActive: true,
|
||||
isAccepted: true,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
lastConnexion: new Date()
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class FictitiousDatasService
|
||||
{
|
||||
|
||||
private makeid(length)
|
||||
{
|
||||
let res = '';
|
||||
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||
for( let i = 0; i < length; i++ ) {
|
||||
const k = Math.floor(Math.random() * characters.length);
|
||||
res += characters.charAt(k);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
private randomDate(start, end): Date
|
||||
{
|
||||
return new Date(start.getTime() + Math.random() * (end.getTime() - start.getTime()));
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
getVideo(): Video
|
||||
{
|
||||
const index = Math.floor(Math.random() * TAB_VIDEO.length);
|
||||
let video: Video = Object.assign({}, TAB_VIDEO[index]);
|
||||
|
||||
// id
|
||||
video._id = video._id + this.makeid(5);
|
||||
|
||||
// watched
|
||||
const nbWatched = 1 + Math.floor(Math.random() * 2);
|
||||
const start = new Date(2021, 0, 1);
|
||||
const end = new Date();
|
||||
video.watched = [];
|
||||
for(let i=0 ; i<nbWatched ; i++) video.watched.push(this.randomDate(start, end));
|
||||
|
||||
return video;
|
||||
}
|
||||
|
||||
getTabVideo(n: number): Video[]
|
||||
{
|
||||
let tabVideo = [];
|
||||
for(let i=0 ; i<n ; i++) tabVideo.push(this.getVideo());
|
||||
return tabVideo;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
getTabPlaylist(nbPlaylist: number, nbVideoMax: number)
|
||||
{
|
||||
let tabTabPlaylist: Playlist[] = [];
|
||||
|
||||
for (let i = 0; i < nbPlaylist; i++)
|
||||
{
|
||||
let playlist: Playlist = {
|
||||
_id: i.toString(),
|
||||
user: null,
|
||||
name: "playlist_"+i.toString(),
|
||||
videos: this.getTabVideo(Math.floor(Math.random() * nbVideoMax))
|
||||
}
|
||||
tabTabPlaylist.push(playlist);
|
||||
}
|
||||
|
||||
return tabTabPlaylist
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
getAdvert(): Advert
|
||||
{
|
||||
const idx = Math.floor(Math.random() * TAB_ADVERT.length);
|
||||
let advert = Object.assign({}, TAB_ADVERT[idx]);
|
||||
advert._id = advert._id + this.makeid(5);
|
||||
advert.tags = advert.tags.slice();
|
||||
advert.isVisible = (Math.random() < 0.5);
|
||||
return advert;
|
||||
}
|
||||
|
||||
getTabAdvert(n: number): Advert[]
|
||||
{
|
||||
let tabAdvert = [];
|
||||
for(let i=0 ; i<n ; i++) tabAdvert.push(this.getAdvert());
|
||||
return tabAdvert;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
private getUserOrAdvertiserOrAdmin(modele: User): User
|
||||
{
|
||||
const res = Object.assign({}, modele);
|
||||
res._id += this.makeid(5);
|
||||
res.login += (Math.floor(Math.random() * 1000)).toString();
|
||||
res.mail = res.login + "@gmail.com" ;
|
||||
res.isAccepted = (Math.random() < 0.5);
|
||||
return res;
|
||||
}
|
||||
|
||||
getUser(): User {
|
||||
return this.getUserOrAdvertiserOrAdmin(USER);
|
||||
}
|
||||
|
||||
getAdvertiser(): User {
|
||||
return this.getUserOrAdvertiserOrAdmin(ADVERTISER);
|
||||
}
|
||||
|
||||
getAdmin(): User {
|
||||
return this.getUserOrAdvertiserOrAdmin(ADMIN);
|
||||
}
|
||||
|
||||
getTabUser(n: number): User[]
|
||||
{
|
||||
const res: User[] = [];
|
||||
for(let i=0 ; i<n ; i++) res.push(this.getUser());
|
||||
return res;
|
||||
}
|
||||
|
||||
getTabAdvertiser(n: number): User[]
|
||||
{
|
||||
const res: User[] = [];
|
||||
for(let i=0 ; i<n ; i++) res.push(this.getAdvertiser());
|
||||
return res;
|
||||
}
|
||||
|
||||
getTabAdmin(n: number): User[]
|
||||
{
|
||||
const res: User[] = [];
|
||||
for(let i=0 ; i<n ; i++) res.push(this.getAdmin());
|
||||
return res;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
getTags(): string[]
|
||||
{
|
||||
return [ "musique", "rap", "rock", "sport", "foot", "basket", "tennis", "film", "action", "aventure", "horreur", "romance", "comedie"];
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { FictitiousAdvertsService } from './fictitious-adverts.service';
|
||||
|
||||
describe('FictitiousAdvertsService', () => {
|
||||
let service: FictitiousAdvertsService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(FictitiousAdvertsService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import {Advert} from "../../../interfaces/advert";
|
||||
import {FictitiousUtilsService} from "../fictitiousUtils/fictitious-utils.service";
|
||||
|
||||
|
||||
|
||||
const TAB_ADVERT: Advert[] = [
|
||||
{
|
||||
_id: "idNutella",
|
||||
userId: "userId",
|
||||
title: "pot de nutella XXL",
|
||||
advertiser: "nutella",
|
||||
images: [
|
||||
{ url: "nutella_v_1.jpeg", description: "image nutella 1" },
|
||||
{ url: "nutella_v_2.png", description: "image nutella 2" },
|
||||
{ url: "nutella_v_3.jpg", description: "image nutella 3" }
|
||||
],
|
||||
tags: [ "bon", "petit-déjeuner", "chocolat" ],
|
||||
comment: "pub pour vacances de noêl",
|
||||
views: 5,
|
||||
isVisible: true,
|
||||
isActive: true,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
_id: "idRolex",
|
||||
userId: "userId",
|
||||
title: "Rolex",
|
||||
advertiser: "rolex",
|
||||
images: [
|
||||
{ url: "rolex_v_1.jpg", description: "rolex 1" },
|
||||
{ url: "rolex_v_2.png", description: "rolex 2" },
|
||||
],
|
||||
tags: [ "montre", "luxe", "suisse" ],
|
||||
comment: "pub pour cette année",
|
||||
views: 2,
|
||||
isVisible: true,
|
||||
isActive: true,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class FictitiousAdvertsService
|
||||
{
|
||||
|
||||
constructor(private fictitiousUtilsService: FictitiousUtilsService) {}
|
||||
|
||||
|
||||
getAdvert(): Advert
|
||||
{
|
||||
const idx = Math.floor(Math.random() * TAB_ADVERT.length);
|
||||
let advert = Object.assign({}, TAB_ADVERT[idx]);
|
||||
advert._id = advert._id + this.fictitiousUtilsService.makeid(5);
|
||||
advert.tags = advert.tags.slice();
|
||||
advert.isVisible = (Math.random() < 0.5);
|
||||
return advert;
|
||||
}
|
||||
|
||||
|
||||
getTabAdvert(n: number): Advert[]
|
||||
{
|
||||
let tabAdvert = [];
|
||||
for(let i=0 ; i<n ; i++) tabAdvert.push(this.getAdvert());
|
||||
return tabAdvert;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,13 +1,13 @@
|
|||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { FictitiousDatasService } from './fictitious-datas.service';
|
||||
import { FictitiousUsersService } from './fictitious-users.service';
|
||||
|
||||
describe('FictitiousDatasService', () => {
|
||||
let service: FictitiousDatasService;
|
||||
describe('FictitiousUsersService', () => {
|
||||
let service: FictitiousUsersService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(FictitiousDatasService);
|
||||
service = TestBed.inject(FictitiousUsersService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
|
|
@ -0,0 +1,119 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import {User} from "../../../interfaces/user";
|
||||
import {FictitiousUtilsService} from "../fictitiousUtils/fictitious-utils.service";
|
||||
|
||||
|
||||
|
||||
const USER: User = {
|
||||
_id: "ririId",
|
||||
login: "Riri",
|
||||
hashPass: "agourgroou",
|
||||
email: "riri@gmail.com",
|
||||
role: {
|
||||
name: "user",
|
||||
permission: 0,
|
||||
},
|
||||
profileImageUrl: "https://www.figurines-goodies.com/1185-thickbox_default/huey-duck-tales-disney-funko-pop.jpg",
|
||||
dateOfBirth: new Date(),
|
||||
gender: "man",
|
||||
interests: ["foot", "jeux-vidéo"],
|
||||
isActive: true,
|
||||
isAccepted: true,
|
||||
lastConnexion: new Date(),
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date()
|
||||
};
|
||||
|
||||
const ADVERTISER: User = {
|
||||
_id: "fifiId",
|
||||
login: "Fifi",
|
||||
hashPass: "agourgroou",
|
||||
email: "fifi@gmail.com",
|
||||
role: {
|
||||
name: "advertiser",
|
||||
permission: 5,
|
||||
},
|
||||
profileImageUrl: "https://www.figurines-goodies.com/1188-large_default/dewey-duck-tales-disney-funko-pop.jpg",
|
||||
dateOfBirth: null,
|
||||
gender: "",
|
||||
interests: [],
|
||||
isActive: true,
|
||||
isAccepted: true,
|
||||
lastConnexion: new Date(),
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
};
|
||||
|
||||
const ADMIN: User = {
|
||||
_id: "loulouId",
|
||||
login: "Loulou",
|
||||
hashPass: "agourgroou",
|
||||
email: "loulou@gmail.com",
|
||||
role: {
|
||||
name: "admin",
|
||||
permission: 5,
|
||||
},
|
||||
profileImageUrl: "https://www.reference-gaming.com/assets/media/product/41195/figurine-pop-duck-tales-n-309-loulou.jpg?format=product-cover-large&k=1519639530",
|
||||
dateOfBirth: null,
|
||||
gender: "",
|
||||
interests: [],
|
||||
isActive: true,
|
||||
isAccepted: true,
|
||||
lastConnexion: new Date(),
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
};
|
||||
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class FictitiousUsersService
|
||||
{
|
||||
|
||||
constructor(private fictitiousUtilsService: FictitiousUtilsService) { }
|
||||
|
||||
private getUserOrAdvertiserOrAdmin(modele: User): User
|
||||
{
|
||||
const res = Object.assign({}, modele);
|
||||
res._id += this.fictitiousUtilsService.makeid(5);
|
||||
res.login += (Math.floor(Math.random() * 1000)).toString();
|
||||
res.email = res.login + "@gmail.com" ;
|
||||
res.isAccepted = (Math.random() < 0.5);
|
||||
return res;
|
||||
}
|
||||
|
||||
getUser(): User {
|
||||
return this.getUserOrAdvertiserOrAdmin(USER);
|
||||
}
|
||||
|
||||
getAdvertiser(): User {
|
||||
return this.getUserOrAdvertiserOrAdmin(ADVERTISER);
|
||||
}
|
||||
|
||||
getAdmin(): User {
|
||||
return this.getUserOrAdvertiserOrAdmin(ADMIN);
|
||||
}
|
||||
|
||||
getTabUser(n: number): User[]
|
||||
{
|
||||
const res: User[] = [];
|
||||
for(let i=0 ; i<n ; i++) res.push(this.getUser());
|
||||
return res;
|
||||
}
|
||||
|
||||
getTabAdvertiser(n: number): User[]
|
||||
{
|
||||
const res: User[] = [];
|
||||
for(let i=0 ; i<n ; i++) res.push(this.getAdvertiser());
|
||||
return res;
|
||||
}
|
||||
|
||||
getTabAdmin(n: number): User[]
|
||||
{
|
||||
const res: User[] = [];
|
||||
for(let i=0 ; i<n ; i++) res.push(this.getAdmin());
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { FictitiousUtilsService } from './fictitious-utils.service';
|
||||
|
||||
describe('FictitiousUtilsService', () => {
|
||||
let service: FictitiousUtilsService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(FictitiousUtilsService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class FictitiousUtilsService
|
||||
{
|
||||
|
||||
makeid(length)
|
||||
{
|
||||
let res = '';
|
||||
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||
for( let i = 0; i < length; i++ ) {
|
||||
const k = Math.floor(Math.random() * characters.length);
|
||||
res += characters.charAt(k);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
randomDate(start, end): Date
|
||||
{
|
||||
return new Date(start.getTime() + Math.random() * (end.getTime() - start.getTime()));
|
||||
}
|
||||
|
||||
|
||||
getTags(): string[]
|
||||
{
|
||||
return [ "musique", "rap", "rock", "sport", "foot", "basket", "tennis", "film", "action", "aventure", "horreur", "romance", "comedie"];
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { FictitiousVideosService } from './fictitious-videos.service';
|
||||
|
||||
describe('FictitiousVideosService', () => {
|
||||
let service: FictitiousVideosService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(FictitiousVideosService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
|
@ -0,0 +1,226 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import {VideoAll} from "../../../interfaces/video";
|
||||
import {PlaylistDB} from "../../../interfaces/playlist";
|
||||
import {FictitiousUtilsService} from "../fictitiousUtils/fictitious-utils.service";
|
||||
|
||||
|
||||
|
||||
const TAB_VIDEO: VideoAll[] = [
|
||||
{
|
||||
_id: "Mowgli",
|
||||
videoId: "https://www.youtube.com/watch?v=medPORJ8KO0",
|
||||
userId: "userId",
|
||||
source: "youtube",
|
||||
tags: [ "rap", "musique" ],
|
||||
watchedDates: [new Date()],
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
|
||||
title: "PNL - Mowgli",
|
||||
views: 999999999,
|
||||
publishedAt: new Date(),
|
||||
imageUrl: "https://i.ytimg.com/vi/CaeH7TRnI3s/hq720.jpg?sqp=-oaymwEcCOgCEMoBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLCr4TMUqy_Lqi9_zh7efICrF_V_Vw",
|
||||
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor. Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper congue, euismod non, mi. Proin porttitor, orci nec nonummy molestie, enim est eleifend mi, non fermentum diam nisl sit amet erat. Duis semper. Duis arcu massa, scelerisque vitae, consequat in, pretium a, enim. Pellentesque congue. Ut in risus volutpat libero pharetra tempor. Cras vestibulum bibendum augue. Praesent egestas leo in pede. Praesent blandit odio eu enim. Pellentesque sed dui ut augue blandit sodales. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aliquam nibh. Mauris ac mauris sed pede pellentesque fermentum. Maecenas adipiscing ante non diam sodales hendrerit. "
|
||||
},
|
||||
{
|
||||
_id: "Mexico",
|
||||
videoId: "https://www.youtube.com/watch?v=LZx6oeNeoWM",
|
||||
userId: "userId",
|
||||
source: "youtube",
|
||||
tags: [ "rap", "musique" ],
|
||||
watchedDates: [new Date()],
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
|
||||
title: "PNL - Mexico",
|
||||
views: 999999,
|
||||
publishedAt: new Date(),
|
||||
imageUrl: "https://i.ytimg.com/vi/LZx6oeNeoWM/hq720.jpg?sqp=-oaymwEcCOgCEMoBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLAIJsokYSLBB3TrnKhX5V1beCTrpQ",
|
||||
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor. Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper congue, euismod non, mi. Proin porttitor, orci nec nonummy molestie, enim est eleifend mi, non fermentum diam nisl sit amet erat. Duis semper. Duis arcu massa, scelerisque vitae, consequat in, pretium a, enim. Pellentesque congue. Ut in risus volutpat libero pharetra tempor. Cras vestibulum bibendum augue. Praesent egestas leo in pede. Praesent blandit odio eu enim. Pellentesque sed dui ut augue blandit sodales. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aliquam nibh. Mauris ac mauris sed pede pellentesque fermentum. Maecenas adipiscing ante non diam sodales hendrerit. "
|
||||
},
|
||||
{
|
||||
_id: "Luz de luna",
|
||||
videoId: "https://www.youtube.com/watch?v=fGoPhSV2Jic",
|
||||
userId: "userId",
|
||||
source: "youtube",
|
||||
tags: [ "rap", "musique" ],
|
||||
watchedDates: [new Date()],
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
|
||||
title: "PNL - Luz de luna",
|
||||
views: 999999,
|
||||
publishedAt: new Date(),
|
||||
imageUrl: "https://i.ytimg.com/vi/fGoPhSV2Jic/hq720.jpg?sqp=-oaymwEcCOgCEMoBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLBICz3ZfnjAXQNZQniiCTRLbdyLcg",
|
||||
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor. Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper congue, euismod non, mi. Proin porttitor, orci nec nonummy molestie, enim est eleifend mi, non fermentum diam nisl sit amet erat. Duis semper. Duis arcu massa, scelerisque vitae, consequat in, pretium a, enim. Pellentesque congue. Ut in risus volutpat libero pharetra tempor. Cras vestibulum bibendum augue. Praesent egestas leo in pede. Praesent blandit odio eu enim. Pellentesque sed dui ut augue blandit sodales. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aliquam nibh. Mauris ac mauris sed pede pellentesque fermentum. Maecenas adipiscing ante non diam sodales hendrerit. "
|
||||
},
|
||||
{
|
||||
_id: "Blanka",
|
||||
videoId: "https://www.youtube.com/watch?v=u8bHjdljyLw",
|
||||
userId: "userId",
|
||||
source: "youtube",
|
||||
tags: [ "rap", "musique" ],
|
||||
watchedDates: [new Date()],
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
|
||||
title: "PNL - Blanka",
|
||||
views: 999999,
|
||||
publishedAt: new Date(),
|
||||
imageUrl: "https://i.ytimg.com/vi/PCwZnN4zDiY/hq720.jpg?sqp=-oaymwEcCOgCEMoBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLCaA-xe5rkkYJbNCbSg0z27Lm1Hgw",
|
||||
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor. Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper congue, euismod non, mi. Proin porttitor, orci nec nonummy molestie, enim est eleifend mi, non fermentum diam nisl sit amet erat. Duis semper. Duis arcu massa, scelerisque vitae, consequat in, pretium a, enim. Pellentesque congue. Ut in risus volutpat libero pharetra tempor. Cras vestibulum bibendum augue. Praesent egestas leo in pede. Praesent blandit odio eu enim. Pellentesque sed dui ut augue blandit sodales. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aliquam nibh. Mauris ac mauris sed pede pellentesque fermentum. Maecenas adipiscing ante non diam sodales hendrerit. "
|
||||
},
|
||||
{
|
||||
_id: "Mowgli 2",
|
||||
videoId: "https://www.dailymotion.com/video/x7ahxdn",
|
||||
userId: "userId",
|
||||
source: "dailymotion",
|
||||
tags: [ "rap", "musique" ],
|
||||
watchedDates: [new Date()],
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
|
||||
title: "PNL - Mowgli 2",
|
||||
views: 999999,
|
||||
publishedAt: new Date(),
|
||||
imageUrl: "https://i.ytimg.com/vi/tno1qRfO894/hq720.jpg?sqp=-oaymwEcCOgCEMoBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLCOBBR6c3woXXIbOSdU06quQcN7pw",
|
||||
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor. Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper congue, euismod non, mi. Proin porttitor, orci nec nonummy molestie, enim est eleifend mi, non fermentum diam nisl sit amet erat. Duis semper. Duis arcu massa, scelerisque vitae, consequat in, pretium a, enim. Pellentesque congue. Ut in risus volutpat libero pharetra tempor. Cras vestibulum bibendum augue. Praesent egestas leo in pede. Praesent blandit odio eu enim. Pellentesque sed dui ut augue blandit sodales. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aliquam nibh. Mauris ac mauris sed pede pellentesque fermentum. Maecenas adipiscing ante non diam sodales hendrerit. "
|
||||
},
|
||||
{
|
||||
_id: "Etre humain",
|
||||
videoId: "https://www.youtube.com/watch?v=gfVo39B92Ow",
|
||||
userId: "userId",
|
||||
source: "youtube",
|
||||
tags: [ "rap", "musique" ],
|
||||
watchedDates: [new Date()],
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
|
||||
title: "PNL - Etre humain",
|
||||
views: 999999,
|
||||
publishedAt: new Date(),
|
||||
imageUrl: "https://i.ytimg.com/vi/gfVo39B92Ow/hq720.jpg?sqp=-oaymwEcCOgCEMoBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLCPJpBqTYk5Nj3RSgase3GdbT7_Pg",
|
||||
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor. Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper congue, euismod non, mi. Proin porttitor, orci nec nonummy molestie, enim est eleifend mi, non fermentum diam nisl sit amet erat. Duis semper. Duis arcu massa, scelerisque vitae, consequat in, pretium a, enim. Pellentesque congue. Ut in risus volutpat libero pharetra tempor. Cras vestibulum bibendum augue. Praesent egestas leo in pede. Praesent blandit odio eu enim. Pellentesque sed dui ut augue blandit sodales. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aliquam nibh. Mauris ac mauris sed pede pellentesque fermentum. Maecenas adipiscing ante non diam sodales hendrerit. "
|
||||
},
|
||||
{
|
||||
_id: "Humanoide",
|
||||
videoId: "https://www.youtube.com/watch?v=MiyIg__WNOw",
|
||||
userId: "userId",
|
||||
source: "youtube",
|
||||
tags: [ "rap", "musique" ],
|
||||
watchedDates: [new Date()],
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
|
||||
title: "Nekfeu - Humanoide",
|
||||
views: 999999,
|
||||
publishedAt: new Date(),
|
||||
imageUrl: "https://i.ytimg.com/vi/MiyIg__WNOw/hq720.jpg?sqp=-oaymwEcCOgCEMoBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLDboAq0TRqXBFGgXdpOD_HOsRZucw",
|
||||
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor. Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper congue, euismod non, mi. Proin porttitor, orci nec nonummy molestie, enim est eleifend mi, non fermentum diam nisl sit amet erat. Duis semper. Duis arcu massa, scelerisque vitae, consequat in, pretium a, enim. Pellentesque congue. Ut in risus volutpat libero pharetra tempor. Cras vestibulum bibendum augue. Praesent egestas leo in pede. Praesent blandit odio eu enim. Pellentesque sed dui ut augue blandit sodales. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aliquam nibh. Mauris ac mauris sed pede pellentesque fermentum. Maecenas adipiscing ante non diam sodales hendrerit. ",
|
||||
},
|
||||
{
|
||||
_id: "Dernier soupir",
|
||||
videoId: "https://youtu.be/0GqjIF-4QQM?list=PLqeKQSn3LuAmpF-uIu39RIQRQkUzVol5l",
|
||||
userId: "userId",
|
||||
source: "youtube",
|
||||
tags: [ "rap", "musique" ],
|
||||
watchedDates: [new Date()],
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
|
||||
title: "Nekfeu - Dernier soupir",
|
||||
views: 999999,
|
||||
publishedAt: new Date(),
|
||||
imageUrl: "https://i.ytimg.com/vi/-S5IKBvT34c/hqdefault.jpg?sqp=-oaymwEcCOADEI4CSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLC1kVCIB2bQGmOH74I5puXIhn7HRQ",
|
||||
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor. Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper congue, euismod non, mi. Proin porttitor, orci nec nonummy molestie, enim est eleifend mi, non fermentum diam nisl sit amet erat. Duis semper. Duis arcu massa, scelerisque vitae, consequat in, pretium a, enim. Pellentesque congue. Ut in risus volutpat libero pharetra tempor. Cras vestibulum bibendum augue. Praesent egestas leo in pede. Praesent blandit odio eu enim. Pellentesque sed dui ut augue blandit sodales. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aliquam nibh. Mauris ac mauris sed pede pellentesque fermentum. Maecenas adipiscing ante non diam sodales hendrerit. ",
|
||||
},
|
||||
{
|
||||
_id: "Les prélis",
|
||||
videoId: "https://www.dailymotion.com/video/x4trtkd",
|
||||
userId: "userId",
|
||||
source: "youtube",
|
||||
tags: [ "rap", "musique" ],
|
||||
watchedDates: [new Date()],
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
|
||||
title: "Columbine - Les prélis",
|
||||
views: 999999,
|
||||
publishedAt: new Date(),
|
||||
imageUrl: "https://i.ytimg.com/an_webp/LfFI3bzMLU0/mqdefault_6s.webp?du=3000&sqp=CKq33owG&rs=AOn4CLDZmaPGWwcuo9yUWJ-xOzA69r2Qrw",
|
||||
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor. Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper congue, euismod non, mi. Proin porttitor, orci nec nonummy molestie, enim est eleifend mi, non fermentum diam nisl sit amet erat. Duis semper. Duis arcu massa, scelerisque vitae, consequat in, pretium a, enim. Pellentesque congue. Ut in risus volutpat libero pharetra tempor. Cras vestibulum bibendum augue. Praesent egestas leo in pede. Praesent blandit odio eu enim. Pellentesque sed dui ut augue blandit sodales. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aliquam nibh. Mauris ac mauris sed pede pellentesque fermentum. Maecenas adipiscing ante non diam sodales hendrerit. ",
|
||||
},
|
||||
{
|
||||
_id: "Pierre feuille ciseau",
|
||||
videoId: "https://www.dailymotion.com/video/x6agl6i",
|
||||
userId: "userId",
|
||||
source: "dailymotion",
|
||||
tags: [ "rap", "musique" ],
|
||||
watchedDates: [new Date()],
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
|
||||
title: "Columbine - Pierre feuille ciseau",
|
||||
views: 999999,
|
||||
publishedAt: new Date(),
|
||||
imageUrl: "https://i.ytimg.com/vi/tTo7CrPlbpI/hq720.jpg?sqp=-oaymwEcCOgCEMoBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLAhC5bWURH9R8Icdkv6LWRgsW2G-Q",
|
||||
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor. Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper congue, euismod non, mi. Proin porttitor, orci nec nonummy molestie, enim est eleifend mi, non fermentum diam nisl sit amet erat. Duis semper. Duis arcu massa, scelerisque vitae, consequat in, pretium a, enim. Pellentesque congue. Ut in risus volutpat libero pharetra tempor. Cras vestibulum bibendum augue. Praesent egestas leo in pede. Praesent blandit odio eu enim. Pellentesque sed dui ut augue blandit sodales. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aliquam nibh. Mauris ac mauris sed pede pellentesque fermentum. Maecenas adipiscing ante non diam sodales hendrerit. ",
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class FictitiousVideosService
|
||||
{
|
||||
|
||||
constructor(private fictitiousUtilsService: FictitiousUtilsService) {}
|
||||
|
||||
|
||||
getVideoAll(): VideoAll
|
||||
{
|
||||
const index = Math.floor(Math.random() * TAB_VIDEO.length);
|
||||
return TAB_VIDEO[index];
|
||||
//return Object.assign({}, TAB_VIDEO[index]);
|
||||
}
|
||||
|
||||
|
||||
getTabVideoAll(nbVideo: number): VideoAll[]
|
||||
{
|
||||
let tabVideo = [];
|
||||
for(let i=0 ; i<nbVideo ; i++) tabVideo.push(this.getVideoAll());
|
||||
return tabVideo;
|
||||
}
|
||||
|
||||
|
||||
getTabPlaylistDB(nbPlaylist: number, nbVideoMax: number): PlaylistDB[]
|
||||
{
|
||||
let tabPlaylist: PlaylistDB[] = [];
|
||||
|
||||
for (let i = 0; i < nbPlaylist; i++)
|
||||
{
|
||||
const r = Math.floor(Math.random() * nbVideoMax);
|
||||
const tabVideo = this.getTabVideoAll(r);
|
||||
tabPlaylist.push({
|
||||
_id: "id_playlist_"+i.toString(),
|
||||
userId: "userId",
|
||||
name: "playlist_"+i.toString(),
|
||||
videoIds: tabVideo.map(x => x._id),
|
||||
isActive: true,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date()
|
||||
});
|
||||
}
|
||||
|
||||
return tabPlaylist;
|
||||
}
|
||||
|
||||
|
||||
getAllVideoAll(): VideoAll[]
|
||||
{
|
||||
return TAB_VIDEO;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in a new issue