Merge lp:~jtatum/supytube/indexerrors into lp:supytube

Proposed by James Tatum
Status: Merged
Approved by: Benjamin Rubin
Approved revision: 10
Merged at revision: 10
Proposed branch: lp:~jtatum/supytube/indexerrors
Merge into: lp:supytube
Diff against target: 15 lines (+4/-1)
1 file modified
plugin.py (+4/-1)
To merge this branch: bzr merge lp:~jtatum/supytube/indexerrors
Reviewer Review Type Date Requested Status
Benjamin Rubin Approve
Review via email: mp+56292@code.launchpad.net

Description of the change

If youtube is mentioned in channel, IndexError is raised. Fix with try/except.

To post a comment you must log in.
Revision history for this message
Benjamin Rubin (bnrubin) wrote :

Looks good to me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'plugin.py'
--- plugin.py 2011-03-29 01:24:39 +0000
+++ plugin.py 2011-04-05 06:01:30 +0000
@@ -55,7 +55,10 @@
55 def getVideoid(self,msg):55 def getVideoid(self,msg):
56 for word in msg.args[1].split(' '):56 for word in msg.args[1].split(' '):
57 if(word.find("youtube") != -1):57 if(word.find("youtube") != -1):
58 return urlparse(word.replace ('#!' , '?'))[4].split('=')[1].split('&')[0]58 try:
59 return urlparse(word.replace ('#!' , '?'))[4].split('=')[1].split('&')[0]
60 except IndexError:
61 log.debug("Couldn't find youtube video ID in string: %s" % word)
5962
60 def convertRating(self,oldrating):63 def convertRating(self,oldrating):
61 return 100 * (float(oldrating)/5)64 return 100 * (float(oldrating)/5)

Subscribers

People subscribed via source and target branches

to all changes: