Package org.torrcast.model

Examples of org.torrcast.model.Torrent


        @Override
        public void run() {
            String filename = item.getFilename();
            String completeFilePath = podcastCacheDir + File.separatorChar + filename;

            Torrent torrent = new Torrent();

            TorrentProcessor tp = new TorrentProcessor();
            tp.setAnnounceURL("http://10.0.0.139:6969/announce");
            tp.setPieceLength(256);
            tp.setName("test")// TODO: don't set?

            ArrayList<String> files = new ArrayList<String>();
            files.add(completeFilePath);

            try {
                tp.addFiles(files);
            } catch (Exception e) {
                System.err.println("Problem when adding files to torrent. Check your data");
                e.printStackTrace();
                return;
            }

            tp.setComment(item.getDescription());
            tp.setCreator("TorrentCaster");

            try {
                System.out.println("Hashing the files...");
                System.out.flush();
                tp.generatePieceHashes();
                System.out.println("Hash complete... Saving...");

                TorrentFile torrentFile = new TorrentFile(tp.generateTorrent(item.getFileUrl()));
               
                torrent.setCreatedDate(new Date());
                torrent.setFile(torrentFile);

                OutputStream fos = new FileOutputStream("/tmp/file-989.mp3.torrent");
                fos.write(torrentFile.getData());

//                 Save the new data (TorrentFile & Torrent).
View Full Code Here

TOP

Related Classes of org.torrcast.model.Torrent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.