md2slides 0.0.3 → 0.0.4
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 +4 -4
- data/README.md +25 -26
- data/lib/md2slides/presentation.rb +10 -3
- data/lib/md2slides/version.rb +1 -1
- data/lib/md2slides/video.rb +5 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37da571eb1e048ee8704c95778e990564251cc1dfed86fb0e5c92c8d63378227
|
4
|
+
data.tar.gz: ef0f3367747ea41eb5e0850ac02a6d844a9b69ca9af8fe1395c3c19484f0fd88
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b65446aa4824038aa84c4f7f9954ed6986d8ae3e7c8107806b803f4e75df8fd199c10061371075c229d5886f767d725b21430f3d2611cbf268b2d7b8dc779bb
|
7
|
+
data.tar.gz: 9e0a800ed47263fe9fd3b55a226891f987a2bb91f6eb32396bfe8e8bf6eebdbe01790d23e066ea8cb18e0a369e8c4a56f00cab71b69c5ccca978bc855663163c
|
data/README.md
CHANGED
@@ -3,6 +3,22 @@
|
|
3
3
|
A video file of a presentation will be also generated, and it may contains narration if supplied.
|
4
4
|
Narration can be given as notes in slides, and the audio will be generated using Google text-to-speech API and ffmpeg.
|
5
5
|
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
install by gem:
|
9
|
+
|
10
|
+
% gem install md2slides
|
11
|
+
|
12
|
+
Or add this line to your application's Gemfile:
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
gem 'md2slides'
|
16
|
+
```
|
17
|
+
|
18
|
+
and then execute:
|
19
|
+
|
20
|
+
$ bundle
|
21
|
+
|
6
22
|
## Quick start
|
7
23
|
1. Generate your Google API credentials and copy it to credentails.json:
|
8
24
|
```
|
@@ -24,14 +40,9 @@ Narration can be given as notes in slides, and the audio will be generated using
|
|
24
40
|
```
|
25
41
|
2. install ffmpeg if necessary (if producing video file).
|
26
42
|
|
27
|
-
3.
|
28
|
-
```
|
29
|
-
% bundle install --path vendor/bundle
|
30
|
-
```
|
31
|
-
|
32
|
-
4. create an empty Google slide.
|
43
|
+
3. create an empty Google slide, share it with **client_email** user, and copy the URL.
|
33
44
|
|
34
|
-
|
45
|
+
4. write a markdown file.
|
35
46
|
```
|
36
47
|
cat >> doc/sample.md
|
37
48
|
---
|
@@ -53,33 +64,21 @@ narration text...
|
|
53
64
|
^D (this means CTRL + D)
|
54
65
|
```
|
55
66
|
|
56
|
-
|
67
|
+
5. run the script.
|
57
68
|
```
|
58
|
-
|
69
|
+
% md2slides sample.md
|
59
70
|
```
|
60
71
|
|
61
|
-
|
62
|
-
|
63
|
-
## Installation
|
64
|
-
|
65
|
-
Add this line to your application's Gemfile:
|
66
|
-
|
67
|
-
```ruby
|
68
|
-
gem 'md2slides'
|
69
|
-
```
|
70
|
-
|
71
|
-
And then execute:
|
72
|
-
|
73
|
-
$ bundle
|
74
|
-
|
75
|
-
Or install it yourself as:
|
76
|
-
|
77
|
-
$ gem install md2slides
|
72
|
+
the Google presentation is updated, and the video is stored in the current directory.
|
78
73
|
|
79
74
|
## Usage
|
80
75
|
|
81
76
|
TODO: Write usage instructions here
|
82
77
|
|
78
|
+
## TODO
|
79
|
+
|
80
|
+
See [TODO.md](https://github.com/ohmori7/md2slides/blob/main/TODO.md "TODO.md")
|
81
|
+
|
83
82
|
## Development
|
84
83
|
|
85
84
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -16,7 +16,7 @@ class Presentation
|
|
16
16
|
attr_reader :id
|
17
17
|
|
18
18
|
def self.filename_sanitize(s)
|
19
|
-
s
|
19
|
+
s&.gsub(/[\/\\:\*\?"<>\|]/, '')
|
20
20
|
end
|
21
21
|
|
22
22
|
def initialize(url = nil)
|
@@ -40,7 +40,14 @@ class Presentation
|
|
40
40
|
@drive_service.authorization = @authorizer
|
41
41
|
|
42
42
|
if @id
|
43
|
-
|
43
|
+
begin
|
44
|
+
@presentation = @slides_service.get_presentation(@id)
|
45
|
+
rescue => e
|
46
|
+
require 'webrick'
|
47
|
+
raise(e, "#{e.message} (#{e.status_code} " +
|
48
|
+
"#{WEBrick::HTTPStatus.reason_phrase(e.status_code)})\n" +
|
49
|
+
"#{e.full_message}")
|
50
|
+
end
|
44
51
|
end
|
45
52
|
|
46
53
|
@requests = []
|
@@ -60,7 +67,7 @@ class Presentation
|
|
60
67
|
|
61
68
|
def existence_check
|
62
69
|
if ! exists?
|
63
|
-
raise("presentation (ID: #{@id})does not exists!!!")
|
70
|
+
raise("presentation (ID: #{@id}) does not exists!!!")
|
64
71
|
end
|
65
72
|
end
|
66
73
|
|
data/lib/md2slides/version.rb
CHANGED
data/lib/md2slides/video.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
require 'open3'
|
2
2
|
|
3
3
|
class Presentation
|
4
|
+
VIDEO_FRAME_RATE = 1
|
5
|
+
VIDEO_ONLY_DURATION = 4
|
6
|
+
|
4
7
|
def generate_slide_video(i, dir)
|
5
8
|
img = __data_slide_path(i, '.png', dir)
|
6
9
|
audio = __data_slide_path(i, '.m4a', dir)
|
@@ -11,11 +14,11 @@ class Presentation
|
|
11
14
|
timeopt = '-shortest'
|
12
15
|
else
|
13
16
|
audioin = "-f lavfi -i aevalsrc=0"
|
14
|
-
timeopt = "-vframes
|
17
|
+
timeopt = "-vframes #{VIDEO_FRAME_RATE * VIDEO_ONLY_DURATION}"
|
15
18
|
end
|
16
19
|
cmd = <<~CMD
|
17
20
|
ffmpeg -hide_banner -y \
|
18
|
-
-framerate
|
21
|
+
-framerate #{VIDEO_FRAME_RATE} -loop 1 -i "#{img}" \
|
19
22
|
#{audioin} -map 0:v:0 -map 1:a:0 \
|
20
23
|
-c:v libx264 -tune stillimage \
|
21
24
|
-c:a aac -ar #{AUDIO_RATE} -ac 1 \
|