youtube-dl

Another place where youtube-dl lives on
git clone git://git.oshgnacknak.de/youtube-dl.git
Log | Files | Refs | README | LICENSE

commit 1143535d762fc4260aacc108f2c41079867f9f00
parent 7d52c052efe7accf098bca84aef0ea70caa64889
Author: Yen Chi Hsuan <yan12125@gmail.com>
Date:   Sun, 26 Jun 2016 15:16:49 +0800

[utils] Add urshift()

Used in IqiyiIE and LeIE

Diffstat:
Mtest/test_utils.py | 5+++++
Myoutube_dl/utils.py | 4++++
2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/test/test_utils.py b/test/test_utils.py @@ -66,6 +66,7 @@ from youtube_dl.utils import ( lowercase_escape, url_basename, urlencode_postdata, + urshift, update_url_query, version_tuple, xpath_with_ns, @@ -980,5 +981,9 @@ The first line self.assertRaises(ValueError, encode_base_n, 0, 70) self.assertRaises(ValueError, encode_base_n, 0, 60, custom_table) + def test_urshift(self): + self.assertEqual(urshift(3, 1), 1) + self.assertEqual(urshift(-3, 1), 2147483646) + if __name__ == '__main__': unittest.main() diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py @@ -2899,3 +2899,7 @@ def parse_m3u8_attributes(attrib): val = val[1:-1] info[key] = val return info + + +def urshift(val, n): + return val >> n if val >= 0 else (val + 0x100000000) >> n