willyb321

RS_Mixer

May 15th, 2016
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.28 KB | None | 0 0
  1. --[[
  2.  RS Mixer for VLC >= 1.1.0
  3.  Authors: Willyb321 (https://tehsuperwilly.tech)
  4. --]]
  5.  
  6. stations = {
  7.     { name = "Radio Sidewinder", url = "http://radiosidewinder.out.airtime.pro:8000/radiosidewinder_a" },
  8. }
  9.  
  10. function descriptor()
  11.     return { title = "RS Mixer" ;
  12.              version = "0.1" ;
  13.              author = "Willyb321" ;
  14.              capabilities = {} }
  15. end
  16.  
  17. function activate()
  18.     dlg = vlc.dialog("Streaming Radio Player")
  19.     list = dlg:add_list(1, 3, 4, 1)
  20.     button_play = dlg:add_button("Play", click_play, 1, 4, 4, 1)
  21.     -- Add the radio stations
  22.     for idx, details in ipairs(stations) do
  23.         list:add_value(details.name, idx)
  24.     end
  25.     dlg:show()
  26. end
  27.  
  28. function click_play()
  29.     selection = list:get_selection()
  30.     if (not selection) then return 1 end
  31.     local sel = nil
  32.     for idx, selectedItem in pairs(selection) do
  33.         sel = idx
  34.         break
  35.     end
  36.     details = stations[sel]
  37.  
  38.     -- Play the selected radio station
  39.     playlistItem = {}
  40. playlistItem.path = details.url
  41. vlc.playlist.clear()
  42. vlc.playlist.add( {playlistItem} )
  43. test = vlc.playlist.get("media library")
  44. vlc.playlist.add( {test} )
  45. vlc.playlist.play()
  46. vlc.playlist.next()
  47. end
  48.  
  49. function deactivate()
  50. end
  51.  
  52. function close()
  53.     vlc.deactivate()
  54. end
Advertisement
Add Comment
Please, Sign In to add comment