@@ -56,9 +56,6 @@ const CONFIG_FILE: string = `${HOME}/.dub-editor-config.v2.json`;
56
56
const COLLECTIONS_FILE : string = '.dub-editor-collections.v2.json' ;
57
57
const BATCH_CACHE_FILE : string = '.dub-editor-batch-cache.v2.json' ;
58
58
59
- const BATCH_VIDEO_TEMP_FILE : string = '.dub-editor-data.v2/dub-editor-batch-tmp.mp4' ;
60
- const CLIP_VIDEO_TEMP_FILE : string = '.dub-editor-data.v2/dub-editor-clip-tmp.mp4' ;
61
-
62
59
const VIDEO_SUB_DIRECTORY = 'VideoClips' ;
63
60
const SUBTITLE_SUB_DIRECTORY = 'Subtitles' ;
64
61
const THUMBNAIL_SUB_DIRECTORY = 'ThumbNails' ;
@@ -167,7 +164,6 @@ const getDirectoriesForGame = (game: string) : DirectoryList => {
167
164
previewImage : path . join ( config . mediaDirectory , game , PREVIEW_IMAGE_SUB_DIRECTORY ) ,
168
165
collectionMeta : path . join ( config . mediaDirectory , COLLECTIONS_FILE ) ,
169
166
batchCacheMeta : path . join ( config . mediaDirectory , BATCH_CACHE_FILE ) ,
170
- batchVideoMeta : path . join ( config . mediaDirectory , BATCH_VIDEO_TEMP_FILE ) ,
171
167
}
172
168
}
173
169
@@ -179,7 +175,6 @@ const getConfigDirectories = () : DirectoryList => {
179
175
previewImage : '' ,
180
176
collectionMeta : path . join ( config . mediaDirectory , COLLECTIONS_FILE ) ,
181
177
batchCacheMeta : path . join ( config . mediaDirectory , BATCH_CACHE_FILE ) ,
182
- batchVideoMeta : path . join ( config . mediaDirectory , BATCH_VIDEO_TEMP_FILE ) ,
183
178
}
184
179
}
185
180
@@ -468,7 +463,7 @@ const createMetaDataFiles = () => {
468
463
469
464
// If batch storage doesn't exist, then create it
470
465
if ( ! fs . existsSync ( batchCacheMeta ) ) {
471
- console . log ( "CREATING BATCH CACHE" ) ;
466
+ console . log ( "CREATING BATCH CACHE " + batchCacheMeta ) ;
472
467
fs . mkdirSync ( HOME , { recursive : true } ) ;
473
468
fs . writeFileSync (
474
469
batchCacheMeta ,
@@ -605,12 +600,6 @@ const createWindow = async () => {
605
600
let url = request . url . substring ( 'game://' . length ) ;
606
601
let pattern = / ^ ( r i f f t r a x | w h a t t h e d u b ) \/ ( .+ ) \. ( m p 4 | s r t | j p g ) $ / ;
607
602
608
- if ( url === "batch.tmp.mp4" ) {
609
- return callback ( BATCH_VIDEO_TEMP_FILE ) ;
610
- } else if ( url === "clip.tmp.mp4" ) {
611
- return callback ( CLIP_VIDEO_TEMP_FILE ) ;
612
- }
613
-
614
603
let match : any = url . match ( pattern ) ;
615
604
616
605
if ( ! match ) {
@@ -708,10 +697,12 @@ ipcMain.handle('storeBatch', async (event, { clips, video, title }) => {
708
697
clips,
709
698
} ;
710
699
700
+ let { batchCacheMeta} = getConfigDirectories ( ) ;
701
+
711
702
// Write cache file
712
703
fs . writeFileSync (
713
704
BATCH_CACHE_FILE ,
714
- Buffer . from ( JSON . stringify ( batchCache , null , 5 ) )
705
+ Buffer . from ( JSON . stringify ( batchCacheMeta , null , 5 ) )
715
706
) ;
716
707
} ) ;
717
708
@@ -733,6 +724,8 @@ ipcMain.handle('processBatchClip', async (event, {videoSource, subtitles, title,
733
724
`STORING ${ title } -${ clipNumber } for game ${ game } with subtitles ${ subtitles } `
734
725
) ;
735
726
727
+ let { batchCacheMeta} = getConfigDirectories ( ) ;
728
+
736
729
let clip : any = batchCache . clips [ 0 ] ;
737
730
738
731
if ( clip ) {
@@ -749,7 +742,7 @@ ipcMain.handle('processBatchClip', async (event, {videoSource, subtitles, title,
749
742
batchCache . clips . shift ( ) ;
750
743
batchCache . clipNumber ++ ;
751
744
fs . writeFileSync (
752
- BATCH_CACHE_FILE ,
745
+ batchCacheMeta ,
753
746
Buffer . from ( JSON . stringify ( batchCache , null , 5 ) )
754
747
) ;
755
748
@@ -880,31 +873,6 @@ ipcMain.handle(
880
873
}
881
874
) ;
882
875
883
- ipcMain . handle (
884
- 'storeTempVideo' ,
885
- ( event , { videoArrayBuffer, type} ) => {
886
- console . log (
887
- `STORING TEMP CLIP VIDEO`
888
- ) ;
889
-
890
- if ( type === "clip" ) {
891
- fs . writeFileSync (
892
- CLIP_VIDEO_TEMP_FILE ,
893
- Buffer . from ( videoArrayBuffer )
894
- ) ;
895
- return `app://clip.tmp.mp4` ;
896
- } else if ( type === "batch" ) {
897
- fs . writeFileSync (
898
- BATCH_VIDEO_TEMP_FILE ,
899
- Buffer . from ( videoArrayBuffer )
900
- ) ;
901
- return `app://batch.tmp.mp4` ;
902
- }
903
-
904
- return null ;
905
- }
906
- ) ;
907
-
908
876
ipcMain . handle ( 'deleteVideo' , ( event , { id, game } ) => {
909
877
deleteClip ( id , game ) ;
910
878
} ) ;
0 commit comments