-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtweet.rake
More file actions
28 lines (18 loc) · 835 Bytes
/
tweet.rake
File metadata and controls
28 lines (18 loc) · 835 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
require './lib/twitter_client.rb'
namespace :tweet do
desc "Seek to the latest frame, export it, and then tweet it"
task next: :environment do
film = Film.find(1)
return if film.timestamp == film.length
film.increment!
command = `ffmpeg -ss #{film.timestamp} -i public/#{film.source_file} -s #{film.size} -an -vframes 1 tmp/snapshots/#{film.source_file}-#{film.timestamp}-%05d.jpg`
api = TwitterClient.build
file = File.open("./tmp/snapshots/#{film.source_file}-#{film.timestamp}-00001.jpg")
api.update_with_media(nil, file, {})
cleanup = `rm tmp/snapshots/*`
end
task frame: :environment do
film = Film.find(1)
command = `ffmpeg -ss 00:08:00.1000 -i public/#{film.source_file} -s #{film.size} -an -vframes 1 tmp/snapshots/#{film.source_file}-00:08:00.1000-%05d.jpg`
end
end