~ubuntu-branches/ubuntu/raring/radiotray/raring

« back to all changes in this revision

Viewing changes to src/M3uPlaylistDecoder.py

  • Committer: Bazaar Package Importer
  • Author(s): Elías Alejandro Año Mendoza
  • Date: 2010-06-15 02:19:00 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20100615021900-m8wrzkbq8kez1etv
Tags: 0.6-2
Added build dependency.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
    def __init__(self):
25
25
        print "M3U playlist decoder"
26
26
 
27
 
    def extractStream(self,  url):
 
27
    def isStreamValid(self, contentType, firstBytes):
 
28
 
 
29
        if('audio/mpegurl' in contentType or 'audio/x-mpegurl' in contentType):
 
30
            print 'Stream is readable by M3U Playlist Decoder'
 
31
            return True
 
32
        else:
 
33
            return False
 
34
 
 
35
 
 
36
 
 
37
    def extractPlaylist(self,  url):
28
38
        print "Downloading playlist..."
29
39
 
30
40
        req = urllib2.Request(url)
35
45
        print "Playlist downloaded"
36
46
        print "Decoding playlist..."
37
47
 
38
 
        lines = str.split("\n")
 
48
        lines = str.splitlines()
39
49
        playlist = []
40
50
 
41
51
        for line in lines: