Update src/routes/api/takeSnap.js
parent
d3212fadbc
commit
ec27c1b366
|
@ -4,30 +4,12 @@ const path = require("path");
|
|||
const axios = require("axios");
|
||||
|
||||
const gameIds = [
|
||||
'662', '663', '664', '665', '666', '667', '668', '669', '670', '671',
|
||||
'672', '673', '674', '675', '676', '677', '678', '679', '680', '681',
|
||||
'682', '683', '684', '685', '686', '687', '688', '689', '690', '691',
|
||||
'692', '693', '694', '695', '696', '697', '698', '699', '700', '701',
|
||||
'702', '703', '704', '705', '706', '707', '708', '709', '710', '711',
|
||||
'712', '713', '714', '715', '716', '717', '718', '719', '720', '721',
|
||||
'722', '723', '724', '725', '726', '727', '728', '729', '730', '731',
|
||||
'732', '733', '734', '735', '736', '737', '738', '739', '740', '741',
|
||||
'742', '743', '744', '745', '746', '747', '748', '749', '750', '751',
|
||||
'752', '753', '754', '755', '756', '757', '758', '759', '760', '761',
|
||||
'762', '763', '764', '765', '766', '767', '768', '769', '770', '771',
|
||||
'772', '773', '774', '775', '776', '777', '778', '779', '780', '781',
|
||||
'782', '783', '784', '785', '786', '787', '788', '789', '790', '791',
|
||||
'792', '793', '794', '795', '796', '797', '798', '799', '800', '801',
|
||||
'802', '803', '804', '805', '806', '807', '808', '809', '810', '811',
|
||||
'812', '813', '814', '815', '816', '817', '818', '819', '820', '821',
|
||||
'822', '823', '824', '825', '826', '827', '828', '829', '830', '831',
|
||||
'832', '833', '834', '835', '836', '837', '838', '839', '840', '841',
|
||||
'842', '843', '844', '845', '846', '847', '848', '849', '850', '851',
|
||||
'852', '853', '854', '855', '856', '857', '858', '859', '860', '861',
|
||||
'862', '863', '864', '865', '866', '867', '868', '869', '870', '871',
|
||||
'872', '873', '874', '875', '876', '877', '878', '879', '880', '881',
|
||||
'903', '904', '905', '906', '907', '908', '909', '910', '911', '912',
|
||||
'913', '914', '915', '916', '917', '918', '919'
|
||||
'1', '2', '3', '4', '5', '6', '7', '8', '9', '10',
|
||||
'11', '12', '13', '14', '15', '16', '17', '18', '19', '20',
|
||||
'21', '22', '23', '24', '25', '26', '27', '28', '29', '30',
|
||||
'31', '32', '33', '34', '35', '36', '37', '38', '39', '40',
|
||||
'41', '42', '43', '44', '45', '46', '47', '48', '49', '50',
|
||||
'51'
|
||||
];
|
||||
|
||||
const SCREENSHOT_FOLDER = path.join(__dirname, "game-screen/drawing");
|
||||
|
@ -40,7 +22,7 @@ const DIRECTUS_API_URL = "https://game-du.teachertrainingkolkata.in/files";
|
|||
async function takeSnap(req, res) {
|
||||
for (const id of gameIds) {
|
||||
try {
|
||||
const url = `https://interaktogames.beanstalkedu.com/drawing?id=${id}`;
|
||||
const url = `https://interaktogames.beanstalkedu.com/cross/v1?id=${id}`;
|
||||
console.log(`📸 Taking screenshot for Game ID: ${id}`);
|
||||
const command = `url2jpg ${url}`;
|
||||
execSync(command, { stdio: "inherit", shell: true });
|
||||
|
@ -86,7 +68,7 @@ async function uploadToDirectus(filePath) {
|
|||
|
||||
|
||||
async function updateThumbnail(gameId, fileId) {
|
||||
const UPDATE_THUMBNAIL_URL = "https://game-du.teachertrainingkolkata.in/items/game_drawing/";
|
||||
const UPDATE_THUMBNAIL_URL = "https://game-du.teachertrainingkolkata.in/items/game_cross_varient1/";
|
||||
try {
|
||||
const response = await axios.patch(
|
||||
`${UPDATE_THUMBNAIL_URL}${gameId}`,
|
||||
|
|
Loading…
Reference in New Issue