5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/podrb/commands/open/runner.rb', line 5
def call(episode_id, options = {})
parsed_options = parse_options(options)
db = Infrastructure::Storage::SQL.new(db: podrb_db_dir)
episode = db.query("select link from episodes where id = #{episode_id}")[0]
return build_failure_response(details: :not_found) if episode.nil?
browser = parsed_options["browser"] || "firefox"
cmd = "#{browser} #{episode.link}"
cmd << " && bundle exec podrb archive #{episode_id}" if parsed_options["archive"]
build_success_response(
details: :episode_found,
metadata: {cmd: cmd}
)
end
|