home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2011 January / maximum-cd-2011-01.iso / DiscContents / vlc-1.1.4-win32.exe / lua / playlist / rockbox_fm_presets.lua < prev    next >
Encoding:
Text File  |  2010-08-26  |  722 b   |  28 lines

  1. -- Parser script from Rockbox FM radio presets
  2. -- See http://www.rockbox.org/wiki/FmPresets
  3.  
  4. function probe()
  5.     if not string.match( vlc.path, ".fmr$" ) then return false end
  6.     local line = vlc.peek(256)
  7.     vlc.msg.err(line)
  8.     local freq = tonumber(string.match( line, "(%d*):" ))
  9.     if not freq then return false end
  10.     return freq > 80000000    and freq < 110000000
  11. end
  12.  
  13. function parse()
  14.     vlc.msg.err("test")
  15.     local p = {}
  16.     while true do
  17.         line = vlc.readline()
  18.         if not line then break end
  19.     vlc.msg.err(line)
  20.         for freq, name in string.gmatch( line, "(%d*):(.*)" ) do
  21.             vlc.msg.info(freq)
  22.             table.insert( p, { path = "v4l2c:///dev/radio0:tuner-frequency="..freq, name = name } )
  23.         end
  24.     end
  25. vlc.msg.err("test test")
  26.     return p
  27. end
  28.