Permalink
Browse files

Fixed some more issues

  • Loading branch information...
1 parent f40a08b commit e244b9e24bf9d425b4cccc5867375d04f2f2bc0c amix committed May 13, 2014
Showing with 61 additions and 16 deletions.
  1. +34 −7 lib/media-parser.js
  2. +25 −7 src/media_services.coffee
  3. +2 −2 src/media_types.coffee
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -100,7 +100,6 @@ MediaServices = {
match = cnt.match(MediaServices.providers.Yfrog)
if match
MediaTypes.imageEntity(callback, {
- 'underlying_type': 'image'
'sizes': {
'small': 100,
'medium': 640
@@ -140,10 +139,24 @@ MediaServices = {
# --- Hulu
parseHulu: (cnt, callback, timeout) ->
- return MediaTypes.genericOemebed(cnt, callback,
- MediaServices.providers.Hulu,
- 'http://www.hulu.com/api/oembed?url={0}&format=json',
- timeout, 'video')
+ match = cnt.match(MediaServices.providers.Hulu)
+ if match
+ MediaTypes.oembedImageEntitiy(callback, {
+ 'underlying_type': 'video'
+ 'timeout': timeout
+ 'sizes': {
+ 'r': 145,
+ 'l': 512
+ }
+ 'match': match
+ 'oembed_template': 'http://www.hulu.com/api/oembed?url={0}&format=json'
+ 'custom_thumbnail_url': (turl, best_size, json) ->
+ if best_size == 'r'
+ return [json.thumbnail_url, json.thumbnail_width, json.thumbnail_height]
+ else
+ return [json.large_thumbnail_url, json.large_thumbnail_width, json.large_thumbnail_height]
+ })
+ return true
# --- Justin
parseJustin: (cnt, callback, timeout) ->
@@ -201,7 +214,8 @@ MediaServices = {
'match': match
'oembed_template': "http://vimeo.com/api/oembed.json?url={0}"
'custom_thumbnail_url': (turl, best_size) ->
- return turl.replace(/_\d+\.jpg$/i, "_" + best_size + ".jpg")
+ size = parseInt(best_size)
+ return [turl.replace(/_\d+\.jpg$/i, "_" + best_size + ".jpg"), size, size]
})
return true
@@ -223,7 +237,11 @@ MediaServices = {
turl = turl.replace(/thumbnail(?:-\d)?\.jpg/, "thumbnail-" + best_size + ".jpg")
if turl.indexOf('http') != 0
turl = 'http:' + turl
- return turl
+ if best_size == '3'
+ size = 240
+ else
+ size = 576
+ return [turl, size, size]
})
return true
View
@@ -39,8 +39,8 @@ MediaTypes = {
width = opts.sizes[best_size]
turl = json.thumbnail_url
custom_turl = opts.custom_thumbnail_url(turl, best_size, json)
- if custom_turl
- return [custom_turl.replace('http:', 'https:'), width]
+ custom_turl[0] = custom_turl[0].replace('http:', 'https:')
+ return custom_turl
# Default
turl = json.thumbnail_url

0 comments on commit e244b9e

Please sign in to comment.