Coder Social home page Coder Social logo

pvginkel / frostwire-jlibtorrent Goto Github PK

View Code? Open in Web Editor NEW

This project forked from frostwire/frostwire-jlibtorrent

0.0 1.0 0.0 51.13 MB

A swig Java interface for libtorrent by the makers of FrostWire. Develop libtorrent based apps with the joy of coding in Java.

Home Page: http://www.frostwire.com

License: MIT License

Shell 0.15% Java 40.18% C++ 59.68%

frostwire-jlibtorrent's Introduction

frostwire-jlibtorrent

A swig Java interface for libtorrent by the makers of FrostWire.

Develop libtorrent based apps with the joy of coding in Java.

Here's a simple example of how to create a .torrent downloader using frostwire-jlibtorrent.

public final class DownloadTorrent {

    public static void main(String[] args) throws Throwable {

        // comment this line for a real application
        args = new String[]{"/Users/aldenml/Downloads/Kellee_Maize_The_5th_Element_FrostClick_FrostWire_MP3_April_14_2014.torrent"};

        File torrentFile = new File(args[0]);

        System.out.println("Using libtorrent version: " + LibTorrent.version());

        final Session s = new Session();

        final TorrentHandle th = s.addTorrent(torrentFile, torrentFile.getParentFile());

        final CountDownLatch signal = new CountDownLatch(1);

        s.addListener(new TorrentAlertAdapter(th) {
            @Override
            public void onBlockFinished(BlockFinishedAlert alert) {
                int p = (int) (th.getStatus().getProgress() * 100);
                System.out.println("Progress: " + p);
            }

            @Override
            public void onTorrentFinished(TorrentFinishedAlert alert) {
                System.out.print("Torrent finished");
                signal.countDown();
            }
        });

        signal.await();
    }
}

======= frostwire-jlibtorrent is currently compatible with libtorrent-rasterbar-1.0.2

Building

Requirements

You will have to build libtorrent first on your system, we've included build scripts on the "scripts" folder, for now we just have the MacOSX build scripts ready, Windows, Linux and Android coming soon (perhaps even with your help, pull requests welcome).

If you have not built libtorrent yet, you can get libtorrent 1.0.2 sources from sourceforge.

This is a suggested configure you can invoke prior to building libtorrent, add/remove flags to your needs:

export CC=clang
export CXX=clang
export CFLAGS="-O3 -DTORRENT_USE_IPV6=1 -DNDEBUG=1"
export CXXFLAGS="-O3 -DTORRENT_USE_IPV6=1 -DNDEBUG=1"

export CC=clang
export CXX=clang
export CFLAGS="-O3 -DTORRENT_USE_IPV6=1"
export CXXFLAGS=-O3

./configure --enable-shared --enable-static --enable-debug --enable-python-binding --disable-deprecated-functions

Building the shared library

make libtorrent, and then, go to the build/ folder of our project and execute the run_swig.sh script. The result will be a libjlibtorrent.dylib which you can then use on your Java project along with the Java sources of the frostwire-jlibtorrent api. Make sure the .dylib is on your project's java lib path.

You can always clone the project to your development environment and add it to the build path of your project as a dependency (which would help us in the event you find a bug and you submit a pull request), or copy the sources directly in your project source folder, however you can always just create the frostwire-jlibtorrent.jar and add it to your buildpath and classpath by using the gradle script in the scripts folder.

Building the frostwire-jlibtorrent.jar

inside the build/ folder just invoke gradle build

you will find the resulting frostwire-jlibtorrent.jar at build/build/libs/frostwire-jlibtorrent.jar.

Contributions are rewarded instantly with our Bitcoin donations fund

tip for next commit

License

This software is offered under the MIT License, available here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.