forked from premiere/premiere-libtorrent
replace use of add_torrent_params::url in some examples (#1866)
replace use of add_torrent_params::url in some examples
This commit is contained in:
parent
02bb1251d2
commit
d896e9bab3
|
@ -29,6 +29,7 @@ For example:
|
|||
#include <libtorrent/session.hpp>
|
||||
#include <libtorrent/add_torrent_params.hpp>
|
||||
#include <libtorrent/torrent_handle.hpp>
|
||||
#include <libtorrent/magnet_uri.hpp>
|
||||
|
||||
namespace lt = libtorrent;
|
||||
int main(int argc, char const* argv[])
|
||||
|
@ -40,7 +41,8 @@ For example:
|
|||
lt::session ses;
|
||||
|
||||
lt::add_torrent_params atp;
|
||||
atp.url = argv[1];
|
||||
lt::error_code ec;
|
||||
lt::parse_magnet_uri(argv[1], atp, ec);
|
||||
atp.save_path = "."; // save in current dir
|
||||
lt::torrent_handle h = ses.add_torrent(atp);
|
||||
|
||||
|
|
|
@ -38,6 +38,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <libtorrent/add_torrent_params.hpp>
|
||||
#include <libtorrent/torrent_handle.hpp>
|
||||
#include <libtorrent/alert_types.hpp>
|
||||
#include <libtorrent/magnet_uri.hpp>
|
||||
#include <libtorrent/error_code.hpp>
|
||||
|
||||
namespace lt = libtorrent;
|
||||
int main(int argc, char const* argv[])
|
||||
|
@ -49,7 +51,12 @@ int main(int argc, char const* argv[])
|
|||
lt::session ses;
|
||||
|
||||
lt::add_torrent_params atp;
|
||||
atp.url = argv[1];
|
||||
lt::error_code ec;
|
||||
lt::parse_magnet_uri(argv[1], atp, ec);
|
||||
if (ec) {
|
||||
std::cerr << "invalid magnet URI: " << ec.message() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
atp.save_path = "."; // save in current dir
|
||||
lt::torrent_handle h = ses.add_torrent(atp);
|
||||
|
||||
|
|
|
@ -41,6 +41,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <libtorrent/alert_types.hpp>
|
||||
#include <libtorrent/bencode.hpp>
|
||||
#include <libtorrent/torrent_status.hpp>
|
||||
#include <libtorrent/magnet_uri.hpp>
|
||||
#include <libtorrent/error_code.hpp>
|
||||
|
||||
namespace lt = libtorrent;
|
||||
using clk = std::chrono::steady_clock;
|
||||
|
@ -82,7 +84,12 @@ int main(int argc, char const* argv[])
|
|||
ifs.unsetf(std::ios_base::skipws);
|
||||
atp.resume_data.assign(std::istream_iterator<char>(ifs)
|
||||
, std::istream_iterator<char>());
|
||||
atp.url = argv[1];
|
||||
lt::error_code ec;
|
||||
lt::parse_magnet_uri(argv[1], atp, ec);
|
||||
if (ec) {
|
||||
std::cerr << "invalid magnet URI: " << ec.message() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
atp.save_path = "."; // save in current dir
|
||||
ses.async_add_torrent(atp);
|
||||
|
||||
|
|
Loading…
Reference in New Issue