@@ -16,7 +16,9 @@ import SliderLabel from "../components/sliderLabel";
1616import Textfield from "../components/textfield" ;
1717import Tooltip from "../components/tooltip" ;
1818
19+ import { VideoService } from "@vot.js/ext/types/service" ;
1920import { type VideoHandler , countryCode } from "../.." ;
21+ import { AudioDownloader } from "../../audioDownloader" ;
2022import {
2123 authServerUrl ,
2224 defaultAutoHideDelay ,
@@ -1189,6 +1191,46 @@ export class SettingsView {
11891191 updateLocaleFilesButton ,
11901192 ) ;
11911193
1194+ if (
1195+ DEBUG_MODE &&
1196+ this . videoHandler &&
1197+ this . videoHandler ?. site . host === VideoService . youtube
1198+ ) {
1199+ // ! Available only in debug mode, translation phrase doesn't need
1200+ const debugDownloadAudio = ui . createOutlinedButton (
1201+ "[YT | DEBUG] Download Audio" ,
1202+ ) ;
1203+ debugDownloadAudio . addEventListener ( "click" , async ( ) => {
1204+ if ( ! this . videoHandler ?. videoData ) {
1205+ return ;
1206+ }
1207+
1208+ const audioDownloader = new AudioDownloader ( ) ;
1209+ audioDownloader
1210+ . addEventListener (
1211+ "downloadedAudio" ,
1212+ async ( translationId , data ) => {
1213+ debug . log ( "Audio downloaded:" , translationId , data ) ;
1214+ } ,
1215+ )
1216+ . addEventListener (
1217+ "downloadedPartialAudio" ,
1218+ async ( translationId , data ) => {
1219+ debug . log ( "Partial audio downloaded:" , translationId , data ) ;
1220+ } ,
1221+ )
1222+ . addEventListener ( "downloadAudioError" , ( videoId ) => {
1223+ debug . log ( "Audio download error for videoId:" , videoId ) ;
1224+ } ) ;
1225+ await audioDownloader . runAudioDownload (
1226+ this . videoHandler . videoData . videoId ,
1227+ "debug-mode" ,
1228+ new AbortController ( ) . signal ,
1229+ ) ;
1230+ } ) ;
1231+ dialog . bodyContainer . appendChild ( debugDownloadAudio ) ;
1232+ }
1233+
11921234 updateLocaleFilesButton . addEventListener ( "click" , async ( ) => {
11931235 await votStorage . set ( "localeHash" , "" ) ;
11941236 await localizationProvider . update ( true ) ;
0 commit comments