| 280 | | public CapturePlayback(String subject, |
|---|
| 281 | | String promptID1, String prompt1, String promptID2, String prompt2, String promptID3, String prompt3, String promptID4, String prompt4, String promptID5, String prompt5, |
|---|
| 282 | | String promptID6, String prompt6, String promptID7, String prompt7, String promptID8, String prompt8, String promptID9, String prompt9, String promptID10, String prompt10, |
|---|
| 283 | | String fileFieldName,String language, URL destinationURL, |
|---|
| 284 | | URL endPageURL, URL helpPageURL, String cookie, int defaultCompressionMode) { |
|---|
| 285 | | |
|---|
| | 278 | public CapturePlayback(String language, URL destinationURL, |
|---|
| | 279 | URL endPageURL, URL helpPageURL, String cookie) { |
|---|
| | 280 | // ############ Localized Fields #################################### |
|---|
| | 281 | this.language = language; |
|---|
| | 282 | System.err.println("CapturePlayback Language:" + this.language + ":"); |
|---|
| | 283 | |
|---|
| | 284 | LabelLocalizer labels = new LabelLocalizer(this.language); |
|---|
| | 285 | usernamePanelLabel = labels.getUsernamePanelLabel(); |
|---|
| | 286 | usernamePanelText = labels.getUsernamePanelText(); |
|---|
| | 287 | |
|---|
| | 288 | copyrightName = labels.getCopyrightName(); |
|---|
| | 289 | gplAccepted = labels.getGplAccepted(); |
|---|
| | 290 | |
|---|
| | 291 | pleaseSelect = labels.getPleaseSelect(); |
|---|
| | 292 | notApplicable = labels.getNotApplicable(); |
|---|
| | 293 | |
|---|
| | 294 | genderPanelLabel = labels.getGenderPanelLabel(); |
|---|
| | 295 | genderSelection = labels.getGenderSelection(); |
|---|
| | 296 | gender = notApplicable; // default selection |
|---|
| | 297 | |
|---|
| | 298 | ageRangePanelLabel = labels.getAgeRangePanelLabel(); |
|---|
| | 299 | ageSelection = labels.getAgeSelection(); |
|---|
| | 300 | ageRange = notApplicable; // default selection |
|---|
| | 301 | |
|---|
| | 302 | dialectPanelLabel = labels.getDialectPanelLabel(); |
|---|
| | 303 | dialectSelection = labels.getDialectSelection(); |
|---|
| | 304 | dialect = notApplicable; // default selection |
|---|
| | 305 | |
|---|
| | 306 | microphonePanelLabel = labels.getMicrophonePanelLabel(); |
|---|
| | 307 | microphoneSelection = labels.getMicrophoneSelection(); |
|---|
| | 308 | microphone = notApplicable; // default selection |
|---|
| | 309 | |
|---|
| | 310 | uploadText = labels.getUploadText(); |
|---|
| | 311 | uploadButtonLabel = labels.getUploadButtonLabel(); |
|---|
| | 312 | |
|---|
| | 313 | moreInfoText = labels.getMoreInfoText(); |
|---|
| | 314 | moreInfoButtonLabel = labels.getMoreInfoButtonLabel(); |
|---|
| | 315 | |
|---|
| | 316 | disclaimerText = labels.getDisclaimerText() ; |
|---|
| | 317 | aboutButtonLabel = labels.getAboutButtonLabel(); |
|---|
| | 318 | |
|---|
| | 319 | recordButton = labels.getRecordButton(); |
|---|
| | 320 | stopButton = labels.getStopButton(); |
|---|
| | 321 | playButton = labels.getPlayButton(); |
|---|
| | 322 | |
|---|
| | 323 | peakWarningLabel = labels.getPeakWarningLabel(); |
|---|
| | 324 | sampleGraphFileLabel = labels.getSampleGraphFileLabel(); |
|---|
| | 325 | sampleGraphLengthLabel = labels.getSampleGraphLengthLabel(); |
|---|
| | 326 | sampleGraphPositionLabel = labels.getSampleGraphPositionLabel(); |
|---|
| | 327 | // ############ Localized Fields #################################### |
|---|
| 1748 | | |
|---|
| 1749 | | |
|---|
| 1750 | | //if(subject != null) { |
|---|
| 1751 | | // System.err.println("Adding subject to URL"); |
|---|
| 1752 | | try { |
|---|
| 1753 | | destinationURL = new URL(destinationURL.toString()); |
|---|
| 1754 | | }catch(Exception err){ |
|---|
| 1755 | | System.err.println(err); |
|---|
| 1756 | | } |
|---|
| 1757 | | System.err.println("Destination URL is " + destinationURL); |
|---|
| 1758 | | //} |
|---|
| 1759 | | |
|---|
| 1760 | | File[] files = new File[15]; |
|---|
| 1761 | | //############ audio files #################################### |
|---|
| 1762 | | files[1] = uploadWavFile1; |
|---|
| 1763 | | files[2] = uploadWavFile2; |
|---|
| 1764 | | files[3] = uploadWavFile3; |
|---|
| 1765 | | files[4] = uploadWavFile4; |
|---|
| 1766 | | files[5] = uploadWavFile5; |
|---|
| 1767 | | files[6] = uploadWavFile6; |
|---|
| 1768 | | files[7] = uploadWavFile7; |
|---|
| 1769 | | files[8] = uploadWavFile8; |
|---|
| 1770 | | files[9] = uploadWavFile9; |
|---|
| 1771 | | files[10] = uploadWavFile10; |
|---|
| 1772 | | |
|---|
| 1773 | | //############ prompt files #################################### |
|---|
| 1774 | | try { |
|---|
| 1775 | | BufferedWriter out_prompts = new BufferedWriter(new FileWriter(promptsFile)); |
|---|
| 1776 | | out_prompts.write(promptID1 + " " + prompt1 + System.getProperty("line.separator")); |
|---|
| 1777 | | out_prompts.write(promptID2 + " " + prompt2 + System.getProperty("line.separator")); |
|---|
| 1778 | | out_prompts.write(promptID3 + " " + prompt3 + System.getProperty("line.separator")); |
|---|
| 1779 | | out_prompts.write(promptID4 + " " + prompt4 + System.getProperty("line.separator")); |
|---|
| 1780 | | out_prompts.write(promptID5 + " " + prompt5 + System.getProperty("line.separator")); |
|---|
| 1781 | | out_prompts.write(promptID6 + " " + prompt6 + System.getProperty("line.separator")); |
|---|
| 1782 | | out_prompts.write(promptID7 + " " + prompt7 + System.getProperty("line.separator")); |
|---|
| 1783 | | out_prompts.write(promptID8 + " " + prompt8 + System.getProperty("line.separator")); |
|---|
| 1784 | | out_prompts.write(promptID9 + " " + prompt9 + System.getProperty("line.separator")); |
|---|
| 1785 | | out_prompts.write(promptID10 + " " + prompt10 + System.getProperty("line.separator")); |
|---|
| 1786 | | out_prompts.close(); |
|---|
| 1787 | | } catch (IOException e) { |
|---|
| 1788 | | System.err.println("Problems with prompts"); |
|---|
| 1789 | | } |
|---|
| 1790 | | files[11] = promptsFile; |
|---|
| 1791 | | //############ ReadMe file#################################### |
|---|
| 1792 | | try { |
|---|
| 1793 | | BufferedWriter out_readme = new BufferedWriter(new FileWriter(readmeFile)); |
|---|
| 1794 | | out_readme.write("User Name:" + userName + System.getProperty("line.separator")); |
|---|
| 1795 | | out_readme.write(System.getProperty("line.separator")); |
|---|
| 1796 | | |
|---|
| 1797 | | out_readme.write("Speaker Characteristics:" + System.getProperty("line.separator") ); |
|---|
| 1798 | | out_readme.write(System.getProperty("line.separator")); |
|---|
| 1799 | | out_readme.write("Gender: " + gender + System.getProperty("line.separator") ); |
|---|
| 1800 | | out_readme.write("Age Range: " + ageRange + System.getProperty("line.separator")); |
|---|
| 1801 | | out_readme.write("Pronunciation dialect: " + dialect + System.getProperty("line.separator")); |
|---|
| 1802 | | out_readme.write(System.getProperty("line.separator")); |
|---|
| 1803 | | |
|---|
| 1804 | | out_readme.write("Recording Information:" + System.getProperty("line.separator")); |
|---|
| 1805 | | out_readme.write(System.getProperty("line.separator")); |
|---|
| 1806 | | out_readme.write("Microphone make: n/a" + System.getProperty("line.separator")); |
|---|
| 1807 | | out_readme.write("Microphone type:" + microphone + System.getProperty("line.separator")); |
|---|
| 1808 | | out_readme.write("Audio card make: unknown" + System.getProperty("line.separator")); |
|---|
| 1809 | | out_readme.write("Audio card type: unknown" + System.getProperty("line.separator")); |
|---|
| 1810 | | out_readme.write("Audio Recording Software: VoxForge Speech Submission Application" + System.getProperty("line.separator")); |
|---|
| 1811 | | out_readme.write("O/S:" + System.getProperty("line.separator")); |
|---|
| 1812 | | out_readme.write(System.getProperty("line.separator")); |
|---|
| 1813 | | |
|---|
| 1814 | | out_readme.write("File Info:" + System.getProperty("line.separator")); |
|---|
| 1815 | | out_readme.write(System.getProperty("line.separator")); |
|---|
| 1816 | | out_readme.write("File type: " + fileType + System.getProperty("line.separator")); |
|---|
| 1817 | | out_readme.write("Sampling Rate: " + samplingRate + System.getProperty("line.separator")); |
|---|
| 1818 | | out_readme.write("Sample rate format: " + samplingRateFormat + System.getProperty("line.separator")); |
|---|
| 1819 | | out_readme.write("Number of channels: " + numberChannels + System.getProperty("line.separator")); |
|---|
| 1820 | | |
|---|
| 1821 | | out_readme.close(); |
|---|
| 1822 | | } catch (IOException e) { |
|---|
| 1823 | | System.err.println("Problems with Gender, Age Range or Dialect"); |
|---|
| 1824 | | } |
|---|
| 1825 | | files[12] = readmeFile; |
|---|
| 1826 | | //############ License Notice File #################################### |
|---|
| 1827 | | try { |
|---|
| 1828 | | Calendar cal = Calendar.getInstance(); |
|---|
| 1829 | | int year = cal.get(Calendar.YEAR); |
|---|
| 1830 | | BufferedWriter out_licenseNoticeFile = new BufferedWriter(new FileWriter(licenseNoticeFile)); |
|---|
| 1831 | | String licenseNotice = "Copyright " + cal.get(Calendar.YEAR) + " " + copyrightName + System.getProperty("line.separator") |
|---|
| 1832 | | + System.getProperty("line.separator") |
|---|
| 1833 | | + licenseObject.getBlanklicenseNotice(); |
|---|
| 1834 | | out_licenseNoticeFile.write(licenseNotice); |
|---|
| 1835 | | out_licenseNoticeFile.close(); |
|---|
| 1836 | | } catch (IOException e) { |
|---|
| 1837 | | System.err.println("Problems with licenseNoticeFile file"); |
|---|
| 1838 | | } |
|---|
| 1839 | | files[13] = licenseNoticeFile; |
|---|
| 1840 | | |
|---|
| 1841 | | //############ license file #################################### |
|---|
| 1842 | | try { |
|---|
| 1843 | | BufferedWriter out_licenseFile = new BufferedWriter(new FileWriter(licenseFile)); |
|---|
| 1844 | | out_licenseFile.write(licenseObject.getGPLLicense()); |
|---|
| 1845 | | out_licenseFile.close(); |
|---|
| 1846 | | } catch (IOException e) { |
|---|
| 1847 | | System.err.println("Problems with license file"); |
|---|
| 1848 | | } |
|---|
| 1849 | | files[14] = licenseFile; |
|---|
| 1850 | | //############ create archive file #################################### |
|---|
| 1851 | | File archiveFile; |
|---|
| 1852 | | Calendar cal = Calendar.getInstance(); |
|---|
| 1853 | | int day = cal.get(Calendar.DATE); |
|---|
| 1854 | | int month = cal.get(Calendar.MONTH) + 1; |
|---|
| 1855 | | int year = cal.get(Calendar.YEAR); |
|---|
| 1856 | | StringBuffer sb = new StringBuffer(11); |
|---|
| 1857 | | sb.append(year); |
|---|
| 1858 | | if( month < 10 ) sb.append("0"); |
|---|
| 1859 | | sb.append(month); |
|---|
| 1860 | | if( day < 10 ) sb.append("0"); |
|---|
| 1861 | | sb.append(day); |
|---|
| 1862 | | String date = sb.toString(); |
|---|
| 1863 | | |
|---|
| 1864 | | Random randomGenerator = new Random(); |
|---|
| 1865 | | int SMALL_LETTERS_BASE_VALUE = 97; |
|---|
| 1866 | | // int CAPITAL_LETTERS_BASE_VALUE = 65; |
|---|
| 1867 | | StringBuffer randomID = new StringBuffer(""); // required for jvm 1.4.2 |
|---|
| 1868 | | //StringBuilder randomID = new StringBuilder(""); // will not work with JVM 1.4.2 |
|---|
| 1869 | | for ( int i = 0; randomID.length() < 3; i++ ) |
|---|
| 1870 | | { |
|---|
| 1871 | | int currentValue = randomGenerator.nextInt(26); |
|---|
| 1872 | | currentValue += SMALL_LETTERS_BASE_VALUE;//convert to ASCII value for a-z |
|---|
| 1873 | | randomID.append((char)currentValue); |
|---|
| 1874 | | } |
|---|
| 1875 | | |
|---|
| 1876 | | if (userName != null){ |
|---|
| 1877 | | archiveFile = new File(tempdir + userName + "-" + date + "-" + randomID + ".zip"); |
|---|
| 1878 | | } else { |
|---|
| 1879 | | archiveFile = new File(tempdir +"Anonymous-" + date + "-" + randomID + ".zip"); |
|---|
| 1880 | | } |
|---|
| 1881 | | |
|---|
| 1882 | | createZipArchive(archiveFile, files); |
|---|
| 1883 | | System.err.println("Archive file location:" + archiveFile); |
|---|
| 1884 | | // debug System.err.println("username:" + userName + ":"); |
|---|
| 1885 | | //!!!!!! |
|---|
| 1886 | | totalBytes = ((int)archiveFile.length()) ; |
|---|
| 1887 | | progBar.setMaximum((int)archiveFile.length()); |
|---|
| 1888 | | // !!!!!! |
|---|
| 1889 | | //############ Upload #################################### |
|---|
| 1890 | | |
|---|
| 1891 | | // Upload manager needs an array but JavaUpload.php script can only handle one file at a time |
|---|
| 1892 | | File[] archiveFiles = new File[1]; |
|---|
| 1893 | | |
|---|
| 1894 | | archiveFiles[0] = archiveFile; |
|---|
| 1895 | | UploadManager u; |
|---|
| 1896 | | try { |
|---|
| 1897 | | // u = new UploadManager(files, capturePlayback, destinationURL, 1, fileFieldName); |
|---|
| 1898 | | u = new UploadManager(archiveFiles, capturePlayback, destinationURL, 1, fileFieldName); |
|---|
| 1899 | | |
|---|
| 1900 | | } catch(java.lang.NullPointerException npered){ |
|---|
| 1901 | | // u = new UploadManager(files, capturePlayback, destinationURL, fileFieldName); |
|---|
| 1902 | | u = new UploadManager(archiveFiles, capturePlayback, destinationURL, fileFieldName); |
|---|
| 1903 | | } |
|---|
| 1904 | | System.err.println("Uploading to " + destinationURL); |
|---|
| 1905 | | // !!!!!! |
|---|
| 1906 | | u.start(); |
|---|
| 1907 | | |
|---|
| 1908 | | } catch(IOException e) { |
|---|
| 1909 | | shutDown("Unable to encode the stream\n" + e); |
|---|
| 1910 | | } |
|---|
| | 1742 | try { |
|---|
| | 1743 | destinationURL = new URL(destinationURL.toString()); |
|---|
| | 1744 | }catch(Exception err){ |
|---|
| | 1745 | System.err.println(err); |
|---|
| | 1746 | } |
|---|
| | 1747 | System.err.println("Destination URL is " + destinationURL); |
|---|
| | 1748 | |
|---|
| | 1749 | File[] files = new File[15]; |
|---|
| | 1750 | //############ audio files #################################### |
|---|
| | 1751 | files[1] = uploadWavFile1; |
|---|
| | 1752 | files[2] = uploadWavFile2; |
|---|
| | 1753 | files[3] = uploadWavFile3; |
|---|
| | 1754 | files[4] = uploadWavFile4; |
|---|
| | 1755 | files[5] = uploadWavFile5; |
|---|
| | 1756 | files[6] = uploadWavFile6; |
|---|
| | 1757 | files[7] = uploadWavFile7; |
|---|
| | 1758 | files[8] = uploadWavFile8; |
|---|
| | 1759 | files[9] = uploadWavFile9; |
|---|
| | 1760 | files[10] = uploadWavFile10; |
|---|
| | 1761 | //############ prompt files #################################### |
|---|
| | 1762 | try { |
|---|
| | 1763 | BufferedWriter out_prompts = new BufferedWriter(new FileWriter(promptsFile)); |
|---|
| | 1764 | out_prompts.write(promptID1 + " " + prompt1 + System.getProperty("line.separator")); |
|---|
| | 1765 | out_prompts.write(promptID2 + " " + prompt2 + System.getProperty("line.separator")); |
|---|
| | 1766 | out_prompts.write(promptID3 + " " + prompt3 + System.getProperty("line.separator")); |
|---|
| | 1767 | out_prompts.write(promptID4 + " " + prompt4 + System.getProperty("line.separator")); |
|---|
| | 1768 | out_prompts.write(promptID5 + " " + prompt5 + System.getProperty("line.separator")); |
|---|
| | 1769 | out_prompts.write(promptID6 + " " + prompt6 + System.getProperty("line.separator")); |
|---|
| | 1770 | out_prompts.write(promptID7 + " " + prompt7 + System.getProperty("line.separator")); |
|---|
| | 1771 | out_prompts.write(promptID8 + " " + prompt8 + System.getProperty("line.separator")); |
|---|
| | 1772 | out_prompts.write(promptID9 + " " + prompt9 + System.getProperty("line.separator")); |
|---|
| | 1773 | out_prompts.write(promptID10 + " " + prompt10 + System.getProperty("line.separator")); |
|---|
| | 1774 | out_prompts.close(); |
|---|
| | 1775 | } catch (IOException e) { |
|---|
| | 1776 | System.err.println("Problems with prompts"); |
|---|
| | 1777 | } |
|---|
| | 1778 | files[11] = promptsFile; |
|---|
| | 1779 | //############ ReadMe file#################################### |
|---|
| | 1780 | try { |
|---|
| | 1781 | BufferedWriter out_readme = new BufferedWriter(new FileWriter(readmeFile)); |
|---|
| | 1782 | out_readme.write("User Name:" + userName + System.getProperty("line.separator")); |
|---|
| | 1783 | out_readme.write(System.getProperty("line.separator")); |
|---|
| | 1784 | |
|---|
| | 1785 | out_readme.write("Speaker Characteristics:" + System.getProperty("line.separator") ); |
|---|
| | 1786 | out_readme.write(System.getProperty("line.separator")); |
|---|
| | 1787 | out_readme.write("Gender: " + gender + System.getProperty("line.separator") ); |
|---|
| | 1788 | out_readme.write("Age Range: " + ageRange + System.getProperty("line.separator")); |
|---|
| | 1789 | out_readme.write("Pronunciation dialect: " + dialect + System.getProperty("line.separator")); |
|---|
| | 1790 | out_readme.write(System.getProperty("line.separator")); |
|---|
| | 1791 | |
|---|
| | 1792 | out_readme.write("Recording Information:" + System.getProperty("line.separator")); |
|---|
| | 1793 | out_readme.write(System.getProperty("line.separator")); |
|---|
| | 1794 | out_readme.write("Microphone make: n/a" + System.getProperty("line.separator")); |
|---|
| | 1795 | out_readme.write("Microphone type:" + microphone + System.getProperty("line.separator")); |
|---|
| | 1796 | out_readme.write("Audio card make: unknown" + System.getProperty("line.separator")); |
|---|
| | 1797 | out_readme.write("Audio card type: unknown" + System.getProperty("line.separator")); |
|---|
| | 1798 | out_readme.write("Audio Recording Software: VoxForge Speech Submission Application" + System.getProperty("line.separator")); |
|---|
| | 1799 | out_readme.write("O/S:" + System.getProperty("line.separator")); |
|---|
| | 1800 | out_readme.write(System.getProperty("line.separator")); |
|---|
| | 1801 | |
|---|
| | 1802 | out_readme.write("File Info:" + System.getProperty("line.separator")); |
|---|
| | 1803 | out_readme.write(System.getProperty("line.separator")); |
|---|
| | 1804 | out_readme.write("File type: " + fileType + System.getProperty("line.separator")); |
|---|
| | 1805 | out_readme.write("Sampling Rate: " + samplingRate + System.getProperty("line.separator")); |
|---|
| | 1806 | out_readme.write("Sample rate format: " + samplingRateFormat + System.getProperty("line.separator")); |
|---|
| | 1807 | out_readme.write("Number of channels: " + numberChannels + System.getProperty("line.separator")); |
|---|
| | 1808 | |
|---|
| | 1809 | out_readme.close(); |
|---|
| | 1810 | } catch (IOException e) { |
|---|
| | 1811 | System.err.println("Problems with Gender, Age Range or Dialect"); |
|---|
| | 1812 | } |
|---|
| | 1813 | files[12] = readmeFile; |
|---|
| | 1814 | //############ License Notice File #################################### |
|---|
| | 1815 | try { |
|---|
| | 1816 | Calendar cal = Calendar.getInstance(); |
|---|
| | 1817 | int year = cal.get(Calendar.YEAR); |
|---|
| | 1818 | BufferedWriter out_licenseNoticeFile = new BufferedWriter(new FileWriter(licenseNoticeFile)); |
|---|
| | 1819 | String licenseNotice = "Copyright " + cal.get(Calendar.YEAR) + " " + copyrightName + System.getProperty("line.separator") |
|---|
| | 1820 | + System.getProperty("line.separator") |
|---|
| | 1821 | + licenseObject.getBlanklicenseNotice(); |
|---|
| | 1822 | out_licenseNoticeFile.write(licenseNotice); |
|---|
| | 1823 | out_licenseNoticeFile.close(); |
|---|
| | 1824 | } catch (IOException e) { |
|---|
| | 1825 | System.err.println("Problems with licenseNoticeFile file"); |
|---|
| | 1826 | } |
|---|
| | 1827 | files[13] = licenseNoticeFile; |
|---|
| | 1828 | //############ license file #################################### |
|---|
| | 1829 | try { |
|---|
| | 1830 | BufferedWriter out_licenseFile = new BufferedWriter(new FileWriter(licenseFile)); |
|---|
| | 1831 | out_licenseFile.write(licenseObject.getGPLLicense()); |
|---|
| | 1832 | out_licenseFile.close(); |
|---|
| | 1833 | } catch (IOException e) { |
|---|
| | 1834 | System.err.println("Problems with license file"); |
|---|
| | 1835 | } |
|---|
| | 1836 | files[14] = licenseFile; |
|---|
| | 1837 | //############ create archive file #################################### |
|---|
| | 1838 | File archiveFile; |
|---|
| | 1839 | Calendar cal = Calendar.getInstance(); |
|---|
| | 1840 | int day = cal.get(Calendar.DATE); |
|---|
| | 1841 | int month = cal.get(Calendar.MONTH) + 1; |
|---|
| | 1842 | int year = cal.get(Calendar.YEAR); |
|---|
| | 1843 | StringBuffer sb = new StringBuffer(11); |
|---|
| | 1844 | sb.append(year); |
|---|
| | 1845 | if( month < 10 ) sb.append("0"); |
|---|
| | 1846 | sb.append(month); |
|---|
| | 1847 | if( day < 10 ) sb.append("0"); |
|---|
| | 1848 | sb.append(day); |
|---|
| | 1849 | String date = sb.toString(); |
|---|
| | 1850 | |
|---|
| | 1851 | Random randomGenerator = new Random(); |
|---|
| | 1852 | int SMALL_LETTERS_BASE_VALUE = 97; |
|---|
| | 1853 | // int CAPITAL_LETTERS_BASE_VALUE = 65; |
|---|
| | 1854 | StringBuffer randomID = new StringBuffer(""); // required for jvm 1.4.2 |
|---|
| | 1855 | //StringBuilder randomID = new StringBuilder(""); // will not work with JVM 1.4.2 |
|---|
| | 1856 | for ( int i = 0; randomID.length() < 3; i++ ) |
|---|
| | 1857 | { |
|---|
| | 1858 | int currentValue = randomGenerator.nextInt(26); |
|---|
| | 1859 | currentValue += SMALL_LETTERS_BASE_VALUE;//convert to ASCII value for a-z |
|---|
| | 1860 | randomID.append((char)currentValue); |
|---|
| | 1861 | } |
|---|
| | 1862 | |
|---|
| | 1863 | if (userName != null){ |
|---|
| | 1864 | archiveFile = new File(tempdir + userName + "-" + date + "-" + randomID + ".zip"); |
|---|
| | 1865 | } else { |
|---|
| | 1866 | archiveFile = new File(tempdir +"Anonymous-" + date + "-" + randomID + ".zip"); |
|---|
| | 1867 | } |
|---|
| | 1868 | |
|---|
| | 1869 | createZipArchive(archiveFile, files); |
|---|
| | 1870 | System.err.println("Archive file location:" + archiveFile); |
|---|
| | 1871 | totalBytes = ((int)archiveFile.length()) ; |
|---|
| | 1872 | progBar.setMaximum((int)archiveFile.length()); |
|---|
| | 1873 | //############ Upload #################################### |
|---|
| | 1874 | // Upload manager needs an array but JavaUpload.php script can only handle one file at a time |
|---|
| | 1875 | File[] archiveFiles = new File[1]; |
|---|
| | 1876 | archiveFiles[0] = archiveFile; |
|---|
| | 1877 | UploadManager u; |
|---|
| | 1878 | try { |
|---|
| | 1879 | u = new UploadManager(archiveFiles, capturePlayback, destinationURL, 1, fileFieldName); |
|---|
| | 1880 | } catch(java.lang.NullPointerException npered){ |
|---|
| | 1881 | u = new UploadManager(archiveFiles, capturePlayback, destinationURL, fileFieldName); |
|---|
| | 1882 | } |
|---|
| | 1883 | System.err.println("Uploading to " + destinationURL); |
|---|
| | 1884 | u.start(); |
|---|