pptx2medias 0.0.1
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 +7 -0
- data/bin/pptx2medias +4 -0
- data/lib/pptx2medias.rb +35 -0
- metadata +46 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e3fddb47e4e67dd4714f47bcdbe2a8a01f0d647361e07aa2e6ab484b6475ee76
|
4
|
+
data.tar.gz: 16a191cd11e90a6f6d3cfd3c6fbc8b87475b068222a6d8e8700cbd05d3c988b2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2edc044dcf1cb4e1865608e40c97357469e351d2357aed7e974986f10476bb5d1b712f67d86214b125edb88ba3bd22dc4947a926c283810e722d5bb1d04d843e
|
7
|
+
data.tar.gz: 7d5074bedb416e9696555e6d2f1e9e4fef930f695d21287beab216bf0fca98e424739578ddb07221d305fe5e4a9908cd373888243650374e5a186ef957288d2d
|
data/bin/pptx2medias
ADDED
data/lib/pptx2medias.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
module Pptx2Medias
|
2
|
+
VERSION = '0.0.1'
|
3
|
+
|
4
|
+
def self.extract(file_path)
|
5
|
+
file_type = `file -b "#{file_path}"`
|
6
|
+
file_ext = File.extname(file_path)
|
7
|
+
|
8
|
+
puts "- Input file: #{file_path}"
|
9
|
+
puts "- File type: #{file_type}"
|
10
|
+
|
11
|
+
unless file_type.include?('PowerPoint') && file_ext == '.pptx'
|
12
|
+
puts 'Input file is not a valid PPTX. Exiting...'
|
13
|
+
return
|
14
|
+
end
|
15
|
+
|
16
|
+
puts 'Input file is a PowerPoint presentation. Processing...'
|
17
|
+
|
18
|
+
dir = File.dirname(file_path)
|
19
|
+
basename = File.basename(file_path, file_ext)
|
20
|
+
|
21
|
+
system("cp \"#{file_path}\" \"#{dir}/archive.zip\"")
|
22
|
+
system("unzip \"#{dir}/archive.zip\" ppt/media/* -d #{dir}")
|
23
|
+
system("mv \"#{dir}/ppt/media\" \"#{dir}/#{basename}_media\"")
|
24
|
+
|
25
|
+
medias_count = `ls -1 \"#{dir}/#{basename}_media\" | wc -l`.strip.to_i
|
26
|
+
videos_count = `ls -1 \"#{dir}/#{basename}_media\" | grep .mp4 | wc -l`.strip.to_i
|
27
|
+
|
28
|
+
puts "File has been processed. Found #{medias_count} medias (including #{videos_count} videos). Cleaning..."
|
29
|
+
|
30
|
+
system("rmdir \"#{dir}/ppt\"")
|
31
|
+
system("rm \"#{dir}/archive.zip\"")
|
32
|
+
|
33
|
+
puts "Done!"
|
34
|
+
end
|
35
|
+
end
|
metadata
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pptx2medias
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Sébastien Gaya
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-07-30 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Extracts media files (images, videos, sounds) from a PPTX file.
|
14
|
+
email:
|
15
|
+
- sebastien.gaya@gmail.com
|
16
|
+
executables:
|
17
|
+
- pptx2medias
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- bin/pptx2medias
|
22
|
+
- lib/pptx2medias.rb
|
23
|
+
homepage: http://rubygems.org/gems/pptx2medias
|
24
|
+
licenses:
|
25
|
+
- MIT
|
26
|
+
metadata: {}
|
27
|
+
post_install_message:
|
28
|
+
rdoc_options: []
|
29
|
+
require_paths:
|
30
|
+
- lib
|
31
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - ">="
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '0'
|
36
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
requirements: []
|
42
|
+
rubygems_version: 3.1.2
|
43
|
+
signing_key:
|
44
|
+
specification_version: 4
|
45
|
+
summary: Get medias from your PowerPoint presentation!
|
46
|
+
test_files: []
|