lib/quartz_flow/wrappers.rb in quartz_flow-0.0.3 vs lib/quartz_flow/wrappers.rb in quartz_flow-0.0.4
- old
+ new
@@ -49,10 +49,19 @@
result
end
end
+ class Alarm
+ def to_h
+ result = {}
+ result[:details] = @details
+ result[:time] = @time
+ result
+ end
+ end
+
class TorrentDataDelegate
# Convert to a hash. Also flattens some of the data into new fields.
def to_h
result = {}
@@ -68,10 +77,12 @@
(total.to_f - cur.to_f) / @downloadRateDataOnly
else
0
end
end
+ # Cap estimated time at 9999 hours
+ secondsLeft = 35996400 if secondsLeft > 35996400
result[:timeLeft] = Formatter.formatTime(secondsLeft)
## Regular fields
result[:info] = @info ? @info.to_h : nil
result[:infoHash] = @infoHash
@@ -85,15 +96,17 @@
result[:state] = @state
#result[:completePieceBitfield] = @completePieceBitfield
result[:metainfoLength] = @metainfoLength
result[:metainfoCompletedLength] = @metainfoCompletedLength
result[:paused] = @paused
+ result[:queued] = @queued
result[:uploadRateLimit] = @uploadRateLimit
result[:downloadRateLimit] = @downloadRateLimit
result[:ratio] = @ratio
result[:uploadDuration] = @uploadDuration
result[:bytesUploaded] = @bytesUploaded
result[:bytesDownloaded] = @bytesDownloaded
+ result[:alarms] = @alarms.collect{ |a| a.to_h }
result
end
private