def test_return_provider(self): yt = 'http://www.youtube.com/watch?v=693m7iCh-TE' vimeo = 'http://vimeo.com/21443752' blip = 'http://blip.tv/file/4985985/' self.assertTrue(isinstance(get_provider(yt), Youtube)) self.assertTrue(isinstance(get_provider(vimeo), Vimeo)) self.assertTrue(isinstance(get_provider(blip), Embedly))
def magicembed(value, arg=None): '''value is the url and arg the size tuple ussage: {% http://myurl.com/|magicembed:"640x480" %}''' arg = [int(item) for item in arg.split('x')] provider = get_provider(value, arg) return mark_safe(provider.render_video())
def magicthumbnail(value): '''value is the url and arg the link_to another url ussage: {% http://myurl.com/|magicthumbnail: '/some/url' %}''' provider = get_provider(value) return provider.render_thumbnail()