adding all images for perfect order to repo
Build and Push Image / build-and-push (push) Successful in 1m16s
@@ -3,7 +3,7 @@ const path = require('path');
|
|||||||
const csvParser = require('csv-parser');
|
const csvParser = require('csv-parser');
|
||||||
const koillectionBaseUrl = 'https://koillection.nelson-household.com/api'; // Verify this URL
|
const koillectionBaseUrl = 'https://koillection.nelson-household.com/api'; // Verify this URL
|
||||||
const authenticationUrl = `${koillectionBaseUrl}/authentication_token`; // URL to obtain JWT
|
const authenticationUrl = `${koillectionBaseUrl}/authentication_token`; // URL to obtain JWT
|
||||||
const imagesDir = path.join(__dirname, 'images'); // Use __dirname for correct path
|
const imagesDir = path.join(__dirname, 'master-set-images/perfect-order'); // Use __dirname for correct path
|
||||||
|
|
||||||
// Define mapping of collection names to their corresponding CSV files
|
// Define mapping of collection names to their corresponding CSV files
|
||||||
const collectionsMapping = {
|
const collectionsMapping = {
|
||||||
@@ -208,9 +208,9 @@ const createCollectionFromCSV = async (name, csvFilePath) => {
|
|||||||
for (const productId of Object.keys(mergedCollectionData)) {
|
for (const productId of Object.keys(mergedCollectionData)) {
|
||||||
const item = mergedCollectionData[productId];
|
const item = mergedCollectionData[productId];
|
||||||
// Await each download before starting the next
|
// Await each download before starting the next
|
||||||
const { destination } = await downloadTcgImage(productId, item.imageUrl);
|
// const { destination } = await downloadTcgImage(productId, item.imageUrl);
|
||||||
|
|
||||||
item.itemIds.forEach((id) => itemIdImageLocations.push({ itemId: id, imageDest: destination }));
|
item.itemIds.forEach((id) => itemIdImageLocations.push({ itemId: id, imageDest: path.join(imagesDir, productId) }));
|
||||||
}
|
}
|
||||||
|
|
||||||
// After processing all collections, check the imagesDir
|
// After processing all collections, check the imagesDir
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
|
// Define the target directory for saving images
|
||||||
|
let imageDir = './master-set-images/perfect-order';
|
||||||
|
if (!fs.existsSync(imageDir)) {
|
||||||
|
fs.mkdirSync(imageDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read the CSV file line by line
|
||||||
|
const stream = fs.createReadStream('./csv/ME03PerfectOrderProductsAndPrices.csv');
|
||||||
|
let data = [];
|
||||||
|
stream.on('data', chunk => data.push(chunk));
|
||||||
|
stream.on('end', () => {
|
||||||
|
let rows = data.toString().split('\n').slice(1);
|
||||||
|
|
||||||
|
// Loop through each row (product) and download its image
|
||||||
|
rows.forEach(row => {
|
||||||
|
const columns = row.split(/[\t,]/).map(c => c.trim());
|
||||||
|
|
||||||
|
if (!!columns[3]) { // Image URL exists
|
||||||
|
let imgUrl = columns[3]; // Change image resolution
|
||||||
|
const fileName = columns[0]; // Get the file name (cleanName)
|
||||||
|
console.log(imgUrl);
|
||||||
|
fetch(imgUrl)
|
||||||
|
.then(res => res.arrayBuffer())
|
||||||
|
.then(buffer => fs.writeFileSync(`${imageDir}/${fileName}.jpg`, Buffer.from(buffer)))
|
||||||
|
.catch(err => console.error(err));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 7.0 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 7.9 KiB |
|
After Width: | Height: | Size: 22 KiB |
@@ -0,0 +1,2 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Error><Code>AccessDenied</Code><Message>Access Denied</Message></Error>
|
||||||
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 6.5 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 7.0 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 7.7 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 6.1 KiB |
|
After Width: | Height: | Size: 6.1 KiB |
|
After Width: | Height: | Size: 6.0 KiB |
|
After Width: | Height: | Size: 6.1 KiB |
|
After Width: | Height: | Size: 6.1 KiB |
|
After Width: | Height: | Size: 6.1 KiB |
|
After Width: | Height: | Size: 6.4 KiB |
|
After Width: | Height: | Size: 6.2 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 16 KiB |