Merge pull request #122 from nfvs/add_file_options
Add ability to specify per-file options in Add by URI.
This commit is contained in:
commit
9bb72eac8d
|
@ -646,7 +646,9 @@
|
||||||
- You can also add multiple uris (mirrors) for the
|
- You can also add multiple uris (mirrors) for the
|
||||||
*same* file. To do this separate the uris
|
*same* file. To do this separate the uris
|
||||||
by a space. <br>
|
by a space. <br>
|
||||||
- A URI can be HTTP(S)/FTP/BitTorrent Magnet URI.
|
- Additional options can be specified for individual
|
||||||
|
files, in "--option[=value]" format. <br>
|
||||||
|
- A URI can be HTTP(S)/FTP/BitTorrent Magnet URI. </br>
|
||||||
- Aria2 will use multiple uris (or mirrors) to boost
|
- Aria2 will use multiple uris (or mirrors) to boost
|
||||||
the download speed for that file (download). <br>
|
the download speed for that file (download). <br>
|
||||||
E.g. To add 2 files (downloads) f1.jpg
|
E.g. To add 2 files (downloads) f1.jpg
|
||||||
|
@ -656,7 +658,7 @@
|
||||||
<!-- pre tags print tabs, so do not indent them! -->
|
<!-- pre tags print tabs, so do not indent them! -->
|
||||||
<pre>
|
<pre>
|
||||||
http://ex1.com/f1.jpg http://ex2.com/f1.jpg
|
http://ex1.com/f1.jpg http://ex2.com/f1.jpg
|
||||||
http://ex1.com/f2.mp4 http://ex2.com/f2.mp4
|
http://ex1.com/f2.mp4 http://ex2.com/f2.mp4 --out=file2.mp4
|
||||||
</pre>
|
</pre>
|
||||||
</p>
|
</p>
|
||||||
<textarea rows="4" style="width: 100%" ng-model="getUris.uris"></textarea>
|
<textarea rows="4" style="width: 100%" ng-model="getUris.uris"></textarea>
|
||||||
|
|
|
@ -13,8 +13,21 @@ angular.module('webui.services.rpc.helpers', [
|
||||||
},
|
},
|
||||||
addUris: function(uris, settings, cb) {
|
addUris: function(uris, settings, cb) {
|
||||||
_.each(uris, function(uri) {
|
_.each(uris, function(uri) {
|
||||||
|
uri_parsed = [];
|
||||||
|
// parse options passed in the URIs. E.g. http://ex1.com/f1.jpg --out=image.jpg --check-integrity
|
||||||
|
_.each(uri, function(uri_element) {
|
||||||
|
if (uri_element.startsWith('--')) {
|
||||||
|
uri_options = uri_element.split(/--|=(.*)/);
|
||||||
|
if (uri_options.length > 2) {
|
||||||
|
settings[uri_options[2]] = uri_options[3] || 'true';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
uri_parsed.push(uri_element);
|
||||||
|
}
|
||||||
|
});
|
||||||
// passing true to batch all the addUri calls
|
// passing true to batch all the addUri calls
|
||||||
rpc.once('addUri', [uri, settings], cb, true);
|
rpc.once('addUri', [uri_parsed, settings], cb, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
// now dispatch all addUri syscalls
|
// now dispatch all addUri syscalls
|
||||||
|
|
Loading…
Reference in New Issue
Block a user