qt: playlist: use item title if available
[vlc.git] / share / lua / playlist / rockbox_fm_presets.lua
blobae841f9eecc4ee37b60c5f20d4ddad5f11b421f9
1 --[[
2 $Id$
4 Copyright © 2009, 2016 the VideoLAN team
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
19 --]]
21 -- Parser script from Rockbox FM radio presets
22 -- See http://www.rockbox.org/wiki/FmPresets
24 local MRL_base = "v4l2c:///dev/radio0:tuner-frequency="
26 function probe()
27 if not string.match( vlc.path, "%.[fF][mM][rR]$" ) then return false end
28 local line = vlc.peek(256)
29 local freq = tonumber(string.match( line, "^[^%d]?[^%d]?[^%d]?[^%d]?(%d+):" )) -- handle BOM
30 return freq and freq > 80000000 and freq < 110000000
31 end
33 function parse()
34 local p = {}
35 while true do
36 local line = vlc.readline()
37 if not line then break end
38 local freq, name = string.match( line, "(%d+):(.*)" )
39 if freq then
40 table.insert( p, { path = MRL_base..freq, name = name } )
41 end
42 end
43 return p
44 end