Skip to content

Commit

Permalink
V : 0.11.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthieu committed Apr 9, 2017
1 parent 67cf3c9 commit 027216a
Show file tree
Hide file tree
Showing 42 changed files with 543 additions and 420 deletions.
3 changes: 2 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
### Changelog :

0.11.3 : debugs mineurs + implémentation de scripts pour faire les migrations plus facilement<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 />
0.11.2 : implemented the 'data' instruction<br />
0.11.1 : implemented the 'details' and 'fast-update' instructions + debugged the delete-diff + the directory system should be compatible with Windows<br />
0.11.0 : the argument management completely changed and is now much easier to use ( added instructions and a new way to use MangaScrap ) + the html was heavily optimised + added a management of bad gem loads + changed the way mangas are identified to allow the scrap of multiple sites<br />
Expand Down
90 changes: 27 additions & 63 deletions MangaScrap.rb
Original file line number Diff line number Diff line change
@@ -1,76 +1,40 @@
#!/usr/bin/env ruby
# coding: utf-8

# thanks for downloading MangaScrap !
# if you have a question, please go here :
# https://github.com/Hellfire01/MangaScrap
#
# Note :
# MangaScrap will install it's databases and templates
# in ~/.MangaScrap
#
# MangaScrap's return values :+
# 0 : good
# 1 : fatal error ( ruby native code exceptions )
# 2 : db error
# 3 : connection error
# 4 : unexpected error ( not yet managed stuff )
# 5 : argument error
# 6 : gem error
=begin
require 'singleton'
require 'open-uri'
require 'pp'
thanks for downloading MangaScrap !
if you have a question, please go here :
https://github.com/Hellfire01/MangaScrap
def load_gem(gem)
begin
require gem
rescue Exception => e
puts ''
puts "exception while trying to load #{gem}, please follow the installation instructions in the install directory"
puts 'message is : ' + e.message
puts 'please note that a ruby update may require a re-download of the gems'
puts ''
exit 6
end
end
Note :
MangaScrap will install it's databases and templates
in ~/.MangaScrap/
# gems
load_gem 'colorize'
load_gem 'nokogiri'
load_gem 'sqlite3'
MangaScrap's return values :
0 : good
1 : fatal error ( ruby native code exceptions )
2 : db error
3 : connection error
4 : unexpected error ( not yet managed stuff )
5 : argument error
6 : gem error
# files
require_relative 'sources/init'
require_relative 'sources/scan/scan'
require_relative 'sources/scan/scan_utils'
require_relative 'sources/instructions/delete_diff'
require_relative 'sources/instructions/basic_instructions'
require_relative 'sources/instructions/params'
require_relative 'sources/instructions/redl'
require_relative 'sources/utils/utils_file'
require_relative 'sources/utils/utils_args'
require_relative 'sources/utils/utils_co'
require_relative 'sources/utils/utils_manga'
require_relative 'sources/utils/utils_html'
require_relative 'sources/utils/utils_debug'
require_relative 'sources/Classes/html/html'
require_relative 'sources/Classes/html/html_buffer'
require_relative 'sources/Classes/Download/mangafox'
require_relative 'sources/Classes/DownloadDisplay'
require_relative 'sources/Classes/instructions/Parsers/Instruction_parser'
require_relative 'sources/Classes/instructions/Parsers/Data_parser'
require_relative 'sources/Classes/instructions/Parsers/Query_Parser'
require_relative 'sources/Classes/instructions/Parsers/File_parser'
require_relative 'sources/Classes/instructions/query'
require_relative 'sources/Classes/instructions/Instructions_exec'
require_relative 'sources/Classes/instructions/Manga_data_filter'
require_relative 'sources/Classes/DB/Manga_data'
require_relative 'sources/Classes/DB/Manga_database'
require_relative 'sources/Classes/DB/Params'
API :
should you want to use your own gui or use MangaScrap your own way,
the api can be found in ./sources/api/
=end

require_relative 'sources/init'
initialize_mangascrap

# if ARGV.size == 0
# note : instruction_exec posses this comparison
args = Instructions_exec.new
args.run
# else
# gui
# end


40 changes: 25 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,40 @@ MangaScrap is a Ruby based program that will allow you to download your mangas a
It posses a database that allows it to know what chapters where not downloaded yet<br />
Unlike other manga downloaders, it creates a local website on your computer allowing you to browse your mangas offline<br />
<br />

### basic usage :

`./MangaScrap add link [link]`<br />
Will add a manga to follow to the database<br />
`./MangaScrap`<br />
Will update all mangas within the database<br />
`./MangaScrap download link [link]`<br />
Will add the manga to the database and then download it<br />
How to add and download a manga<br />

- `./MangaScrap add link [link]`<br />
Will add a manga to follow to the database
- `./MangaScrap`<br />
Will update all mangas within the database
- `./MangaScrap download link [link]`<br />
Will add the manga to the database and then download it
<br />
<br />

### configuration

MangaScrap has configurable parameters witch will allow you to configure the way it work to fit your needs<br />
<br />
`./MangaScrap params list`<br />
Shows all the parameters and there values<br />
`./MangaScrap params set [param] [value]`<br />
- `./MangaScrap params list`<br />
Shows all the parameters and there values
- `./MangaScrap params set [param] [value]`<br />
Allow you to change a parameter<br />
<br />

### notes :
`./MangaScrap help`<br />

- `./MangaScrap help`<br />
Displays instructions<br />
- The program will download all mangas in ~/Documents/mangas/ by default ( should the path not exist, it will be created automatically )<br />
- Currently MangaScrap only manages mangafox but it is planned to do much more in the near future<br />
- The dev branch of MangaScrap is on [gitlab](https://gitlab.com/Hellfire01/MangaScrapp)
<br />
<br />
The program will download all mangas in ~/Documents/mangas/ by default<br />
( should the path not exist, it will be created automatically )<br />
Currently MangaScrap only manages mangafox but it is planned to do much more in the near future<br />

### API :

If you wish to add instructions / a gui / ... to MangaScrap, please check [here](sources/api/README.md).
<br />
19 changes: 0 additions & 19 deletions migration/0.9.X_to_1.0.x.txt

This file was deleted.

22 changes: 17 additions & 5 deletions sources/Classes/DB/Manga_data.rb → sources/DB/Manga_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ def is_site_compatible?(display)
end

public
# returns an array of the sites that MangaScrap currently manages
def self.get_compatible_sites
['http://mangafox.me/']
end
Expand All @@ -113,9 +114,11 @@ def to_s
', site = ' + ((@site == nil) ? '/' : '"' + @site + '"')
end

# used to get an array containing the volume / chapter / page values from a link
# will exit if the resolve method was not called before and did not return true
def extract_values_from_link(link)
unless @status
critical_error('extract_values_from_link function was called when the data class was not resolved or invalid')
critical_error('the extract_values_from_link method was called when the data class was not resolved or invalid')
end
case @site
when 'http://mangafox.me/'
Expand All @@ -125,9 +128,11 @@ def extract_values_from_link(link)
end
end

# returns the class used to download the manga
# will exit if the resolve method was not called before and did not return true
def get_download_class
unless @status
critical_error('the download class was required when the data class is not ready')
critical_error('the get_download_class method was called when the data class was not resolved or invalid')
end
begin
case @site
Expand All @@ -145,8 +150,10 @@ def get_download_class
end

# the function resolve will try to complete the missing information
# for that it will connect to the database and check or look online
# unless get_data_in_db
# for that it will connect to the database and check or look online unless get_data_in_db
# please note that the function will exit if the constructor was not called with the good arguments
# connect = bool, determines if the class can try to use internet if it could not find in the database
# display = bool, used to allow writing on the standard output or not
def resolve(connect, display)
if @status
return true
Expand Down Expand Up @@ -192,7 +199,12 @@ def resolve(connect, display)
end
end

# if data = nil => the manga is not in the database
# the constructor takes multiple arguments but they should not all be given at once unless the data comes from the database
# id = int / nil, is the id used in the database
# name = string / nil, is the name used in the url of the manga
# site = string / nil, is the name of the website hosting the manga
# link = string / nil, is the url of the manga
# data = array of elements / nil, the array contains the line of the manga in the database
def initialize(id, name, site, link, data)
@name = name
@site = site
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
25 changes: 25 additions & 0 deletions sources/api/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# MangaScrap's API

All of MangaScrap passes through the methods that are in the api directory<br />
Here you can use MangaScrap directly to ( example ) build your own GUI or your own instruction<br />
Please note that these methods are called from the argument parser witch is at ./sources/instructions/Instructions_exec.rb
( you will have to add the call to your instruction there and follow the directions there )<br />

There are 4 files containing the API :
- _mangas.rb_<br />
Allows you to manipulate the mangas database ( add / update / download / ... )<br />
**methods**: add, update, download, data, clear, delete
- _oher.rb_<br />
contains any part of the API that could not be sorted as they are too small to justify having a file of their own<br />
**methods**: html
- _ouput.rb_<br />
Reading from the database<br />
**methods**: details, output, help and version
- _params_<br />
Configuring MangaScrap using it's parameters<br />
**methods**: get_params_list, set_param, reset_params

**Important** :<br />
To manipulate mangas, MangaScrap uses the Manga_Data class witch you can find here : ./sources/DB/Manga_data.rb.<br />
The class works by giving to it's constructor the name and site or the link and the calling the **resolve** method witch
will return true or false depending on if it could find / use the given information.
Loading

0 comments on commit 027216a

Please sign in to comment.