BattleTorrent plug-ins

From NSIS Wiki

Author: eries (talk, contrib)



This page is out of date - the links do not lead to the correct software


Links

Source + binaries:

Zip.gif BattleTorrent-0.0.zip (4.03 MB)

Description

Version: 0.0.

Combine NSISdl and the NSIS Python Plugin, and you get an NSIS installer that is capable of downloading content via BitTorrent. This was initially developed by IMVU, and released as part of the BattleTorrent project.

If you'd like to see an example in action, you can download it here.

Because BitTorrent only downloads only the chunks of files that have changed, it makes a great client updater too. And because it's peer-to-peer, it uses a lot less bandwidth than just a regular HTTP downloader.

This contribution is the combination of use of 2 plug-ins:

  • NSISdl plug-in (by eries) - Supports running Python scripts (using code from NsPython plug-in) and showing the download dialog at the same time. Supports interactivety with the Python plug-in to show the dialog as this Python script tells it so.
  • BitDownloadNSIS plug-in - Supports downloading a torrent file using a Python script header called "BitTorrent". This plug-in uses its download function to interactively send information to the NSISdl plug-in (by eries) and download the torrent at the same time.

How to use NSISdl plug-in (by eries)

Some functions are the same as found on the original NSISdl plug-in. The most important function is the "NSISdl::execFile".

NSISdl::execFile

Runs a Python plug-in to use the NSISdl's own dialog.

Syntax

NSISdl::execFile "PythonPlug-in"
Pop "ResultVar"

Parameters

ResultVar
Variable where the result of the operation is returned. If it succeeded, "success" is returned, otherwise "error" is returned. "error" is returned when the python plug-in cannot be opened.

How to use BitDownloadNSIS plug-in

Syntax for usage with NSISdl plug-in (by eries)

StrCpy $R0 "$CMDLINE UrlTorrentToDownload" ;Note: "$CMDLINE" is not required, but the space after it is - not used by the plug-in.
StrCpy $R1 "DownloadDir"
NSISdl::execFile "$PLUGINSDIR\btdownloadnsis.py" ;This file needs to be extracted to $PLUGINSDIR before this call
Pop "ResultVar"

Parameters

UrlTorrentToDownload
Link to an online torrent file in which more information about the files to be downloaded can be found.
DownloadDir
Directory where the files indicated by the torrent file will be located after the download is done.
ResultVar
Same as on the normal call to NSISdl::execFile.

Example Usage

  ; $R0 contains the CMDLINE plus the torrent URL
  StrCpy $R0 "$CMDLINE http://download.imvu.com/catalog/download/dist.torrent"
  ; $R1 contains the target folder
  StrCpy $R1 "$INSTDIR"
  NSISdl::execFile "$INSTDIR\bt\btdownloadnsis.py"
  IfErrors errortag 
  Pop $R2
  StrCmp $R2 "error" errortag noerrortag
  errortag:
  Abort
  noerrortag:
Personal tools
donate
ads