jwthumbs 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5876c6963e6df7b78a4aaf8a3889dedc0b9e50be
4
- data.tar.gz: 7a255034e3cedd695e0e56b09427887339a4913f
3
+ metadata.gz: 61e03b7571c388ee6177d85052127d28f51bcfaa
4
+ data.tar.gz: b05214162237a8824b1d138ee01cf55d464acab3
5
5
  SHA512:
6
- metadata.gz: fc8b3eb567b6e9329caa4a343badd5c0d2b8b81b39e149d67fd2575b955dfc01d2077963a7797ede9d5d05b2fa6010fbebbbb461afbbabe45371b05e44a59324
7
- data.tar.gz: 9a2ab54410723e29536589eac4dc447e76f97740624cbae085679177b602a7b3c52989f13f27494b2c8913fd6216c70be9ecb9a1b1e33ff27801b86da7e903ed
6
+ metadata.gz: 2615caa6f94182617d8006daaa7baab6cbd2d6cc5af74288f469eb9d97ce26e9760a63fe94a687aa17c497f2eba4b52b9efbabf8a17fe039a7a5d97d7d4bed1f
7
+ data.tar.gz: 3cdcef6c802a27b19a1044ca241cb0f877610a5d311a26176f5cad3aa5d2cd277fe4c63c2644eedd37ac6697242b7a0eb3714d22ccb096d0e644ef197d2f6738
data/.gitignore CHANGED
@@ -16,3 +16,4 @@ spec/reports
16
16
  test/tmp
17
17
  test/version_tmp
18
18
  tmp
19
+ output
@@ -0,0 +1,9 @@
1
+ before_script: "sudo sh ffmpeg.sh"
2
+ language: ruby
3
+ rvm:
4
+ - "1.9.3"
5
+ - "2.0.0"
6
+ - "2.1.0"
7
+ - rbx
8
+ # uncomment this line if your project needs to run something other than `rake`:
9
+ # script: bundle exec rspec spec
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
+ [![Build Status](https://travis-ci.org/scaryguy/jwthumbs.png?branch=master)](https://travis-ci.org/scaryguy/jwthumbs)
2
+
1
3
  # JWthumbs
2
4
 
3
- Want to add tooltip thumbnails to your JWPlayer or another HTML5 video player? You're welcome!
5
+ Want to add tooltip thumbnails to your JWPlayer? You're welcome!
4
6
 
5
7
  JWthumbs is a Ruby gem to create a .VTT file and a sprite of thumbnails of a given video file (mp4, mpg, avi, mov and so on...). You can't create timeline thumnails easier than this. Heavily inspired by [vlanard](https://github.com/vlanard)'s great [Python script](https://github.com/vlanard/videoscripts).
6
8
 
data/Rakefile CHANGED
@@ -1 +1,4 @@
1
1
  require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+ task :default => :spec
4
+ RSpec::Core::RakeTask.new
@@ -0,0 +1,51 @@
1
+ #!/bin/bash
2
+
3
+ apt-get -y update
4
+ apt-get -y install libjpeg-dev libpng12-dev libtiff4-dev curl apache2 wget imagemagick libimage-exiftool-perl unzip lame autoconf build-essential checkinstall git libass-dev libfaac-dev libgpac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev librtmp-dev libtheora-dev libtool libvorbis-dev pkg-config texi2html zlib1g-dev ffmpeg2theora poppler-utils
5
+ apt-get install imagemagick
6
+ ## Install ffmpeg from source
7
+ mkdir ~/ffmpeg-source
8
+ cd ~/ffmpeg-source
9
+ wget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz
10
+ tar xzvf yasm-1.2.0.tar.gz && rm -rf yasm-1.2.0.tar.gz
11
+ cd yasm-1.2.0
12
+ ./configure
13
+ make
14
+ checkinstall --pkgname=yasm --pkgversion="1.2.0" --backup=no --deldoc=yes --fstrans=no --default
15
+ cd ~/ffmpeg-source
16
+ git clone git://git.videolan.org/x264.git
17
+ cd x264
18
+ ./configure --enable-static --enable-shared
19
+ make
20
+ checkinstall --pkgname=x264 --pkgversion="3:$(./version.sh | awk -F'[" ]' '/POINT/{print $4"+git"$5}')" --backup=no --deldoc=yes --fstrans=no --default
21
+ ldconfig
22
+ cd ~/ffmpeg-source
23
+ git clone --depth 1 git://github.com/mstorsjo/fdk-aac.git
24
+ cd fdk-aac
25
+ autoreconf -fiv
26
+ ./configure --disable-shared
27
+ make
28
+ checkinstall --pkgname=fdk-aac --pkgversion="$(date +%Y%m%d%H%M)-git" --backup=no --deldoc=yes --fstrans=no --default
29
+ cd ~/ffmpeg-source
30
+ git clone --depth 1 http://git.chromium.org/webm/libvpx.git
31
+ cd libvpx
32
+ ./configure --disable-examples --disable-unit-tests
33
+ make
34
+ checkinstall --pkgname=libvpx --pkgversion="1:$(date +%Y%m%d%H%M)-git" --backup=no --deldoc=yes --fstrans=no --default
35
+ cd ~/ffmpeg-source
36
+ git clone --depth 1 git://git.xiph.org/opus.git
37
+ cd opus
38
+ ./autogen.sh
39
+ ./configure --disable-shared
40
+ make
41
+ checkinstall --pkgname=libopus --pkgversion="$(date +%Y%lsm%d%H%M)-git" --backup=no --deldoc=yes --fstrans=no --default
42
+ cd ~/ffmpeg-source
43
+ wget http://www.ffmpeg.org/releases/ffmpeg-1.1.1.tar.gz
44
+ tar xf ffmpeg-1.1.1.tar.gz && rm -rf ffmpeg-1.1.1.tar.gz
45
+ cd ffmpeg-1.1.1
46
+ ./configure --enable-gpl --enable-libass --enable-libfaac --enable-libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp \
47
+ --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-version3 --enable-libopus
48
+ make
49
+ checkinstall --pkgname=ffmpeg --pkgversion="7:$(date +%Y%m%d%H%M)-git" --backup=no --deldoc=yes --fstrans=no --default
50
+ hash -r
51
+ cd ~
@@ -1,3 +1,3 @@
1
1
  module Jwthumbs
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -5,7 +5,7 @@ module Jwthumbs
5
5
  class Movie
6
6
 
7
7
  attr_reader :file_path, :duration
8
- attr_accessor :outdir, :seconds_between, :thumb_width, :vttfile, :spritefile, :clear_files
8
+ attr_accessor :outdir, :seconds_between, :thumb_width, :vttfile, :spritefile, :clear_files, :gallery_mode_on
9
9
 
10
10
  def initialize(file_path=nil, options={})
11
11
  raise Errno::ENOENT, "the file '#{file_path}' does not exist" unless File.exists?(file_path)
@@ -22,7 +22,8 @@ module Jwthumbs
22
22
  @spritefile = options[:spritefile] ||= "#{File.basename(@file_path, File.extname(@file_path))}_sprite.jpg"
23
23
  @vttfile_name = options[:vttfile_name] ||= "thumbs.vtt"
24
24
  @outdir = options[:thumb_outdir] ||= "output/thumbs_#{Time.now.to_i.to_s}"
25
- @vttfile = File.basename(@file_path, File.extname(@file_path))+"_"+@vttfile_name
25
+ @vttfile = File.basename(@file_path, File.extname(@file_path))+"_"+@vttfile_name
26
+ @gallery_mode_on = options[:gallery_mode_on] ||= false
26
27
  end
27
28
 
28
29
 
@@ -27,8 +27,8 @@ module Jwthumbs
27
27
  coords = get_geometry(@images.first)
28
28
  gridsize = Math.sqrt(@images.length).ceil.to_i
29
29
  gridsize = gridsize <= 0 ? 1 : gridsize
30
- create_sprite(@movie.outdir, @movie.spritefile, coords, gridsize)
31
- create_vtt(@movie, @movie.spritefile, @images.length, coords, gridsize)
30
+ create_sprite(@movie.outdir, @movie.spritefile, coords, gridsize) if !@movie.gallery_mode_on
31
+ create_vtt(@movie, @movie.spritefile, @images.length, coords, gridsize) if !@movie.gallery_mode_on
32
32
  end
33
33
 
34
34
  def create_vtt(movie, spritefile, images_count, coords, gridsize)
@@ -39,8 +39,9 @@ module Jwthumbs
39
39
  grid = "#{gridsize}x#{gridsize}"
40
40
  cmd = "montage #{outdir}/thumbnail*.jpg -tile #{grid} -geometry #{coords} #{outdir}/#{spritefile}"
41
41
  Jwthumbs.logger.info(system(cmd))
42
+
42
43
  end
43
-
44
+
44
45
 
45
46
  def take_snaps
46
47
  rate = "1/#{@movie.seconds_between}"
data/lib/vtt.rb CHANGED
@@ -5,6 +5,7 @@ module Jwthumbs
5
5
  @movie = movie
6
6
  create(movie, spritefile, images_count, coords, gridsize)
7
7
  clear_files if @movie.clear_files
8
+
8
9
  end
9
10
 
10
11
  def create(movie, spritefile, images_count, coords, gridsize)
@@ -29,16 +30,18 @@ module Jwthumbs
29
30
  clipstart = clipend
30
31
  clipend = clipend + thumb_rate
31
32
  end
32
-
33
- vtt_path = movie.outdir+"/"+movie.vttfile
34
- File.open(vtt_path, 'w+') do |f|
35
- f.write(vtt.join("\n"))
33
+
34
+ vtt_path = movie.outdir+"/"+movie.vttfile
35
+ File.open(vtt_path, 'w+') do |f|
36
+ f.write(vtt.join("\n"))
37
+
36
38
  end
37
-
39
+
38
40
  end
39
41
 
40
- protected
41
42
 
43
+ protected
44
+
42
45
  def clear_files
43
46
  Dir.glob("#{@movie.outdir}/thumbnail*.jpg") do |image|
44
47
 
@@ -63,7 +63,7 @@ describe "File progresses" do
63
63
  describe "VTT progresses" do
64
64
 
65
65
  describe "should create vtt file" do
66
- it { expect(File.file?("#{outdir}/#{@movie.spritefile}")).to eq true}
66
+ it { expect(File.file?("#{outdir}/#{@movie.vttfile}")).to eq true}
67
67
  end
68
68
 
69
69
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jwthumbs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - scary.mac
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-31 00:00:00.000000000 Z
11
+ date: 2014-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -64,10 +64,12 @@ files:
64
64
  - .rspec
65
65
  - .ruby-gemset
66
66
  - .ruby-version
67
+ - .travis.yml
67
68
  - Gemfile
68
69
  - LICENSE.txt
69
70
  - README.md
70
71
  - Rakefile
72
+ - ffmpeg.sh
71
73
  - fixtures/iki_dakka.mp4
72
74
  - jwthumbs.gemspec
73
75
  - lib/jwthumbs.rb