YouTubeDownload(TransferManager manager, YouTubeCrawledSearchResult sr) { this.manager = manager; this.sr = sr; this.downloadType = buildDownloadType(sr); this.size = sr.getSize(); String filename = sr.getFilename(); File savePath = SystemPaths.getTorrentData(); ensureDirectoryExits(savePath); ensureDirectoryExits(SystemPaths.getTemp()); completeFile = buildFile(savePath, filename); tempVideo = buildTempFile(FilenameUtils.getBaseName(filename), "m4v"); tempAudio = buildTempFile(FilenameUtils.getBaseName(filename), "m4a"); bytesReceived = 0; dateCreated = new Date(); httpClientListener = new HttpDownloadListenerImpl(); httpClient = HttpClientFactory.getInstance(HttpClientFactory.HttpContext.DOWNLOAD); httpClient.setListener(httpClientListener); if (TransferManager.isCurrentMountAlmostFull()) { this.status = STATUS_ERROR_DISK_FULL; } }
public SoundcloudDownload(SoundcloudSearchResult sr) { this.sr = sr; this.size = sr.getSize(); String filename = sr.getFilename(); completeFile = buildFile(SharingSettings.TORRENT_DATA_DIR_SETTING.getValue(), filename); tempAudio = buildTempFile(FilenameUtils.getBaseName(filename), "mp3"); bytesReceived = 0; dateCreated = new Date(); httpClientListener = new HttpDownloadListenerImpl(); httpClient = HttpClientFactory.getInstance(HttpClientFactory.HttpContext.DOWNLOAD); httpClient.setListener(httpClientListener); start(); }