Compare commits
No commits in common. "f0a1d7f136a09fefb26e208de35ea02c8750a9e8" and "9457717cfcc460fea9df954f912ce5a1a94264c4" have entirely different histories.
f0a1d7f136
...
9457717cfc
4 changed files with 65 additions and 52 deletions
44
README.md
44
README.md
|
@ -1,32 +1,26 @@
|
||||||
|
|
||||||
# FOSDEM Recorder
|
# FOSDEM Recorder
|
||||||
|
|
||||||
:turning_light: This project has been discontinued. It was replaced with [fosdem-recorder.cr](#FIXME).
|
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
* Make sure you have a recent Ruby version installed
|
* Make sure you have Ruby installed
|
||||||
* Make sure you have the 'bundler' Gem installed
|
* Make sure you have the 'bundler' Gem installed
|
||||||
|
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
Install project dependencies
|
Install project dependencies
|
||||||
|
|
||||||
$ bundle install
|
$ bundle install
|
||||||
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Get information about given URL
|
Get information about given URL
|
||||||
|
|
||||||
$ fosdem_recorder info URL
|
$ bundle exec fosdem-recorder info URL
|
||||||
|
|
||||||
|
|
||||||
Schedule video download for given URL
|
Schedule video download for given URL
|
||||||
|
|
||||||
$ fosdem_recorder download URL
|
$ bundle exec fosdem-recorder download URL
|
||||||
|
|
||||||
|
|
||||||
Real example
|
Real example
|
||||||
|
|
||||||
|
@ -39,18 +33,42 @@ $ bundle exec fosdem-recorder info https://fosdem.org/2021/schedule/event/sca_we
|
||||||
* url = https://stream.fosdem.org/dcomposition.m3u8
|
* url = https://stream.fosdem.org/dcomposition.m3u8
|
||||||
|
|
||||||
$ bundle exec fosdem-recorder info https://fosdem.org/2021/schedule/event/sca_weclome/
|
$ bundle exec fosdem-recorder info https://fosdem.org/2021/schedule/event/sca_weclome/
|
||||||
[... schedules the download with 'at'... ]
|
[... schedules the download ... ]
|
||||||
[... downloads the file with 'ffmpeg'... ]
|
|
||||||
[... a MP4 file will be created once the video is downloaded ...]
|
[... a MP4 file will be created once the video is downloaded ...]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
# Fosdem
|
||||||
|
|
||||||
|
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/fosdem`. To experiment with that code, run `bin/console` for an interactive prompt.
|
||||||
|
|
||||||
|
TODO: Delete this and the text above, and describe your gem
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
Add this line to your application's Gemfile:
|
||||||
|
|
||||||
|
```ruby
|
||||||
|
gem 'fosdem'
|
||||||
|
```
|
||||||
|
|
||||||
|
And then execute:
|
||||||
|
|
||||||
|
$ bundle install
|
||||||
|
|
||||||
|
Or install it yourself as:
|
||||||
|
|
||||||
|
$ gem install fosdem
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
TODO: Write usage instructions here
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
||||||
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
||||||
|
|
||||||
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
Bug reports and pull requests are welcome on GitHub at https://github.com/glenux/fosdem-recorder.
|
Bug reports and pull requests are welcome on GitHub at https://github.com/glenux/fosdem.
|
||||||
|
|
||||||
|
|
15
bin/console
Executable file
15
bin/console
Executable file
|
@ -0,0 +1,15 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require "bundler/setup"
|
||||||
|
require "fosdem"
|
||||||
|
|
||||||
|
# You can add fixtures and/or initialization code here to make experimenting
|
||||||
|
# with your gem easier. You can also use a different console, if you like.
|
||||||
|
|
||||||
|
# (If you use this, don't forget to add pry to your Gemfile!)
|
||||||
|
# require "pry"
|
||||||
|
# Pry.start
|
||||||
|
|
||||||
|
require "irb"
|
||||||
|
IRB.start(__FILE__)
|
8
bin/setup
Executable file
8
bin/setup
Executable file
|
@ -0,0 +1,8 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
IFS=$'\n\t'
|
||||||
|
set -vx
|
||||||
|
|
||||||
|
bundle install
|
||||||
|
|
||||||
|
# Do any other automated setup that you need to do here
|
|
@ -1,33 +1,21 @@
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
# Cli part of FosdemRecorder
|
|
||||||
module FosdemRecorder
|
module FosdemRecorder
|
||||||
# Fosdem Cli - Download and cut streams video
|
# Fosdem Cli - Download and cut streams video
|
||||||
class Cli < Thor
|
class Cli < Thor
|
||||||
desc 'info URL', 'Get information about URL'
|
desc 'info URL', 'Get information about URL'
|
||||||
def info(url)
|
def info(url)
|
||||||
meta = _get_meta(url)
|
meta = _get_meta(url)
|
||||||
puts meta[:title].green
|
puts meta[:title]
|
||||||
puts "* event start = #{meta[:event_start]}"
|
puts "* start = #{meta[:start_str]}"
|
||||||
puts "* event stop = #{meta[:event_stop]}"
|
puts "* stop = #{meta[:stop_str]}"
|
||||||
puts "* event length = #{meta[:duration_str]}"
|
puts "* length = #{meta[:duration_str]}"
|
||||||
puts "* stream url = #{meta[:stream_url]}"
|
puts "* stream url = #{meta[:stream_url]}"
|
||||||
end
|
end
|
||||||
|
|
||||||
desc 'download URL', 'Download conference described at URL'
|
desc 'download URL', 'Download conference described at URL'
|
||||||
def download(url)
|
def download(url)
|
||||||
meta = _get_meta(url)
|
meta = _get_meta(url)
|
||||||
|
cmd = "echo ffmpeg -i #{meta[:stream_url]} -c copy -t #{meta[:duration_str]} \"#{meta[:title_sane]}.mp4\" | at #{meta[:start_str]}"
|
||||||
localtime = meta[:event_start].localtime
|
|
||||||
timeformat = format(
|
|
||||||
'%<hours>02d:%<minutes>02d %<year>d-%<month>02d-%<day>02d',
|
|
||||||
hours: localtime.hour,
|
|
||||||
minutes: localtime.min,
|
|
||||||
year: localtime.year,
|
|
||||||
month: localtime.month,
|
|
||||||
day: localtime.day
|
|
||||||
)
|
|
||||||
cmd = "echo ffmpeg -i #{meta[:stream_url]} -c copy -t #{meta[:duration_str]} \"#{meta[:title_sane]}.mp4\" | at #{timeformat}"
|
|
||||||
puts "Command: #{cmd}".yellow
|
puts "Command: #{cmd}".yellow
|
||||||
system cmd
|
system cmd
|
||||||
end
|
end
|
||||||
|
@ -37,28 +25,14 @@ module FosdemRecorder
|
||||||
def _validate_url(url)
|
def _validate_url(url)
|
||||||
return if url =~ %r{^https://fosdem.org/\d+/schedule/event/.*}
|
return if url =~ %r{^https://fosdem.org/\d+/schedule/event/.*}
|
||||||
|
|
||||||
if url =~ %r{^https://fosdem.org/.*}
|
|
||||||
warn 'ERROR: not a schedule page. URL must contain .../schedule/event/...'
|
|
||||||
exit 1
|
|
||||||
end
|
|
||||||
|
|
||||||
warn 'ERROR: not a fosdem stream. URL must start with https://fosdem.org/...'
|
warn 'ERROR: not a fosdem stream. URL must start with https://fosdem.org/...'
|
||||||
exit 1
|
exit 1
|
||||||
end
|
end
|
||||||
|
|
||||||
def _get_meta(url)
|
def _get_meta(url)
|
||||||
puts "Loading data from #{url}".yellow
|
|
||||||
mechanize = Mechanize.new
|
mechanize = Mechanize.new
|
||||||
page = mechanize.get(url)
|
page = mechanize.get(url)
|
||||||
|
|
||||||
# body_class = page.at('body').attr('class')
|
|
||||||
# if body_class != 'schedule-event'
|
|
||||||
# STDERR.puts "ERROR: Not an event schedule page!"
|
|
||||||
# exit 1
|
|
||||||
# end
|
|
||||||
|
|
||||||
puts body_class
|
|
||||||
|
|
||||||
title = page.title
|
title = page.title
|
||||||
title_sane =
|
title_sane =
|
||||||
title
|
title
|
||||||
|
@ -72,7 +46,7 @@ module FosdemRecorder
|
||||||
.at('.side-box .icon-play')
|
.at('.side-box .icon-play')
|
||||||
.parent
|
.parent
|
||||||
.at('.value-title')
|
.at('.value-title')
|
||||||
.attr('title')
|
.text
|
||||||
.strip
|
.strip
|
||||||
|
|
||||||
play_start = Time.parse(play_start_str)
|
play_start = Time.parse(play_start_str)
|
||||||
|
@ -82,8 +56,7 @@ module FosdemRecorder
|
||||||
.at('.side-box .icon-stop')
|
.at('.side-box .icon-stop')
|
||||||
.parent
|
.parent
|
||||||
.at('.value-title')
|
.at('.value-title')
|
||||||
.attr('title')
|
.text.strip
|
||||||
.strip
|
|
||||||
|
|
||||||
play_stop = Time.parse(play_stop_str)
|
play_stop = Time.parse(play_stop_str)
|
||||||
|
|
||||||
|
@ -108,12 +81,11 @@ module FosdemRecorder
|
||||||
title: title,
|
title: title,
|
||||||
title_sane: title_sane,
|
title_sane: title_sane,
|
||||||
stream_url: stream_url,
|
stream_url: stream_url,
|
||||||
event_start: play_start,
|
start_str: play_start_str,
|
||||||
event_stop: play_stop,
|
stop_str: play_stop_str,
|
||||||
event_start_str: play_start_str,
|
|
||||||
event_stop_str: play_stop_str,
|
|
||||||
duration_str: duration_str
|
duration_str: duration_str
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue