videos 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/app/css/views.index.css +1 -0
- data/app/js/controllers.index.js +19 -3
- data/lib/videos.rb +1 -0
- data/lib/videos/core_ext/pathname.rb +1 -1
- data/lib/videos/update.rb +1 -1
- data/lib/videos/version.rb +1 -1
- data/lib/videos/video.rb +22 -5
- data/lib/videos/videos.rb +2 -1
- data/videos.gemspec +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
M2UwMzM2OWI1ZDU0ODViNTMzOTJiMzIyYTlhNTQ3ZjM0YzQyNTk1Nw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NmQ1OTE0YmI0MTJiYmZkMGE3N2YyMWM4NTJlMjJiNmEwNzJhMjExOQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NjI2ZmE3NmNmNGVjZDQzMWE4Nzg5ZTFhN2RkYTI4ZWQ3YWViN2RiOTIzYjkz
|
10
|
+
NWU5YzJiMmI3ODA5NTYxYzhlNmFkZDY2ZGVkZjQ5MmFhZTE0ZGEzODI2NjMx
|
11
|
+
NTkyNDg4MzRiMTJlMWEzMWQ3NmI5NDcxYzEzZDczZDYwMjRjYWU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZDMyMGQzMjc3OGJiYTljMTY3Y2ZjMWI2YjM4ZjQ4ZjRiZjVkMTNmOGNkM2Ux
|
14
|
+
NzQ0ZWJiNjVlYWMzMzIxMDU0ZWJkYmM3NDFlNGY0OTZlOThlYjE1MjI1YTM0
|
15
|
+
NDg2OWJmMDJiNGM3MmM0MmIzNGFlMmIxM2ZlZGNhZTU3OGI4M2Q=
|
data/app/css/views.index.css
CHANGED
@@ -31,6 +31,7 @@
|
|
31
31
|
#items li .info { padding: 2px; }
|
32
32
|
#items li .info img { vertical-align: middle; }
|
33
33
|
#items li .info .title { padding-bottom: 3px; }
|
34
|
+
#items li .info .labels { margin-bottom: 4px; }
|
34
35
|
#items .tag_list { min-height: 1.2em; }
|
35
36
|
#items .tag_list:hover { background-color: #ffffaa; }
|
36
37
|
#items input { width: 100%; }
|
data/app/js/controllers.index.js
CHANGED
@@ -21,7 +21,7 @@ controllers.index = function(search, sort, sortDirection) {
|
|
21
21
|
_.each(words, function(word) {
|
22
22
|
regex = RegExp(word, "i");
|
23
23
|
videos = _.filter(videos, function(video) {
|
24
|
-
return video.title.match(regex);
|
24
|
+
return video.title.match(regex) || video.resolution.match(regex);
|
25
25
|
});
|
26
26
|
});
|
27
27
|
}
|
@@ -84,7 +84,7 @@ controllers.index = function(search, sort, sortDirection) {
|
|
84
84
|
return a.href;
|
85
85
|
}
|
86
86
|
|
87
|
-
function
|
87
|
+
function formatLengthNumeric(length) {
|
88
88
|
var out = [];
|
89
89
|
if(length >= 3600) {
|
90
90
|
out.push(Math.floor(length / 3600) + "h");
|
@@ -100,6 +100,21 @@ controllers.index = function(search, sort, sortDirection) {
|
|
100
100
|
return out.join(" ");
|
101
101
|
}
|
102
102
|
|
103
|
+
function formatLength(length) {
|
104
|
+
return '<span class="label label-default" title="Video Length"><span class="glyphicon glyphicon-expand"></span> ' +
|
105
|
+
formatLengthNumeric(length) + '</span>';
|
106
|
+
}
|
107
|
+
|
108
|
+
function formatResolution(resolution) {
|
109
|
+
if(resolution == "1080p") {
|
110
|
+
return '<span class="label label-success" title="Video Width/Height"><span class="glyphicon ' +
|
111
|
+
'glyphicon-hd-video"></span> 1080p</span>';
|
112
|
+
}
|
113
|
+
else {
|
114
|
+
return '<span class="label label-default" title="Video Width/Height">' + resolution + '</span>';
|
115
|
+
}
|
116
|
+
}
|
117
|
+
|
103
118
|
function addVideos(videos) {
|
104
119
|
$("#items").empty();
|
105
120
|
|
@@ -114,7 +129,8 @@ controllers.index = function(search, sort, sortDirection) {
|
|
114
129
|
item.append(link);
|
115
130
|
|
116
131
|
item.append('<div class="info-wrapper"><div class="info"><div class="title">' + video.title + '</div>' +
|
117
|
-
'<
|
132
|
+
'<div class="labels">' + formatLength(video.length) + ' ' + formatResolution(video.resolution) +
|
133
|
+
'</div></div>');
|
118
134
|
|
119
135
|
$("#items").append(item);
|
120
136
|
});
|
data/lib/videos.rb
CHANGED
data/lib/videos/update.rb
CHANGED
data/lib/videos/version.rb
CHANGED
data/lib/videos/video.rb
CHANGED
@@ -70,11 +70,13 @@ class Videos::Video
|
|
70
70
|
end
|
71
71
|
|
72
72
|
def get_metadata
|
73
|
-
return unless
|
73
|
+
return unless metadata.keys.empty?
|
74
74
|
|
75
|
-
output = `
|
76
|
-
|
77
|
-
@length =
|
75
|
+
output = `mediainfo -f --Output=XML #{path.to_s.shellescape}`
|
76
|
+
doc = Nokogiri::XML.parse(output)
|
77
|
+
@metadata["length"] = (e = doc.search("File Duration").first) ? e.text.to_i : 0
|
78
|
+
@metadata["width"] = (e = doc.search("File Width").first) ? e.text.to_i : 0
|
79
|
+
@metadata["height"] = (e = doc.search("File Height").first) ? e.text.to_i : 0
|
78
80
|
end
|
79
81
|
|
80
82
|
def self.from_hash(videos_package, data)
|
@@ -89,8 +91,23 @@ class Videos::Video
|
|
89
91
|
"title" => title,
|
90
92
|
"publishedOn" => path.mtime.to_i,
|
91
93
|
"thumbnailUrl" => thumbnail_url,
|
92
|
-
"length" => length,
|
94
|
+
"length" => (metadata["length"] / 1000.0).round,
|
95
|
+
"width" => metadata["width"],
|
96
|
+
"height" => metadata["height"],
|
97
|
+
"resolution" => approx_resolution,
|
93
98
|
"key" => path_hash
|
94
99
|
}
|
95
100
|
end
|
101
|
+
|
102
|
+
private
|
103
|
+
def approx_resolution
|
104
|
+
if metadata["width"] == 1920 && metadata["height"] == 1080
|
105
|
+
"1080p"
|
106
|
+
elsif
|
107
|
+
metadata["width"] == 1280 && metadata["height"] == 720
|
108
|
+
"720p"
|
109
|
+
else
|
110
|
+
"#{metadata["width"]}x#{metadata["height"]}"
|
111
|
+
end
|
112
|
+
end
|
96
113
|
end
|
data/lib/videos/videos.rb
CHANGED
@@ -3,7 +3,8 @@ class Videos::Videos
|
|
3
3
|
attr_reader :videos_path
|
4
4
|
|
5
5
|
def pathname_to_url(path, relative_from)
|
6
|
-
|
6
|
+
url = path.relative_path_from(relative_from)
|
7
|
+
(url.dirname + URI.escape(url.basename.to_s, URI::REGEXP::PATTERN::RESERVED).force_encoding("utf-8")).to_s
|
7
8
|
end
|
8
9
|
|
9
10
|
def url_to_pathname(url)
|
data/videos.gemspec
CHANGED
@@ -18,6 +18,7 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.add_dependency "addressable", ">= 2.3.5"
|
19
19
|
s.add_dependency "naturally", ">= 1.0.3"
|
20
20
|
s.add_dependency "rmagick", ">= 2.13.1"
|
21
|
+
s.add_dependency "nokogiri", ">= 0"
|
21
22
|
|
22
23
|
s.files = `git ls-files`.split("\n")
|
23
24
|
s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: videos
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brenton "B-Train" Fletcher
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - ! '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 2.13.1
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: nokogiri
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ! '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ! '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
description: A collection of videos is a directory (the container) containing both
|
70
84
|
video files and directories that have video files in them. Videos indexes a collection
|
71
85
|
in this format, and generates a HTML/JS Single Page Application (SPA) that allows
|