Skip to content

Commit

Permalink
Added MPD and M3U8 samples for video in seed file.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rajgupta36 committed May 16, 2024
1 parent 79ac4b9 commit b7fa2ff
Showing 1 changed file with 162 additions and 65 deletions.
227 changes: 162 additions & 65 deletions prisma/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ async function seedCourses() {
},
{
id: 3,
appxCourseId: 2,
appxCourseId: 3,
discordRoleId: '3',
title: 'test course 2',
imageUrl:
Expand Down Expand Up @@ -137,6 +137,26 @@ async function seedContent() {
parentId: 1,
commentsCount: 0,
},
{
id: 4,
type: 'video',
title: 'test video 2 for week 1',
hidden: false,
thumbnail:
'https://appx-recordings.s3.ap-south-1.amazonaws.com/drm/100x/images/week-1-orientation.jpg',
parentId: 1,
commentsCount: 0,
},
{
id: 5,
type: 'video',
title: 'test video-3 for week 1',
hidden: false,
thumbnail:
'https://appx-recordings.s3.ap-south-1.amazonaws.com/drm/100x/images/week-1-orientation.jpg',
parentId: 1,
commentsCount: 0,
},
];
try {
await db.content.createMany({ data: content });
Expand Down Expand Up @@ -177,76 +197,154 @@ async function seedNotionMetadata() {

async function seedVideoMetadata() {
try {
await db.videoMetadata.create({
data: {
id: 1,
contentId: 3,
video_1080p_mp4_1: 'https://www.w3schools.com/html/mov_bbb.mp4',
video_1080p_mp4_2: 'https://www.w3schools.com/html/mov_bbb.mp4',
video_1080p_mp4_3: 'https://www.w3schools.com/html/mov_bbb.mp4',
video_1080p_mp4_4: 'https://www.w3schools.com/html/mov_bbb.mp4',
video_1080p_1: 'https://www.w3schools.com/html/mov_bbb.mp4',
video_1080p_2: 'https://www.w3schools.com/html/mov_bbb.mp4',
video_1080p_3: 'https://www.w3schools.com/html/mov_bbb.mp4',
video_1080p_4: 'https://www.w3schools.com/html/mov_bbb.mp4',
video_720p_mp4_1: 'https://www.w3schools.com/html/mov_bbb.mp4',
video_720p_mp4_2: 'https://www.w3schools.com/html/mov_bbb.mp4',
video_720p_mp4_3: 'https://www.w3schools.com/html/mov_bbb.mp4',
video_720p_mp4_4: 'https://www.w3schools.com/html/mov_bbb.mp4',
video_720p_1: 'https://www.w3schools.com/html/mov_bbb.mp4',
video_720p_2: 'https://www.w3schools.com/html/mov_bbb.mp4',
video_720p_3: 'https://www.w3schools.com/html/mov_bbb.mp4',
video_720p_4: 'https://www.w3schools.com/html/mov_bbb.mp4',
video_360p_mp4_1: 'https://www.w3schools.com/html/mov_bbb.mp4',
video_360p_mp4_2: 'https://www.w3schools.com/html/mov_bbb.mp4',
video_360p_mp4_3: 'https://www.w3schools.com/html/mov_bbb.mp4',
video_360p_mp4_4: 'https://www.w3schools.com/html/mov_bbb.mp4',
video_360p_1: 'https://www.w3schools.com/html/mov_bbb.mp4',
video_360p_2: 'https://www.w3schools.com/html/mov_bbb.mp4',
video_360p_3: 'https://www.w3schools.com/html/mov_bbb.mp4',
video_360p_4: 'https://www.w3schools.com/html/mov_bbb.mp4',
slides:
'https://appx-recordings.s3.ap-south-1.amazonaws.com/drm/100x/slides/Loops%2C+callbacks.pdf',
},
await db.videoMetadata.createMany({
data: [
{
id: 1,
contentId: 3,
video_1080p_mp4_1: 'https://www.w3schools.com/html/mov_bbb.mp4',
video_1080p_mp4_2: 'https://www.w3schools.com/html/mov_bbb.mp4',
video_1080p_mp4_3: 'https://www.w3schools.com/html/mov_bbb.mp4',
video_1080p_mp4_4: 'https://www.w3schools.com/html/mov_bbb.mp4',
video_1080p_1: 'https://www.w3schools.com/html/mov_bbb.mp4',
video_1080p_2: 'https://www.w3schools.com/html/mov_bbb.mp4',
video_1080p_3: 'https://www.w3schools.com/html/mov_bbb.mp4',
video_1080p_4: 'https://www.w3schools.com/html/mov_bbb.mp4',
video_720p_mp4_1: 'https://www.w3schools.com/html/mov_bbb.mp4',
video_720p_mp4_2: 'https://www.w3schools.com/html/mov_bbb.mp4',
video_720p_mp4_3: 'https://www.w3schools.com/html/mov_bbb.mp4',
video_720p_mp4_4: 'https://www.w3schools.com/html/mov_bbb.mp4',
video_720p_1: 'https://www.w3schools.com/html/mov_bbb.mp4',
video_720p_2: 'https://www.w3schools.com/html/mov_bbb.mp4',
video_720p_3: 'https://www.w3schools.com/html/mov_bbb.mp4',
video_720p_4: 'https://www.w3schools.com/html/mov_bbb.mp4',
video_360p_mp4_1: 'https://www.w3schools.com/html/mov_bbb.mp4',
video_360p_mp4_2: 'https://www.w3schools.com/html/mov_bbb.mp4',
video_360p_mp4_3: 'https://www.w3schools.com/html/mov_bbb.mp4',
video_360p_mp4_4: 'https://www.w3schools.com/html/mov_bbb.mp4',
video_360p_1: 'https://www.w3schools.com/html/mov_bbb.mp4',
video_360p_2: 'https://www.w3schools.com/html/mov_bbb.mp4',
video_360p_3: 'https://www.w3schools.com/html/mov_bbb.mp4',
video_360p_4: 'https://www.w3schools.com/html/mov_bbb.mp4',
slides:
'https://appx-recordings.s3.ap-south-1.amazonaws.com/drm/100x/slides/Loops%2C+callbacks.pdf',
},
{
id: 2,
contentId: 4,
video_1080p_mp4_1:
'https://live-par-2-cdn-alt.livepush.io/live/bigbuckbunnyclip/index.m3u8',
video_1080p_mp4_2:
'https://live-par-2-cdn-alt.livepush.io/live/bigbuckbunnyclip/index.m3u8',
video_1080p_mp4_3:
'https://live-par-2-cdn-alt.livepush.io/live/bigbuckbunnyclip/index.m3u8',
video_1080p_mp4_4:
'https://live-par-2-cdn-alt.livepush.io/live/bigbuckbunnyclip/index.m3u8',
video_1080p_1:
'https://live-par-2-cdn-alt.livepush.io/live/bigbuckbunnyclip/index.m3u8',
video_1080p_2:
'https://live-par-2-cdn-alt.livepush.io/live/bigbuckbunnyclip/index.m3u8',
video_1080p_3:
'https://live-par-2-cdn-alt.livepush.io/live/bigbuckbunnyclip/index.m3u8',
video_1080p_4:
'https://live-par-2-cdn-alt.livepush.io/live/bigbuckbunnyclip/index.m3u8',
video_720p_mp4_1:
'https://live-par-2-cdn-alt.livepush.io/live/bigbuckbunnyclip/index.m3u8',
video_720p_mp4_2:
'https://live-par-2-cdn-alt.livepush.io/live/bigbuckbunnyclip/index.m3u8',
video_720p_mp4_3:
'https://live-par-2-cdn-alt.livepush.io/live/bigbuckbunnyclip/index.m3u8',
video_720p_mp4_4:
'https://live-par-2-cdn-alt.livepush.io/live/bigbuckbunnyclip/index.m3u8',
video_720p_1:
'https://live-par-2-cdn-alt.livepush.io/live/bigbuckbunnyclip/index.m3u8',
video_720p_2:
'https://live-par-2-cdn-alt.livepush.io/live/bigbuckbunnyclip/index.m3u8',
video_720p_3:
'https://live-par-2-cdn-alt.livepush.io/live/bigbuckbunnyclip/index.m3u8',
video_720p_4:
'https://live-par-2-cdn-alt.livepush.io/live/bigbuckbunnyclip/index.m3u8',
video_360p_mp4_1:
'https://live-par-2-cdn-alt.livepush.io/live/bigbuckbunnyclip/index.m3u8',
video_360p_mp4_2:
'https://live-par-2-cdn-alt.livepush.io/live/bigbuckbunnyclip/index.m3u8',
video_360p_mp4_3:
'https://live-par-2-cdn-alt.livepush.io/live/bigbuckbunnyclip/index.m3u8',
video_360p_mp4_4:
'https://live-par-2-cdn-alt.livepush.io/live/bigbuckbunnyclip/index.m3u8',
video_360p_1:
'https://live-par-2-cdn-alt.livepush.io/live/bigbuckbunnyclip/index.m3u8',
video_360p_2:
'https://live-par-2-cdn-alt.livepush.io/live/bigbuckbunnyclip/index.m3u8',
video_360p_3:
'https://live-par-2-cdn-alt.livepush.io/live/bigbuckbunnyclip/index.m3u8',
video_360p_4:
'https://live-par-2-cdn-alt.livepush.io/live/bigbuckbunnyclip/index.m3u8',
slides:
'https://appx-recordings.s3.ap-south-1.amazonaws.com/drm/100x/slides/Loops%2C+callbacks.pdf',
},
{
id: 3,
contentId: 5,
video_1080p_mp4_1:
'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd',
video_1080p_mp4_2:
'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd',
video_1080p_mp4_3:
'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd',
video_1080p_mp4_4:
'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd',
video_1080p_1:
'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd',
video_1080p_2:
'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd',
video_1080p_3:
'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd',
video_1080p_4:
'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd',
video_720p_mp4_1:
'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd',
video_720p_mp4_2:
'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd',
video_720p_mp4_3:
'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd',
video_720p_mp4_4:
'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd',
video_720p_1:
'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd',
video_720p_2:
'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd',
video_720p_3:
'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd',
video_720p_4:
'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd',
video_360p_mp4_1:
'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd',
video_360p_mp4_2:
'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd',
video_360p_mp4_3:
'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd',
video_360p_mp4_4:
'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd',
video_360p_1:
'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd',
video_360p_2:
'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd',
video_360p_3:
'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd',
video_360p_4:
'https://bitmovin-a.akamaihd.net/content/MI201109210084_1/mpds/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.mpd',
slides:
'https://appx-recordings.s3.ap-south-1.amazonaws.com/drm/100x/slides/Loops%2C+callbacks.pdf',
},
],
});
} catch (error) {
console.error('Error seeding video metadata:', error);
throw error;
}
}

async function seedPurchases() {
try {
await db.userPurchases.create({
data: {
userId: '1',
courseId: 1,
},
});
await db.userPurchases.create({
data: {
userId: '2',
courseId: 1,
},
});
await db.userPurchases.create({
data: {
userId: '1',
courseId: 2,
},
});
await db.userPurchases.create({
data: {
userId: '2',
courseId: 2,
},
});
} catch (error) {
console.error('Error while seeding purchases');
throw error;
}
}

async function seedDatabase() {
try {
await seedUsers();
Expand All @@ -255,7 +353,6 @@ async function seedDatabase() {
await seedCourseContent();
await seedNotionMetadata();
await seedVideoMetadata();
await seedPurchases();
} catch (error) {
console.error('Error seeding database:', error);
throw error;
Expand Down

0 comments on commit b7fa2ff

Please sign in to comment.