Warning: session_start(): open(/var/lib/php/sessions/sess_qqrnjjlqvgl7vft6bcn4gp0eeo, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
!7
sclass YouTubeDownloader > DynModule {
transient JTextArea ta;
transient JTextField tfURL, tfDest;
transient JButton btnGo;
transient File lastFileMade;
start {
doEvery(1000, r updateMe);
}
visualize {
tfURL = jtextfield("https://www.youtube.com/watch?v=YYOKMUTTDdA");
// Full paste
componentPopupMenu_clear(tfURL);
componentPopupMenuItem(tfURL, "Paste", r { tfURL.selectAll(); tfURL.paste() });
tfDest = jtextfield(desktopDir());
onEnter(tfURL, r go);
ret northAndCenterWithMargins(
vstackWithSpacing(
centerAndEast(withLabel("Video URL to download:", tfURL),
withLeftMargin(btnGo = jbutton("Download", r go))),
withLabel("Destination directory:", tfDest)),
ta = typeWriterTextArea());
}
void unvisualize() { ta = null; }
void update {
if (ta != null) setText(ta, localPrintLog());
}
void go {
thread "YouTube Download" {
temp tempDisableButton(btnGo);
installOrUpdateYouTubeDL();
S url = /*formatYouTubeURL_long*/(gtt(tfURL));
File dir = newFile(gtt(tfDest));
S output = downloadImpl(url, dir);
File f = youtubeDLExtractDestination(output);
if (f != null)
print("\nMade: " + fileInfo(lastFileMade = f));
else
print("\nHmm. Did something go wrong?");
}
}
S downloadImpl(S url, File dir) {
ret youtubeDownloadVideo(url, dir);
}
// API
File downloadAndReturnFile(S url, File dir) enter {
ret youtubeDLExtractDestination(downloadImpl(url, dir));
}
}