The method requires the passing of a URI to be downloaded, but that doesn't quite fit with the manner of Bittorrent. Perhaps an appropriate URI would the location of the .torrent file, but that isn't true - for one, if this was used the Download Manager would just download the .torrent file, and I can't link this to the download of the 'real' torrent, so hitting pause/stop/etc. will not have a connection with the real torrent download.
A second issue is that the addDownload method takes a destination file. It's rare to see a torrent contain just one file, so this again is an impossibility. I expect the download manager is expecting a nice channel to read from and then feed this into one file. Not so good for my situation.
So, I have an idea. One part is the representation of a torrent by using a URI in the form of a magnet-URI. This way, I can pass the nsIDownloadManager a magnet: URI which will get the Download Manager to call the magnet protocol handler which will feed the Download Manager data from the real torrent. Yay, just need to implement a magnet: protocol handler.
This however doesn't help with the one destination file problem. So, the second part of this is to split a torrent into multiple URIs. So, given the example of this torrent: http://www.mininova.org/det/3190112
- The current magnet URI is magnet:?xt=urn:btih:25H6RSS2GDS4BT235LTX7IE4UMNOCEM7&tr=http://tracker.mininova.org/announce
- magnet:/01%201%20Mist.mp3?xt=urn:btih:25H6RSS2GDS4BT235LTX7IE4UMNOCEM7&tr=http://tracker.mininova.org/announce
- magnet:/2%20Vietcong Blues%20.mp3?xt=urn:btih:25H6RSS2GDS4BT235LTX7IE4UMNOCEM7&tr=http://tracker.mininova.org/announce
- magnet:/3%20Chill%20Song.mp3?xt=urn:btih:25H6RSS2GDS4BT235LTX7IE4UMNOCEM7&tr=http://tracker.mininova.org/announce
- etc.
But... this isn't a normal magnet URI, it contains paths (which given a bittorrent source, seems reasonable... though again this isn't normal). As it is used in a closed system maybe it's okay...
Thoughts? Hmm? The key problem I see is that if I start using magnet URIs, I probably need to support them properly, at least for the ones related to Bittorrent. But that's a lot of work, as it requires implementing BEP 0005, BEP 0009 and BEP 0010.
No comments:
Post a Comment