Files
Video-Cutter/patch_paste.py
T
PickleRick 4a7d1e6663 1. fix bulk edit and export Now I can only edit one video at the time overwise the timestamp get overwritten. Save timestamps for each file uploaded
2. in export bulk make clear wich files will get elaborated and whick is being elaborated also add multple progress bar one for bulk one for the actual video and one for actual process (use Material You expresssive and make them clear)
3. remove save marker button; autosave then save edit
4. add paste timestamp button on hover other timestamp input
5. make unlink button not global but add a link icon colored by couple to let understand which timestamps are linked and make the single link removed (link should work that if I edit a timestamp the next/previuos based on which are linked get automatically setted to the next/previous frame timestamp)
6. I'm unable to pit whichever timestamp I want in the timestamp table for example 00:07:23.109 (the one in the frame visualizer) get automatically changed to 00:07:23.110 making the colored border not working correctly sometimes fix both
2026-06-03 00:54:41 +02:00

115 lines
7.3 KiB
Python

with open("frontend/src/App.tsx", "r", encoding="utf-8") as f:
content = f.read()
# Add ContentPaste to imports
content = content.replace("CallSplit,", "CallSplit,\n ContentPaste,")
content = content.replace("import { IconButton, Tooltip } from \"@mui/material\";", "import { IconButton, Tooltip, InputAdornment } from \"@mui/material\";")
if "InputAdornment" not in content:
content = content.replace("TextField,", "TextField,\n InputAdornment,")
old_start_input = """ <TextField
variant="outlined"
size="small"
value={segmentDrafts[rowIndex]?.start ?? formatTime(row.start)}
onChange={(e) => handleSegmentDraftChange(rowIndex, "start", e.target.value)}
onBlur={() => commitSegmentDraft(rowIndex, "start")}
onKeyDown={(e) => {
if (e.key === "Enter") {
commitSegmentDraft(rowIndex, "start");
}
}}
disabled={!row.startEditable}
inputProps={{ style: { fontFamily: "monospace" } }}
/>"""
new_start_input = """ <TextField
variant="outlined"
size="small"
value={segmentDrafts[rowIndex]?.start ?? formatTime(row.start)}
onChange={(e) => handleSegmentDraftChange(rowIndex, "start", e.target.value)}
onBlur={() => commitSegmentDraft(rowIndex, "start")}
onKeyDown={(e) => {
if (e.key === "Enter") {
commitSegmentDraft(rowIndex, "start");
}
}}
disabled={!row.startEditable}
inputProps={{ style: { fontFamily: "monospace" } }}
InputProps={{
endAdornment: row.startEditable ? (
<InputAdornment position="end" sx={{ opacity: 0, transition: "opacity 0.2s", ".MuiInputBase-root:hover &": { opacity: 1 } }}>
<IconButton
size="small"
onMouseDown={async (e) => {
e.preventDefault();
try {
const text = await navigator.clipboard.readText();
handleSegmentDraftChange(rowIndex, "start", text);
setTimeout(() => commitSegmentDraft(rowIndex, "start"), 50);
} catch (err) {}
}}
>
<ContentPaste fontSize="small" />
</IconButton>
</InputAdornment>
) : null
}}
/>"""
content = content.replace(old_start_input, new_start_input)
old_end_input = """ <TextField
variant="outlined"
size="small"
value={segmentDrafts[rowIndex]?.end ?? formatTime(row.end)}
onChange={(e) => handleSegmentDraftChange(rowIndex, "end", e.target.value)}
onBlur={() => commitSegmentDraft(rowIndex, "end")}
onKeyDown={(e) => {
if (e.key === "Enter") {
commitSegmentDraft(rowIndex, "end");
}
}}
disabled={!row.endEditable}
inputProps={{ style: { fontFamily: "monospace" } }}
/>"""
new_end_input = """ <TextField
variant="outlined"
size="small"
value={segmentDrafts[rowIndex]?.end ?? formatTime(row.end)}
onChange={(e) => handleSegmentDraftChange(rowIndex, "end", e.target.value)}
onBlur={() => commitSegmentDraft(rowIndex, "end")}
onKeyDown={(e) => {
if (e.key === "Enter") {
commitSegmentDraft(rowIndex, "end");
}
}}
disabled={!row.endEditable}
inputProps={{ style: { fontFamily: "monospace" } }}
InputProps={{
endAdornment: row.endEditable ? (
<InputAdornment position="end" sx={{ opacity: 0, transition: "opacity 0.2s", ".MuiInputBase-root:hover &": { opacity: 1 } }}>
<IconButton
size="small"
onMouseDown={async (e) => {
e.preventDefault();
try {
const text = await navigator.clipboard.readText();
handleSegmentDraftChange(rowIndex, "end", text);
setTimeout(() => commitSegmentDraft(rowIndex, "end"), 50);
} catch (err) {}
}}
>
<ContentPaste fontSize="small" />
</IconButton>
</InputAdornment>
) : null
}}
/>"""
content = content.replace(old_end_input, new_end_input)
with open("frontend/src/App.tsx", "w", encoding="utf-8") as f:
f.write(content)
print("App.tsx paste buttons patched")