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

12345678910111213141516171819202122232425262728
  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__='play.md'
  11. def supports(url):
  12. return not _regex(url) == None
  13. def resolve(link):
  14. if _regex(link):
  15. data = util.request(link)
  16. url = re.search('base_url\: \"(?P<url>[^\"]+)',data)
  17. file = re.search('file_name\: \"(?P<url>[^\"]+)',data)
  18. res = re.search('resolutions\: \"(?P<url>[^\"]+)',data)
  19. if url and file and res:
  20. url = '%s/%s/%s' % (url.group('url'),res.group('url'),file.group('url'))
  21. return [{'quality':res.group('url'),'url':url}]
  22. def _regex(url):
  23. return re.search('play\.md',url,re.IGNORECASE | re.DOTALL)