Anithest / bluecop-xbmc-repo

Automatically exported from code.google.com/p/bluecop-xbmc-repo
0 stars 0 forks source link

Patch for trunk/plugin.video.free.cable/resources/lib/abc.py #209

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
ABC has taken to enclose some of its video bit rates in quotes. This causes the 
Python int function to generate an exception because it can not convert strings 
to numbers. The Python float function can convert strings to numbers. So, lets 
pass the bitrate to the float function to protect against this behavior. Note 
that the float function can handle both string and numerical inputs so this 
should have no negative impact on previous videos.

--- trunk/plugin.video.free.cable/resources/lib/abc.py
+++ trunk/plugin.video.free.cable/resources/lib/abc.py
@@ -182,7 +182,7 @@
     platpath=False
     for filename in filenames:
         if filename['src'] <> '':
-            bitrate = int(float(filename['bitrate']))
+            bitrate = int(filename['bitrate'])
             if bitrate > hbitrate and bitrate <= sbitrate:
                 hbitrate = bitrate
                 playpath = filename['src']

Original issue reported on code.google.com by vernon...@gmail.com on 9 Feb 2013 at 12:06

GoogleCodeExporter commented 8 years ago
Oops, got the filename order reversed. Corrected patch below.

--- trunk/plugin.video.free.cable/resources/lib/abc.py
+++ trunk/plugin.video.free.cable/resources/lib/abc.py
@@ -182,7 +182,7 @@
     platpath=False
     for filename in filenames:
         if filename['src'] <> '':
-            bitrate = int(filename['bitrate'])
+            bitrate = int(float(filename['bitrate']))
             if bitrate > hbitrate and bitrate <= sbitrate:
                 hbitrate = bitrate
                 playpath = filename['src']

Original comment by vernon...@gmail.com on 9 Feb 2013 at 12:11