dmanga 0.1.1 → 0.1.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 +4 -4
- data/Gemfile +1 -1
- data/README.md +26 -6
- data/dmanga.gemspec +1 -0
- data/lib/dmanga/mangahost_parser.rb +13 -1
- data/lib/dmanga/site_parser_base.rb +41 -46
- data/lib/dmanga/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf04eb02bbe8e6268d7ae75c820bfac829d2e4ed
|
4
|
+
data.tar.gz: c48748c58ada3e4ac4609ce830d7b4750b9083e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 696e74eeb4c4e21d7f003f9d88d1332446a332bdaaa50f1e1ce5fbd327c0d309d82de722089341c9bf8c6b10ac4324246f9945754ec1b8b90120dabe7184a56b
|
7
|
+
data.tar.gz: e31919fe538cae709c16a162ab4631767bbb1f92079bab6d61cb3880f05c6e9f3277a0e840553b05493578ec548dc7e4ce69dad141ec1970abf0d651f2d38449
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -7,6 +7,18 @@ manga) de forma automatizada e sem restrição de quantidade. Basta
|
|
7
7
|
dizer o nome do manga e selecionar os capitulos que deseja baixar
|
8
8
|
e pronto o script fará os downloads do capitulos selecionados.
|
9
9
|
|
10
|
+
#### Atualização
|
11
|
+
|
12
|
+
> - Corrigido erro com download de shokugeki no souma
|
13
|
+
> - Corrigido erro com download de elfen lied
|
14
|
+
> - Corrigido erro com download de tokyo ghoul:re no windows
|
15
|
+
|
16
|
+
> **Se acontecer qualquer erro atualize o script/programa (esse erro provalvemente já foi corrigido)**.
|
17
|
+
|
18
|
+
> Para atualizar:
|
19
|
+
|
20
|
+
> `gem update dmanga`
|
21
|
+
|
10
22
|
## Instalação
|
11
23
|
|
12
24
|
### Windows
|
@@ -28,7 +40,7 @@ Com isso o script/programa será instalado.
|
|
28
40
|
|
29
41
|
Você pode atualizar o script/programa com:
|
30
42
|
|
31
|
-
`gem update`
|
43
|
+
`gem update dmanga`
|
32
44
|
|
33
45
|
Atualize sempre para obter melhoras (desempenho ou novas funcionalidades) e correções de bugs.
|
34
46
|
|
@@ -47,7 +59,7 @@ Pode ser necessário usar o sudo.
|
|
47
59
|
|
48
60
|
Você pode atualizar o script/programa com:
|
49
61
|
|
50
|
-
`gem update`
|
62
|
+
`gem update dmanga`
|
51
63
|
|
52
64
|
Atualize sempre para obter melhoras (desempenho ou novas funcionalidades) e correções de bugs.
|
53
65
|
|
@@ -69,6 +81,10 @@ Ex2:
|
|
69
81
|
|
70
82
|
`dmanga tomo-chan`
|
71
83
|
|
84
|
+
Ex3:
|
85
|
+
<!---->
|
86
|
+

|
87
|
+
|
72
88
|
obs: A pasta padrão de destino dos downloads é a pasta Downloads mas
|
73
89
|
você pode dizer ao script a pasta de destino do downloads com a
|
74
90
|
opçao -d, veja [Opções](#opções) para mais detalhes.
|
@@ -153,7 +169,7 @@ Mostra detalhes da execução do programa.
|
|
153
169
|
`dmanga -d "C:\window\users\images\manga e animes" "One piece"`
|
154
170
|
|
155
171
|
No windows, baixe 'One piece' para
|
156
|
-
'
|
172
|
+
'C:\window\users\images\manga e animes'
|
157
173
|
|
158
174
|
`dmanga "One punch man"`
|
159
175
|
|
@@ -171,15 +187,19 @@ Baixa todos os capitulos.
|
|
171
187
|
|
172
188
|
`34-96`
|
173
189
|
|
174
|
-
Baixa do
|
190
|
+
Baixa do capitulo 34 ao 96.
|
175
191
|
|
176
192
|
`1,3,55`
|
177
193
|
|
178
|
-
Baixa
|
194
|
+
Baixa os capitulos 1, 3 e 55.
|
179
195
|
|
180
196
|
`34,124`
|
181
197
|
|
182
|
-
Baixa
|
198
|
+
Baixa os capitulos 34 e 124.
|
199
|
+
|
200
|
+
`200`
|
201
|
+
|
202
|
+
Baixa o capitulo 200.
|
183
203
|
|
184
204
|
## License
|
185
205
|
|
data/dmanga.gemspec
CHANGED
@@ -32,6 +32,7 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.require_paths = ["lib"]
|
33
33
|
|
34
34
|
spec.add_runtime_dependency "ruby-progressbar","~> 1.8"
|
35
|
+
spec.add_runtime_dependency "addressable","~> 2.5"
|
35
36
|
spec.add_runtime_dependency "rubyzip","~> 1.2"
|
36
37
|
spec.add_runtime_dependency "formatador", "~> 0.2"
|
37
38
|
spec.add_development_dependency "minitest","~> 5.10"
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# require 'dmanga/site_parser_base'
|
2
2
|
require 'dmanga/site_parser_base'
|
3
3
|
require 'dmanga/zip_file_generator'
|
4
|
+
#require 'pry'
|
4
5
|
|
5
6
|
module DManga
|
6
7
|
class MangaHostParser < SiteParserBase
|
@@ -76,6 +77,9 @@ module DManga
|
|
76
77
|
# img.mangahost.net/br/images/img.png.webp => img.mangahost.net/br/mangas_files/img.png
|
77
78
|
img.sub!(/images/, "mangas_files")
|
78
79
|
img.sub!(/\.webp/, "")
|
80
|
+
|
81
|
+
#correct créditos img problem
|
82
|
+
correct_image_uri(img)
|
79
83
|
end
|
80
84
|
resul
|
81
85
|
end
|
@@ -88,7 +92,7 @@ module DManga
|
|
88
92
|
create_dir(chapter_dir)
|
89
93
|
|
90
94
|
DManga::display_feedback "\nBaixando #{chapter_name}"
|
91
|
-
|
95
|
+
imgs_download(chapter_dir, imgs_url)
|
92
96
|
end
|
93
97
|
end
|
94
98
|
|
@@ -99,5 +103,13 @@ module DManga
|
|
99
103
|
def correct_chapters_name
|
100
104
|
@chapters.each {|chapter| chapter[0].sub!(/[cC]ap.*?tulo/, "capitulo")}
|
101
105
|
end
|
106
|
+
|
107
|
+
# Due to problems with open-uri and utf-8
|
108
|
+
# some images uris need to be corrected.
|
109
|
+
# substitute Cru00e9ditos for Créditos.
|
110
|
+
# one uri at a time
|
111
|
+
def correct_image_uri(img_uri)
|
112
|
+
img_uri.sub!(/[cC]r.*?ditos/, "Créditos")
|
113
|
+
end
|
102
114
|
end
|
103
115
|
end
|
@@ -2,6 +2,7 @@ require 'dmanga/options'
|
|
2
2
|
require 'dmanga/os'
|
3
3
|
require 'ruby-progressbar'
|
4
4
|
require 'open-uri'
|
5
|
+
require 'addressable/uri'
|
5
6
|
# require 'pry'
|
6
7
|
# require 'formatador'
|
7
8
|
|
@@ -15,6 +16,7 @@ module DManga
|
|
15
16
|
def initialize(argv)
|
16
17
|
@options = Options.new(argv)
|
17
18
|
@manga_url = nil
|
19
|
+
# manga_name also is used as manga directory name
|
18
20
|
@manga_name = nil
|
19
21
|
@chapters = nil
|
20
22
|
end
|
@@ -123,44 +125,37 @@ module DManga
|
|
123
125
|
end
|
124
126
|
end
|
125
127
|
|
126
|
-
|
128
|
+
# return a progressbar suitable to the user operating system
|
129
|
+
def get_progressbar
|
130
|
+
if DManga::OS.windows?
|
131
|
+
return ProgressBar.create(:title => 'Baixando',
|
132
|
+
:starting_at => 20,
|
133
|
+
:length => 70,
|
134
|
+
:total => nil)
|
135
|
+
else
|
136
|
+
return ProgressBar.create(:title => 'Baixando',
|
137
|
+
:starting_at => 20,
|
138
|
+
:total => nil)
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
# download images to a path relative to download directory
|
143
|
+
def imgs_download(chp_path, imgs_urls)
|
127
144
|
imgs_urls.each do |url|
|
128
|
-
original_filename = url.slice(/(\w|[_-])+\.(png|jpg)/)
|
129
|
-
|
145
|
+
original_filename = url.slice(/(?u)(\w|[_-])+\.(png|jpg)/)
|
146
|
+
#original_filename = url.slice(/(\w|[_-])+\.(png|jpg)/)
|
147
|
+
|
148
|
+
img_path = [@options.download_dir,
|
149
|
+
chp_path,
|
150
|
+
original_filename].join(File::SEPARATOR)
|
130
151
|
unless File.exist? img_path
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
:starting_at => 20,
|
139
|
-
:length => 70,
|
140
|
-
:total => nil)
|
141
|
-
else
|
142
|
-
pbar = ProgressBar.create(:title => 'Baixando',
|
143
|
-
:starting_at => 20,
|
144
|
-
:total => nil)
|
145
|
-
end
|
146
|
-
else
|
147
|
-
if DManga::OS.windows?
|
148
|
-
pbar = ProgressBar.create(:total => size / Integer(16384),
|
149
|
-
:format => '%a %B %p%% %r KB/sec',
|
150
|
-
:rate_scale => lambda { |rate|
|
151
|
-
rate / 1024 },
|
152
|
-
length: 70)
|
153
|
-
else
|
154
|
-
pbar = ProgressBar.create(:total => size / Integer(16384),
|
155
|
-
:format => '%a %B %p%% %r KB/sec',
|
156
|
-
:rate_scale => lambda { |rate|
|
157
|
-
rate / 1024 })
|
158
|
-
end
|
159
|
-
end
|
160
|
-
},
|
161
|
-
:progress_proc => lambda {|s|
|
162
|
-
pbar.increment
|
163
|
-
}) do |response|
|
152
|
+
encoded_url = Addressable::URI.encode(url)
|
153
|
+
DManga::display_feedback "\n#{encoded_url}"
|
154
|
+
pbar = get_progressbar
|
155
|
+
open(
|
156
|
+
encoded_url,
|
157
|
+
:progress_proc => lambda {|s| pbar.increment }
|
158
|
+
) do |response|
|
164
159
|
if response.status[1] == "OK"
|
165
160
|
DManga::display_feedback "Salvando imagem em:'#{img_path}'" if @options.verbose
|
166
161
|
File.open(img_path, "wb") do |img|
|
@@ -174,29 +169,29 @@ module DManga
|
|
174
169
|
end
|
175
170
|
|
176
171
|
# check if the directory exists and
|
177
|
-
# create a directory relative to
|
178
|
-
def create_dir(
|
179
|
-
|
180
|
-
|
181
|
-
unless Dir.exist?
|
182
|
-
Dir.mkdir(
|
172
|
+
# create a directory relative to downlaod directory
|
173
|
+
def create_dir(relative_path)
|
174
|
+
absolute_path = [@options.download_dir, relative_path].join(File::SEPARATOR)
|
175
|
+
DManga::display_feedback "\nCriando diretorio '#{relative_path}' em '#{@options.download_dir}'" if @options.verbose
|
176
|
+
unless Dir.exist? absolute_path
|
177
|
+
Dir.mkdir(absolute_path)
|
183
178
|
puts if @options.verbose ## just a blank line for prettier output
|
184
179
|
else
|
185
|
-
DManga::display_feedback "'#{
|
180
|
+
DManga::display_feedback "'#{relative_path}' directorio ja existe" if @options.verbose
|
186
181
|
end
|
187
182
|
end
|
188
183
|
|
189
184
|
def zip_chapter
|
190
|
-
|
185
|
+
# TODO
|
191
186
|
end
|
192
187
|
|
193
|
-
#
|
188
|
+
# Returns the download destination directory
|
194
189
|
def download_dir
|
195
190
|
@options.download_dir
|
196
191
|
end
|
197
192
|
|
198
193
|
def remove_invalid_simbols(name)
|
199
|
-
# windows OS dont
|
194
|
+
# windows OS dont accept these simbols in folder name
|
200
195
|
name.gsub!(/[\/\\:*?"<>|]/, '_')
|
201
196
|
end
|
202
197
|
end
|
data/lib/dmanga/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dmanga
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Endrew
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-progressbar
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.8'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: addressable
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.5'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.5'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: rubyzip
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|