Advertisement
Guest User

zzzzzzzz.lua

a guest
Aug 12th, 2012
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.62 KB | None | 0 0
  1. -- Probe function.
  2. function probe()
  3.      if vlc.access ~= "http" and vlc.access ~= "https" then
  4.           return false
  5.      end
  6.      return true
  7. end
  8.  
  9. -- Parse function.
  10. function parse()
  11.      dhead = "\27[1;35mzzzzzzzz.lua debug: "
  12.      dtail = "\27[0m"
  13.      -- vlc.msg.dbg( dhead .. 'debug message here' .. dtail )
  14.  
  15.      while true do
  16.           line = vlc.readline()
  17.           if not line then break end
  18.           if string.match( line, "<link rel='derp .-' href='" ) then
  19.                _,_,where,lua = string.find( line, "rel='derp (.-)' href='(.-)'" )
  20.                vlc.msg.dbg( dhead .. 'found a lua playlist script to install: ' .. lua .. dtail )
  21.                if string.match( lua, "^/") then
  22.                     _,_,domain = string.find( vlc.path, "^(.-)/?" )
  23.                     lua = vlc.access .. '://' .. domain .. lua
  24.                elseif not string.match( lua, "^http" ) then
  25.                     _,_,domainandpath = string.find( vlc.path, "^(.+/)" )
  26.                     lua = vlc.access .. '://' .. domainandpath .. lua
  27.                end
  28.                vlc.msg.dbg( dhead .. 'fullpath should be ' .. lua .. dtail )
  29.  
  30.                -- We need to download the "lua" link and place it whereever "where" says.
  31.                -- Of course, we should insist on sane values, prompt the user if they want to allow or deny it, etc.
  32.                -- But we have no access to the filesystem or to dialog prompts. That sucks. :(
  33.  
  34.           end
  35.      end
  36.      -- Here we need to take and reload vlc.path now that they have a playlist that will presumably parse this page.
  37.      return { { path = vlc.path } }
  38. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement