Skip to content

Commit

Permalink
changed add_video_thumb
Browse files Browse the repository at this point in the history
  • Loading branch information
Allan-Nava authored Jun 11, 2024
1 parent 35428d1 commit 6c23ea3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
25 changes: 19 additions & 6 deletions lib/compressjs/tangram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,19 +182,27 @@ export class TangramClient {

/**
* @param {file} file_thumb
* @param {number} jobid
* @returns
*/
async add_video_thumb(file_thumb) {
async add_video_thumb(file_thumb, jobid) {
var fd = new FormData();
fd.append("api_key", this.api_key);
fd.append("client_id", this.client_id);
fd.append("file", file_thumb);
fd.append("jobid", jobid);
// need to finish the add thumb
return await fetch(TNGRM_BASE_URL + ADD_VIDEO_THUMB, {
method: "POST",
data: fd,
/*headers: {
"Content-Type": "application/json",
},*/
body: JSON.stringify({
/*body: JSON.stringify({
api_key: this.api_key,
client_id: this.client_id,
}),
jobid: jobid,
}),*/
})
.then((res) => {
if (!res.ok) {
Expand Down Expand Up @@ -247,14 +255,16 @@ export class TangramClient {
* @param {string} tags
* @param {string} location_place
* @param {number} category_id
* @param {string} zone
*/
async upload_with_encoding(
destination_folder,
file,
title,
tags,
location_place,
category_id
category_id,
zone,
) {
//get categories
let fileName = file.name
Expand All @@ -264,7 +274,7 @@ export class TangramClient {
console.log(`uploading ${fileName} to minio S3...`);
let upload = await this.upload_s3(destination_folder, file, fileName);
console.log("upload ", upload);
return await this.encode(file_dest, file, title, tags, location_place, category_id);
return await this.encode(file_dest, file, title, tags, location_place, category_id, zone);
//
}

Expand All @@ -281,14 +291,16 @@ export class TangramClient {
* @param {string} tags
* @param {string} location_place
* @param {number} category_id
* @param {string} zone
*/
async encode(
uploaded_filename,
file,
title,
tags,
location_place,
category_id
category_id,
zone,
) {
//get categories
//path = path.replaceAll(" ", "_");
Expand All @@ -307,6 +319,7 @@ export class TangramClient {
filename: uploaded_filename,
size: parseInt(file.size),
reporter_email: `${this.customer_name}@tngrm.io`,
region: zone,
}),
}).then((res) => {
if (!res.ok) {
Expand Down
2 changes: 1 addition & 1 deletion lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* v0.5.02
* v0.5.03
* Author: Allan Nava ([email protected])
* Author: Antonio Borgese ([email protected])
* -----
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "compress-nodejs",
"private": false,
"version": "0.5.02",
"version": "0.5.03",
"description": "The Compress NodeJS library provides access to the Compress API for encoding videos, restreamers",
"main": "dist/compress.js",
"module": "dist/compress.module.js",
Expand Down

0 comments on commit 6c23ea3

Please sign in to comment.