Advertisement
Guest User

Untitled

a guest
Dec 16th, 2011
10,208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3.  
  4. R_M3U="http://mafreebox.freebox.fr/freeboxtv/playlist.m3u"
  5.  
  6. F_IN=playlist.m3u
  7. F_NAME=playlist.name
  8.  
  9. F_OUT_ALL=/etc/enigma2/userbouquet.FreeIPTV.tv
  10. F_OUT_LD=/etc/enigma2/userbouquet.FreeIPTV_LD.tv
  11. F_OUT_SD=/etc/enigma2/userbouquet.FreeIPTV_SD.tv
  12. F_OUT_HD=/etc/enigma2/userbouquet.FreeIPTV_HD.tv
  13. F_OUT_RD=/etc/enigma2/userbouquet.FreeIPTV_radio.radio
  14.  
  15. echo "getting remote file..."
  16. # get remote-file
  17. wget "$R_M3U" -O $F_IN
  18.  
  19. echo "parsing channel names..."
  20. #get channel names
  21. grep EXTINF $F_IN | sed -e 's/.*- //' > $F_NAME
  22.  
  23. echo "reading URLs and replacing colon..."
  24. # read urls and replace ":"
  25. URLS=`grep rtsp $F_IN | sed -e 's/:/%3a/'`
  26.  
  27. echo "go trough urls and creating bouqet..."
  28. # go trough urls and create bouqet
  29. echo "#NAME FreeIPTV ALL" > $F_OUT_ALL
  30. CNT=0
  31. for u in $URLS; do
  32. CNT=$(($CNT + 1))
  33. NAM=`head -$CNT $F_NAME | tail -1`
  34. SRV=` printf "%x" $(echo $u | sed -e 's/.*service=//' -e 's/&.*//' -e 's/\l\n//')`
  35. echo "#SERVICE 1:0:1:$SRV:0:0:0:0:0:0:$u:$NAM" >> $F_OUT_ALL
  36. done
  37.  
  38. echo "seperating stream-types..."
  39. ### seperate stream-types
  40. echo "#NAME FreeIPTV LD" > $F_OUT_LD
  41. grep "flavour=ld" $F_OUT_ALL >> $F_OUT_LD
  42.  
  43. echo "#NAME FreeIPTV SD" > $F_OUT_SD
  44. grep "flavour=sd" $F_OUT_ALL >> $F_OUT_SD
  45.  
  46. echo "#NAME FreeIPTV HD" > $F_OUT_HD
  47. grep "flavour=hd" $F_OUT_ALL >> $F_OUT_HD
  48.  
  49. echo "#NAME FreeIPTV Radio" > $F_OUT_RD
  50. grep -v "flavour" $F_OUT_ALL | grep -v ^#NAME >> $F_OUT_RD
  51.  
  52. rm $F_NAME
  53. rm $F_IN
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement