my-local-putio 4.3.0 → 4.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1fda9ccd9e21d1f3028968ec7a14e6457053553910740739fba4f5b56d39ea47
4
- data.tar.gz: d9299607c186f5c6cdb339c0e3d5a3e2075af67dc2ef3243fc0e282df65723d4
3
+ metadata.gz: 9b97f8142ada24f92bd2ba81ad1a698bf75b730ecb98f7878a10ddf84bfc6968
4
+ data.tar.gz: b1616b5139f17b2528fa61637df6082be9d330980d13ac515bdbe398a2effc4a
5
5
  SHA512:
6
- metadata.gz: 0f4facdcd383dfc2c0f3a2e85e04617bf15c23b35a149a0f6686353406e15c3f96dc60588417f0858b65a7972674158a1b221d8053e8df84ce5e3c7c0bc3ba77
7
- data.tar.gz: 6497ba264ee6de19adfa927adb54ca118ec4a22993e6c37753277a3383b9ad5be7df04457574e67c9a097d742fa0f41828c3070be976004db1f4878bfe83ebe3
6
+ metadata.gz: 6c6b14174288fea62fe55b7b92b10afad8a0a8d2149c1bb2cebc73864b89caf7c45b6129ae658a2c03ef1a2420769ed877e1a6a3235f941a110500a8fac763e0
7
+ data.tar.gz: 60c701b5765e86541188bf4a43bd2b4c9fe69cc81809edfab416f657c640314bcf4a96d6ab1b2f9ea6ca57d13199c86b0e5f1289689efd76b535fa552c55fd51
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.6.3
1
+ 3.1.0
data/CHANGELOG.md CHANGED
@@ -1,3 +1,23 @@
1
+ # v4.4.2
2
+
3
+ - Package updates
4
+
5
+ # v4.4.1
6
+
7
+ - Bugfix: Checking if folder is empty before removing it, due to per page limit
8
+ - Bugfix: Downloader creating folder dir when downloading a single file
9
+
10
+ # v4.4.0
11
+
12
+ - Introducing --detailed-progress
13
+ - Display the default curl output with a detailed information of the download, instead of a simple progress bar.
14
+
15
+ # v4.3.1
16
+
17
+ - Bugfix: Already downloaded files no longer need to be downloaded again
18
+ - No parameter is necessary this is the default behaviour
19
+ - The codes matches the name and the filesize
20
+
1
21
  # v4.3.0
2
22
 
3
23
  - Introducing --disk-threshold
data/Gemfile.lock CHANGED
@@ -1,22 +1,22 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- my-local-putio (4.2.0)
4
+ my-local-putio (4.4.2)
5
5
  socksify (= 1.7.1)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- rake (13.0.1)
10
+ rake (13.0.6)
11
11
  socksify (1.7.1)
12
12
 
13
13
  PLATFORMS
14
14
  ruby
15
15
 
16
16
  DEPENDENCIES
17
- bundler (~> 2.0)
17
+ bundler (~> 2.3)
18
18
  my-local-putio!
19
19
  rake (~> 13.0)
20
20
 
21
21
  BUNDLED WITH
22
- 2.0.2
22
+ 2.3.17
data/README.md CHANGED
@@ -42,11 +42,12 @@ To update your installed version:
42
42
  -d, --delete-remote Delete remote file/folder after the download
43
43
  -s, --with-subtitles Fetch subtitles from Put.io api
44
44
  -v, --version Print my-local-putio version
45
+ --debug Debug mode [Developer mode]
46
+ --disk-threshold size Stops the downloads when the disk space threshold is reached. (Size in MB, e.g: 2000 for 2GB)
47
+ --detailed-progress Detailed download information instead a progress bar
45
48
  --temp-destination FULLPATH Temporary destination for the incomplete downloads (Default: 'local_destination'/incomplete_downloads)
46
49
  --silent Hide all messages and progress bar
47
- --debug Debug mode [Developer mode]
48
50
  --socks5-proxy hostname:port SOCKS5 hostname and port for proxy. Format: 127.0.0.1:1234
49
- --disk-threshold size Stops the downloads when the disk space threshold is reached. (Size in MB, e.g: 2000 for 2GB)
50
51
 
51
52
  #### Required attributes:
52
53
  * **-t** or **--token**: Your Put.io Token. This attribute becames optional if you set `PUTIO_TOKEN` env variable with your token (Can be inline or into your bash profile). Check examples below.
@@ -57,7 +58,7 @@ Examples:
57
58
  my-local-putio -t 123 -l Downloads
58
59
  my-local-putio -l Downloads --token 123
59
60
  my-local-putio -l Downloads -t token123 -d -s --socks5-proxy 127.0.0.1:1234
60
- my-local-putio -d -s --disk-threshold size 1000
61
+ my-local-putio -d -s --disk-threshold 1000
61
62
 
62
63
  With Token variable (inline or exporting):
63
64
 
@@ -71,11 +72,12 @@ With Token variable (inline or exporting):
71
72
  * **-s** or **--with-subtitles**: Download subtitles from Put.io API if available. (Remember to set your preferred subtitle language on Put.io Settings website, otherwise no subtitle will be available for download.)
72
73
  * **-h**: Print the help usage message
73
74
  * **-v** or **--version**: Print the version of the application
75
+ * **--debug**: Developer mode: Prints everything and expose URLs with tokens for debug purposes.
76
+ * **--disk-threshold**: Set a disk threshold **(in MB)** to prevent the script to fill up the entire disk. The threshold value is in MB **(e.g 1000 for 1GB)**. The script will test both download folder and temporary folder to detect if there is enough space before download each file. If the free space is less than (file size + disk threshold) the script will stop. (Example: If the folder have 10GB available, and the threshold is set to 2GB (2000), the script will stop before start downloading a file with 9GB size)
77
+ * **--detailed-progress**: Display the default curl output with a detailed information of the download, instead of a simple progress bar.
74
78
  * **--temp-destination**: Overwrite the default path (incomplete_downloads folder) of the temporary download files. After the download the complete file is moved to the selected local destination.
75
79
  * **--silent**: Hide all messages and progress bar. Recommended for Cronjob tasks.
76
- * **--debug**: Developer mode: Prints everything and expose URLs with tokens for debug purposes.
77
80
  * **--socks5-proxy**: Enable the SOCKS5 proxy. If enabled, all the connections for PUT.IO API and the downloads will be performed using this proxy. If the socks connection became unavailable, the application will raise an error and will stop.
78
- * **--disk-threshold**: Set a disk threshold **(in MB)** to prevent the script to fill up the entire disk. The threshold value is in MB **(e.g 1000 for 1GB)**. The script will test both download folder and temporary folder to detect if there is enough space before download each file. If the free space is less than (file size + disk threshold) the script will stop. (Example: If the folder have 10GB available, and the threshold is set to 2GB (2000), the script will stop before start downloading a file with 9GB size)
79
81
 
80
82
  Examples:
81
83
 
@@ -85,11 +87,11 @@ Examples:
85
87
  my-local-putio -l Downloads -t 123 --temp-destination /tmp --with-subtitles
86
88
  my-local-putio --local-destination Downloads -t 123 --debug --with-subtitles
87
89
  my-local-putio --local-destination Downloads -t 123 --socks5-proxy 127.0.0.1:3333
88
- my-local-putio -d -s --disk-threshold size 1000
90
+ my-local-putio -d -s --disk-threshold 1000
89
91
 
90
92
  Verbose output example:
91
93
 
92
- my-local-putio -t 123 -l Downloads -d -s --socks5-proxy 127.0.0.1:3333 --temp-destination /tmp --disk-threshold size 2000
94
+ my-local-putio -t 123 -l Downloads -d -s --socks5-proxy 127.0.0.1:3333 --temp-destination /tmp --disk-threshold 2000 --detailed-progress
93
95
 
94
96
  Starting My Local Put.io - version 4.3.0
95
97
  https://github.com/rafaelbiriba/my-local-putio
@@ -98,6 +100,7 @@ Verbose output example:
98
100
  Full path of the temporary destination: /tmp (Free space: 8543 MB)
99
101
  >>> Delete remote files enabled!
100
102
  >>> With subtitles enabled!
103
+ >>> With detailed progress bar!
101
104
  >>> SOCKS5 enabled with 127.0.0.1:3333
102
105
  >>> With disk threshold of 2000 MB!
103
106
  =============================================
data/Rakefile CHANGED
@@ -1,2 +1,3 @@
1
1
  require "bundler/gem_tasks"
2
+ require "fileutils"
2
3
  task :default => :spec
@@ -2,7 +2,7 @@ module MyLocalPutio
2
2
  class Configuration
3
3
  attr_reader :token, :local_destination, :temp_destination,
4
4
  :silent, :debug, :socks_host, :socks_port, :delete_remote, :with_subtitles,
5
- :disk_threshold
5
+ :disk_threshold, :detailed_progress
6
6
 
7
7
  def initialize
8
8
  read_args_from_envs!
@@ -35,15 +35,21 @@ module MyLocalPutio
35
35
  exit
36
36
  end
37
37
 
38
+ opt.on("--debug", "Debug mode [Developer mode]") { |v| @debug = true }
39
+
40
+ opt.on("--disk-threshold size", "Stops the downloads when the disk space threshold is reached. (Size in MB, e.g: 2000 for 2GB)") do |v|
41
+ @disk_threshold = v.to_i
42
+ end
43
+
44
+ opt.on("--detailed-progress", "Detailed download information instead a progress bar") { |v| @detailed_progress = true }
45
+
38
46
  opt.on("--temp-destination FULLPATH", "Temporary destination for the incomplete downloads (Default: 'local_destination'/incomplete_downloads)") { |v| @temp_destination = v }
47
+
39
48
  opt.on("--silent", "Hide all messages and progress bar") { |v| @silent = true }
40
- opt.on("--debug", "Debug mode [Developer mode]") { |v| @debug = true }
49
+
41
50
  opt.on("--socks5-proxy hostname:port", "SOCKS5 hostname and port for proxy. Format: 127.0.0.1:1234") do |v|
42
51
  @socks_host, @socks_port = v.to_s.split(":")
43
52
  end
44
- opt.on("--disk-threshold size", "Stops the downloads when the disk space threshold is reached. (Size in MB, e.g: 2000 for 2GB)") do |v|
45
- @disk_threshold = v.to_i
46
- end
47
53
  end.parse!
48
54
  end
49
55
 
@@ -37,12 +37,14 @@ module MyLocalPutio
37
37
  end
38
38
 
39
39
  def download_command(url, path)
40
- temp_destination = File.join(configuration.temp_destination, path)
40
+ temp_destination = File.join(configuration.temp_destination, File.dirname(path))
41
41
 
42
42
  command = [
43
- "curl", "--create-dirs", "--progress-bar", "-L", "--retry", "5", "-S", "-C", "-", "-o", temp_destination, url.to_s
43
+ "curl", "--create-dirs", "-L", "--retry", "5", "-S", "-C", "-", "-o", temp_destination, url.to_s
44
44
  ]
45
45
 
46
+ command.push("--progress-bar") unless configuration.detailed_progress
47
+
46
48
  command.push("--silent") if logger.silent?
47
49
 
48
50
  if configuration.socks_enabled?
@@ -27,27 +27,34 @@ module MyLocalPutio
27
27
  end
28
28
 
29
29
  def process_file(file, path)
30
- local_file_path = File.join(path, file.name)
30
+ file_path = File.join(path, file.name)
31
31
  if file.content_type == "application/x-directory"
32
- fetch_files(id: file.id, path: local_file_path)
32
+ while !directory_empty?(file)
33
+ fetch_files(id: file.id, path: file_path)
34
+ end
33
35
  else
34
36
  url = cli.get_download_url(file.id)["url"]
35
37
  disk_manager.check_for_available_space_on_destinations!(file.size/1024/1024)
36
- Downloader.new(@configuration).download(url, local_file_path) unless file_exists?(local_file_path, file)
38
+ Downloader.new(@configuration).download(url, file_path) unless file_exists?(file_path, file)
37
39
  SubtitlesManager.new(configuration).fetch(file, path)
38
40
  end
39
- delete_file(local_file_path, file)
41
+ delete_file(file_path, file)
40
42
  end
41
43
 
42
- def delete_file(local_file_path, file)
44
+ def directory_empty?(file)
45
+ cli.get_files(file.id)["files"].count < 1
46
+ end
47
+
48
+ def delete_file(file_path, file)
43
49
  return unless configuration.delete_remote
44
- logger.log "Deleting remote #{file.file_type.downcase}: #{local_file_path}"
50
+ logger.log "Deleting remote #{file.file_type.downcase}: #{file_path}"
45
51
  cli.delete_file(file.id)
46
52
  end
47
53
 
48
- def file_exists?(local_file_path, file)
49
- file_exists = File.exists?(local_file_path) && File.size(local_file_path) == file.size
50
- logger.log "File already downloaded #{local_file_path}" if file_exists
54
+ def file_exists?(file_path, file)
55
+ local_full_path = File.join(configuration.local_destination, file_path)
56
+ file_exists = File.exists?(local_full_path) && File.size(local_full_path)/1024 == file.size/1024
57
+ logger.log "File already downloaded #{file_path}" if file_exists
51
58
  file_exists
52
59
  end
53
60
  end
@@ -1,3 +1,3 @@
1
1
  module MyLocalPutio
2
- VERSION = "4.3.0"
2
+ VERSION = "4.4.2"
3
3
  end
@@ -40,6 +40,7 @@ module MyLocalPutio
40
40
  puts "Full path of the temporary destination: #{File.realdirpath(configuration.temp_destination)} (Free space: #{configuration.disk_manager.get_folder_free_space(configuration.temp_destination)} MB)"
41
41
  puts ">>> Delete remote files enabled!" if configuration.delete_remote
42
42
  puts ">>> With subtitles enabled!" if configuration.with_subtitles
43
+ puts ">>> With detailed progress bar!" if configuration.detailed_progress
43
44
  puts ">>> SOCKS5 enabled with #{configuration.socks_host}:#{configuration.socks_port}" if configuration.socks_enabled?
44
45
  puts ">>> With disk threshold of #{configuration.disk_threshold} MB!" if configuration.disk_threshold
45
46
  puts ">>> DEBUG enabled! Hello Mr(s) developer :)" if configuration.debug
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
24
24
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
25
25
  spec.require_paths = ["lib"]
26
26
 
27
- spec.add_development_dependency "bundler", "~> 2.0"
27
+ spec.add_development_dependency "bundler", "~> 2.3"
28
28
  spec.add_development_dependency "rake", "~> 13.0"
29
29
  spec.add_dependency "socksify", "1.7.1"
30
30
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: my-local-putio
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.3.0
4
+ version: 4.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rafael Biriba
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-07 00:00:00.000000000 Z
11
+ date: 2022-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.0'
19
+ version: '2.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '2.0'
26
+ version: '2.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -85,7 +85,7 @@ metadata:
85
85
  homepage_uri: https://github.com/rafaelbiriba/my-local-putio
86
86
  source_code_uri: https://github.com/rafaelbiriba/my-local-putio
87
87
  changelog_uri: https://github.com/rafaelbiriba/my-local-putio/blob/master/CHANGELOG.md
88
- post_install_message:
88
+ post_install_message:
89
89
  rdoc_options: []
90
90
  require_paths:
91
91
  - lib
@@ -100,8 +100,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
100
  - !ruby/object:Gem::Version
101
101
  version: '0'
102
102
  requirements: []
103
- rubygems_version: 3.0.3
104
- signing_key:
103
+ rubygems_version: 3.3.3
104
+ signing_key:
105
105
  specification_version: 4
106
106
  summary: The easiest script to synchronise all your put.io files locally.
107
107
  test_files: []