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

1234567891011121314151617181920212223242526272829303132333435
  1. # * GNU General Public License for more details.
  2. # *
  3. # * You should have received a copy of the GNU General Public License
  4. # * along with this program; see the file COPYING. If not, write to
  5. # * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  6. # * http://www.gnu.org/copyleft/gpl.html
  7. # *
  8. # */
  9. import re,util
  10. __name__='nahnoji'
  11. __priiority__=-1
  12. def supports(url):
  13. return not _regex(url) == None
  14. # returns the steam url
  15. def url(url):
  16. #if supports(url):
  17. m = _regex(url)
  18. if not m == None:
  19. ur = m.group('url')
  20. if ur.find('.flv') > -1:
  21. return [ur]
  22. data = util.substr(util.request(ur),'<body style','</a>')
  23. pattern = 'href=\"(.+?)\"[^>]+>'
  24. match = re.compile(pattern).findall(data)
  25. return [match[0]]
  26. def resolve(u):
  27. stream = url(u)
  28. if stream:
  29. return [{'name':__name__,'quality':'360p','url':stream[0],'surl':u}]
  30. def _regex(url):
  31. return re.search('(?P<url>http://nahnoji.cz/[^\"|\'|\\\]+)',url,re.IGNORECASE | re.DOTALL)