Changeset 1145 for trunk/rtorrent/src/command_download.cc
- Timestamp:
- 03/15/10 14:31:50 (2 years ago)
- Files:
-
- 1 modified
-
trunk/rtorrent/src/command_download.cc (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/rtorrent/src/command_download.cc
r1144 r1145 108 108 109 109 if (type == "base_path") { 110 target = rpc::call_command_string("d. get_base_path", rpc::make_target(download));111 link = rak::path_expand(prefix + rpc::call_command_string("d. get_base_path", rpc::make_target(download)) + postfix);110 target = rpc::call_command_string("d.base_path", rpc::make_target(download)); 111 link = rak::path_expand(prefix + rpc::call_command_string("d.base_path", rpc::make_target(download)) + postfix); 112 112 113 113 } else if (type == "base_filename") { 114 target = rpc::call_command_string("d. get_base_path", rpc::make_target(download));114 target = rpc::call_command_string("d.base_path", rpc::make_target(download)); 115 115 link = rak::path_expand(prefix + rpc::call_command_string("d.get_base_filename", rpc::make_target(download)) + postfix); 116 116 117 117 // } else if (type == "directory_path") { 118 118 // target = rpc::call_command_string("d.get_directory", rpc::make_target(download)); 119 // link = rak::path_expand(prefix + rpc::call_command_string("d. get_base_path", rpc::make_target(download)) + postfix);119 // link = rak::path_expand(prefix + rpc::call_command_string("d.base_path", rpc::make_target(download)) + postfix); 120 120 121 121 } else if (type == "tied") { … … 126 126 127 127 link = rak::path_expand(prefix + link + postfix); 128 target = rpc::call_command_string("d. get_base_path", rpc::make_target(download));128 target = rpc::call_command_string("d.base_path", rpc::make_target(download)); 129 129 130 130 } else { … … 192 192 download->set_root_directory(name); 193 193 else if (name.empty() || *name.rbegin() == '/') 194 download->set_root_directory(name + download-> download()->name());194 download->set_root_directory(name + download->info()->name()); 195 195 else 196 download->set_root_directory(name + "/" + download-> download()->name());196 download->set_root_directory(name + "/" + download->info()->name()); 197 197 } 198 198 … … 233 233 234 234 int64_t bytesDone = download->download()->bytes_done(); 235 int64_t upTotal = download-> download()->up_rate()->total();235 int64_t upTotal = download->info()->up_rate()->total(); 236 236 237 237 return bytesDone > 0 ? (1000 * upTotal) / bytesDone : 0; … … 240 240 torrent::Object 241 241 retrieve_d_hash(core::Download* download) { 242 const torrent::HashString* hashString = &download-> download()->info_hash();242 const torrent::HashString* hashString = &download->info()->hash(); 243 243 244 244 return torrent::Object(rak::transform_hex(hashString->begin(), hashString->end())); … … 247 247 torrent::Object 248 248 retrieve_d_local_id(core::Download* download) { 249 const torrent::HashString* hashString = &download-> download()->local_id();249 const torrent::HashString* hashString = &download->info()->local_id(); 250 250 251 251 return torrent::Object(rak::transform_hex(hashString->begin(), hashString->end())); … … 254 254 torrent::Object 255 255 retrieve_d_local_id_html(core::Download* download) { 256 const torrent::HashString* hashString = &download-> download()->local_id();256 const torrent::HashString* hashString = &download->info()->local_id(); 257 257 258 258 return torrent::Object(rak::copy_escape_html(hashString->begin(), hashString->end())); … … 563 563 } 564 564 565 #define CMD_ON_INFO(func) \ 566 rak::on(std::mem_fun(&core::Download::info), std::mem_fun(&torrent::DownloadInfo::func)) 567 565 568 void 566 569 initialize_command_download() { 567 ADD_CD_VOID("hash", &retrieve_d_hash); 568 ADD_CD_VOID("local_id", &retrieve_d_local_id); 569 ADD_CD_VOID("local_id_html", &retrieve_d_local_id_html); 570 ADD_CD_VOID("bitfield", &retrieve_d_bitfield); 571 ADD_CD_VOID("base_path", &retrieve_d_base_path); 572 ADD_CD_VOID("base_filename", &retrieve_d_base_filename); 573 ADD_CD_STRING_UNI("name", rak::on(std::mem_fun(&core::Download::download), std::mem_fun(&torrent::Download::name))); 570 CMD_D_VOID("d.hash", &retrieve_d_hash); 571 CMD_D_VOID("d.local_id", &retrieve_d_local_id); 572 CMD_D_VOID("d.local_id_html", &retrieve_d_local_id_html); 573 CMD_D_VOID("d.bitfield", &retrieve_d_bitfield); 574 CMD_D_VOID("d.base_path", &retrieve_d_base_path); 575 CMD_D_VOID("d.base_filename", &retrieve_d_base_filename); 576 577 CMD_D_VOID_SLOT("d.name", CMD_ON_INFO(name)); 578 579 CMD_D_VOID_SLOT("d.creation_date", CMD_ON_INFO(creation_date)); 580 CMD_D_VOID_SLOT("d.load_date", CMD_ON_INFO(load_date)); 574 581 575 582 // ????? … … 677 684 ADD_CD_VALUE_UNI("peers_accounted", rak::on(std::mem_fun(&core::Download::download), std::mem_fun(&torrent::Download::peers_accounted))); 678 685 679 ADD_CD_VALUE_MEM_UNI("up_rate", &torrent::Download::mutable_up_rate, &torrent::Rate::rate); 680 ADD_CD_VALUE_MEM_UNI("up_total", &torrent::Download::mutable_up_rate, &torrent::Rate::total); 681 ADD_CD_VALUE_MEM_UNI("down_rate", &torrent::Download::mutable_down_rate, &torrent::Rate::rate); 682 ADD_CD_VALUE_MEM_UNI("down_total", &torrent::Download::mutable_down_rate, &torrent::Rate::total); 683 ADD_CD_VALUE_MEM_UNI("skip_rate", &torrent::Download::mutable_skip_rate, &torrent::Rate::rate); 684 ADD_CD_VALUE_MEM_UNI("skip_total", &torrent::Download::mutable_skip_rate, &torrent::Rate::total); 686 // 687 CMD_D_VOID_SLOT("d.up.rate", rak::on(CMD_ON_INFO(up_rate), std::mem_fun(&torrent::Rate::rate))); 688 CMD_D_VOID_SLOT("d.up.total", rak::on(CMD_ON_INFO(up_rate), std::mem_fun(&torrent::Rate::total))); 689 CMD_D_VOID_SLOT("d.down.rate", rak::on(CMD_ON_INFO(down_rate), std::mem_fun(&torrent::Rate::rate))); 690 CMD_D_VOID_SLOT("d.down.total", rak::on(CMD_ON_INFO(down_rate), std::mem_fun(&torrent::Rate::total))); 691 CMD_D_VOID_SLOT("d.skip.rate", rak::on(CMD_ON_INFO(skip_rate), std::mem_fun(&torrent::Rate::rate))); 692 CMD_D_VOID_SLOT("d.skip.total", rak::on(CMD_ON_INFO(skip_rate), std::mem_fun(&torrent::Rate::total))); 693 // 685 694 686 695 ADD_CD_STRING("set_throttle_name", std::mem_fun(&core::Download::set_throttle_name)); 687 696 ADD_CD_SLOT_PUBLIC("d.get_throttle_name", call_unknown, rpc::get_variable_d_fn("rtorrent", "throttle_name"), "i:", ""); 688 697 689 ADD_CD_VALUE_UNI("creation_date", rak::on(std::mem_fun(&core::Download::download), std::mem_fun(&torrent::Download::creation_date)));690 698 ADD_CD_VALUE_UNI("bytes_done", rak::on(std::mem_fun(&core::Download::download), std::mem_fun(&torrent::Download::bytes_done))); 691 699 ADD_CD_VALUE_UNI("ratio", std::ptr_fun(&retrieve_d_ratio));
