This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This .travis.yml file instructs travis-ci.org to build your master branch using `yeoman build` | |
# and deploy the output to your project's gh-pages branch. | |
# | |
# You must sign into travis-ci.org and set the commit hook on your project for travis to | |
# run on your project. You also need to replace the env variables below. The secure: variable | |
# must be generated by running `travis encrypt` on a github oauth key that you can generate using | |
# curl. | |
language: | |
node_js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var liveOnceExtension = { | |
liveOnce: function(selectors, callback, context) { | |
var _this = this; | |
var wrapper = function() { | |
_this.die(selectors, wrapper, context); | |
callback.apply(this, arguments); | |
} | |
this.live(selectors, wrapper, context); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
btapp = new Btapp; | |
btapp.connect(); | |
btapp.on('plugin:update_plugin', function(options) { options.update = false; }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
btapp.get('os').browse_for_files(function(files) { | |
console.log(JSON.stringify(files, null, 4)); | |
/** | |
OLD RETURN VALUES | |
["/Users/pwmckenna/Documents/caitlin/humerus anteriorl view.jpg", ...] | |
NEW RETURN VALUES | |
[ | |
{ | |
"handle": 812535217, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.btapp.on('pairing:found', function(info) { | |
var build_number = info.version.engine_version; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.get('btapp').on('all', _.bind(console.log, console)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
logger = function(ev) { | |
if(ev === 'client:connected') { | |
app.get('btapp').off('all', logger); | |
} | |
console.log(JSON.stringify(_.toArray(arguments), null, 4)); | |
}; | |
app.get('btapp').on('all', logger); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var request = app.btapp.get('torrent').download({ | |
url: 'magnet:?xt=urn:btih:D075D45EA1DA3E20BA148A08D984EFFC439273A4', | |
callback: function() { | |
// torrent has been added to the torrent list of the client. | |
// this is called immediately on magnet links, | |
// but might take a bit for http://*.torrent file urls | |
} | |
}); | |
request.then(function(res) { | |
// the client has heard and acknowledged your request |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Btapp.prototype.resolve_torrent_metadata = function(magnet_link) { | |
var magnet_identifier = 'magnet:?xt=urn:btih:'; | |
if(magnet_link.indexOf(magnet_identifier) !== 0) | |
throw 'malformed magnet link'; | |
var hash = magnet_link.substring(magnet_identifier.length).substr(0, 40); | |
console.log(hash); | |
if(!hash.match(/[a-zA-Z0-9]/)) | |
throw 'only support hex encoded info hashes'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Usage: | |
scrape(hash).then(function(infos) { | |
//we have the scrape info for our favorite trackers | |
}); | |
**/ | |
var btapp = new Btapp; | |
var scrape = (function() { | |
// First off get a function wrapper that we can call at any time |