Open .torrent files support

This commit is contained in:
Diego Rodríguez 2015-12-07 11:53:57 -05:00
parent 9d9ef890b5
commit 631afc5008
5 changed files with 9 additions and 25 deletions

View file

@ -6,7 +6,7 @@
### Features
- [x] Informative GUI with easy sharing options
- [x] Downloading from an info hash or magnet URI
- [ ] Downloading from a .torrent file (Coming Soon)
- [x] Downloading from a .torrent file (Coming Soon)
- [x] Seeding files (Single file only for the moment)
- [ ] Seeding CORS-enabled remote files (Coming Soon)
- [x] Download/Upload speed per torrent

View file

@ -83,13 +83,7 @@ app.controller 'bTorrentCtrl', ['$scope','$http','$log','$location', 'uiGridCons
if file?
dbg 'Adding ' + file.name
$scope.client.processing = true
url = URL.createObjectURL file
$http.get(url).then((response) ->
dbg 'Success' + response.data
, (response) ->
dbg 'ERROR'
)
$scope.client.add url, opts, $scope.onTorrent
$scope.client.add file, opts, $scope.onTorrent
$scope.addMagnet = ->
if $scope.torrentInput != ''

View file

@ -122,17 +122,10 @@
}
};
$scope.openTorrentFile = function(file) {
var url;
if (file != null) {
dbg('Adding ' + file.name);
$scope.client.processing = true;
url = URL.createObjectURL(file);
$http.get(url).then(function(response) {
return dbg('Success' + response.data);
}, function(response) {
return dbg('ERROR');
});
return $scope.client.add(url, opts, $scope.onTorrent);
return $scope.client.add(file, opts, $scope.onTorrent);
}
};
$scope.addMagnet = function() {

View file

@ -8,7 +8,7 @@
<meta name="keywords" content="βTorrent, btorrent, client, webtorrent, browser, torrent, stream, bittorrent">
<meta name="author" content="Diego Rodríguez Baquero - DiegoRBaquero">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://cdn.jsdelivr.net/g/webtorrent@0.63.2,momentjs@2.10,angularjs@1.4,angular.ui-grid@3.0"></script>
<script src="https://cdn.jsdelivr.net/g/webtorrent@0.63.3,momentjs@2.10,angularjs@1.4,angular.ui-grid@3.0"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/danialfarid-angular-file-upload/10.1.8/ng-file-upload.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/g/normalize@3.0,skeleton@2.0">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/fontawesome/4.5/css/font-awesome.min.css">
@ -17,7 +17,7 @@
</head>
<body ng-controller="bTorrentCtrl" ng-cloak="">
<header>
<h1>βTorrent<span class="version"> v0.6.2</span></h1>
<h1>βTorrent<span class="version"> v0.6.3</span></h1>
</header>
<div class="container">
<div class="row">
@ -28,10 +28,7 @@
<button ng-click="addMagnet()" class="button-primary"><i class="fa fa-download"></i> Download</button>
</div>
<div class="three columns">
<!--button.button-primary(type='file', ngf-select='openTorrentFile($file)')
i.fa.fa-folder-open
| Open torrent file
-->
<button type="file" ngf-select="openTorrentFile($file)" class="button-primary"><i class="fa fa-folder-open"></i> Open torrent file</button>
</div>
<div class="three columns u-pull-right">
<button type="file" ngf-select="seedFile($file)" class="u-pull-right button-primary"><i class="fa fa-upload"></i> Seed a file</button>

View file

@ -8,7 +8,7 @@ html(ng-app='bTorrent', lang='en')
meta(name='keywords', content='βTorrent, btorrent, client, webtorrent, browser, torrent, stream, bittorrent')
meta(name='author', content='Diego Rodríguez Baquero - DiegoRBaquero')
meta(name='viewport', content='width=device-width, initial-scale=1')
script(src='https://cdn.jsdelivr.net/g/webtorrent@0.63.2,momentjs@2.10,angularjs@1.4,angular.ui-grid@3.0')
script(src='https://cdn.jsdelivr.net/g/webtorrent@0.63.3,momentjs@2.10,angularjs@1.4,angular.ui-grid@3.0')
script(src='https://cdnjs.cloudflare.com/ajax/libs/danialfarid-angular-file-upload/10.1.8/ng-file-upload.min.js')
link(rel='stylesheet', href='https://cdn.jsdelivr.net/g/normalize@3.0,skeleton@2.0')
link(rel='stylesheet', href='https://cdn.jsdelivr.net/fontawesome/4.5/css/font-awesome.min.css')
@ -18,7 +18,7 @@ html(ng-app='bTorrent', lang='en')
header
h1
| βTorrent
span.version v0.6.2
span.version v0.6.3
.container
.row
@ -29,7 +29,7 @@ html(ng-app='bTorrent', lang='en')
i.fa.fa-download
| Download
.three.columns
//button.button-primary(type='file', ngf-select='openTorrentFile($file)')
button.button-primary(type='file', ngf-select='openTorrentFile($file)')
i.fa.fa-folder-open
| Open torrent file
.three.columns.u-pull-right