diff options
24 files changed, 172 insertions, 476 deletions
@@ -1,6 +1,6 @@ MIT License -Copyright (c) 2019 David Luevano Alvarado +Copyright (c) 2021 David Luevano Alvarado Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 7152b80..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1 +0,0 @@ -include README.md LICENSE
\ No newline at end of file diff --git a/Makefile b/Makefile deleted file mode 100644 index 1a05b92..0000000 --- a/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -init: - pip install -r requirements.txt
\ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..b5a3c46 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,6 @@ +[build-system] +requires = [ + "setuptools>=42", + "wheel" +] +build-backend = "setuptools.build_meta"
\ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 16f6f23..cabc158 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ -beautifulsoup4==4.8.1
-requests==2.22.0
-urllib3==1.26.5
+beautifulsoup4==4.10.0
+requests==2.26.6
+urllib3==1.26.6
diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..5edcbfb --- /dev/null +++ b/setup.cfg @@ -0,0 +1,37 @@ +[metadata] +name = tirante +author = David Luevano Alvarado +author_email = david@luevano.xyz +summary = A (wannabe) manga download manager +description_file = README.md +license = GPLv3 +home_page = https://github.com/luevano/tirante +classifiers = + Programming Language :: Python :: 3 + License :: OSI Approved :: GNU General Public License v3 (GPLv3) + Operating System :: Microsoft :: Windows +keywords = + python + manga + download + manager + +[files] +packages = + tirante + +[bdist_wheel] +universal = 0 + +[entry_points] +console_scripts = + tirante = tirante:main + +[options] +package_dir = + = src +packages = find: +include_package_data = True + +[options.packages.find] +where = src
\ No newline at end of file @@ -1,102 +1,6 @@ -"""MIT License +from setuptools import setup -Copyright (c) 2019 David Luevano Alvarado - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -""" -# This setup.py template was obtained from -# https://github.com/navdeep-G/setup.py/blob/master/setup.py -# ---------------------------------------------------------------------- -# Note: To use the 'upload' functionality of this file, you must: -# $ pipenv install twine --dev - -import io -import os - -from setuptools import find_packages, setup - -from tirante.version import __version__ - -# Package meta-data. -NAME = 'tirante' -DESCRIPTION = 'A (wannabe) manga downloader manager.' -URL = 'https://github.com/luevano/tirante' -EMAIL = 'lorentzeus@gmail.com' -AUTHOR = 'David Luevano Alvarado' -REQUIRES_PYTHON = '>=3.7' -VERSION = __version__ -# VERSION = '0.0.1' - -# What packages are required for this module to be executed? -REQUIRED = [ - # 'requests', 'maya', 'records', -] - -# What packages are optional? -EXTRAS = { - # 'fancy feature': ['django'], -} - -# The rest you shouldn't have to touch too much :) -# ------------------------------------------------ -# Except, perhaps the License and Trove Classifiers! -# If you do change the License, remember to change -# the Trove Classifier for that! - -here = os.path.abspath(os.path.dirname(__file__)) - -# Import the README and use it as the long-description. -# Note: this will only work if 'README.md' -# is present in your MANIFEST.in file! -try: - with io.open(os.path.join(here, 'README.md'), encoding='utf-8') as f: - long_description = '\n' + f.read() -except FileNotFoundError: - long_description = DESCRIPTION - -# Where the magic happens: setup( - name=NAME, - version=VERSION, - description=DESCRIPTION, - long_description=long_description, - long_description_content_type='text/markdown', - author=AUTHOR, - author_email=EMAIL, - python_requires=REQUIRES_PYTHON, - url=URL, - packages=find_packages(exclude=["tests", - "*.tests", - "*.tests.*", - "tests.*"]), - # If your package is a single module, use this instead of 'packages': - # py_modules=['mypackage'], - install_requires=REQUIRED, - extras_require=EXTRAS, - include_package_data=True, - license='MIT', - classifiers=[ - # Trove classifiers - # Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers - 'License :: OSI Approved :: MIT License', - 'Programming Language :: Python', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.7' - ] -) + setup_requires=['pbr'], + pbr=True +)
\ No newline at end of file diff --git a/src/tirante/__init__.py b/src/tirante/__init__.py new file mode 100644 index 0000000..168b24e --- /dev/null +++ b/src/tirante/__init__.py @@ -0,0 +1,3 @@ +from .tirante import main + +__all__ = ['main']
\ No newline at end of file diff --git a/src/tirante/__main__.py b/src/tirante/__main__.py new file mode 100644 index 0000000..f56161e --- /dev/null +++ b/src/tirante/__main__.py @@ -0,0 +1,3 @@ +from .tirante import main + +main()
\ No newline at end of file diff --git a/src/tirante/chapter_images_manager.py b/src/tirante/chapter_images_manager.py new file mode 100644 index 0000000..1b8afbc --- /dev/null +++ b/src/tirante/chapter_images_manager.py @@ -0,0 +1,33 @@ +from tirante.get_chapter_image_list import get_chapter_image_list + + +def chapter_images_list_to_csv(chapter_data): + """ + Creates csv file for a chapter, given the list. + chapter_data: A list containing a url and a title. + """ + + ch_name = ''.join([chapter_data[1], '.csv']) + + chapter_image_list = get_chapter_image_list(chapter_data) + + with open(ch_name, 'w') as outcsv: + for image in chapter_image_list: + outcsv.write(''.join([image[0], ',', image[1], '\n'])) + + +def chapter_images_csv_to_list(chapter_image_csv): + """ + Returns a list given the csv file. + chapter_image_csv: csv containing data for the chapter. + """ + + out_chapter_image_list = [] + + with open(chapter_image_csv, 'r') as incsv: + lines = incsv.readlines() + for line in lines: + # print(line.strip().split(',')) + out_chapter_image_list.append(line.strip().split(',')) + + return out_chapter_image_list diff --git a/src/tirante/chapters_manager.py b/src/tirante/chapters_manager.py new file mode 100644 index 0000000..3d99c3f --- /dev/null +++ b/src/tirante/chapters_manager.py @@ -0,0 +1,31 @@ +def chapters_list_to_csv(chapters_list, + manga_name): + """ + Creates a csv file from the input chapter_list. + chapters_list: List of data of the chapters. + manga_name: Name of the manga, folder naming friendly. + """ + + # Adding '.csv' for csv creation. + m_name_ext = ''.join([manga_name, '.csv']) + # print(m_name) + + with open(m_name_ext, 'w') as outcsv: + for chapter in chapters_list: + outcsv.write(''.join([chapter[0], ',', chapter[1], '\n'])) + + +def chapters_csv_to_list(chapter_csv): + """ + Gives a list of chaptesrs from a csv file. + chapters_list: List of data of the chapters. + """ + + out_chapters_list = [] + + with open(chapter_csv, 'r') as incsv: + lines = incsv.readlines() + for line in lines: + out_chapters_list.append(line.strip().split(',')) + + return out_chapters_list diff --git a/tirante/create_database.py b/src/tirante/create_database.py index 8c9b43b..22d8230 100644 --- a/tirante/create_database.py +++ b/src/tirante/create_database.py @@ -1,25 +1,3 @@ -"""MIT License - -Copyright (c) 2019 David Luevano Alvarado - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -""" import os # Project specific imports. diff --git a/src/tirante/download_manager.py b/src/tirante/download_manager.py new file mode 100644 index 0000000..2d833e6 --- /dev/null +++ b/src/tirante/download_manager.py @@ -0,0 +1,28 @@ +import requests + + +def download_image(image_list): + """ + Downloads an image from the specified url, + and saves it with the specified name. + image_list: list that contains url and name. + """ + + # Gets the content of an image from its url. + img_data = requests.get(image_list[0]).content + + # Opens a file with its corresponding name as 'wb' (write, binary), + # and then, writes the img_data. + with open(image_list[1], 'wb') as handler: + handler.write(img_data) + + +def download_chapter(image_list): + """ + Downloads the whole chapter as images. + image_url_list: List containing urls and file names for each image. + """ + + for image in image_list: + print(image) + download_image(image) diff --git a/tirante/download_manga.py b/src/tirante/download_manga.py index 3bcd947..50e2755 100644 --- a/tirante/download_manga.py +++ b/src/tirante/download_manga.py @@ -1,25 +1,3 @@ -"""MIT License - -Copyright (c) 2019 David Luevano Alvarado - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -""" import os # Project specific imports. diff --git a/tirante/get_chapter_image_list.py b/src/tirante/get_chapter_image_list.py index 9b0397b..a0881c6 100644 --- a/tirante/get_chapter_image_list.py +++ b/src/tirante/get_chapter_image_list.py @@ -1,25 +1,3 @@ -"""MIT License - -Copyright (c) 2019 David Luevano Alvarado - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -""" import urllib3 from bs4 import BeautifulSoup diff --git a/tirante/get_chapters_list.py b/src/tirante/get_chapters_list.py index f8c3d9d..83cefc7 100644 --- a/tirante/get_chapters_list.py +++ b/src/tirante/get_chapters_list.py @@ -1,25 +1,3 @@ -"""MIT License - -Copyright (c) 2019 David Luevano Alvarado - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -""" import urllib3 from bs4 import BeautifulSoup diff --git a/src/tirante/tirante.py b/src/tirante/tirante.py new file mode 100644 index 0000000..108154a --- /dev/null +++ b/src/tirante/tirante.py @@ -0,0 +1,23 @@ +from tirante.create_database import create_database + + +def main() -> None: + # Main manga source. + MAIN_URL = 'https://manganelo.com/manga/' + # Manga name. + MANGA_NAME = 'Kimetsu no Yaiba' + # Manga name in the form of how appears in the url. + MANGA_NAME_URL = 'kimetsu_no_yaiba/' + + # PC main file location. + MANGA_DIR = 'E:\\Mangas\\' + # PC main manga data location. + MANGA_DATA_DIR = ''.join(['C:\\Users\\Lorentzeus\\Google Drive\\', + 'Personal\\Python\\tirante\\test_data']) + + if __name__ == "__main__": + create_database(main_url=MAIN_URL, + manga_name_url=MANGA_NAME_URL, + manga_name=MANGA_NAME, + manga_dir=MANGA_DIR, + manga_data_dir=MANGA_DATA_DIR)
\ No newline at end of file diff --git a/tirante/update_database.py b/src/tirante/update_database.py index e33cce0..5d7fd8c 100644 --- a/tirante/update_database.py +++ b/src/tirante/update_database.py @@ -1,26 +1,3 @@ -"""MIT License - -Copyright (c) 2019 David Luevano Alvarado - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -""" - import os # Project specific imports. diff --git a/tirante/__init__.py b/tirante/__init__.py deleted file mode 100644 index 1cee674..0000000 --- a/tirante/__init__.py +++ /dev/null @@ -1,32 +0,0 @@ -"""MIT License - -Copyright (c) 2019 David Luevano Alvarado - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -""" -# from version import __version__ -from tirante.create_database import create_database -from tirante.update_database import update_database -from tirante.download_manga import download_manga - -# If somebody does "from package import *", this is what they will -# be able to access: -__all__ = ['create_database', - 'update_database', - 'download_manga'] diff --git a/tirante/__main__.py b/tirante/__main__.py deleted file mode 100644 index 8738da0..0000000 --- a/tirante/__main__.py +++ /dev/null @@ -1,43 +0,0 @@ -"""MIT License - -Copyright (c) 2019 David Luevano Alvarado - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -""" -from tirante.create_database import create_database - -# Main manga source. -MAIN_URL = 'https://manganelo.com/manga/' -# Manga name. -MANGA_NAME = 'Kimetsu no Yaiba' -# Manga name in the form of how appears in the url. -MANGA_NAME_URL = 'kimetsu_no_yaiba/' - -# PC main file location. -MANGA_DIR = 'E:\\Mangas\\' -# PC main manga data location. -MANGA_DATA_DIR = ''.join(['C:\\Users\\Lorentzeus\\Google Drive\\', - 'Personal\\Python\\tirante\\test_data']) - -if __name__ == "__main__": - create_database(main_url=MAIN_URL, - manga_name_url=MANGA_NAME_URL, - manga_name=MANGA_NAME, - manga_dir=MANGA_DIR, - manga_data_dir=MANGA_DATA_DIR) diff --git a/tirante/chapter_images_manager.py b/tirante/chapter_images_manager.py deleted file mode 100644 index bd8aa07..0000000 --- a/tirante/chapter_images_manager.py +++ /dev/null @@ -1,55 +0,0 @@ -"""MIT License - -Copyright (c) 2019 David Luevano Alvarado - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -""" -from tirante.get_chapter_image_list import get_chapter_image_list - - -def chapter_images_list_to_csv(chapter_data): - """ - Creates csv file for a chapter, given the list. - chapter_data: A list containing a url and a title. - """ - - ch_name = ''.join([chapter_data[1], '.csv']) - - chapter_image_list = get_chapter_image_list(chapter_data) - - with open(ch_name, 'w') as outcsv: - for image in chapter_image_list: - outcsv.write(''.join([image[0], ',', image[1], '\n'])) - - -def chapter_images_csv_to_list(chapter_image_csv): - """ - Returns a list given the csv file. - chapter_image_csv: csv containing data for the chapter. - """ - - out_chapter_image_list = [] - - with open(chapter_image_csv, 'r') as incsv: - lines = incsv.readlines() - for line in lines: - # print(line.strip().split(',')) - out_chapter_image_list.append(line.strip().split(',')) - - return out_chapter_image_list diff --git a/tirante/chapters_manager.py b/tirante/chapters_manager.py deleted file mode 100644 index d5cbe80..0000000 --- a/tirante/chapters_manager.py +++ /dev/null @@ -1,55 +0,0 @@ -"""MIT License - -Copyright (c) 2019 David Luevano Alvarado - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -""" - - -def chapters_list_to_csv(chapters_list, - manga_name): - """ - Creates a csv file from the input chapter_list. - chapters_list: List of data of the chapters. - manga_name: Name of the manga, folder naming friendly. - """ - - # Adding '.csv' for csv creation. - m_name_ext = ''.join([manga_name, '.csv']) - # print(m_name) - - with open(m_name_ext, 'w') as outcsv: - for chapter in chapters_list: - outcsv.write(''.join([chapter[0], ',', chapter[1], '\n'])) - - -def chapters_csv_to_list(chapter_csv): - """ - Gives a list of chaptesrs from a csv file. - chapters_list: List of data of the chapters. - """ - - out_chapters_list = [] - - with open(chapter_csv, 'r') as incsv: - lines = incsv.readlines() - for line in lines: - out_chapters_list.append(line.strip().split(',')) - - return out_chapters_list diff --git a/tirante/download_manager.py b/tirante/download_manager.py deleted file mode 100644 index e7e7285..0000000 --- a/tirante/download_manager.py +++ /dev/null @@ -1,50 +0,0 @@ -"""MIT License - -Copyright (c) 2019 David Luevano Alvarado - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -""" -import requests - - -def download_image(image_list): - """ - Downloads an image from the specified url, - and saves it with the specified name. - image_list: list that contains url and name. - """ - - # Gets the content of an image from its url. - img_data = requests.get(image_list[0]).content - - # Opens a file with its corresponding name as 'wb' (write, binary), - # and then, writes the img_data. - with open(image_list[1], 'wb') as handler: - handler.write(img_data) - - -def download_chapter(image_list): - """ - Downloads the whole chapter as images. - image_url_list: List containing urls and file names for each image. - """ - - for image in image_list: - print(image) - download_image(image) diff --git a/tirante/version.py b/tirante/version.py deleted file mode 100644 index fab5843..0000000 --- a/tirante/version.py +++ /dev/null @@ -1,23 +0,0 @@ -"""MIT License - -Copyright (c) 2019 David Luevano Alvarado - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -""" -__version__ = '0.0.1' |