Skip to content

Commit 9d140ef

Browse files
Updated how the game value changes and how we load all the videos
1 parent 8fdc864 commit 9d140ef

19 files changed

+204
-117
lines changed

.dub-editor-batch-cache.v2.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"video": "localfile:///Users/michaelmain/Downloads/365778504_824985109259568_3291619676639901566_n.mp4",
3+
"title": "test",
4+
"clipNumber": 4,
5+
"clips": []
6+
}

assets/icon.icns

835 KB
Binary file not shown.

assets/icon.ico

-145 KB
Binary file not shown.

assets/icon.png

100755100644
631 KB
Loading

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"description": "An application for creating and managing clips for What the Dub and Rifftrax",
3-
"version": "2.1.0-beta",
3+
"version": "2.3.0-beta",
44
"keywords": [
55
"electron",
66
"boilerplate",

release/app/package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/main.ts

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -594,15 +594,15 @@ const createWindow = async () => {
594594
});
595595

596596
protocol.interceptFileProtocol('localfile', (request, callback) => {
597-
let filePath = request.url.substring(12);
597+
let filePath = request.url.substring('localfile://'.length);
598598

599599
console.log("FILE PATH: " + filePath);
600600

601601
callback(filePath);
602602
});
603603

604604
protocol.interceptFileProtocol('game', async (request, callback) => {
605-
let url = request.url.substring(7);
605+
let url = request.url.substring('game://'.length);
606606
let pattern = /^(rifftrax|whatthedub)\/(.+)\.(mp4|srt|jpg)$/;
607607

608608
if (url === "batch.tmp.mp4") {
@@ -623,17 +623,21 @@ const createWindow = async () => {
623623

624624
const {clip, subtitle, thumbnail} = getClipPaths(id, game);
625625

626-
if (ext === 'mp4') {
627-
callback(clip);
628-
} else if (ext === 'srt') {
629-
callback(subtitle);
630-
} else if (ext === 'jpg') {
631-
if (!fs.existsSync(thumbnail)) {
632-
await createThumbnail(clip, '00:00:01', thumbnail);
626+
try {
627+
if (ext === 'mp4') {
628+
callback(clip);
629+
} else if (ext === 'srt') {
630+
callback(subtitle);
631+
} else if (ext === 'jpg') {
632+
if (!fs.existsSync(thumbnail) && fs.existsSync(clip)) {
633+
await createThumbnail(clip, '00:00:01', thumbnail);
634+
}
635+
callback(thumbnail);
636+
} else {
637+
callback(clip);
633638
}
634-
callback(thumbnail);
635-
} else {
636-
callback(clip);
639+
} catch (error) {
640+
console.warn("Cannot fetch file " + id + "." + ext);
637641
}
638642
});
639643
};

src/renderer/App.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,8 @@ button.selected {
248248
background-color: black;
249249
color: white;
250250
z-index: 10;
251+
font-size: 1.8rem;
252+
padding: 10px;
251253
}
252254

253255
.clip-pack-edit {

src/renderer/App.jsx

Lines changed: 69 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -21,28 +21,34 @@ import ClipCutter from './routes/editor/ClipCutter';
2121
import SimpleEditor from './routes/editor/SimpleEditor';
2222
import Interstitial from './components/interstitial/Interstitial';
2323

24+
import riffTraxImage from './images/rifftrax.png';
25+
import whatTheDubImage from './images/whatthedub.png';
26+
2427
import { useAtom } from 'jotai';
2528
import { interstitialAtom } from './atoms/interstitial.atom';
2629

2730
import './App.css';
2831
import 'react-toastify/dist/ReactToastify.css';
2932

3033
import { version } from '../../release/app/package.json';
34+
import { gameAtom } from './atoms/game.atom';
3135

3236
const VERSION = version;
3337

38+
const imageMap = {
39+
rifftrax: riffTraxImage,
40+
whatthedub: whatTheDubImage,
41+
};
42+
3443
let App = (props) => {
3544
const navigate = useNavigate();
3645
const location = useLocation();
3746
const [interstitialState, setInterstitialState] = useAtom(interstitialAtom);
38-
const [game, setGame] = useState('rifftrax');
47+
const [game, setGame] = useAtom(gameAtom);
3948
const [config, setConfig] = useState({});
4049

4150
const changeGame = (newGame) => {
4251
setGame(newGame);
43-
navigate(`/${location.pathname.split('/')[1]}/${newGame}`, {
44-
replace: true,
45-
});
4652
};
4753

4854
useEffect(() => {
@@ -78,27 +84,60 @@ let App = (props) => {
7884
<Interstitial isOpen={interstitialState.isOpen}>
7985
{interstitialState.message}
8086
</Interstitial>
81-
{location.pathname !== `/create/${game}` ? (
87+
{!location.pathname.includes(`/create`) ? (
8288
<div>
83-
<h1>Dub Editor</h1>
84-
<hr />
85-
<div>{VERSION}</div>
86-
<label>Game:</label>
87-
<select
88-
value={game}
89-
onChange={({ target: { value } }) => {
90-
changeGame(value);
89+
<header
90+
style={{
91+
display: 'flex',
92+
flexDirection: 'row',
93+
justifyContent: 'center',
94+
alignItems: 'center',
95+
gap: '10px',
9196
}}
9297
>
93-
<option value="rifftrax">Rifftrax</option>
94-
<option value="whatthedub">What the Dub</option>
95-
</select>
98+
<div
99+
style={{
100+
display: 'flex',
101+
flexDirection: 'row',
102+
justifyContent: 'center',
103+
alignItems: 'center',
104+
gap: '10px',
105+
}}
106+
>
107+
<h1>Dub Editor</h1>
108+
<div>{VERSION}</div>
109+
</div>
110+
<div>
111+
<img
112+
src={imageMap[game]}
113+
style={{
114+
width: '100px',
115+
height: '100px',
116+
objectFit: 'contain',
117+
}}
118+
/>
119+
<div>
120+
<label>Game:</label>
121+
<select
122+
value={game}
123+
onChange={({ target: { value } }) => {
124+
setGame(value);
125+
}}
126+
>
127+
<option value="rifftrax">Rifftrax</option>
128+
<option value="whatthedub">
129+
What the Dub
130+
</option>
131+
</select>
132+
</div>
133+
</div>
134+
</header>
96135
<hr />
97136
<Link
98137
className={({ isActive }) =>
99138
isActive ? 'active' : null
100139
}
101-
to={`/videos/${game}`}
140+
to={`/videos`}
102141
>
103142
Clips
104143
</Link>
@@ -107,7 +146,7 @@ let App = (props) => {
107146
className={({ isActive }) =>
108147
isActive ? 'active' : null
109148
}
110-
to={`/collections/${game}`}
149+
to={`/collections`}
111150
>
112151
Packs
113152
</Link>
@@ -116,7 +155,7 @@ let App = (props) => {
116155
className={({ isActive }) =>
117156
isActive ? 'active' : null
118157
}
119-
to={`/config/${game}`}
158+
to={`/config`}
120159
>
121160
Config
122161
</Link>
@@ -125,7 +164,7 @@ let App = (props) => {
125164
className={({ isActive }) =>
126165
isActive ? 'active' : null
127166
}
128-
to={`/about/${game}`}
167+
to={`/about`}
129168
>
130169
About
131170
</Link>
@@ -140,46 +179,30 @@ let App = (props) => {
140179
) : null}
141180
<div style={{ minHeight: '50vh' }}>
142181
<Routes>
143-
<Route exact path={`/about/:game`} element={<About />} />
144-
<Route exact path={`/config/:game`} element={<Config />} />
145-
<Route
146-
exact
147-
path={`/batch/:type`}
148-
element={<ClipCutter game={game} />}
149-
/>
150-
<Route
151-
exact
152-
path={`/create/:type`}
153-
element={<ClipEditor game={game} />}
154-
/>
182+
<Route exact path={`/about`} element={<About />} />
183+
<Route exact path={`/config`} element={<Config />} />
184+
<Route exact path={`/batch`} element={<ClipCutter />} />
185+
<Route exact path={`/create`} element={<ClipEditor />} />
155186
<Route
156187
exact
157-
path={`/create/advanced/:type`}
188+
path={`/create/advanced`}
158189
element={<AdvancedEditor />}
159190
/>
160191
<Route
161192
exact
162-
path={`/create/simple/:type`}
193+
path={`/create/simple`}
163194
element={<SimpleEditor />}
164195
/>
165196
<Route
166197
exact
167-
path={`/collections/:game`}
198+
path={`/collections`}
168199
element={<CollectionManager />}
169200
/>
170-
<Route
171-
exact
172-
path={`/videos/:game`}
173-
element={<VideoList />}
174-
/>
175-
<Route
176-
exact
177-
path={`/videos/:game/:id`}
178-
element={<VideoView />}
179-
/>
201+
<Route exact path={`/videos`} element={<VideoList />} />
202+
<Route exact path={`/videos/:id`} element={<VideoView />} />
180203
<Route
181204
path="*"
182-
element={<Navigate to="/videos/rifftrax" replace />}
205+
element={<Navigate to="/videos" replace />}
183206
/>
184207
</Routes>
185208
</div>

src/renderer/atoms/game.atom.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { atom } from 'jotai';
2+
3+
export const gameAtom = atom('rifftrax');

0 commit comments

Comments
 (0)