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 +4 -4
- data/.ruby-version +1 -1
- data/CHANGELOG.md +20 -0
- data/Gemfile.lock +4 -4
- data/README.md +10 -7
- data/Rakefile +1 -0
- data/lib/my-local-putio/configuration.rb +11 -5
- data/lib/my-local-putio/downloader.rb +4 -2
- data/lib/my-local-putio/fetcher.rb +16 -9
- data/lib/my-local-putio/version.rb +1 -1
- data/lib/my-local-putio.rb +1 -0
- data/my-local-putio.gemspec +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b97f8142ada24f92bd2ba81ad1a698bf75b730ecb98f7878a10ddf84bfc6968
|
4
|
+
data.tar.gz: b1616b5139f17b2528fa61637df6082be9d330980d13ac515bdbe398a2effc4a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c6b14174288fea62fe55b7b92b10afad8a0a8d2149c1bb2cebc73864b89caf7c45b6129ae658a2c03ef1a2420769ed877e1a6a3235f941a110500a8fac763e0
|
7
|
+
data.tar.gz: 60c701b5765e86541188bf4a43bd2b4c9fe69cc81809edfab416f657c640314bcf4a96d6ab1b2f9ea6ca57d13199c86b0e5f1289689efd76b535fa552c55fd51
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
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
|
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.
|
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.
|
17
|
+
bundler (~> 2.3)
|
18
18
|
my-local-putio!
|
19
19
|
rake (~> 13.0)
|
20
20
|
|
21
21
|
BUNDLED WITH
|
22
|
-
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
|
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
|
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
|
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
@@ -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
|
-
|
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", "
|
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
|
-
|
30
|
+
file_path = File.join(path, file.name)
|
31
31
|
if file.content_type == "application/x-directory"
|
32
|
-
|
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,
|
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(
|
41
|
+
delete_file(file_path, file)
|
40
42
|
end
|
41
43
|
|
42
|
-
def
|
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}: #{
|
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?(
|
49
|
-
|
50
|
-
|
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
|
data/lib/my-local-putio.rb
CHANGED
@@ -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
|
data/my-local-putio.gemspec
CHANGED
@@ -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.
|
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.
|
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:
|
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.
|
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.
|
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.
|
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: []
|