public List <RTorrentTorrent> GetTorrents(RTorrentSettings settings) { _logger.Debug("Executing remote method: d.multicall2"); var client = BuildClient(settings); var ret = ExecuteRequest(() => client.TorrentMulticall( "", "", "d.name=", // string "d.hash=", // string "d.base_path=", // string "d.custom1=", // string (label) "d.size_bytes=", // long "d.left_bytes=", // long "d.down.rate=", // long (in bytes / s) "d.ratio=", // long "d.is_open=", // long "d.is_active=", // long "d.complete=", //long "d.timestamp.finished=")); // long (unix timestamp) _logger.Trace(ret.ToJson()); var items = new List <RTorrentTorrent>(); foreach (object[] torrent in ret) { var labelDecoded = System.Web.HttpUtility.UrlDecode((string)torrent[3]); var item = new RTorrentTorrent(); item.Name = (string)torrent[0]; item.Hash = (string)torrent[1]; item.Path = (string)torrent[2]; item.Category = labelDecoded; item.TotalSize = (long)torrent[4]; item.RemainingSize = (long)torrent[5]; item.DownRate = (long)torrent[6]; item.Ratio = (long)torrent[7]; item.IsOpen = Convert.ToBoolean((long)torrent[8]); item.IsActive = Convert.ToBoolean((long)torrent[9]); item.IsFinished = Convert.ToBoolean((long)torrent[10]); item.FinishedTime = (long)torrent[11]; items.Add(item); } return(items); }
public List <RTorrentTorrent> GetTorrents(RTorrentSettings settings) { _logger.Debug("Executing remote method: d.multicall2"); var client = BuildClient(settings); var ret = client.TorrentMulticall("", "", "d.name=", // string "d.hash=", // string "d.base_path=", // string "d.custom1=", // string (label) "d.size_bytes=", // long "d.left_bytes=", // long "d.down.rate=", // long (in bytes / s) "d.ratio=", // long "d.is_open=", // long "d.is_active=", // long "d.complete="); //long var items = new List <RTorrentTorrent>(); foreach (object[] torrent in ret) { var item = new RTorrentTorrent(); item.Name = (string)torrent[0]; item.Hash = (string)torrent[1]; item.Path = (string)torrent[2]; item.Category = (string)torrent[3]; item.TotalSize = (long)torrent[4]; item.RemainingSize = (long)torrent[5]; item.DownRate = (long)torrent[6]; item.Ratio = (long)torrent[7]; item.IsOpen = Convert.ToBoolean((long)torrent[8]); item.IsActive = Convert.ToBoolean((long)torrent[9]); item.IsFinished = Convert.ToBoolean((long)torrent[10]); items.Add(item); } return(items); }
public List<RTorrentTorrent> GetTorrents(RTorrentSettings settings) { _logger.Debug("Executing remote method: d.multicall2"); var client = BuildClient(settings); var ret = client.TorrentMulticall("", "", "d.name=", // string "d.hash=", // string "d.base_path=", // string "d.custom1=", // string (label) "d.size_bytes=", // long "d.left_bytes=", // long "d.down.rate=", // long (in bytes / s) "d.ratio=", // long "d.is_open=", // long "d.is_active=", // long "d.complete="); //long var items = new List<RTorrentTorrent>(); foreach (object[] torrent in ret) { var labelDecoded = System.Web.HttpUtility.UrlDecode((string) torrent[3]); var item = new RTorrentTorrent(); item.Name = (string) torrent[0]; item.Hash = (string) torrent[1]; item.Path = (string) torrent[2]; item.Category = labelDecoded; item.TotalSize = (long) torrent[4]; item.RemainingSize = (long) torrent[5]; item.DownRate = (long) torrent[6]; item.Ratio = (long) torrent[7]; item.IsOpen = Convert.ToBoolean((long) torrent[8]); item.IsActive = Convert.ToBoolean((long) torrent[9]); item.IsFinished = Convert.ToBoolean((long) torrent[10]); items.Add(item); } return items; }