film_on 0.0.13 → 0.0.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/film_on/models/movie.rb +18 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4787ad8b4cebe28bc0697fdd716a4c1a585a12b5
|
4
|
+
data.tar.gz: dd0e52bf341b6458aebeac666a3a18dd3f983722
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ceb65b48a1bf538e31fd72934a794d1ee27f5205a2e77d8f469e16aa70d97e26ad8f06dc74d639cc9ad5c296fe9d04d80a4c1d62ddbb9591dbeab09903df7e09
|
7
|
+
data.tar.gz: 108a188e016bcaf4e3b42ef0c544c54755629f6c8a506e2b7b6a308890ca558ee809db4aec9337e3dc08a2a6dd1619873078ec0c4b2d123ab8343f2dce0dab28
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.14
|
data/lib/film_on/models/movie.rb
CHANGED
@@ -8,10 +8,12 @@ module FilmOn
|
|
8
8
|
|
9
9
|
class Movie
|
10
10
|
|
11
|
+
Image = Struct.new(:type, :width, :height, :url)
|
12
|
+
|
11
13
|
attr_reader :id, :title, :slug, :description, :type_id, :series_number, :episodes_count, :vendor_id, :vendorka_id
|
12
14
|
attr_reader :content_host, :low_quality_file_id, :high_quality_file_id, :parent_id, :exists_on_edgecast
|
13
15
|
attr_reader :is_featured, :is_enabled, :deleted_at, :genres, :cast, :crew, :artwork, :poster, :georule, :type
|
14
|
-
attr_reader :streams, :content_blocked
|
16
|
+
attr_reader :streams, :content_blocked, :poster_small, :poster_medium, :poster_large
|
15
17
|
|
16
18
|
def initialize(hash)
|
17
19
|
@id = hash["id"]
|
@@ -35,13 +37,27 @@ module FilmOn
|
|
35
37
|
@cast = hash["cast"]
|
36
38
|
@crew = hash["crew"]
|
37
39
|
@artwork = hash["artwork"] #TODO convert to image structs
|
38
|
-
@poster = hash["poster"]
|
40
|
+
@poster = hash["poster"]
|
41
|
+
@poster_small = get_image(:small, hash["poster"])
|
42
|
+
@poster_medium = get_image(:medium, hash["poster"])
|
43
|
+
@poster_large = get_image(:large, hash["poster"])
|
39
44
|
@georule = hash["georule"]
|
40
45
|
@type = hash["type"]
|
41
46
|
@streams = hash["streams"]
|
42
47
|
@content_blocked = hash["content_blocked"]
|
43
48
|
end
|
44
49
|
|
50
|
+
def get_image(type, image)
|
51
|
+
return {} unless image.is_a?(Hash)
|
52
|
+
case type
|
53
|
+
when :small
|
54
|
+
image = (image["thumbs"] && image["thumbs"]["thumb_120p"]) ? image["thumbs"]["thumb_120p"] : image
|
55
|
+
when :medium
|
56
|
+
image = (image["thumbs"] && image["thumbs"]["thumb_220p"]) ? image["thumbs"]["thumb_220p"] : image
|
57
|
+
end
|
58
|
+
Image.new(image["type"], image["width"], image["height"], image["url"])
|
59
|
+
end
|
60
|
+
|
45
61
|
end
|
46
62
|
|
47
63
|
end
|