Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow for null directory to be passed to SharedTorrent.fromFile() constr... #103

Open
wants to merge 41 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
82fb651
Fix read when message size wasn't read in one step
pankdm Apr 10, 2013
728edf8
Throw AnnounceException when current tracker client isn't available.
sroze Jul 18, 2013
9370d86
Fix order of uploaded/downloaded parameters in HTTPAnnounceRequestMes…
mpetazzoni Jul 22, 2013
1ad97ef
Merge pull request #45 from sroze/trackerless-patch
mpetazzoni Jul 22, 2013
2e643f4
add the ability to set upload/download rate-limits (in kB/sec.) on sh…
ptgoetz Jul 19, 2013
b15ea5e
add javadoc documentation for upload/download rate-limit functionality
ptgoetz Jul 22, 2013
73b78f2
reduce rate limit code duplication by refactoring code present in bot…
ptgoetz Jul 22, 2013
3ef9e9b
add example of upload/download rate limiting to the client usage sample.
ptgoetz Jul 22, 2013
13db7ab
add comments documenting the drawbacks/potential improvements for the…
ptgoetz Jul 22, 2013
00bc8f2
minor formatting/style modifications based on feedback from pull requ…
ptgoetz Jul 22, 2013
42775d5
Merge pull request #49 from ptgoetz/rate-limits
mpetazzoni Jul 23, 2013
59a2ec1
Fix a few styling issues from recent contributions
mpetazzoni Jul 23, 2013
c004fa8
Merge pull request #40 from pankdm/fix-incomplete-read
mpetazzoni Jul 23, 2013
64b8865
fixes Issue #47
oxlade39 Jul 22, 2013
a47a275
fixes turn/ttorrent#51
pwoodworth Jul 24, 2013
0dcb033
Merge pull request #50 from oxlade39/bug_fix
mpetazzoni Jul 24, 2013
bf4d679
Merge pull request #53 from pwoodworth/issue-51
mpetazzoni Jul 25, 2013
c1dbcd9
Update pom for compatibility with the maven-release-plugin
pwoodworth Jul 30, 2013
9e8abed
Use maven-shade-plugin to produce executable jar
pwoodworth Jul 30, 2013
5a499ce
Clean up javadoc problems
pwoodworth Jul 30, 2013
c06b110
Merge pull request #54 from pwoodworth/shaded
mpetazzoni Jul 31, 2013
f69190b
Merge pull request #55 from pwoodworth/releaseplugin
mpetazzoni Jul 31, 2013
89a6754
Merge pull request #56 from pwoodworth/javadoc
mpetazzoni Jul 31, 2013
0080296
Fix pom parent relative path
pwoodworth Aug 14, 2013
9e09ee5
Adding more platform agnostic shell scripts
pwoodworth Aug 15, 2013
d50eb99
Removing old shell scripts
pwoodworth Aug 15, 2013
86f4a2f
Merge pull request #57 from pwoodworth/scripts
mpetazzoni Aug 16, 2013
1c8dbfc
Move entry-point main methods to separate package
pwoodworth Aug 26, 2013
d33c361
Merge pull request #59 from pwoodworth/climove
mpetazzoni Aug 26, 2013
dbfd004
Fixes turn/ttorrent#42
pwoodworth Aug 28, 2013
06a3dfc
Merge pull request #60 from pwoodworth/issue-42
mpetazzoni Aug 28, 2013
dd8e7c9
Use commons-io throughout
pwoodworth Sep 11, 2013
f72705f
Merge pull request #63 from pwoodworth/commonsio
mpetazzoni Sep 12, 2013
d243274
Use commons-codec for hex and digest encoding
pwoodworth Aug 28, 2013
6fd448f
Merge pull request #64 from pwoodworth/codec
mpetazzoni Sep 17, 2013
869f664
Fix Piece compareTo ordering
pwoodworth Sep 20, 2013
32c66e1
Correcting improper use of Java 7 API
pwoodworth Sep 26, 2013
d787d9c
Merge pull request #65 from pwoodworth/piececompare
mpetazzoni Sep 30, 2013
cce0c02
Developer contact info updates
mpetazzoni Oct 24, 2013
01276bb
allow for null directory to be passed to SharedTorrent.fromFile() con…
Sep 5, 2014
d815e16
don't initialize if already done
Sep 5, 2014
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ Client client = new Client(
new File("/path/to/your.torrent"),
new File("/path/to/output/directory")));

// You can optionally set download/upload rate limits
// in kB/second. Setting a limit to 0.0 disables rate
// limits.
client.setMaxDownloadRate(50.0);
client.setMaxUploadRate(50.0);

// At this point, can you either call download() to download the torrent and
// stop immediately after...
client.download();
Expand Down Expand Up @@ -134,7 +140,7 @@ License version 2.0. See COPYING file for more details.
Authors and contributors
------------------------

* Maxime Petazzoni <<[email protected]>> (Platform Engineer at Turn, Inc)
* Maxime Petazzoni <<[email protected]>> (Software Engineer at SignalFuse, Inc)
Original author, main developer and maintainer
* David Giffin <<[email protected]>>
Contributed parallel hashing and multi-file torrent support.
Expand Down
18 changes: 0 additions & 18 deletions bin/tracker

This file was deleted.

73 changes: 73 additions & 0 deletions bin/ttorrent
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#!/bin/sh

# Copyright (C) 2012 Turn, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

EXECJAR="ttorrent-*-shaded.jar"

real_path() {
case $1 in
/*)
SCRIPT="$1"
;;
*)
PWD=`pwd`
SCRIPT="$PWD/$1"
;;
esac
CHANGED=true
while [ "X$CHANGED" != "X" ] ; do
# Change spaces to ":" so the tokens can be parsed.
SAFESCRIPT=`echo $SCRIPT | sed -e 's; ;:;g'`
# Get the real path to this script, resolving any symbolic links
TOKENS=`echo $SAFESCRIPT | sed -e 's;/; ;g'`
REALPATH=
for C in $TOKENS; do
# Change any ":" in the token back to a space.
C=`echo $C | sed -e 's;:; ;g'`
REALPATH="$REALPATH/$C"
# If REALPATH is a sym link, resolve it. Loop for nested links.
while [ -h "$REALPATH" ] ; do
LS="`ls -ld "$REALPATH"`"
LINK="`expr "$LS" : '.*-> \(.*\)$'`"
if expr "$LINK" : '/.*' > /dev/null; then
# LINK is absolute.
REALPATH="$LINK"
else
# LINK is relative.
REALPATH="`dirname "$REALPATH"`""/$LINK"
fi
done
done
if [ "$REALPATH" = "$SCRIPT" ] ; then
CHANGED=""
else
SCRIPT="$REALPATH"
fi
done
echo "$REALPATH"
}

base=$(dirname $(real_path $0))
CPARG=$(find ${base}/../build -name "$EXECJAR" | tail -n 1)
if [ -z "$CPARG" ] ; then
echo "Unable to find $EXECJAR"
exit 1
fi
if [ -z "$MAINCLASS" ] ; then
CPARG="-jar $CPARG"
else
CPARG="-cp $CPARG $MAINCLASS"
fi
exec java $CPARG "$@"
6 changes: 3 additions & 3 deletions bin/client → bin/ttorrent-torrent
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh

# Copyright (C) 2012 Turn, Inc.
#
Expand All @@ -14,5 +14,5 @@
# See the License for the specific language governing permissions and
# limitations under the License.

base=$(dirname $(readlink -f $0))
exec java -jar $(find ${base}/../build -name "ttorrent-*.jar" | tail -n 1) $*
EXEFILE="${0%-torrent}"
MAINCLASS="com.turn.ttorrent.cli.TorrentMain" "${EXEFILE}" "$@"
6 changes: 3 additions & 3 deletions bin/torrent → bin/ttorrent-tracker
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh

# Copyright (C) 2012 Turn, Inc.
#
Expand All @@ -14,5 +14,5 @@
# See the License for the specific language governing permissions and
# limitations under the License.

base=$(dirname $(readlink -f $0))
exec java -cp $(find ${base}/../build -name "ttorrent-*.jar" | tail -n 1) com.turn.ttorrent.common.Torrent $*
EXEFILE="${0%-tracker}"
MAINCLASS="com.turn.ttorrent.cli.TrackerMain" "${EXEFILE}" "$@"
54 changes: 32 additions & 22 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>7</version>
<relativePath/>
</parent>

<name>Java BitTorrent library</name>
Expand All @@ -17,7 +18,7 @@
<url>http://turn.github.com/ttorrent/</url>
<groupId>com.turn</groupId>
<artifactId>ttorrent</artifactId>
<version>1.2</version>
<version>1.3-SNAPSHOT</version>
<packaging>jar</packaging>

<organization>
Expand All @@ -27,7 +28,9 @@

<scm>
<connection>scm:git:git://github.com/turn/ttorrent.git</connection>
<developerConnection>scm:git:ssh://[email protected]/turn/ttorrent.git</developerConnection>
<url>http://github.com/turn/ttorrent</url>
<tag>HEAD</tag>
</scm>

<licenses>
Expand All @@ -46,10 +49,10 @@
<developer>
<id>mpetazzoni</id>
<name>Maxime Petazzoni</name>
<email>[email protected]</email>
<email>[email protected]</email>
<url>http://www.bulix.org</url>
<organization>Turn, Inc</organization>
<organizationUrl>http://www.turn.com</organizationUrl>
<organization>SignalFuse, Inc</organization>
<organizationUrl>http://www.signalfuse.com</organizationUrl>
<roles>
<role>maintainer</role>
<role>architect</role>
Expand All @@ -75,10 +78,16 @@
</repositories>

<dependencies>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.8</version>
</dependency>

<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.1</version>
<version>2.4</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -127,6 +136,11 @@
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
</archive>
<includes>
<include>**</include>
</includes>
Expand All @@ -144,28 +158,24 @@
</plugin>

<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<appendAssemblyId>false</appendAssemblyId>
<archive>
<manifest>
<addClasspath>false</addClasspath>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<mainClass>com.turn.ttorrent.client.Client</mainClass>
</manifest>
</archive>
</configuration>
<artifactId>maven-shade-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<id>make-my-jar-with-dependencies</id>
<phase>package</phase>
<goals>
<!--change assembly to single if you don't want include dependencies in jar-->
<goal>assembly</goal>
<goal>shade</goal>
</goals>
<configuration>
<outputFile>${project.build.directory}/${project.artifactId}-${project.version}-shaded.jar</outputFile>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>com.turn.ttorrent.cli.ClientMain</Main-Class>
</manifestEntries>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/turn/ttorrent/bcodec/BDecoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public BEValue bdecodeNumber() throws IOException {
c = this.read();
if (c == '0')
throw new InvalidBEncodingException("Negative zero not allowed");
chars[off] = (char)c;
chars[off] = '-';
off++;
}

Expand Down
Loading