Permalink
Browse files

- Updating documentation

- Escaping urls for net rule, which would fail under some conditions
- Fixed small bug with mock argument not being correctly handled
  • Loading branch information...
1 parent 7c8bb6e commit 51305c0495f44e7fece34dfdbe544577d272d88e @llaxsll llaxsll committed Jan 18, 2012
Showing with 12 additions and 7 deletions.
  1. +1 −0 INSTALL
  2. +7 −3 README.md
  3. +4 −4 dripls/shaper.py
View
@@ -24,6 +24,7 @@ To setup DripLS :
them in the nginx config. If using apache, use conf/apache/ configs and place
tem under /etc/apache/conf.d/
+
5. Execute fab local deploy so that DripLS can setup its components, or make a new
target in the deploy/fabfile for the remote server on which to deploy Dripls
View
@@ -107,10 +107,14 @@ Action
==================
__e[http error code]__ - Replace the playlist's matching segment url with a url that returns a 404 status code upon invocation ( ex. e404 )
-__net[bandwidth in kbps]loss[% of packets dropped]__ - The net rule action, when applied to a segment, causes the segment to be locally cached and then served at
+__net[bandwidth in kbps]loss[% of packets dropped]__ - The net rule action, when applied to a segment, causes the segment to be stream served at
[bandwidth in kbps] with [% of packets dropped] ( ex. net200loss10 - serve the matched segment at 200kbps
max with 10% packet loss during transmission)
+__netcache[bandwidth in kbps]loss[% of packets dropped]__ - The netcache rule action, when applied to a segment, causes the segment to be locally cached and then served at
+ [bandwidth in kbps] with [% of packets dropped] ( ex. netcache200loss10 - serve the matched segment at 200kbps
+ max with 10% packet loss during transmission)
+
Master Playlist Fetching and Options
==================
@@ -186,11 +190,11 @@ Traffic shape segments
http://dripls-host/master.m3u8?authkey=sample&cid=wt&r=*.c1~net5
->Cache the second content segment of each playlist, and rewrite the vplaylist to serve the segment with maximum download speed of 5kbs
+>The second content segment of each playlist, and rewrite the vplaylist to serve the segment with maximum download speed of 5kbs
http://dripls-host/master.m3u8?authkey=sample&cid=wt&r=*.c2~net500.loss10
->Cache the third content segment of each playlist, and rewrite the vplaylist to serve the segment with maximum download speed of 500kbs and 10% packet loss
+>The hird content segment of each playlist, and rewrite the vplaylist to serve the segment with maximum download speed of 500kbs and 10% packet loss
http://dripls-host/master.m3u8?authkey=sample&cid=wt&r=*.c1~net5,*.c2~net500.loss10
View
@@ -7,6 +7,7 @@
import Queue
import urlparse
import urllib2
+import urllib
import uuid
import hashlib
import re
@@ -31,14 +32,13 @@ def get_next_shape_port():
return port
-def get_shape_port_for(traffic_limit, traffic_loss, shape_session):
+def get_shape_port_for(traffic_limit, traffic_loss, shape_session, mock_shape_segment = False):
#shape port
key = "{0}.{1}".format(traffic_limit, traffic_loss)
if shape_session.has_key(key):
return shape_session[key]
else:
port = get_next_shape_port()
- mock_shape_segment = True #XXX
call_ext_shape_port(port, traffic_limit, traffic_loss, mock_shape_segment)
shape_session[key] = port
@@ -286,7 +286,7 @@ def shape_segment(segment, rule_action, mock_shape_segment=False, shape_session
sid = hashlib.sha224(conf.data.provider.normalize_segment_url(segment["url"])).hexdigest()
(traffic_limit, traffic_loss, cache_segment) = parse_net_rule_action(rule_action)
- port = get_shape_port_for(traffic_limit, traffic_loss, shape_session)
+ port = get_shape_port_for(traffic_limit, traffic_loss, shape_session, mock_shape_segment)
if cache_segment:
#cache the file if it hasn't been cached already
@@ -310,7 +310,7 @@ def shape_segment(segment, rule_action, mock_shape_segment=False, shape_session
#return the final url
return conf.common.get_final_url("s/{0}/playlists/{1}.ts".format(port, sid), "" )
else:
- return conf.common.get_final_url("s/{0}/stream.ts?url={1}".format(port, segment["url"]), "")
+ return conf.common.get_final_url("s/{0}/stream.ts?url={1}".format(port, urllib.quote_plus(segment["url"])), "")
def update_shaped_segment(url, rule_action, mock_shape_segment=False):
"""A request requested an update of a segment post-playlist generation. Handle this here"""

0 comments on commit 51305c0

Please sign in to comment.