Skip to content

Commit

Permalink
Merge pull request #857 from AI4Bharat/minorchange001
Browse files Browse the repository at this point in the history
changes for export filename
  • Loading branch information
kartikvirendrar authored Dec 19, 2024
2 parents 00674df + e0ad7f4 commit 1d54efa
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
8 changes: 4 additions & 4 deletions src/containers/Organization/OrgLevelTaskList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -445,8 +445,8 @@ const OrgLevelTaskList = () => {

if (res.ok) {
const resp = await res.blob();

exportFile(resp, currentTaskDetails, transcript, "transcription");
const filename = res.headers.get('content-type');
exportFile(resp, currentTaskDetails, transcript, "transcription", filename);
} else {
const resp = await res.json();

Expand Down Expand Up @@ -486,8 +486,8 @@ const OrgLevelTaskList = () => {

if (res.ok) {
const resp = await res.blob();

exportFile(resp, currentTaskDetails, translate, "translation");
const filename = res.headers.get('content-type');
exportFile(resp, currentTaskDetails, translate, "translation", filename);
} else {
const resp = await res.json();

Expand Down
8 changes: 4 additions & 4 deletions src/containers/Organization/Project/TaskList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -534,8 +534,8 @@ const TaskList = () => {

if (res.ok) {
const resp = await res.blob();

exportFile(resp, currentTaskDetails, transcript, "transcription");
const filename = res.headers.get('content-type');
exportFile(resp, currentTaskDetails, transcript, "transcription", filename);
} else {
const resp = await res.json();

Expand Down Expand Up @@ -575,8 +575,8 @@ const TaskList = () => {

if (res.ok) {
const resp = await res.blob();

exportFile(resp, currentTaskDetails, translate, "translation");
const filename = res.headers.get('content-type');
exportFile(resp, currentTaskDetails, translate, "translation", filename);
} else {
const resp = await res.json();

Expand Down
8 changes: 4 additions & 4 deletions src/containers/Organization/Video/VoiceOverRightPanel1.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -789,8 +789,8 @@ const VoiceOverRightPanel1 = ({ currentIndex, setCurrentIndex, showTimeline, seg

if (res.ok) {
const resp = await res.blob();

exportFile(resp, taskData, transcript, "transcription");
const filename = res.headers.get('content-type');
exportFile(resp, taskData, transcript, "transcription", filename);
} else {
const resp = await res.json();

Expand Down Expand Up @@ -828,8 +828,8 @@ const VoiceOverRightPanel1 = ({ currentIndex, setCurrentIndex, showTimeline, seg

if (res.ok) {
const resp = await res.blob();

exportFile(resp, taskData, translate, "translation");
const filename = res.headers.get('content-type');
exportFile(resp, taskData, translate, "translation", filename);
} else {
const resp = await res.json();

Expand Down
6 changes: 4 additions & 2 deletions src/utils/subtitleUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ export const exportVoiceover = (data, taskDetails, exportTypes) => {
}
};

export const exportFile = (data, taskDetails, exportType, type) => {
export const exportFile = (data, taskDetails, exportType, type, filename) => {
const {
video: videoId,
src_language: sourceLanguage,
Expand Down Expand Up @@ -740,7 +740,9 @@ export const exportFile = (data, taskDetails, exportType, type) => {
let fileName = "";
if (specialOrgIds.includes(userOrgId) && description.length) {
fileName = `${description}.${format}`;
} else {
}else if(filename.length){
fileName = `${filename}.${format}`;
}else {
fileName = `Chitralekha_Video${videoId}_${YYYYMMDD}_${HHMMSS}_${language}.${format}`;
}

Expand Down

0 comments on commit 1d54efa

Please sign in to comment.