Skip to content

Commit

Permalink
Fixed bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
deusprogrammer committed Nov 3, 2023
1 parent 379cdc6 commit c1fdeb5
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 9 deletions.
10 changes: 9 additions & 1 deletion src/renderer/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ button.selected {
}

.subtitle-list {
max-height: 200px;
height: 200px;
overflow-y: scroll;
}

Expand Down Expand Up @@ -200,6 +200,14 @@ button.selected {
}
}

.subtitle-window table td:nth-child(2) {
width: 250px;
}

.subtitle-window input {
width: 100%;
}

.video-list-element {
border: 1px solid transparent;
border-radius: 10px;
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ let App = (props) => {
{interstitialState.message}
</Interstitial>
{!location.pathname.includes(`/create`) &&
!location.pathname.includes(`/batch`) ? (
!location.pathname.includes(`/batch`) &&
!location.pathname.includes(`edit`) ? (
<div>
<header
style={{
Expand Down
12 changes: 9 additions & 3 deletions src/renderer/components/ClipTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,14 @@ export default ({

return (
<div>
<div>
<div
style={{
position: 'sticky',
top: '0px',
zIndex: '10',
backgroundColor: 'black',
}}
>
<label>Search:</label>
<input
type="text"
Expand Down Expand Up @@ -78,7 +85,6 @@ export default ({
<div className="clip-table" style={{ margin: 'auto' }}>
{videos.map((video, index) => {
let opClass;
let opFn;
switch (op) {
case 'remove':
opClass = 'removeable';
Expand All @@ -97,7 +103,7 @@ export default ({
<div
className="video-list-element"
onClick={() => {
opFn(collectionId, videoId);
opFn(collectionId, video._id);
}}
>
<div className={opClass}>
Expand Down
15 changes: 15 additions & 0 deletions src/renderer/components/SubtitleList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ let convertMillisecondsToTimestamp = (milliseconds) => {

export default ({
subs,
videoId,
clipNumberOverride,
titleOverride,
currentSub,
Expand All @@ -42,6 +43,18 @@ export default ({
getCollections();
}, []);

useEffect(() => {
if (titleOverride && clipNumberOverride) {
let found = Object.keys(collections).find((collectionId) => {
return collections[collectionId].includes(videoId);
});

if (found) {
setSelectedCollection(found);
}
}
}, [collections]);

const getCollections = async () => {
let collections = await CollectionAPI.getCollections(game);
setCollections(collections);
Expand Down Expand Up @@ -117,6 +130,7 @@ export default ({
<th>Index</th>
<th>In</th>
<th>Out</th>
<th>Type</th>
<th></th>
</tr>
</thead>
Expand Down Expand Up @@ -145,6 +159,7 @@ export default ({
sub.endTime
)}
</td>
<td>{sub.type}</td>
<td>
<button
onClick={(e) => {
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/routes/VideoList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ let VideoList = () => {
videos={videos}
collections={collections}
op="open"
onOpen={(collectionId, id) => {
opFn={(collectionId, id) => {
navigate(`/edit/${id}`);
}}
onDelete={(id, game) => {
Expand Down
16 changes: 14 additions & 2 deletions src/renderer/routes/editor/AdvancedEditor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ let AdvancedEditor = () => {
height: window.innerHeight,
});

const [titleOverride, setTitleOverride] = useState(null);
const [clipNumberOverride, setClipNumberOverride] = useState(null);

const [batchClip, setBatchClip] = useState(null);
const [offset, setOffset] = useState(0);
const [startTime, setStartTime] = useState(0);
Expand Down Expand Up @@ -313,6 +316,12 @@ let AdvancedEditor = () => {
};
});

let clipTextIndex = id.lastIndexOf('-Clip');
let clipNumber = id.slice(clipTextIndex + 5);
let title = id.slice(0, clipTextIndex);

setTitleOverride(title.replaceAll('_', ' '));
setClipNumberOverride(parseInt(clipNumber));
setVideoSource(`game://${params.type}/${id}.mp4`);

subtitles = distributeSubs(subtitles);
Expand Down Expand Up @@ -588,8 +597,11 @@ let AdvancedEditor = () => {
currentSliderPosition={
currentSliderPosition - offset
}
clipNumberOverride={batchClip?.clipNumber}
titleOverride={batchClip?.title}
videoId={id}
clipNumberOverride={
batchClip?.clipNumber || clipNumberOverride
}
titleOverride={batchClip?.title || titleOverride}
currentSub={currentSub}
currentRow={currentRow}
offset={offset}
Expand Down
4 changes: 3 additions & 1 deletion src/renderer/util/VideoTools.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ export let convertSrtToSubtitles = (srtBase64) => {
let n = 0;

srt.split('\n').forEach((line) => {
console.log('LINE: ' + line);
console.log('n: ' + n);
switch (n++) {
case 0:
break;
Expand Down Expand Up @@ -102,7 +104,7 @@ export let convertSrtToSubtitles = (srtBase64) => {
break;
}
});
if (n === 0) {
if (subtitle.text) {
subtitles.push(subtitle);
}

Expand Down

0 comments on commit c1fdeb5

Please sign in to comment.