vidload 0.1.11 → 0.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5f49b5b5ccfd0249511e3d7d9f14e13409d8c578efc202351fd5ebc5d82bbeba
4
- data.tar.gz: 88f6b50466ce36d590f1407ad8daecd0dddeee00c4739b9d315d9feab8a3293c
3
+ metadata.gz: 9f2f19f4a3e68894970ee46251031cabb28592bd242f0e1b7e2ecc8f5d40c3ee
4
+ data.tar.gz: 78b597dba867b0b988021cee4b8d35ea2a42d5df224af9cd052873c92687cada
5
5
  SHA512:
6
- metadata.gz: ff4a4ecf10a0df9d1d339f1d7e2d2af8c033d967b98a137bea85c41e65179e15f28e031c0bbf9fb7eeda36c1c16d05870072c4f98739912cf04241c05bb546bc
7
- data.tar.gz: 8867c690eaac5b3ecfa177e22b6d44699657ca50d99f820a71b0f50dda3db8b34c56df99ddcd37c7c2a6a00ead4eda672725daaa6a3c4dce601ee7a0681851b4
6
+ metadata.gz: a4261172dc43b40d8f652f96103612d286825816c3d0acc57c2819364545158935c358a0b13b3cb7280d0b9281edc966cb8104c019306ad847548cf7de281120
7
+ data.tar.gz: ea0934e1a52dee15f4204a16c5e1bd08580742b634ad02f86cf17f776373b5b60216098ef94e07e4770903d341c482fd0c1f15b8b4bf738ab1614649588e90e9
data/lib/vidload/cli.rb CHANGED
@@ -4,6 +4,7 @@ class Vidload::Cli < Thor
4
4
  desc "mp2t VIDEO_URL", "download a mp2t containerized video"
5
5
  method_option :video_name, type: :string, required: false
6
6
  method_option :author_name, type: :string, required: false
7
+ method_option :output_dir, type: :string, required: false
7
8
  method_option :hls_url, type: :string, required: true
8
9
  method_option :master_playlist_name, type: :string, required: true
9
10
  method_option :playwright_cli_path, type: :string, required: true
@@ -20,7 +21,8 @@ class Vidload::Cli < Thor
20
21
  video_referer: options[:video_referer],
21
22
  ts_seg_pattern: options[:ts_seg_pattern],
22
23
  hls_index_pattern: options[:hls_index_pattern],
23
- author_name: options[:author_name]
24
+ author_name: options[:author_name],
25
+ output_dir: options[:output_dir],
24
26
  }
25
27
 
26
28
  process_mp2t(params)
@@ -19,13 +19,14 @@ module Vidload::Mp2t::Api
19
19
  def initialize(
20
20
  video_url:,
21
21
  video_name:,
22
+ author_name:,
22
23
  hls_url:,
23
24
  master_playlist_name:,
24
25
  playwright_cli_path:,
25
26
  video_referer:,
26
27
  ts_seg_pattern:,
27
28
  hls_index_pattern:,
28
- author_name:
29
+ output_dir:
29
30
  )
30
31
  raise ArgumentError, "video_url must be provided" unless video_url
31
32
  raise ArgumentError, "hls_url must be provided" unless hls_url
@@ -45,6 +46,7 @@ module Vidload::Mp2t::Api
45
46
  @max_lines = IO.console.winsize[0]
46
47
  @author_name = author_name
47
48
  @video_name = if @author_name then "#{@author_name}_#{video_name}" else nil end
49
+ @output_dir = output_dir || "./"
48
50
  end
49
51
 
50
52
  def self.from_argv
@@ -136,7 +138,7 @@ module Vidload::Mp2t::Api
136
138
 
137
139
  def trigger_video_download(video_url, seg_qty)
138
140
  puts "Video starts. Starting download..."
139
- run_cmd(DEMUXER_PATH, video_url, @video_name, @video_referer) do |line|
141
+ run_cmd(DEMUXER_PATH, video_url, "#{@output_dir}#{@video_name}", @video_referer) do |line|
140
142
  if (line.include?("hls @") || line.include?("https @")) && line.match?(/#{@ts_seg_pattern}/i)
141
143
  seg_nb = line.match(/#{@ts_seg_pattern}/i)[:seg_nb]
142
144
  add_line(line)
@@ -144,7 +146,7 @@ module Vidload::Mp2t::Api
144
146
  end
145
147
  end
146
148
  print "\r\e[2K"
147
- puts "✔ Video downloaded successfully! Available in ./#{@video_name}.mp4"
149
+ puts "✔ Video downloaded successfully! Available in #{@output_dir}#{@video_name}.mp4"
148
150
  VIDEO_DOWNLOADED_EVENT_QUEUE << true
149
151
  end
150
152
 
@@ -1,3 +1,3 @@
1
1
  module Vidload
2
- VERSION = "0.1.11"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vidload
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.11
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patacode <pata.codegineer@gmail.com>