PageSourceSearch

https://modhtom2-qvm.hf.space/js/fullVideo.js

js modhtom2-qvm.hf.space collected 2026-10-03 10:19:34 UTC 2,893 bytes, 88 lines download raw bytes

1import {
2  uploadAudioFile,
3  uploadBackgroundFile,
4  resolveBackgroundData,
5  collectFormOptions,
6  submitVideoJob,
7} from './videoFormHelpers.js';
8import { showImagePicker, needsImagePicker } from './imagePicker.js';
9
10export async function handleFullVideoSubmit(e) {
11  e.preventDefault();
12
13  let requestBody = {};
14  const customAudioFile = e.detail?.customAudioFile;
15  const isCustomFlow = !!customAudioFile;
16  const getVal = (id) => document.getElementById(id)?.value;
17
18  if (isCustomFlow) {
19    requestBody = { ...e.detail };
20    requestBody.audioSource = 'custom';
21    try {
22      requestBody.customAudioPath = await uploadAudioFile(customAudioFile);
23    } catch (error) {
24      return alert(`Error: ${error.message}`);
25    }
26  } else {
27    requestBody.audioSource = 'api';
28    requestBody.surahNumber = getVal("fullSurahNumber");
29    requestBody.edition = getVal("fullEdition");
30  }
31
32  const bgSuffix = isCustomFlow ? "FullCustom" : "Full";
33  const bgUploadId = `backgroundUpload${bgSuffix}`;
34  let uploadedBackgroundPath = null;
35  try {
36    uploadedBackgroundPath = await uploadBackgroundFile(document.getElementById(bgUploadId));
37  } catch (error) {
38    return alert(`Error uploading background: ${error.message}`);
39  }
40  const { videoData, useCustomBg }
40 = resolveBackgroundData(bgSuffix, uploadedBackgroundPath);
41
42  //const optionSuffix = isCustomFlow ? 'FullCustom' : '';
43  const options = isCustomFlow
44    ? collectFormOptions('FullCustom')
45    : {
46      color: getVal('fontColor') || '#ffffff',
47      size: getVal('fontSize') || 30,
48      fontName: getVal('fontNameFull') || 'TaseesRegular',
49      translationEdition: getVal('translationEditionFull'),
50      crop: document.getElementById('verticalVideoFull')?.checked ? 'vertical' : 'horizontal',
51      subtitlePosition: getVal('subtitlePositionFull') || 'bottom',
52      showMetadata: document.getElementById('showMetadataFull')?.checked || false,
53    };
54
55  Object.assign(requestBody, options, {
56    useCustomBackground: useCustomBg,
57    videoNumber: videoData,
58    removeFilesAfterCreation: true,
59    surahNumber: requestBody.surahNumber || getVal(isCustomFlow ? "fullSurahNumberCustom" : "fullSurahNumber"),
60  });
61
62  let query = null;
63  if (typeof requestBody.videoNumber === 'string' && requestBody.videoNumber.startsWith('unsplash:')) {
64    query = requestBody.videoNumber.split(':')[1];
65  }
66
67  if (needsImagePicker(useCustomBg, requestBody.videoNumber)) {
68    const selectedUrls = await showImagePicker({
69      surahNumber: requestBody.surahNumber,
70      startVerse: 1,
71      endVerse: 10,
72      crop: requestBody.crop === 'vertical' ? 'vertical' : 'horizontal',
73      query: query
74    });
75
76    if (!selectedUrls) {
77      return;
78    }
79
80    requestBody.selectedImageUrls = selectedUrls;
81  }
82
83  try {
84    await submitVideoJob('/generate-full-video', requestBody);
85  } catch (error) {
86    alert(`Error: ${error.message}`);
87  }
88}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.