I'm no longer maintaining this project due to time constraints.
An Android torrent client library powered by frostwire-jlibtorrent. It supports sequential and simultaneous downloads.
A single torrent download session is represented as the TorrentSession
class. An instance of this class can be used to start, stop, pause, and resume a torrent download. When creating a new session, a TorrentSessionOptions
instance is a required constructor parameter used to configure the session. The TorrentSessionListener
interface can be implemented and set on the session to receive TorrentSessionStatus
updates tied to the lifecycle of the torrent. The TorrentSessionBufferState
is one of the properties of the status and represents the current state of the torrent piece buffer.
For example, the following code snippet sequentially downloads the largest file of the provided torrent to the downloads directory:
// http, https, magnet, file, and content Uri types are all supported.
val torrentUri = Uri.parse("http://www.frostclick.com/torrents/video/animation/Big_Buck_Bunny_1080p_surround_frostclick.com_frostwire.com.torrent")
val torrentSessionOptions = TorrentSessionOptions(
downloadLocation = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS)
, onlyDownloadLargestFile = true
, enableLogging = false
, shouldStream = true
)
val torrentSession = TorrentSession(torrentSessionOptions)
torrentSession.listener = object : TorrentSessionListener {
// Omitted for brevity
override fun onPieceFinished(
torrentHandle: TorrentHandle
, torrentSessionStatus: TorrentSessionStatus
) { ... }
}
torrentSession.start(context, torrentUri) // Invoke on background thread.
// OR torrentSession.start(bencodeByteArray)
For a more detailed example, please see the demo application alongside this library (screenshot below). Please note, that the demo application does not properly show how to keep sessions alive after the activity is killed. This was a quick and dirty way of showing/testing downloads. A more real-world solution, would be to have the torrent sessions exist within a service that enters the foreground while downloading. By doing this, the sessions will retain network connectivity and will not be murdered by Android the destroyer.
Add this in your root build.gradle at the end of repositories:
allprojects {
repositories {
maven { url "https://jitpack.io" }
}
}
and add the following in the dependent module:
dependencies {
implementation 'com.github.masterwok:simple-torrent-android:0.5.0'
}
下面为下载的工具类: public class DownloadUtil { public static final int DOWNLOAD_FAIL=0; public static final int DOWNLOAD_PROGRESS=1; public static final int DOWNLOAD_SUCCESS=2; private static
权限 <!-- 文件读写权限 --> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <!-- 访问内存 --> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
BitTorrent下载时,用户必须下载一个.torrent文件,它就是所谓"Metainfo file",里面存储有关于下载内容的announce地址,长度,大小,SHA1杂凑项等内容。它由Bencode编码组成.而且字符串是用UTF-8编码的。不过在中国,常常使用GBK编码。它由如下几项组成: Info:描述下载内容的信息,是一个字典.有两种可能,一种是"单文件"模式:当BitTorren
public class DownloadUtil { private static DownloadUtil downloadUtil; private final OkHttpClient okHttpClient; private boolean isCancel = false; public static DownloadUtil get() {
Sending and receiving data between applications with intents is most commonly used for social sharing of content. Intents allow users to share information quickly and easily, using their favorite appl
EasyFileDownloader 一个用于android中的轻量级文件下载器,特别适合应用内升级下载APK。 A lightweight for use in the android file downloader Download the APK is especially suitable for application in upgrade https://github.com/liju
Android FTPUtils工具 在Android客户端上传文件到FTP服务器,或从FTP服务器上下载文件,亲测能成功上传下载,代码很简单。 需要添加的依赖包: Android Studio build-gridle下添加依赖包 compile 'commons-net:commons-net:3.5' FTPUtils源码 import org.apache.commons.net.
Transmission BT下载 转载于:https://blog.51cto.com/jinliang/2107178
https://jaist.dl.sourceforge.net/project/torrent-file-editor/ v0.3.11 下载: https://jaist.dl.sourceforge.net/project/torrent-file-editor/v0.3.11/torrent-file-editor-0.3.11-x64.exe https://jaist.dl.sourc
ALL Torrent Sites! Sites Not Requiring Registration http://www.black-tracker.gr/- Greek http://www.bushtorrent.com/ http://www.chomskytorrents.org - 1400+ files http://www.cw.enlightning.de:6969/ htt
0. add android.injected.testOnly=false to gradle.properties 1.permission 蓝牙的权限主要涉及到下面三个: BLUETOOTH:允许配对的设备进行连接 BLUETOOTH_ADMIN:允许搜索和配对设备 ACCESS_COARSE_LOCATION:广播接收器 AndroidManifest.xml: <?xml ver
https://github.com/webtorrent/create-torrent https://github.com/webtorrent/parse-torrent 1.简介 create-torrent可以用于创建torrent文件 parse-torrent可以用于解析torrent文件 2.使用 2.1 创建torrent const createTorren
go-torrent 是 Torrent 的 Go 语言开发包,提供开发库和命令行工具。 使用: $ go get github.com/anacrolix/torrent/cmd/torrent$ torrent 'magnet:?xt=urn:btih:ZOCMZQIPFFW7OLLMIC5HUB6BPCSDEOQU'2015/03/20 22:51:41 main.go:96: downlo
This notebook is NOT completely useless After releasing notebook, I just realized this notebook is completely useless because you know we can select which files to download so I don't have to download
问题内容: 我想用Java生成一个.torrent文件,但是我不想要一个大的API,它可以执行诸如抓取跟踪器,种子等操作。这仅适用于生成元数据的客户端。存在哪些轻量级解决方案?我只生成一个.zip文件的.torrent。 谢谢! 问题答案: 我整理了这段独立的Java代码,以准备一个带有单个文件的.torrent文件。 通过调用.torrent文件的名称,共享文件的名称和跟踪器URL 来创建.to
我将目标文件(target.mp4)推送到vps,登陆vps后, 在vps上制作好了种子文件,将这个种子文件target.mp4.torrent发送给朋友后,为何他无法下载? 我自己也测试了,无法下载!我的vps上需要开放哪些端口,让别人可以来下载? tracker服务器,我写了100多个!绝对不是这个原因!命令行简化了。
To install Tengine, just follow these three steps: $ ./configure $ make # make install By default, it will be installed to /usr/local/nginx. You can use the '--prefix' option to specify the root dire
插入 // 单条插入 User user=new User(); // 省略entity属性赋值... ... elasticsearchTemplate.save(user); // 批量插入 LinkedList<User> users= new LinkedList<User>(); // 省略entity属性赋值... ... elasticsearchTemplate.save(user