Skip to content

Commit

Permalink
V : 0.12.0
Browse files Browse the repository at this point in the history
  • Loading branch information
matthieu committed Jun 11, 2017
1 parent 808eb4b commit 34ae53e
Show file tree
Hide file tree
Showing 44 changed files with 977 additions and 766 deletions.
4 changes: 4 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
### Changelog :

0.12.0 : huge optimisation : download is close to twice as fast + new management of the parameters + more understandable errors<br />

###### Warning : the params database is not compatible<br />Please look at the file migration/0.11.x_to_0.12.x.txt<br />

0.11.5 : lots of refactoring + bug fixes + optimisation ( the updates are now faster ) + updated the API + updated the help instruction + added management of 2 new sites : mangareader and pandamanga<br />
0.11.4 : added an API and instructions on how to use it, it will be used for the GUI<br />
0.11.3 : small bug fixes + implemented scripts to allow faster migrations / updates<br />
Expand Down
2 changes: 2 additions & 0 deletions MangaScrap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
=end

$0='MangaScrap'

require_relative 'sources/init'

begin
Expand Down
5 changes: 4 additions & 1 deletion UnitTests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
0 : good
1 : file load error
2 : gem load error
3 : bad Ruby version
3 : bad Ruby versionw
4 : bad argument given to UnitTests.rb
5 : error on class require
Expand All @@ -24,6 +24,9 @@
##################################################################################
##################################################################################

puts 'needs to be updated'
exit 42

verbose = false
if ARGV.size != 0
if ARGV[0] == 'verbose'
Expand Down
1 change: 1 addition & 0 deletions migration/0.10.x_to_0.11.x.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env bash
echo "ALTER TABLE manga_trace ADD date VARCHAR(32);
ALTER TABLE manga_trace ADD nb_pages INTEGER;
ALTER TABLE manga_todo ADD date VARCHAR(32);
Expand Down
2 changes: 2 additions & 0 deletions migration/0.11.x_to_0.12.x.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env bash
gem install typhoeus
6 changes: 6 additions & 0 deletions migration/0.11.x_to_0.12.x.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
1. note all of your params

2. install tythoeus
gem install typhoeus

3. input all of your params into MangaScrap using the "param set" instruction
1 change: 1 addition & 0 deletions migration/0.9.X_to_0.10.x.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env bash
# 1 - Delete your params DB ( please note all important information such as mangapath before doing so if you have changed any parameter )
rm ~/.MangaScrap/db/params.db

Expand Down
19 changes: 14 additions & 5 deletions sources/DB/Manga_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ def check_link(display)
@link += '/'
end
end
if Utils_connection::redirection_detection(@link)
puts 'Warning :'.yellow + ' could not connect to ' + @link.yellow if display
begin
Utils_connection::get_page(@link, true)
rescue RuntimeError
puts 'Warning :'.yellow + ' could not connect to ' + @link.yellow if display
return false
end
true
Expand Down Expand Up @@ -94,7 +96,9 @@ def is_site_compatible?(display)
public
# returns an array of the sites that MangaScrap currently manages
def self.get_compatible_sites
%w(http://mangafox.me/ http://www.mangareader.net/ http://www.mangapanda.com/)
%w(http://mangafox.me/
http://www.mangareader.net/
http://www.mangapanda.com/)
end

def self.get_dir_from_site(site)
Expand Down Expand Up @@ -149,9 +153,13 @@ def get_download_class(download_data = true)
end
rescue => e
puts 'Exception while trying to get '.red + @name.yellow
puts 'exception is : ' + e.class.to_s
puts 'reason is : '.yellow + e.message
return nil
end
rescue ArgumentError => e
puts 'Exception while trying to get '.red + @name.yellow
Utils_errors::critical_error('Argument error ( something is wrong with the code', e)
end
end
@download_class
end
Expand Down Expand Up @@ -185,6 +193,7 @@ def resolve(connect, display)
if !ret && connect # if it is not in the database and a connection is required, then it is good
if check_link(display)
@status = true

return true
end
return false
Expand Down Expand Up @@ -225,7 +234,7 @@ def initialize(id, name, site, link, data)
@in_db = @status
@download_class = nil
if @in_db
is_site_compatible?(false) # function used here to get @site_dir and @ to_complete
is_site_compatible?(false) # function used here to get @site_dir and @to_complete values
end
end
end
5 changes: 4 additions & 1 deletion sources/DB/Manga_database.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,15 @@ def add_todo(manga_data, volume_value, chapter_value, page_nb)
exit 2
end
todo = get_todo(manga_data)
insert = [manga_data.id, volume_value, chapter_value, page_nb, now]
insert = [manga_data.id, volume_value, chapter_value, page_nb]
todo.each do |elem|
elem.pop
elem.shift
if elem == insert
return false
end
end
insert << now
Utils_database::db_exec('INSERT INTO manga_todo VALUES (NULL, ?, ?, ?, ?, ?)', 'could not add todo for ' + manga_data.name, @db, insert)
true
end
Expand All @@ -102,6 +104,7 @@ def add_trace(manga_data, volume_value, chapter_value, nb_pages)
trace = get_trace(manga_data)
insert = [manga_data.id, volume_value, chapter_value, now, nb_pages]
found = false
# todo : pour les comparaisons de traces, il ne faut surtout pas comparer les dates
trace.each do |elem| # checking if the trace does not already exist in database to avoid duplicates
elem.shift # the first element is shift as it contains the id of the trace
if elem == insert
Expand Down
Loading

0 comments on commit 34ae53e

Please sign in to comment.