Enigma2 plugin to to play various online streams (mostly Latvian).

novamovresovler.py 1.5KB

123456789101112131415161718192021222324252627282930313233343536
  1. # * Copyright (C) 2011 Libor Zoubek
  2. # *
  3. # *
  4. # * This Program is free software; you can redistribute it and/or modify
  5. # * it under the terms of the GNU General Public License as published by
  6. # * the Free Software Foundation; either version 2, or (at your option)
  7. # * any later version.
  8. # *
  9. # * This Program is distributed in the hope that it will be useful,
  10. # * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # * GNU General Public License for more details.
  13. # *
  14. # * You should have received a copy of the GNU General Public License
  15. # * along with this program; see the file COPYING. If not, write to
  16. # * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  17. # * http://www.gnu.org/copyleft/gpl.html
  18. # *
  19. # */
  20. import util,re
  21. __name__ = 'novamov'
  22. def supports(url):
  23. return not _regex(url) == None
  24. def resolve(url):
  25. if supports(url):
  26. data = util.request(url)
  27. m = re.search('flashvars.file=\"([^\"]+)',data,re.IGNORECASE | re.DOTALL)
  28. n = re.search('flashvars.filekey=\"([^\"]+)',data,re.IGNORECASE | re.DOTALL)
  29. if not m == None and not n == None:
  30. data = util.request('http://www.novamov.com/api/player.api.php?key=%s&file=%s&user=undefined&pass=undefined&codes=1' % (n.group(1),m.group(1)))
  31. stream = re.search('url=([^\&]+)',data).group(1)
  32. return [{'url':stream}]
  33. def _regex(url):
  34. return re.search('novamov\.com',url,re.IGNORECASE | re.DOTALL)