PageRenderTime 56ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/YtuScheduler_14.java

http://ytuscheduler.googlecode.com/
Java | 1529 lines | 1454 code | 62 blank | 13 comment | 104 complexity | 375841b57abd0aedea2ad6ff64f0ee5c MD5 | raw file

Large files files are truncated, but you can click here to view the full file

  1. import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
  2. import java.awt.EventQueue;
  3. import javax.swing.DefaultListModel;
  4. import javax.swing.JDialog;
  5. import javax.swing.JFileChooser;
  6. import javax.swing.JFrame;
  7. import javax.swing.JOptionPane;
  8. import javax.swing.JTextField;
  9. import javax.swing.JLabel;
  10. import javax.swing.JPasswordField;
  11. import javax.swing.JTextArea;
  12. import javax.swing.JScrollPane;
  13. import javax.swing.JComboBox;
  14. import javax.swing.JButton;
  15. import javax.swing.AbstractAction;
  16. import java.awt.event.ActionEvent;
  17. import java.awt.event.FocusEvent;
  18. import java.awt.event.FocusListener;
  19. import java.io.BufferedInputStream;
  20. import java.io.BufferedOutputStream;
  21. import java.io.BufferedReader;
  22. import java.io.File;
  23. import java.io.FileNotFoundException;
  24. import java.io.IOException;
  25. import java.io.InputStream;
  26. import java.io.InputStreamReader;
  27. import java.io.OutputStream;
  28. import java.io.PrintWriter;
  29. import java.net.URL;
  30. import java.nio.file.Files;
  31. import java.nio.file.Path;
  32. import java.nio.file.Paths;
  33. import java.text.DateFormat;
  34. import java.text.SimpleDateFormat;
  35. import java.util.ArrayList;
  36. import java.util.Date;
  37. import java.util.List;
  38. import java.util.Scanner;
  39. import java.util.regex.Matcher;
  40. import java.util.regex.Pattern;
  41. import javax.swing.Action;
  42. import javax.swing.JList;
  43. import org.jasypt.util.text.BasicTextEncryptor;
  44. import com.google.gdata.client.youtube.YouTubeService;
  45. import com.google.gdata.data.media.MediaFileSource;
  46. import com.google.gdata.data.media.MediaSource;
  47. import com.google.gdata.data.media.mediarss.MediaCategory;
  48. import com.google.gdata.data.media.mediarss.MediaDescription;
  49. import com.google.gdata.data.media.mediarss.MediaTitle;
  50. import com.google.gdata.data.youtube.VideoEntry;
  51. import com.google.gdata.data.youtube.YouTubeMediaGroup;
  52. import com.google.gdata.data.youtube.YouTubeNamespace;
  53. import com.google.gdata.util.ServiceException;
  54. import java.awt.Font;
  55. import javax.swing.ListSelectionModel;
  56. public class YtuSchedulerGUI2 {
  57. public static JFileChooser fc = new JFileChooser();
  58. public final static String uploadUrl = "http://uploads.gdata.youtube.com/feeds/api/users/default/uploads";
  59. public static String usershome = System.getProperty("user.home"); //%20
  60. public static String GDataDKey = "AI39si7Iw2fopIkvtGuNeHbPHqQRZyWuN3m-Cv21PX6CO_3EcqrFjOfWbrS59tifYjB6-oYszwbXegEvgF1JDpMq2WB5jwySLQ";
  61. public static String appdata = usershome + "\\AppData\\Roaming\\";
  62. public static String textencryptorpass = "f9c6127646e881a939b23d6c9704679e42acdd3c1aa18bf143d211925615f761" + usershome;
  63. public static String filelocation2 = "";
  64. public static String videomimetype = "";
  65. public static String username2 = "";
  66. public static String passwrd2 = "";
  67. public static String savelogininformation3 = "No";
  68. public static String desiredtitle2 = "";
  69. public static String discription2 = "";
  70. public static String YTcatorgories3 = "";
  71. public static String privacyoption3 = "";
  72. public static String keywords2 = null;
  73. public static String filestringstr = null;
  74. public static String threadjopsmd = null;
  75. public static String filestring = "";
  76. public static String filelocationtest = "";
  77. public static String systemoutvar = "";
  78. public static String sysdrive = "";
  79. public static String listmodel1name = "";
  80. public static String[] YTcatorgories = { "Autos", "Comedy", "Education", "Entertainment", "Film", "Gaming", "Howto", "Music", "News", "Nonprofits", "People", "Tech", "Sports", "Travel" };
  81. public static String[] privacyoption = { "Public", "Private" };
  82. public static String[] savelogininformation = { "No", "Yes" };
  83. public static String[] AMPM = { "AM", "PM" };
  84. public static String[] arr = {};
  85. public static int listmodel1element = 0;
  86. public static List<String> savedloginU = new ArrayList<String>();
  87. public static List<String> savedloginP = new ArrayList<String>();
  88. public static List<?> savedloginUE = new ArrayList<Object>();
  89. public static List<?> savedloginPE = new ArrayList<Object>();
  90. public static List<String> SchTaskarrlist = new ArrayList<String>();
  91. public static List<String> SchTaskarralreadylisted = new ArrayList<String>();
  92. public static List<String> SchTaskarrlistraw = new ArrayList<String>();
  93. public static List<String> SchTaskarralreadylistedraw = new ArrayList<String>();
  94. public static List<String> loadingtextannimation = new ArrayList<String>();
  95. public static MediaFileSource source = null;
  96. public static OutputStream outputStream = null;
  97. public static DefaultListModel<String> listmodel = new DefaultListModel<String>();
  98. public static DefaultListModel<String> listmodel1 = new DefaultListModel<String>();
  99. public static JPasswordField passwrd;
  100. public static JTextArea discription = new JTextArea();
  101. public static JTextField keywords;
  102. public static JTextField filelocation;
  103. public static JTextField ytstime = new JTextField();
  104. public static JTextField ytsdate = new JTextField();
  105. public static JComboBox<?> AMPM2 = new JComboBox<Object>(AMPM);
  106. public static JTextField desiredtitle = new JTextField(); //threadjopsmd
  107. public static JComboBox<?> YTcatorgories2 = new JComboBox<Object>(YTcatorgories);
  108. public static JComboBox<?> privacyoption2 = new JComboBox<Object>(privacyoption);
  109. public static JComboBox<String> username;
  110. public static JList<String> list = new JList<String>(listmodel);
  111. public static JList<String> list_1 = new JList<String>(listmodel1);
  112. public static JLabel statusbar = new JLabel("");
  113. private static JFrame frame;
  114. public static boolean privacyoption4;
  115. public static boolean addusertolist = true;
  116. public static BasicTextEncryptor textEncryptor = new BasicTextEncryptor();
  117. public static File fcstring = null;
  118. private final Action action = new SwingAction();
  119. private final Action action_1 = new SwingAction_1();
  120. private final Action action_2 = new SwingAction_2();
  121. private final Action action_3 = new SwingAction_3();
  122. private final Action action_4 = new SwingAction_4();
  123. private final Action action_5 = new SwingAction_5();
  124. private final Action action_6 = new SwingAction_6();
  125. private final Action action_7 = new SwingAction_7();
  126. private final Action action_8 = new SwingAction_8();
  127. private final Action action_9 = new SwingAction_9();
  128. private final Action action_10 = new SwingAction_10();
  129. public static MediaFileSource ms = null;
  130. public static VideoEntry newEntry = null;
  131. // Below is my attempt to count bytes as they are being uploaded ... still working this out
  132. public static void writeTo(MediaSource source, OutputStream outputStream)
  133. throws IOException {
  134. InputStream sourceStream = source.getInputStream();
  135. BufferedOutputStream bos = new BufferedOutputStream(outputStream);
  136. BufferedInputStream bis = new BufferedInputStream(sourceStream);
  137. long byteCounter = 0L;
  138. try {
  139. byte [] buf = new byte[2048]; // Transfer in 2k chunks
  140. int bytesRead = 0;
  141. while ((bytesRead = bis.read(buf, 0, buf.length)) >= 0) {
  142. // byte counter
  143. byteCounter += bytesRead;
  144. bos.write(buf, 0, bytesRead);
  145. System.out.println("byteCounter:" + byteCounter);
  146. }
  147. bos.flush();
  148. } finally {
  149. bis.close();
  150. }
  151. }
  152. //Thread that starts the uploads
  153. public static Thread startupload = new Thread(new Runnable(){
  154. public void run(){
  155. //Lets not rely on puplic varibles as they might change before the video is fully uploaded
  156. String videomimetype1 = videomimetype;
  157. String filestring1 = filestring;
  158. String username21 = username2;
  159. String passwrd21 = passwrd2;
  160. String desiredtitle21 = desiredtitle2;
  161. String discription21 = discription2;
  162. String YTcatorgories31 = YTcatorgories3;
  163. boolean privacyoption41 = privacyoption4;
  164. //Submits this program's developer key
  165. YouTubeService myService = new YouTubeService(username21, GDataDKey);
  166. VideoEntry newEntry = new VideoEntry();
  167. YouTubeMediaGroup mg = newEntry.getOrCreateMediaGroup();
  168. mg.setTitle(new MediaTitle());
  169. mg.getTitle().setPlainTextContent("Temp title");
  170. mg.addCategory(new MediaCategory(YouTubeNamespace.CATEGORY_SCHEME, YTcatorgories31));
  171. mg.setDescription(new MediaDescription());
  172. mg.getDescription().setPlainTextContent("Temp description");
  173. mg.setPrivate(privacyoption41);
  174. MediaFileSource ms = new MediaFileSource(new File(filestring1), videomimetype1);
  175. String uploadUrl =
  176. "http://uploads.gdata.youtube.com/feeds/api/users/default/uploads";
  177. //erases the text fields in an attempt to avoid duplicate uploads
  178. YtuSchedulerGUI2.desiredtitle.setText("");
  179. YtuSchedulerGUI2.desiredtitle2 = "";
  180. YtuSchedulerGUI2.discription.setText("");
  181. YtuSchedulerGUI2.discription2 = "";
  182. YtuSchedulerGUI2.YTcatorgories2.setSelectedItem("Autos");
  183. YtuSchedulerGUI2.YTcatorgories3 = "";
  184. YtuSchedulerGUI2.privacyoption2.setSelectedItem("Public");
  185. YtuSchedulerGUI2.keywords.setText("");
  186. YtuSchedulerGUI2.filelocation.setText("");
  187. YtuSchedulerGUI2.filestring = "";
  188. YtuSchedulerGUI2.filestringstr = null;
  189. YtuSchedulerGUI2.videomimetype = "";
  190. try {
  191. newEntry.setMediaSource(ms);
  192. listmodel1.addElement(desiredtitle21);
  193. systemoutvar = "Your upload \"" + desiredtitle21 + "\" has started. Dont close this window.";
  194. new Thread(systemout).start();
  195. listmodel1name = desiredtitle21;
  196. loadingtextannimation.add(desiredtitle21);
  197. new Thread(loadingtext).start();
  198. new Thread(cmdloadingtext).start();
  199. myService.setUserCredentials(username21,passwrd21);
  200. VideoEntry createdEntry = myService.insert(new URL(uploadUrl), newEntry); //Uploads
  201. createdEntry.getMediaGroup().getDescription().setPlainTextContent(discription21);
  202. createdEntry.update();
  203. createdEntry.getMediaGroup().getTitle().setPlainTextContent(desiredtitle21);
  204. createdEntry.update();
  205. for(int i=0;i<arr.length;i++) {
  206. if (arr[i].length() > 1) {
  207. if (arr[i].length() < 31) {
  208. System.out.println("Adding keyword:" + arr[i]);
  209. createdEntry.getMediaGroup().getKeywords().addKeyword((String) arr[i]);
  210. }
  211. }
  212. }
  213. for(int i=0; i<loadingtextannimation.size(); i++) {
  214. if (loadingtextannimation.get(i).equals(desiredtitle21)) {
  215. loadingtextannimation.remove(i);
  216. }
  217. }
  218. } catch (IOException | ServiceException e1) {
  219. systemoutvar = e1.toString();
  220. JOptionPane.showMessageDialog(frame, systemoutvar);
  221. new Thread(systemout).start();
  222. e1.printStackTrace();
  223. return;
  224. }
  225. for (int i=0; i < listmodel1.getSize(); i++) {
  226. if (listmodel1.getElementAt(i).equals(desiredtitle21)) {
  227. listmodel1.remove(i);
  228. }
  229. }
  230. systemoutvar = "Uploaded";
  231. new Thread(systemout).start();
  232. }
  233. });
  234. public static Thread loadingtext = new Thread(new Runnable(){
  235. public void run(){
  236. int listmodel1elementtemp = 0;
  237. String listmodel1nametemp = listmodel1name;
  238. String loadingcurser = "";
  239. boolean stoploop = false;
  240. for (int i=0; i < listmodel1.getSize(); i++) {
  241. if (listmodel1.getElementAt(i).equals(listmodel1nametemp)) {
  242. listmodel1elementtemp = i;
  243. }
  244. }
  245. while (stoploop == false) {
  246. Thread.currentThread();
  247. try {
  248. Thread.sleep(100);
  249. } catch (InterruptedException e) {
  250. e.printStackTrace();
  251. }
  252. stoploop = true;
  253. for(int i=0; i<loadingtextannimation.size(); i++) {
  254. if (loadingtextannimation.get(i).equals(listmodel1nametemp)) {
  255. stoploop = false;
  256. }
  257. }
  258. switch (loadingcurser) {
  259. case " |": loadingcurser = " /"; break;
  260. case " /": loadingcurser = " -"; break;
  261. case " -": loadingcurser = " \\"; break;
  262. case " \\": loadingcurser = " |"; break;
  263. default: loadingcurser = " |"; break;
  264. }
  265. listmodel1.set(listmodel1elementtemp, listmodel1nametemp + loadingcurser );
  266. for (int i=0; i < listmodel1.getSize(); i++) {
  267. if (listmodel1.getElementAt(i).equals(listmodel1nametemp + loadingcurser)) {
  268. listmodel1elementtemp = i;
  269. if (stoploop == true) {
  270. listmodel1.set(listmodel1elementtemp, listmodel1nametemp + " {Uploaded}" );
  271. }
  272. }
  273. }
  274. }
  275. }
  276. });
  277. public static Thread cmdloadingtext = new Thread(new Runnable(){
  278. public void run(){
  279. int listmodel1elementtemp = 0;
  280. String listmodel1nametemp = listmodel1name;
  281. String loadingcurser = "";
  282. boolean stoploop = false;
  283. while (stoploop == false) {
  284. Thread.currentThread();
  285. try {
  286. Thread.sleep(100);
  287. } catch (InterruptedException e) {
  288. e.printStackTrace();
  289. }
  290. //stoploop = true;
  291. for(int i=0; i<loadingtextannimation.size(); i++) {
  292. if (loadingtextannimation.get(i).equals(listmodel1nametemp)) {
  293. stoploop = false;
  294. }
  295. }
  296. switch (loadingcurser) {
  297. case " |\r": loadingcurser = " /\r"; break;
  298. case " /\r": loadingcurser = " -\r"; break;
  299. case " -\r": loadingcurser = " \\\r"; break;
  300. case " \\\r": loadingcurser = " |\r"; break;
  301. default: loadingcurser = " |\r"; break;
  302. }
  303. System.out.print( "uploading" + loadingcurser);
  304. }
  305. }
  306. });
  307. public static Thread systemout = new Thread(new Runnable(){
  308. public void run(){
  309. System.out.println(systemoutvar);
  310. YtuSchedulerGUI2.statusbar.setText(systemoutvar);
  311. Thread.currentThread();
  312. try {
  313. Thread.sleep(5000);
  314. } catch (InterruptedException e) {
  315. systemoutvar = e.toString();
  316. new Thread(systemout).start();
  317. e.printStackTrace();
  318. }
  319. YtuSchedulerGUI2.statusbar.setText("");
  320. }
  321. });
  322. public static Thread setsysdrive = new Thread(new Runnable(){
  323. public void run(){
  324. String[] sysdrive2 = usershome.split(":");
  325. sysdrive = sysdrive2[0] + ":\\";
  326. System.out.println("sysdrive:" + sysdrive);
  327. }
  328. });
  329. public static Thread removeselecteduser = new Thread(new Runnable(){
  330. public void run(){
  331. for(int i=0; i<savedloginU.size(); i++) {
  332. if (username.getSelectedItem() == savedloginU.get(i)) {
  333. System.out.println("removing selected user:" + username.getSelectedItem());
  334. username.removeItem(username.getSelectedItem());
  335. savedloginU.remove(i);
  336. savedloginP.remove(i);
  337. }
  338. }
  339. File logininformationfile = new File( appdata + "YTscheduler/" + GDataDKey );
  340. PrintWriter pwInput = null;
  341. try {
  342. pwInput = new PrintWriter(logininformationfile);
  343. } catch (FileNotFoundException e) {
  344. systemoutvar = "File not found";
  345. new Thread(systemout).start();
  346. e.printStackTrace();
  347. }
  348. for(int i=0; i<savedloginU.size(); i++) {
  349. String myEncryptedText = textEncryptor.encrypt((String) savedloginU.get(i));
  350. String myEncryptedText2 = textEncryptor.encrypt((String) savedloginP.get(i));
  351. pwInput.println(myEncryptedText);
  352. pwInput.println(myEncryptedText2);
  353. }
  354. pwInput.close();
  355. }
  356. });
  357. public static Thread deletetask = new Thread(new Runnable(){
  358. public void run(){
  359. Object Selectedtask = null;
  360. if (list.isSelectionEmpty()) {
  361. systemoutvar = "Nothing selected";
  362. new Thread(systemout).start();
  363. } else {
  364. int selected[] = list.getSelectedIndices();
  365. System.out.println("selected:" + selected[0]);
  366. for (int i=0; i < selected.length; i++) {
  367. Selectedtask = list.getModel().getElementAt(selected[i]);
  368. System.out.println("Selectedtask:" + Selectedtask);
  369. }
  370. for (int i=0; i<SchTaskarralreadylisted.size(); i++) {
  371. if (SchTaskarralreadylisted.get(i).equals(Selectedtask)) {
  372. System.out.println(SchTaskarralreadylistedraw.get(i));
  373. List<String> cutdownSchTaskname = new ArrayList<String>();
  374. Pattern regex = Pattern.compile("[^\\s\"']+|\"([^\"]*)\"|'([^']*)'");
  375. Matcher regexMatcher = regex.matcher((CharSequence) SchTaskarralreadylistedraw.get(i));
  376. while (regexMatcher.find()) {
  377. if (regexMatcher.group(1) != null) {
  378. cutdownSchTaskname.add(regexMatcher.group(1));
  379. }
  380. }
  381. System.out.println("cutdownSchTaskname:" + cutdownSchTaskname.get(0));
  382. try {
  383. String makeascheduler2 = sysdrive + "Windows\\system32\\schtasks.exe /Delete /TN " + cutdownSchTaskname.get(0) + " /F";
  384. Runtime rt = Runtime.getRuntime();
  385. Process pr = rt.exec(makeascheduler2);
  386. BufferedReader input = new BufferedReader(new InputStreamReader(pr.getInputStream()));
  387. int exitVal = pr.waitFor();
  388. } catch(Exception e1) {
  389. systemoutvar = e1.toString();
  390. new Thread(systemout).start();
  391. e1.printStackTrace();
  392. }
  393. for (int i1=0; i1<SchTaskarrlistraw.size(); i1++) {
  394. if (SchTaskarrlistraw.get(i1).equals(SchTaskarralreadylistedraw.get(i))) {
  395. SchTaskarrlistraw.remove(i1);
  396. }
  397. }
  398. for (int i1=0; i1<SchTaskarrlist.size(); i1++) {
  399. if (SchTaskarrlist.get(i1).equals(SchTaskarralreadylisted.get(i))) {
  400. SchTaskarrlist.remove(i1);
  401. }
  402. }
  403. list.clearSelection();
  404. listmodel.remove(selected[0]);
  405. SchTaskarralreadylistedraw.remove(i);
  406. SchTaskarralreadylisted.remove(i);
  407. systemoutvar = "Task deleted";
  408. new Thread(systemout).start();
  409. }
  410. }
  411. }
  412. new Thread(loadtasks).start();
  413. }
  414. });
  415. public static Thread loadtasks = new Thread(new Runnable(){
  416. public void run(){
  417. System.out.println(SchTaskarrlist.size());
  418. System.out.println(SchTaskarrlistraw.size());
  419. System.out.println(SchTaskarralreadylisted.size());
  420. System.out.println(SchTaskarralreadylistedraw.size());
  421. }
  422. });
  423. public static Thread runtask = new Thread(new Runnable(){
  424. public void run(){ //TODO finish this
  425. Object Selectedtask = null;
  426. if (list.isSelectionEmpty()) {
  427. systemoutvar = "Nothing selected";
  428. new Thread(systemout).start();
  429. } else {
  430. int selected[] = list.getSelectedIndices();
  431. System.out.println("selected:" + selected[0]);
  432. for (int i=0; i < selected.length; i++) {
  433. Selectedtask = list.getModel().getElementAt(selected[i]);
  434. System.out.println("Selectedtask:" + Selectedtask);
  435. }
  436. for (int i=0; i<SchTaskarralreadylisted.size(); i++) {
  437. if (SchTaskarralreadylisted.get(i).equals(Selectedtask)) {
  438. System.out.println(SchTaskarralreadylistedraw.get(i));
  439. List<String> cutdownSchTaskname = new ArrayList<String>();
  440. Pattern regex = Pattern.compile("[^\\s\"']+|\"([^\"]*)\"|'([^']*)'");
  441. Matcher regexMatcher = regex.matcher((CharSequence) SchTaskarralreadylistedraw.get(i));
  442. while (regexMatcher.find()) {
  443. if (regexMatcher.group(1) != null) {
  444. cutdownSchTaskname.add(regexMatcher.group(1));
  445. }
  446. }
  447. System.out.println("cutdownSchTaskname:" + cutdownSchTaskname.get(0));
  448. try {
  449. String makeascheduler2 = sysdrive + "Windows\\system32\\schtasks.exe /Run /TN " + cutdownSchTaskname.get(0) + " /I";
  450. Runtime rt = Runtime.getRuntime();
  451. Process pr = rt.exec(makeascheduler2);
  452. BufferedReader input = new BufferedReader(new InputStreamReader(pr.getInputStream()));
  453. int exitVal = pr.waitFor();
  454. } catch(Exception e1) {
  455. systemoutvar = e1.toString();
  456. new Thread(systemout).start();
  457. e1.printStackTrace();
  458. }
  459. }
  460. }
  461. }
  462. }
  463. });
  464. public static Thread rescheduletask = new Thread(new Runnable(){
  465. public void run(){
  466. String ytstime4 = "";
  467. String ytsdate4 = "";
  468. DateFormat dateFormatdate3 = new SimpleDateFormat("MM/dd/yyyy");
  469. DateFormat dateFormattime3 = new SimpleDateFormat("HH:mm");
  470. Date date = new Date();
  471. String dateFormatdate4 = dateFormatdate3.format(date);
  472. String dateFormattime4 = dateFormattime3.format(date);
  473. String[] AMPM = { "AM", "PM" };
  474. String[] RAUO = { "No", "Yes" };
  475. JComboBox<?> AMPM2 = new JComboBox<Object>(AMPM);
  476. JTextField winpasswrd = new JPasswordField();
  477. JTextField ytsdate = new JTextField(dateFormatdate4);
  478. JTextField ytstime = new JTextField(dateFormattime4);
  479. Object[] msg5 = {"Windows Password", winpasswrd, "Date to be ran MM/DD/YYYY", ytsdate, "Time to be ran HH:MM (12h or 24h)", ytstime, "AM/PM", AMPM2 };
  480. final JOptionPane op2 = new JOptionPane(
  481. msg5,
  482. JOptionPane.PLAIN_MESSAGE,
  483. JOptionPane.OK_CANCEL_OPTION,
  484. null,
  485. null,
  486. null);
  487. final JDialog dialog2 = op2.createDialog("Reschedule");
  488. dialog2.setVisible(true);
  489. int value = ((Integer) op2.getValue()).intValue();
  490. if (value == JOptionPane.OK_OPTION) {
  491. String ytsdate2 = ytsdate.getText();
  492. String ytstime2 = ytstime.getText();
  493. String winpasswrd2 = winpasswrd.getText();
  494. String AMPM3 = (String) AMPM2.getSelectedItem();
  495. String[] ytstime3 = ytstime2.split(":"); // uses : as a delimiter and splits a string in to an array
  496. String[] ytsdate3 = ytsdate2.split("/"); // uses / as a delimiter and splits a string in to an array
  497. String ytsdateMM = ytsdate3[0];
  498. String ytsdateDD = ytsdate3[1];
  499. String ytsdateYY = ytsdate3[2];
  500. String ytstimeHH = ytstime3[0];
  501. String ytstimeMM = ytstime3[1];
  502. String ytshourString = null;
  503. if (AMPM3 == "PM") {
  504. System.out.println("PM cought");
  505. switch (ytstimeHH) {
  506. case "1": ytshourString = "13"; break;
  507. case "2": ytshourString = "14"; break;
  508. case "3": ytshourString = "15"; break;
  509. case "4": ytshourString = "16"; break;
  510. case "5": ytshourString = "17"; break;
  511. case "6": ytshourString = "18"; break;
  512. case "7": ytshourString = "19"; break;
  513. case "8": ytshourString = "20"; break;
  514. case "9": ytshourString = "21"; break;
  515. case "01": ytshourString = "13"; break;
  516. case "02": ytshourString = "14"; break;
  517. case "03": ytshourString = "15"; break;
  518. case "04": ytshourString = "16"; break;
  519. case "05": ytshourString = "17"; break;
  520. case "06": ytshourString = "18"; break;
  521. case "07": ytshourString = "19"; break;
  522. case "08": ytshourString = "20"; break;
  523. case "09": ytshourString = "21"; break;
  524. case "10": ytshourString = "22"; break;
  525. case "11": ytshourString = "23"; break;
  526. case "12": ytshourString = "12"; break;
  527. default: ytshourString = ytstimeHH; break;
  528. }
  529. }else if (AMPM3 == "AM") {
  530. System.out.println("AM cought");
  531. switch (ytstimeHH) {
  532. case "01": ytshourString = "01"; break;
  533. case "02": ytshourString = "02"; break;
  534. case "03": ytshourString = "03"; break;
  535. case "04": ytshourString = "04"; break;
  536. case "05": ytshourString = "05"; break;
  537. case "06": ytshourString = "06"; break;
  538. case "07": ytshourString = "07"; break;
  539. case "08": ytshourString = "08"; break;
  540. case "09": ytshourString = "09"; break;
  541. case "1": ytshourString = "01"; break;
  542. case "2": ytshourString = "02"; break;
  543. case "3": ytshourString = "03"; break;
  544. case "4": ytshourString = "04"; break;
  545. case "5": ytshourString = "05"; break;
  546. case "6": ytshourString = "06"; break;
  547. case "7": ytshourString = "07"; break;
  548. case "8": ytshourString = "08"; break;
  549. case "9": ytshourString = "09"; break;
  550. case "10": ytshourString = "10"; break;
  551. case "11": ytshourString = "11"; break;
  552. case "12": ytshourString = "00"; break;
  553. default: ytshourString = ytstimeHH; break;
  554. }
  555. }
  556. ytstimeHH = ytshourString;
  557. ytstime4 = ytstimeHH + ":" + ytstimeMM;
  558. ytsdate4 = ytsdateMM + "/" + ytsdateDD + "/" + ytsdateYY;
  559. Object Selectedtask = null;
  560. if (list.isSelectionEmpty()) {
  561. systemoutvar = "Nothing selected";
  562. new Thread(systemout).start();
  563. } else {
  564. int selected[] = list.getSelectedIndices();
  565. System.out.println("selected:" + selected[0]);
  566. for (int i=0; i < selected.length; i++) {
  567. Selectedtask = list.getModel().getElementAt(selected[i]);
  568. System.out.println("Selectedtask:" + Selectedtask);
  569. }
  570. for (int i=0; i<SchTaskarralreadylisted.size(); i++) {
  571. if (SchTaskarralreadylisted.get(i).equals(Selectedtask)) {
  572. System.out.println(SchTaskarralreadylistedraw.get(i));
  573. List<String> cutdownSchTaskname = new ArrayList<String>();
  574. Pattern regex = Pattern.compile("[^\\s\"']+|\"([^\"]*)\"|'([^']*)'");
  575. Matcher regexMatcher = regex.matcher((CharSequence) SchTaskarralreadylistedraw.get(i));
  576. while (regexMatcher.find()) {
  577. if (regexMatcher.group(1) != null) {
  578. cutdownSchTaskname.add(regexMatcher.group(1));
  579. }
  580. }
  581. System.out.println("cutdownSchTaskname:" + cutdownSchTaskname.get(0));
  582. try {
  583. String makeascheduler2 = sysdrive + "Windows\\system32\\schtasks.exe /Change /TN " + cutdownSchTaskname.get(0) + " /SD " + ytsdate4 + " /ST " + ytstime4 + " /RP " + winpasswrd2;
  584. Runtime rt = Runtime.getRuntime();
  585. Process pr = rt.exec(makeascheduler2);
  586. System.out.println("makeascheduler2:" + makeascheduler2);
  587. BufferedReader input = new BufferedReader(new InputStreamReader(pr.getInputStream()));
  588. int exitVal = pr.waitFor();
  589. } catch(Exception e1) {
  590. systemoutvar = e1.toString();
  591. new Thread(systemout).start();
  592. e1.printStackTrace();
  593. }
  594. }
  595. }
  596. }
  597. } else if (value == JOptionPane.CANCEL_OPTION) {
  598. System.out.println("You hit \"cancel\"");
  599. return;
  600. }
  601. }
  602. });
  603. FocusListener listener = new FocusListener() {
  604. public void focusGained(FocusEvent event) {
  605. System.out.println("Gained focus");
  606. }
  607. public void focusLost(FocusEvent event) {
  608. System.out.println("lost focus");
  609. new Thread(setmimetype).start();
  610. }
  611. };
  612. public static Thread setmimetype = new Thread(new Runnable(){
  613. public void run(){
  614. filelocation2 = (String) YtuSchedulerGUI2.filelocation.getText();
  615. String[] filestringarr=filelocation2.split("\\\\"); // uses \\ as a delimiter and splits a string in to an array
  616. for(int i=0; i<filestringarr.length; i++) {
  617. filestringstr = filestringarr[i];
  618. }
  619. System.out.println("Setting mime type");
  620. String ext="";
  621. int mid= filelocation2.lastIndexOf(".");
  622. ext=filelocation2.substring(mid+1,filelocation2.length());
  623. videomimetype = "video/" + ext;
  624. System.out.println("File ext:" + ext);
  625. }
  626. });
  627. public static Thread settime = new Thread(new Runnable(){
  628. public void run(){
  629. DateFormat dateFormatdate = new SimpleDateFormat("MM/dd/yyyy");
  630. DateFormat dateFormattime = new SimpleDateFormat("HH:mm");
  631. Date date = new Date();
  632. System.out.println("date:" + date);
  633. String dateFormatdate2 = dateFormatdate.format(date);
  634. String dateFormattime2 = dateFormattime.format(date);
  635. ytsdate.setText(dateFormatdate2);
  636. ytstime.setText(dateFormattime2);
  637. }
  638. });
  639. public static Thread makevideoconfig = new Thread(new Runnable(){
  640. public void run(){
  641. username2 = (String) YtuSchedulerGUI2.username.getSelectedItem();
  642. passwrd2 = (String) YtuSchedulerGUI2.passwrd.getText();
  643. desiredtitle2 = YtuSchedulerGUI2.desiredtitle.getText();
  644. discription2 = YtuSchedulerGUI2.discription.getText();
  645. YTcatorgories3 = (String) YtuSchedulerGUI2.YTcatorgories2.getSelectedItem();
  646. privacyoption3 = (String) YtuSchedulerGUI2.privacyoption2.getSelectedItem();
  647. keywords2 = YtuSchedulerGUI2.keywords.getText();
  648. filelocationtest = (String) YtuSchedulerGUI2.filelocation.getText();
  649. if (privacyoption3 == "Private") {
  650. privacyoption4 = true;
  651. } else if (privacyoption3 == "Public") {
  652. privacyoption4 = false;
  653. }
  654. if (filestringstr == null) {
  655. if (filelocationtest.length() == 0) {
  656. systemoutvar = "Please choose a file";
  657. new Thread(systemout).start();
  658. JOptionPane.showMessageDialog(null, systemoutvar);
  659. return;
  660. } else {
  661. systemoutvar = "setting filestringstr to filelocationtest";
  662. new Thread(systemout).start();
  663. String[] filestringarr = filelocationtest.split("\\\\"); // uses \\ as a delimiter and splits a string in to an array
  664. for(int i=0; i<filestringarr.length; i++) {
  665. //System.out.println("array place " + i + ":" + args[i]);
  666. filestringstr = filestringarr[i];
  667. }
  668. }
  669. systemoutvar = filestringstr;
  670. new Thread(systemout).start();
  671. }
  672. if (username2 == null) {
  673. systemoutvar = "Please enter a username";
  674. new Thread(systemout).start();
  675. JOptionPane.showMessageDialog(null, systemoutvar);
  676. return;
  677. }
  678. if (passwrd2.length() == 0) {
  679. systemoutvar = "Please enter a password";
  680. new Thread(systemout).start();
  681. JOptionPane.showMessageDialog(null, systemoutvar);
  682. return;
  683. }
  684. if (discription2.length() < 1) {
  685. discription2 = filestringstr;
  686. }
  687. if (desiredtitle2.length() < 1) {
  688. desiredtitle2 = filestringstr;
  689. }
  690. if (keywords2.length() < 2) {
  691. keywords2 = filestringstr;
  692. }
  693. String videomimetype1 = videomimetype;
  694. String username21 = username2;
  695. String desiredtitle21 = desiredtitle2;
  696. String discription21 = discription2;
  697. String YTcatorgories31 = YTcatorgories3;
  698. filestringstr = filestringstr.replace( "\'",""); //TODO
  699. filestringstr = filestringstr.replace( "\"","");
  700. System.out.println("Saving entered information for later");
  701. File mainconfig = new File( appdata + "YTscheduler\\" + username2 + "_" + filestringstr + ".txt" );
  702. PrintWriter MCpwInput = null;
  703. try {
  704. MCpwInput = new PrintWriter(mainconfig);
  705. } catch (FileNotFoundException e) {
  706. systemoutvar = e.toString();
  707. JOptionPane.showMessageDialog(frame, systemoutvar);
  708. new Thread(systemout).start();
  709. e.printStackTrace();
  710. }
  711. MCpwInput.println(username21);
  712. MCpwInput.println(desiredtitle21);
  713. MCpwInput.println(filelocationtest);
  714. MCpwInput.println(YTcatorgories31);
  715. MCpwInput.println(privacyoption4);
  716. MCpwInput.println(videomimetype1);
  717. MCpwInput.print(keywords2);
  718. MCpwInput.close();
  719. File DESconfig = new File( appdata + "YTscheduler\\" + "description." + username2 + "_" + filestringstr + ".txt" );
  720. PrintWriter pwInputDES = null;
  721. try {
  722. pwInputDES = new PrintWriter(DESconfig);
  723. } catch (FileNotFoundException e) {
  724. systemoutvar = e.toString();
  725. JOptionPane.showMessageDialog(frame, systemoutvar);
  726. new Thread(systemout).start();
  727. e.printStackTrace();
  728. }
  729. pwInputDES.print(discription21);
  730. pwInputDES.close();
  731. System.out.println("The file has been created at:" + appdata + "YTscheduler\\" + username2 + "_" + filestringstr + ".txt");
  732. }
  733. });
  734. public static Thread saveloginstuff = new Thread(new Runnable(){
  735. public void run(){
  736. if (savelogininformation3 == "Yes") {
  737. username2 = (String) YtuSchedulerGUI2.username.getSelectedItem();
  738. passwrd2 = (String) YtuSchedulerGUI2.passwrd.getText();
  739. boolean username2found = false;
  740. for(int i=0; i<savedloginU.size(); i++) {
  741. if (username2 == savedloginU.get(i)) {
  742. username2found = true;
  743. }
  744. }
  745. System.out.println("username2:" + username2);
  746. if (username2found == true) {
  747. System.out.println("Username already stored:" + username2);
  748. for(int i=0; i<savedloginU.size(); i++) {
  749. if (username2 == savedloginU.get(i)) {
  750. String passwrdloginP = (String) savedloginP.get(i);
  751. if (passwrd2.equals(passwrdloginP)) {
  752. systemoutvar = "Username already stored with that password";
  753. new Thread(systemout).start();
  754. } else {
  755. username2found = false;
  756. username.removeItem(username2);
  757. System.out.println("Password not the same, removing old username/pass and saving new information");
  758. savedloginU.remove(i);
  759. savedloginP.remove(i);
  760. }
  761. }
  762. }
  763. }
  764. if (username2found == false) {
  765. File logininformationfile = new File( appdata + "YTscheduler/" + GDataDKey );
  766. savedloginU.add(username2);
  767. savedloginP.add(passwrd2);
  768. username.addItem(username2);
  769. username.setSelectedItem(username2);
  770. PrintWriter pwInput = null;
  771. try {
  772. pwInput = new PrintWriter(logininformationfile);
  773. } catch (FileNotFoundException e) {
  774. systemoutvar = e.toString();
  775. JOptionPane.showMessageDialog(frame, systemoutvar);
  776. new Thread(systemout).start();
  777. e.printStackTrace();
  778. }
  779. for(int i=0; i<savedloginU.size(); i++) {
  780. String myEncryptedText = textEncryptor.encrypt((String) savedloginU.get(i));
  781. String myEncryptedText2 = textEncryptor.encrypt((String) savedloginP.get(i));
  782. pwInput.println(myEncryptedText);
  783. pwInput.println(myEncryptedText2);
  784. }
  785. pwInput.close();
  786. systemoutvar = "Log-in information saved";
  787. new Thread(systemout).start();
  788. } else { //if username2found == false
  789. System.out.println("User information already saved");
  790. }
  791. savelogininformation3 ="No";
  792. }
  793. }
  794. });
  795. public static Thread loadusersandpass = new Thread(new Runnable(){
  796. public void run(){
  797. File Storeduserpass = new File( appdata + "YTscheduler/" + GDataDKey );
  798. if( Storeduserpass.exists() ) {
  799. Scanner opnScanner2 = null;
  800. try {
  801. opnScanner2 = new Scanner(Storeduserpass);
  802. } catch (FileNotFoundException e) {
  803. systemoutvar = e.toString();
  804. new Thread(systemout).start();
  805. e.printStackTrace();
  806. }
  807. String decryptedU = "";
  808. while( opnScanner2.hasNext() ) {
  809. decryptedU = textEncryptor.decrypt(opnScanner2.nextLine());
  810. savedloginP.add(textEncryptor.decrypt(opnScanner2.nextLine()));
  811. savedloginU.add(decryptedU);
  812. if (addusertolist == true) {
  813. username.addItem(decryptedU);
  814. }
  815. }
  816. }
  817. addusertolist = true;
  818. }
  819. });
  820. public static Thread makecopy = new Thread(new Runnable(){
  821. public void run(){
  822. File targetcopyfrom = new File(YtuSchedulerGUI2.class.getProtectionDomain().getCodeSource().getLocation().getPath());
  823. String targetcopyfromstring = targetcopyfrom.toString();
  824. String targetcopyfromreplace2 = targetcopyfromstring.replace( "%20"," ");
  825. String copytopath = appdata + "YTscheduler\\YtuScheduler.jar";
  826. System.out.println("File not there. Making a new one");
  827. Path p1 = Paths.get(copytopath);
  828. Path p2 = Paths.get(targetcopyfromreplace2);
  829. System.out.println("copytopath: " + copytopath);
  830. System.out.println("targetcopyfromreplace2: " + targetcopyfromreplace2);
  831. try {
  832. Files.copy(p2, p1, REPLACE_EXISTING);
  833. } catch (IOException e) {
  834. systemoutvar = e.toString();
  835. JOptionPane.showMessageDialog(frame, systemoutvar);
  836. new Thread(systemout).start();
  837. e.printStackTrace();
  838. return;
  839. }
  840. System.out.println("File copied");
  841. }
  842. });
  843. public static Thread uploadbar = new Thread(new Runnable(){
  844. public void run(){
  845. }
  846. });
  847. public static void main(final String[] args) throws IOException {
  848. EventQueue.invokeLater(new Runnable() {
  849. public void run() {
  850. new Thread(setsysdrive).start();
  851. textEncryptor.setPassword(textencryptorpass);
  852. if (args.length == 0) {
  853. new Thread(makecopy).start();
  854. new Thread(loadusersandpass).start();
  855. new Thread(settime).start();
  856. boolean success = (new File(appdata + "YTscheduler")).mkdirs();
  857. if (!success) {}
  858. try {
  859. YtuSchedulerGUI2 window = new YtuSchedulerGUI2();
  860. window.frame.setVisible(true);
  861. } catch (Exception e) {
  862. e.printStackTrace();
  863. }
  864. } else { //if (args.length > 0)
  865. String filefromargslist = "";
  866. for(int i=0; i<args.length; i++) {
  867. filefromargslist = filefromargslist + args[i] + " ";
  868. }
  869. addusertolist = false;
  870. new Thread(loadusersandpass).start();
  871. int counter1 = 0;
  872. System.out.print("Loading users");
  873. while (addusertolist == false) {
  874. //do nothing
  875. counter1 = counter1 + 1;
  876. System.out.print(".");
  877. try {
  878. Thread.currentThread();
  879. Thread.sleep(500);
  880. } catch (InterruptedException e) {
  881. e.printStackTrace();
  882. }
  883. }
  884. System.out.println("");
  885. File fleExample = new File( appdata + "YTscheduler/" + filefromargslist);
  886. File fleExampleDES = new File( appdata + "YTscheduler/" + "description." + filefromargslist);
  887. if( fleExample.exists() ) {
  888. String selecteduser = null;
  889. String username2 = "";
  890. String passwrd2 = "";
  891. String desiredtitle2 = null;
  892. String discription2 = "";
  893. String filestring = null;
  894. String YTcatorgories3 = null;
  895. String privacyoption3 = null;
  896. String keywords2 = null;
  897. String videomimetype = null;
  898. String[] arr = null;
  899. Scanner opnScanner2 = null;
  900. try {
  901. opnScanner2 = new Scanner(fleExample);
  902. } catch (FileNotFoundException e2) {
  903. systemoutvar = e2.toString();
  904. JOptionPane.showMessageDialog(frame, systemoutvar);
  905. new Thread(systemout).start();
  906. e2.printStackTrace();
  907. }
  908. while( opnScanner2.hasNext() ) {
  909. selecteduser = (String) opnScanner2.nextLine(); // discription2
  910. desiredtitle2 = opnScanner2.nextLine(); // desiredtitle2
  911. filestring = opnScanner2.nextLine(); // filestring
  912. YTcatorgories3 = opnScanner2.nextLine(); // YTcatorgories3
  913. privacyoption3 = (String) opnScanner2.nextLine(); // privacyoption3
  914. videomimetype = opnScanner2.nextLine(); // privacyoption3
  915. keywords2 = opnScanner2.nextLine(); // keywords2
  916. String matchList = "";
  917. Pattern regex = Pattern.compile("[^\\s\"']+|\"([^\"]*)\"|'([^']*)'");
  918. Matcher regexMatcher = regex.matcher(keywords2);
  919. while (regexMatcher.find()) {
  920. if (regexMatcher.group(1) != null) {
  921. // Add double-quoted string without the quotes
  922. matchList = matchList + regexMatcher.group(1) + ";";
  923. } else if (regexMatcher.group(2) != null) {
  924. // Add single-quoted string without the quotes
  925. matchList = matchList + regexMatcher.group(2) + ";";
  926. } else {
  927. // Add unquoted word
  928. matchList = matchList + regexMatcher.group() + ";";
  929. }
  930. }
  931. arr = matchList.split(";");
  932. }
  933. opnScanner2.close();
  934. String username21 = selecteduser;
  935. List<String> testarray = new ArrayList<String>();
  936. testarray.add(username21);
  937. for(int i=0; i<savedloginU.size(); i++) {
  938. if (savedloginU.get(i).equals(testarray.get(0))) {
  939. System.out.println("username " + savedloginU.get(i) + " found");
  940. passwrd2 = (String) savedloginP.get(i);
  941. username2 = (String) savedloginU.get(i);
  942. }
  943. }
  944. if (passwrd2 == "") {
  945. System.out.println("Password for stored username not found");
  946. return;
  947. }
  948. Scanner opnScannerDES = null;
  949. try {
  950. opnScannerDES = new Scanner(fleExampleDES);
  951. } catch (FileNotFoundException e1) {
  952. systemoutvar = e1.toString();
  953. new Thread(systemout).start();
  954. e1.printStackTrace();
  955. }
  956. while( opnScannerDES.hasNext() ) {
  957. discription2 = discription2 + opnScannerDES.nextLine() + "\n"; // discription2
  958. }
  959. opnScannerDES.close();
  960. boolean privacyoption4 = Boolean.parseBoolean(privacyoption3) ;
  961. YouTubeService myService = new YouTubeService(username2, GDataDKey);
  962. VideoEntry newEntry = new VideoEntry();
  963. YouTubeMediaGroup mg = newEntry.getOrCreateMediaGroup();
  964. mg.setTitle(new MediaTitle());
  965. mg.getTitle().setPlainTextContent("Temp title");
  966. mg.addCategory(new MediaCategory(YouTubeNamespace.CATEGORY_SCHEME, YTcatorgories3));
  967. mg.setDescription(new MediaDescription());
  968. mg.getDescription().setPlainTextContent("Temp description");
  969. mg.setPrivate(privacyoption4);
  970. threadjopsmd = "Your scheduled upload \"" + desiredtitle2 + "\" has started Please dont close the \"Taskeng.exe\" window";
  971. System.out.println("Your scheduled upload \"" + desiredtitle2 + "\" has started \n Please dont close the \"Taskeng.exe window\"");
  972. new Thread(cmdloadingtext).start();
  973. MediaFileSource ms = new MediaFileSource(new File(filestring), videomimetype);
  974. newEntry.setMediaSource(ms);
  975. String uploadUrl =
  976. "http://uploads.gdata.youtube.com/feeds/api/users/default/uploads";
  977. try {
  978. myService.setUserCredentials(username2,passwrd2);
  979. VideoEntry createdEntry = myService.insert(new URL(uploadUrl), newEntry); //Uploads
  980. myService.insert(new URL(uploadUrl), newEntry);
  981. createdEntry.getMediaGroup().getDescription().setPlainTextContent(discription2);
  982. createdEntry.update();
  983. createdEntry.getMediaGroup().getTitle().setPlainTextContent(desiredtitle2);
  984. createdEntry.update();
  985. for(int i=0;i<arr.length;i++) {
  986. if (arr[i].length() > 1) {
  987. if (arr[i].length() < 31) {
  988. System.out.println("Adding keyword:" + arr[i]);
  989. createdEntry.getMediaGroup().getKeywords().addKeyword((String) arr[i]); //TODO bad request on keywords
  990. }
  991. }
  992. createdEntry.update();
  993. }
  994. } catch (IOException | ServiceException e) {
  995. e.printStackTrace();
  996. systemoutvar = e.toString();
  997. JOptionPane.showMessageDialog(frame, systemoutvar);
  998. new Thread(systemout).start();
  999. return;
  1000. }
  1001. System.out.println("Video uploaded");
  1002. System.exit(0);
  1003. } else { // if( !fleExample.exists() )
  1004. System.out.println(fleExample + ": No file exists with that name");
  1005. return;
  1006. }
  1007. return;
  1008. }
  1009. }
  1010. });
  1011. }
  1012. public YtuSchedulerGUI2() {
  1013. initialize();
  1014. }
  1015. private void initialize() {
  1016. frame = new JFrame("YtuScheduler" + discription.getText());
  1017. frame.setBounds(100, 100, 669, 694);
  1018. frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  1019. frame.getContentPane().setLayout(null);
  1020. JLabel lblUsername = new JLabel("Username");
  1021. lblUsername.setBounds(377, 26, 59, 20);
  1022. frame.getContentPane().add(lblUsername);
  1023. JLabel lblPassword = new JLabel("Password");
  1024. lblPassword.setBounds(518, 26, 59, 20);
  1025. frame.getContentPane().add(lblPassword);
  1026. passwrd = new JPasswordField();
  1027. passwrd.setBounds(518, 44, 127, 20);
  1028. frame.getContentPane().add(passwrd);
  1029. desiredtitle.setBounds(10, 44, 359, 20);
  1030. frame.getContentPane().add(desiredtitle);
  1031. desiredtitle.setColumns(10);
  1032. JLabel lblTitle = new JLabel("Title");
  1033. lblTitle.setBounds(10, 29, 46, 14);
  1034. frame.getContentPane().add(lblTitle);
  1035. JLabel lblDescription = new JLabel("Description");
  1036. lblDescription.setBounds(10, 90, 98, 14);
  1037. frame.getContentPane().add(lblDescription);
  1038. discription.setLineWrap(true);
  1039. discription.setBounds(1, 125, 633, 77);
  1040. frame.getContentPane().add(discription);
  1041. JScrollPane discriptionJSP = new JScrollPane(discription);
  1042. //JScrollPane discriptionJSP = new JScrollPane();
  1043. discriptionJSP.setBounds(10, 106, 635, 203);
  1044. frame.getContentPane().add(discriptionJSP);
  1045. JLabel lblNewLabel = new JLabel("Catorgory");
  1046. lblNewLabel.setBounds(158, 70, 59, 14);
  1047. frame.getContentPane().add(lblNewLabel);
  1048. JLabel lblNewLabel_1 = new JLabel("Privacy");
  1049. lblNewLabel_1.setBounds(10, 70, 46, 14);
  1050. frame.getContentPane().add(lblNewLabel_1);
  1051. JLabel lblKeywords = new JLabel("Keywords");
  1052. lblKeywords.setBounds(10, 311, 68, 14);
  1053. frame.getContentPane().add(lblKeywords);
  1054. YTcatorgories2.setBounds(225, 67, 144, 20);
  1055. frame.getContentPane().add(YTcatorgories2);
  1056. privacyoption2.setBounds(53, 67, 97, 20);
  1057. frame.getContentPane().add(privacyoption2);
  1058. keywords = new JTextField();
  1059. keywords.setBounds(9, 327, 636, 20);
  1060. frame.getContentPane().add(keywords);
  1061. keywords.setColumns(10);
  1062. JButton btnUploadNow = new JButton();
  1063. btnUploadNow.setAction(action);
  1064. btnUploadNow.setBounds(10, 355, 309, 30);
  1065. frame.getContentPane().add(btnUploadNow);
  1066. JButton btnScheduleIt = new JButton();
  1067. btnScheduleIt.setAction(action_1);
  1068. btnScheduleIt.setBounds(540, 355, 105, 30);
  1069. frame.getContentPane().add(btnScheduleIt);
  1070. list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  1071. list.setBounds(10, 509, 629, 70);
  1072. frame.getContentPane().add(list);
  1073. JScrollPane scrollPane = new JScrollPane(list);
  1074. //JScrollPane scrollPane = new JScrollPane();
  1075. scrollPane.setBounds(10, 393, 529, 105);
  1076. frame.getContentPane().add(scrollPane);
  1077. filelocation = new JTextField("");
  1078. filelocation.setBounds(105, 5, 537, 20);
  1079. frame.getContentPane().add(filelocation);
  1080. filelocation.setColumns(10);
  1081. filelocation.addFocusListener(listener);
  1082. filelocation.setAction(action_7);
  1083. JButton btnNewButton = new JButton();
  1084. btnNewButton.setAction(action_2);
  1085. btnNewButton.setBounds(8, 5, 89, 20);
  1086. frame.getContentPane().add(btnNewButton);
  1087. JButton btnReschedule = new JButton("Reschedule");
  1088. btnReschedule.setAction(action_3);
  1089. btnReschedule.setBounds(540, 392, 105, 23);
  1090. frame.getContentPane().add(btnReschedule);
  1091. JButton btnRunNow = new JButton("Run now");
  1092. btnRunNow.setAction(action_4);
  1093. btnRunNow.setBounds(540, 447, 105, 23);
  1094. frame.getContentPane().add(btnRunNow);
  1095. JButton btnDelete = new JButton("Delete");
  1096. btnDelete.setAction(action_5);
  1097. btnDelete.setBounds(540, 474, 105, 23);
  1098. frame.getContentPane().add(btnDelete);
  1099. username = new JComboBox<String>();
  1100. username.setEditable(true);
  1101. username.setBounds(377, 44, 136, 20);
  1102. frame.getContentPane().add(username);
  1103. username.setAction(action_6);
  1104. statusbar.setFont(new Font("Tahoma", Font.PLAIN, 12));
  1105. statusbar.setBounds(10, 635, 633, 21);
  1106. frame.getContentPane().add(statusbar);
  1107. ytstime.setBounds(422, 366, 61, 20);
  1108. frame.getContentPane().add(ytstime);
  1109. ytstime.setColumns(10);
  1110. ytsdate.setBou

Large files files are truncated, but you can click here to view the full file