#378: Advanced (pieces) progress bar
-------------------+--------------------------------------------------------
 Reporter:  andar  |       Owner:  andar 
     Type:  patch  |      Status:  new   
 Priority:  major  |   Milestone:  Future
Component:  gtkui  |     Version:        
 Keywords:         |  
-------------------+--------------------------------------------------------

Comment(by s0undt3ch):

 Actually:
 {{{
 #!python
 >>> x = [3, 2, 1, 1, 1, 0, 0, 2, 0, 1, 0, 2, 0, 2, 1, 0, 2, 0, 0, 0, 2, 0,
 0, 0,
 ...      2, 0, 0, 2, 2, 1, 0, 2, 1, 0, 1, 1, 0, 0, 2, 0, 0, 0, 0, 0, 0, 3,
 3, 0,
 ...      0, 2, 0, 2, 2, 2, 0, 2, 2, 1]
 >>> t = len(x)*1.0
 >>> xx = []
 >>> v = None
 >>> n = None
 >>>
 >>> while True:
 ...     if not x:
 ...         break
 ...     if v is None:
 ...         v = x.pop(0)
 ...         n = 1
 ...     else:
 ...         vv = x.pop(0)
 ...         if v == vv:
 ...             n += 1
 ...         else:
 ...             xx.append((v, n/t))
 ...             v = vv
 ...             n = 1
 ...
 >>>
 >>>
 >>> print xx
 [(3, 0.017241379310344827), (2, 0.017241379310344827),
 (1, 0.051724137931034482), (0, 0.034482758620689655),
 (2, 0.017241379310344827), (0, 0.017241379310344827),
 (1, 0.017241379310344827), (0, 0.017241379310344827),
 (2, 0.017241379310344827), (0, 0.017241379310344827),
 (2, 0.017241379310344827), (1, 0.017241379310344827),
 (0, 0.017241379310344827), (2, 0.017241379310344827),
 (0, 0.051724137931034482), (2, 0.017241379310344827),
 (0, 0.051724137931034482), (2, 0.017241379310344827),
 (0, 0.034482758620689655), (2, 0.034482758620689655),
 (1, 0.017241379310344827), (0, 0.017241379310344827),
 (2, 0.017241379310344827), (1, 0.017241379310344827),
 (0, 0.017241379310344827), (1, 0.034482758620689655),
 (0, 0.034482758620689655), (2, 0.017241379310344827),
 (0, 0.10344827586206896), (3, 0.034482758620689655),
 (0, 0.034482758620689655), (2, 0.017241379310344827),
 (0, 0.017241379310344827), (2, 0.051724137931034482),
 (0, 0.017241379310344827), (2, 0.034482758620689655)]
 >>> print len(xx)
 36
 >>>
 }}}

-- 
Ticket URL: <http://dev.deluge-torrent.org/ticket/378#comment:22>
Deluge <http://deluge-torrent.org/>
Deluge project

-- 
You received this message because you are subscribed to the Google Groups 
"Deluge Dev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/deluge-dev?hl=en.

Reply via email to