youtubeDL 0.0.1 → 0.0.2

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
  SHA1:
3
- metadata.gz: c2468c5f7ee3d478be58c72858dbee90089a465f
4
- data.tar.gz: c29c3f80b9e3041aee8a8d457609688789090ac5
3
+ metadata.gz: 0d1c617ce0683c042b2fd3f872af909fc4c70a26
4
+ data.tar.gz: cf2d3672bdaebd5e2e866ff188d2aef4351dceec
5
5
  SHA512:
6
- metadata.gz: 4afcf02a2d86cf64dd51ae9eabf669f830618b80ddc0aa77f973ce336ebaf97fa5541e656183d5be76fa92e9aacf7a422e27d0a1197a13208414c4fb96941328
7
- data.tar.gz: 7d0db5654d33ddd41d7c0a8c529ce2d4dbb72afd8a08198dc53274f48adbefbc42aaccfa70b7b5e5e49d9192137721ec18a377f2fb674a0f57361e6a434c36f2
6
+ metadata.gz: 64f870b12d11642bfd8cb8fe3293e0cab6aaae68515e2969b688e46cf202c9cccdc96c3f70142450547ed2cb2b74a58949c3965998ac760cad3f1f6b3f498433
7
+ data.tar.gz: 7a029f38ff619014b7c8e1cfb20f445c94d412609ecefd1f81c0073fb0a3a0de3b5cee0ca60e002dad46cd9ba3c7bab0fe5cec6befedabcf3068e48143853824
data/lib/youtubeDL.rb CHANGED
@@ -2,7 +2,7 @@ require "youtubeDL/version"
2
2
  require "securerandom"
3
3
 
4
4
  class YoutubeDL
5
- attr_accessor :options, :command, :output, :id, :downloadPath, :downloadProgress, :vidID, :running
5
+ attr_accessor :options, :command, :output, :id, :downloadPath, :downloadProgress, :vidID, :running, :finished
6
6
 
7
7
  def initialize(videoID)
8
8
  @vidID = videoID
@@ -31,6 +31,7 @@ class YoutubeDL
31
31
  pid = spawn(@command)
32
32
  Process.detach(pid)
33
33
  @running = true
34
+ @finished = false
34
35
  end
35
36
 
36
37
  def getProgress
@@ -44,11 +45,26 @@ class YoutubeDL
44
45
  percIdx = line.index("%")
45
46
  if percIdx != nil
46
47
  percentDone = line.slice(spaceIdx+1,percIdx-spaceIdx-1);
48
+ if percentDone = "100"
49
+ #File.close(@progressFile)
50
+ #File.delete(@progressFile)
51
+ @finished = true
52
+ @running = false
53
+ end
47
54
  return percentDone.to_f
48
55
  end
49
56
  end
57
+ elsif @finished
58
+ return 100
50
59
  end
60
+
51
61
  end
52
62
 
63
+ def deleteProgress
64
+ if @finished
65
+ File.close(@progressFile)
66
+ File.delete(@progressFile)
67
+ end
68
+ end
53
69
  end
54
70
 
@@ -1,3 +1,3 @@
1
1
  module YoutubeDL
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: youtubeDL
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - cyburgee