BattleTorrent plug-ins: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
m (NSISdl plug-in (by eries) moved to BattleTorrent plug-ins) |
m (Added some reference to functions supported by the 2 plug-ins.) |
||
Line 12: | Line 12: | ||
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. | 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) == | |||
Most functions are the same as found on the original [[NSISdl plug-in]]. | |||
=== NSISdl::execFile === | |||
Runs a Python plug-in to use the NSISdl's own dialog. | |||
==== Syntax ==== | |||
<highlight-nsis> | |||
NSISdl::execFile "PythonPlug-in" | |||
Pop "ResultVar" | |||
</highlight-nsis> | |||
==== 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) === | |||
<highlight-nsis> | |||
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" | |||
</highlight-nsis> | |||
==== 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 == | == Example Usage == |
Revision as of 17:48, 27 December 2005
Author: eries (talk, contrib) |
Links
Source + binaries:
BattleTorrent-0.0.zip (4.03 MB)
Description
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)
Most functions are the same as found on the original NSISdl plug-in.
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: