Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import re
- import subprocess
- class bcolors:
- YELLOW = '\033[93m'
- RED = '\033[95m'
- ENDC = '\033[0m'
- url= "/root/Download/Play.pls"
- p= subprocess.Popen(['mplayer','-playlist', url], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
- for line in p.stdout:
- if line.startswith('Name'):
- info = line.split(':', 1)[1].strip()
- print bcolors.RED + '---{ ' + bcolors.ENDC, bcolors.YELLOW, info, bcolors.ENDC, bcolors.RED + ' }---'+ bcolors.ENDC
- if line.startswith('ICY Info:'):
- info = line.split(':', 1)[1].strip()
- attrs = dict(re.findall("(\w+)='([^']*)'", info))
- f1=open('/tmp/nowplaying.log', 'w+')
- print >>f1, attrs.get('StreamTitle', '(none)')
- f1.close()
- print bcolors.RED + '>>> ' + bcolors.ENDC, attrs.get('StreamTitle', '(none)')
- ----------------------------------
- cat /root/Download/Play.pls
- #EXTM3U
- #EXTINF:-1 tvg-name="ТНТ"
- http://go.dnbfm.ru:8000/play
- #EXTINF:-1 tvg-name="ТНТ"
- http://online.radiorecord.ru:8102/ps_128
- #EXTINF:-1 tvg-name="ТНТ"
- http://deppy.dnbradio.com:8016
- #EXTINF:-1 tvg-name="ТНТ"
- http://aol.streams.bassdrive.com:8008
- #EXTINF:-1 tvg-name="ТНТ"
- http://radio.dnbtv.com:8004/
- #EXTINF:-1 tvg-name="ТНТ"
- http://u12.di.fm:80/di_liquiddnb
- #EXTINF:-1 tvg-name="ТНТ"
- http://sanfm.ru:8000/drum
- #EXTINF:-1 tvg-name="ТНТ"
- http://www.destroyer.net:8800
- #EXTINF:-1 tvg-name="ТНТ"
- http://stream2.jungletrain.net:8000
Add Comment
Please, Sign In to add comment