diff options
author | Wojciech Polak <polak@gnu.org> | 2019-08-12 20:11:05 +0200 |
---|---|---|
committer | Wojciech Polak <polak@gnu.org> | 2019-08-12 20:11:05 +0200 |
commit | bcc984212b9f629454358ac6cd86c0b1e45b22f5 (patch) | |
tree | cca53322a73a2d9e5329af756128b9af100ff86f | |
parent | 1cf6c9b9eb1b170a37f542c6e43f9ac6a62e6531 (diff) | |
download | glifestream-bcc984212b9f629454358ac6cd86c0b1e45b22f5.tar.gz glifestream-bcc984212b9f629454358ac6cd86c0b1e45b22f5.tar.bz2 |
Use larger video thumbnails
-rw-r--r-- | glifestream/apis/vimeo.py | 12 | ||||
-rw-r--r-- | glifestream/apis/youtube.py | 11 | ||||
-rw-r--r-- | glifestream/filters/expand.py | 40 | ||||
-rw-r--r-- | glifestream/static/themes/default/style.css | 10 |
4 files changed, 49 insertions, 24 deletions
diff --git a/glifestream/apis/vimeo.py b/glifestream/apis/vimeo.py index e980103..6da0b11 100644 --- a/glifestream/apis/vimeo.py +++ b/glifestream/apis/vimeo.py @@ -140,11 +140,11 @@ class API: e.author_name = ent['user_name'] if self.service.public: - ent['thumbnail_medium'] = media.save_image( - ent['thumbnail_medium']) + ent['thumbnail_large'] = media.save_image( + ent['thumbnail_large'], downscale=True, size=(320, 180)) - e.content = """<table class="vc"><tr><td><div id="vimeo-%s" class="play-video"><a href="%s" rel="nofollow"><img src="%s" width="200" height="150" alt="%s" /></a><div class="playbutton"></div></div></td></tr></table>""" % ( - ent['id'], e.link, ent['thumbnail_medium'], ent['title']) + e.content = """<table class="vc"><tr><td><div id="vimeo-%s" class="play-video"><a href="%s" rel="nofollow"><img src="%s" width="320" height="180" alt="%s" /></a><div class="playbutton"></div></div></td></tr></table>""" % ( + ent['id'], e.link, ent['thumbnail_large'], ent['title']) mblob = media.mrss_init() mblob[ @@ -165,7 +165,9 @@ def get_thumbnail_url(id): r = httpclient.get('https://vimeo.com/api/v2/video/%s.json' % id) if r.status_code == 200: jsn = r.json() - if 'thumbnail_medium' in jsn[0]: + if 'thumbnail_large' in jsn[0]: + return jsn[0]['thumbnail_large'] + elif 'thumbnail_medium' in jsn[0]: return jsn[0]['thumbnail_medium'] except: pass diff --git a/glifestream/apis/youtube.py b/glifestream/apis/youtube.py index 6511756..509e385 100644 --- a/glifestream/apis/youtube.py +++ b/glifestream/apis/youtube.py @@ -115,18 +115,19 @@ class API: if vid and 'thumbnails' in snippet: tn = None - if 'high' in snippet['thumbnails']: - tn = snippet['thumbnails']['high'] - tn['width'], tn['height'] = 200, 150 - elif 'medium' in snippet['thumbnails']: + if 'medium' in snippet['thumbnails']: tn = snippet['thumbnails']['medium'] + tn['width'], tn['height'] = 320, 180 + elif 'high' in snippet['thumbnails']: + tn = snippet['thumbnails']['high'] tn['width'], tn['height'] = 200, 150 if not tn: tn = snippet['thumbnails']['default'] + tn['width'], tn['height'] = 200, 150 if self.service.public: tn['url'] = media.save_image(tn['url'], downscale=True, - size=(200, 150)) + size=(tn['width'], tn['height'])) e.content = """<table class="vc"><tr><td><div id="youtube-%s" class="play-video"><a href="%s" rel="nofollow"><img src="%s" width="%s" height="%s" alt="YouTube Video" /></a><div class="playbutton"></div></div></td></tr></table>""" % ( vid, e.link, tn['url'], tn['width'], tn['height']) diff --git a/glifestream/filters/expand.py b/glifestream/filters/expand.py index b84c344..09e5751 100644 --- a/glifestream/filters/expand.py +++ b/glifestream/filters/expand.py @@ -114,9 +114,11 @@ def __sv_youtube(m): ltag = rest.find('<') if rest else -1 rest = rest[ltag:] if ltag != -1 else '' link = 'https://www.youtube.com/watch?v=%s' % id - imgurl = 'http://i.ytimg.com/vi/%s/hqdefault.jpg' % id - imgurl = media.save_image(imgurl, downscale=True, size=(200, 150)) - return '<table class="vc"><tr><td><div data-id="youtube-%s" class="play-video"><a href="%s" rel="nofollow"><img src="%s" width="200" height="150" alt="YouTube Video" /></a><div class="playbutton"></div></div></td></tr></table>%s' % (id, link, imgurl, rest) + imgurl = 'http://i.ytimg.com/vi/%s/mqdefault.jpg' % id + imgurl = media.save_image(imgurl, downscale=True, size=(320, 180)) + return '<table class="vc"><tr><td><div data-id="youtube-%s" class="play-video"><a href="%s" rel="nofollow">' \ + '<img src="%s" width="320" height="180" alt="YouTube Video" /></a><div class="playbutton">' \ + '</div></div></td></tr></table>%s' % (id, link, imgurl, rest) def __sv_vimeo(m): @@ -127,8 +129,10 @@ def __sv_vimeo(m): link = m.group(0) imgurl = vimeo.get_thumbnail_url(id) if imgurl: - imgurl = media.save_image(imgurl) - return '<table class="vc"><tr><td><div data-id="vimeo-%s" class="play-video"><a href="%s" rel="nofollow"><img src="%s" width="200" height="150" alt="Vimeo Video" /></a><div class="playbutton"></div></div></td></tr></table>' % (id, link, imgurl) + imgurl = media.save_image(imgurl, downscale=True, size=(320, 180)) + return '<table class="vc"><tr><td><div data-id="vimeo-%s" class="play-video"><a href="%s" rel="nofollow">' \ + '<img src="%s" width="320" height="180" alt="Vimeo Video" /></a>' \ + '<div class="playbutton"></div></div></td></tr></table>' % (id, link, imgurl) else: return link @@ -136,19 +140,22 @@ def __sv_vimeo(m): def __sv_chtv(m): id = m.group(1) link = m.group(0) - return '<span data-id="chtv-%s" class="play-video video-inline"><a href="%s" rel="nofollow">%s</a></span>' % (id, link, link) + return '<span data-id="chtv-%s" class="play-video video-inline">' \ + '<a href="%s" rel="nofollow">%s</a></span>' % (id, link, link) def __sv_ustream(m): id = m.group(1) link = m.group(0) - return '<span data-id="ustream-%s" class="play-video video-inline"><a href="%s" rel="nofollow">%s</a></span>' % (id, link, link) + return '<span data-id="ustream-%s" class="play-video video-inline">' \ + '<a href="%s" rel="nofollow">%s</a></span>' % (id, link, link) def __sv_twitvid(m): id = m.group(2) link = m.group(0) - return '<span data-id="twitvid-%s" class="play-video video-inline"><a href="%s" rel="nofollow">%s</a></span>' % (id, link, link) + return '<span data-id="twitvid-%s" class="play-video video-inline">' \ + '<a href="%s" rel="nofollow">%s</a></span>' % (id, link, link) def __sv_dailymotion(m): @@ -159,7 +166,9 @@ def __sv_dailymotion(m): rest = rest[ltag:] if ltag != -1 else '' imgurl = 'http://www.dailymotion.com/thumbnail/160x120/video/%s' % id imgurl = media.save_image(imgurl) - return '<table class="vc"><tr><td><div data-id="dailymotion-%s" class="play-video"><a href="%s" rel="nofollow"><img src="%s" width="160" height="120" alt="Dailymotion Video" /></a><div class="playbutton"></div></div></td></tr></table>%s' % (id, link, imgurl, rest) + return '<table class="vc"><tr><td><div data-id="dailymotion-%s" class="play-video"><a href="%s" rel="nofollow">' \ + '<img src="%s" width="160" height="120" alt="Dailymotion Video" />' \ + '</a><div class="playbutton"></div></div></td></tr></table>%s' % (id, link, imgurl, rest) def __sv_metacafe(m): @@ -170,7 +179,9 @@ def __sv_metacafe(m): rest = rest[ltag:] if ltag != -1 else '' imgurl = 'http://www.metacafe.com/thumb/%s.jpg' % id imgurl = media.save_image(imgurl) - return '<table class="vc"><tr><td><div data-id="metacafe-%s" class="play-video"><a href="%s" rel="nofollow"><img src="%s" width="136" height="81" alt="Metacafe Video" /></a><div class="playbutton"></div></div></td></tr></table>%s' % (id, link, imgurl, rest) + return '<table class="vc"><tr><td><div data-id="metacafe-%s" class="play-video"><a href="%s" rel="nofollow">' \ + '<img src="%s" width="136" height="81" alt="Metacafe Video" /></a>' \ + '<div class="playbutton"></div></div></td></tr></table>%s' % (id, link, imgurl, rest) def __sv_googlevideo(m): @@ -179,7 +190,8 @@ def __sv_googlevideo(m): rest = m.group(2) ltag = rest.find('<') if rest else -1 rest = rest[ltag:] if ltag != -1 else '' - return '<div data-id="googlevideo-%s" class="play-video video-inline"><a href="%s" rel="nofollow">Google Video %s</a></div>%s' % (id, link, id, rest) + return '<div data-id="googlevideo-%s" class="play-video video-inline">' \ + '<a href="%s" rel="nofollow">Google Video %s</a></div>%s' % (id, link, id, rest) def videolinks(s): @@ -223,7 +235,8 @@ def __sa_ogg(m): def __sa_thesixtyone(m): link = m.group(0) songid = m.group(1) - return '<span data-id="thesixtyone-art-%s" class="play-audio"><a href="%s" rel="nofollow">%s</a></span>' % (songid, link, link) + return '<span data-id="thesixtyone-art-%s" class="play-audio">' \ + '<a href="%s" rel="nofollow">%s</a></span>' % (songid, link, link) def audiolinks(s): @@ -260,7 +273,8 @@ def __sm_googlemaps(m): ll = ll.split(',') geolat = float(ll[0]) geolng = float(ll[1]) - return '<div class="geo"><a href="%s" class="map"><span class="latitude">%.10f</span> <span class="longitude">%.10f</span></a></div>%s' % (link, geolat, geolng, rest) + return '<div class="geo"><a href="%s" class="map"><span class="latitude">%.10f</span> ' \ + '<span class="longitude">%.10f</span></a></div>%s' % (link, geolat, geolng, rest) else: return link diff --git a/glifestream/static/themes/default/style.css b/glifestream/static/themes/default/style.css index f04c895..f28c4f8 100644 --- a/glifestream/static/themes/default/style.css +++ b/glifestream/static/themes/default/style.css @@ -36,6 +36,7 @@ body { padding: 0; color: #333; background-color: white; + overflow-y: scroll !important; } header, footer, aside, nav, section, article { @@ -970,8 +971,15 @@ fieldset .hint { min-width: 0; padding: 0.5em; } - .entry-content { word-wrap: break-word; } + .entry-icon { + zoom: 0.6; + -moz-transform: scale(0.6); + -moz-transform-origin: 0 0; + } + #stream .entry-content { word-wrap: break-word; margin-left: 0; } .entry-info { margin-top: 7px !important; } .photo img, .gallery img, .thumbnails img, .screenshot img { max-width: 100%; height: auto; } + .play-video img { width: 100%; height: auto; } + table.vc { clear: both; } } |