From b4c889522d3de352eb724a39191bcc9361a56ce3 Mon Sep 17 00:00:00 2001 From: Vishnunarayan K I Date: Tue, 9 Oct 2018 20:34:27 +0530 Subject: [PATCH] add docs --- Pipfile | 2 + Pipfile.lock | 238 +++++++++++++++++++++++--------- anime_downloader/sites/anime.py | 36 ++++- docs/Makefile | 19 +++ docs/advanced/custom_site.rst | 3 + docs/api/anime.rst | 7 + docs/conf.py | 185 +++++++++++++++++++++++++ docs/index.rst | 45 ++++++ docs/make.bat | 35 +++++ docs/usage/config.rst | 39 ++++++ docs/usage/dl.rst | 59 ++++++++ docs/usage/installation.rst | 108 +++++++++++++++ docs/usage/watch.rst | 94 +++++++++++++ 13 files changed, 801 insertions(+), 69 deletions(-) create mode 100644 docs/Makefile create mode 100644 docs/advanced/custom_site.rst create mode 100644 docs/api/anime.rst create mode 100644 docs/conf.py create mode 100644 docs/index.rst create mode 100644 docs/make.bat create mode 100644 docs/usage/config.rst create mode 100644 docs/usage/dl.rst create mode 100644 docs/usage/installation.rst create mode 100644 docs/usage/watch.rst diff --git a/Pipfile b/Pipfile index c49cc98..7a0fe10 100644 --- a/Pipfile +++ b/Pipfile @@ -8,3 +8,5 @@ anime-downloader = {editable = true, path = "."} [dev-packages] twine = "*" +sphinx = "*" +sphinx-rtd-theme = "*" diff --git a/Pipfile.lock b/Pipfile.lock index 8b3b351..5cb1407 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "158aab91b6bd0eb82ff86dd8e3df22c27c46e38acc47d6f14356bf03d4957d3a" + "sha256": "3c226d0611904abe8b253ddaa90b12046c1c6363b5920e508f067e2d5830e130" }, "pipfile-spec": 6, "requires": {}, @@ -20,18 +20,18 @@ }, "beautifulsoup4": { "hashes": [ - "sha256:194ec62a25438adcb3fdb06378b26559eda1ea8a747367d34c33cef9c7f48d57", - "sha256:90f8e61121d6ae58362ce3bed8cd997efb00c914eae0ff3d363c32f9a9822d10", - "sha256:f0abd31228055d698bb392a826528ea08ebb9959e6bea17c606fd9c9009db938" + "sha256:034740f6cb549b4e932ae1ab975581e6103ac8f942200a0e9759065984391858", + "sha256:945065979fb8529dd2f37dbb58f00b661bdbcbebf954f93b32fdf5263ef35348", + "sha256:ba6d5c59906a85ac23dadfe5c88deaf3e179ef565f4898671253e50a78680718" ], - "version": "==4.6.3" + "version": "==4.7.1" }, "certifi": { "hashes": [ - "sha256:339dc09518b07e2fa7eda5450740925974815557727d6bd35d319c1524a04a4c", - "sha256:6d58c986d22b038c8c0df30d639f23a3e6d172a05c3583e766f4c0b785c0986a" + "sha256:59b7658e26ca9c7339e00f8f4636cdfe59d34fa37b9b04f6f9e9926b3cece1a5", + "sha256:b26104d6835d1f5e49452a26eb2ff87fe7090b89dfcaee5ea2212697e1e1d7ae" ], - "version": "==2018.10.15" + "version": "==2019.3.9" }, "chardet": { "hashes": [ @@ -45,7 +45,6 @@ "sha256:2335065e6395b9e67ca716de5f7526736bfa6ceead690adf616d925bdc622b13", "sha256:5b94b49521f6456670fdb30cd82a4eca9412788a93fa6dd6df72c94d5a8ff2d7" ], - "markers": "python_version >= '2.7' and python_version != '3.1.*' and python_version != '3.0.*' and python_version != '3.3.*' and python_version != '3.2.*'", "version": "==7.0" }, "fuzzywuzzy": { @@ -57,42 +56,61 @@ }, "idna": { "hashes": [ - "sha256:156a6814fb5ac1fc6850fb002e0852d56c0c8d2531923a51032d1b70760e186e", - "sha256:684a38a6f903c1d71d6d5fac066b58d7768af4de2b832e426ec79c30daa94a16" + "sha256:c357b3f628cf53ae2c4c05627ecc484553142ca23264e593d327bcde5e9c3407", + "sha256:ea8b7f6188e6fa117537c3df7da9fc686d485087abf6ac197f9c46432f7e4a3c" ], - "version": "==2.7" + "version": "==2.8" }, "requests": { "hashes": [ - "sha256:99dcfdaaeb17caf6e526f32b6a7b780461512ab3f1d992187801694cba42770c", - "sha256:a84b8c9ab6239b578f22d1c21d51b696dcfe004032bb80ea832398d6909d7279" + "sha256:502a824f31acdacb3a35b6690b5fbf0bc41d63a24a45c4004352b0242707598e", + "sha256:7bf2a778576d825600030a110f3c0e3e8edc51dfaafe1c146e39a2027784957b" ], - "markers": "python_version < '4' and python_version != '3.2.*' and python_version != '3.1.*' and python_version != '3.0.*' and python_version != '3.3.*' and python_version >= '2.7'", - "version": "==2.20.0" + "version": "==2.21.0" + }, + "soupsieve": { + "hashes": [ + "sha256:afa56bf14907bb09403e5d15fbed6275caa4174d36b975226e3b67a3bb6e2c4b", + "sha256:eaed742b48b1f3e2d45ba6f79401b2ed5dc33b2123dfe216adb90d4bfa0ade26" + ], + "version": "==1.8" }, "urllib3": { "hashes": [ - "sha256:41c3db2fc01e5b907288010dec72f9d0a74e37d6994e6eb56849f59fea2265ae", - "sha256:8819bba37a02d143296a4d032373c4dd4aca11f6d4c9973335ca75f9c8475f59" + "sha256:61bf29cada3fc2fbefad4fdf059ea4bd1b4a86d2b6d15e1c7c0b582b9752fe39", + "sha256:de9529817c93f27c8ccbfead6985011db27bd0ddfcdb2d86f3f663385c6a9c22" ], - "markers": "python_version < '4' and python_version != '3.2.*' and python_version != '3.1.*' and python_version != '3.0.*' and python_version != '3.3.*' and python_version >= '2.7'", - "version": "==1.24" + "version": "==1.24.1" } }, "develop": { + "alabaster": { + "hashes": [ + "sha256:446438bdcca0e05bd45ea2de1668c1d9b032e1a9154c2c259092d77031ddd359", + "sha256:a661d72d58e6ea8a57f7a86e37d86716863ee5e92788398526d58b26a4e4dc02" + ], + "version": "==0.7.12" + }, + "babel": { + "hashes": [ + "sha256:6778d85147d5d85345c14a26aada5e478ab04e39b078b0745ee6870c2b5cf669", + "sha256:8cba50f48c529ca3fa18cf81fa9403be176d374ac4d60738b839122dfaaa3d23" + ], + "version": "==2.6.0" + }, "bleach": { "hashes": [ - "sha256:48d39675b80a75f6d1c3bdbffec791cf0bbbab665cf01e20da701c77de278718", - "sha256:73d26f018af5d5adcdabf5c1c974add4361a9c76af215fe32fdec8a6fc5fb9b9" + "sha256:213336e49e102af26d9cde77dd2d0397afabc5a6bf2fed985dc35b5d1e285a16", + "sha256:3fdf7f77adcf649c9911387df51254b813185e32b2c6619f690b593a617e19fa" ], - "version": "==3.0.2" + "version": "==3.1.0" }, "certifi": { "hashes": [ - "sha256:339dc09518b07e2fa7eda5450740925974815557727d6bd35d319c1524a04a4c", - "sha256:6d58c986d22b038c8c0df30d639f23a3e6d172a05c3583e766f4c0b785c0986a" + "sha256:59b7658e26ca9c7339e00f8f4636cdfe59d34fa37b9b04f6f9e9926b3cece1a5", + "sha256:b26104d6835d1f5e49452a26eb2ff87fe7090b89dfcaee5ea2212697e1e1d7ae" ], - "version": "==2018.10.15" + "version": "==2019.3.9" }, "chardet": { "hashes": [ @@ -109,86 +127,174 @@ ], "version": "==0.14" }, - "future": { - "hashes": [ - "sha256:e39ced1ab767b5936646cedba8bcce582398233d6a627067d4c6a454c90cfedb" - ], - "version": "==0.16.0" - }, "idna": { "hashes": [ - "sha256:156a6814fb5ac1fc6850fb002e0852d56c0c8d2531923a51032d1b70760e186e", - "sha256:684a38a6f903c1d71d6d5fac066b58d7768af4de2b832e426ec79c30daa94a16" + "sha256:c357b3f628cf53ae2c4c05627ecc484553142ca23264e593d327bcde5e9c3407", + "sha256:ea8b7f6188e6fa117537c3df7da9fc686d485087abf6ac197f9c46432f7e4a3c" ], - "version": "==2.7" + "version": "==2.8" + }, + "imagesize": { + "hashes": [ + "sha256:3f349de3eb99145973fefb7dbe38554414e5c30abd0c8e4b970a7c9d09f3a1d8", + "sha256:f3832918bc3c66617f92e35f5d70729187676313caa60c187eb0f28b8fe5e3b5" + ], + "version": "==1.1.0" + }, + "jinja2": { + "hashes": [ + "sha256:74c935a1b8bb9a3947c50a54766a969d4846290e1e788ea44c1392163723c3bd", + "sha256:f84be1bb0040caca4cea721fcbbbbd61f9be9464ca236387158b0feea01914a4" + ], + "version": "==2.10" + }, + "markupsafe": { + "hashes": [ + "sha256:00bc623926325b26bb9605ae9eae8a215691f33cae5df11ca5424f06f2d1f473", + "sha256:09027a7803a62ca78792ad89403b1b7a73a01c8cb65909cd876f7fcebd79b161", + "sha256:09c4b7f37d6c648cb13f9230d847adf22f8171b1ccc4d5682398e77f40309235", + "sha256:1027c282dad077d0bae18be6794e6b6b8c91d58ed8a8d89a89d59693b9131db5", + "sha256:24982cc2533820871eba85ba648cd53d8623687ff11cbb805be4ff7b4c971aff", + "sha256:29872e92839765e546828bb7754a68c418d927cd064fd4708fab9fe9c8bb116b", + "sha256:43a55c2930bbc139570ac2452adf3d70cdbb3cfe5912c71cdce1c2c6bbd9c5d1", + "sha256:46c99d2de99945ec5cb54f23c8cd5689f6d7177305ebff350a58ce5f8de1669e", + "sha256:500d4957e52ddc3351cabf489e79c91c17f6e0899158447047588650b5e69183", + "sha256:535f6fc4d397c1563d08b88e485c3496cf5784e927af890fb3c3aac7f933ec66", + "sha256:62fe6c95e3ec8a7fad637b7f3d372c15ec1caa01ab47926cfdf7a75b40e0eac1", + "sha256:6dd73240d2af64df90aa7c4e7481e23825ea70af4b4922f8ede5b9e35f78a3b1", + "sha256:717ba8fe3ae9cc0006d7c451f0bb265ee07739daf76355d06366154ee68d221e", + "sha256:79855e1c5b8da654cf486b830bd42c06e8780cea587384cf6545b7d9ac013a0b", + "sha256:7c1699dfe0cf8ff607dbdcc1e9b9af1755371f92a68f706051cc8c37d447c905", + "sha256:88e5fcfb52ee7b911e8bb6d6aa2fd21fbecc674eadd44118a9cc3863f938e735", + "sha256:8defac2f2ccd6805ebf65f5eeb132adcf2ab57aa11fdf4c0dd5169a004710e7d", + "sha256:98c7086708b163d425c67c7a91bad6e466bb99d797aa64f965e9d25c12111a5e", + "sha256:9add70b36c5666a2ed02b43b335fe19002ee5235efd4b8a89bfcf9005bebac0d", + "sha256:9bf40443012702a1d2070043cb6291650a0841ece432556f784f004937f0f32c", + "sha256:ade5e387d2ad0d7ebf59146cc00c8044acbd863725f887353a10df825fc8ae21", + "sha256:b00c1de48212e4cc9603895652c5c410df699856a2853135b3967591e4beebc2", + "sha256:b1282f8c00509d99fef04d8ba936b156d419be841854fe901d8ae224c59f0be5", + "sha256:b2051432115498d3562c084a49bba65d97cf251f5a331c64a12ee7e04dacc51b", + "sha256:ba59edeaa2fc6114428f1637ffff42da1e311e29382d81b339c1817d37ec93c6", + "sha256:c8716a48d94b06bb3b2524c2b77e055fb313aeb4ea620c8dd03a105574ba704f", + "sha256:cd5df75523866410809ca100dc9681e301e3c27567cf498077e8551b6d20e42f", + "sha256:e249096428b3ae81b08327a63a485ad0878de3fb939049038579ac0ef61e17e7" + ], + "version": "==1.1.1" + }, + "packaging": { + "hashes": [ + "sha256:0c98a5d0be38ed775798ece1b9727178c4469d9c3b4ada66e8e6b7849f8732af", + "sha256:9e1cbf8c12b1f1ce0bb5344b8d7ecf66a6f8a6e91bcb0c84593ed6d3ab5c4ab3" + ], + "version": "==19.0" }, "pkginfo": { "hashes": [ - "sha256:5878d542a4b3f237e359926384f1dde4e099c9f5525d236b1840cf704fa8d474", - "sha256:a39076cb3eb34c333a0dd390b568e9e1e881c7bf2cc0aee12120636816f55aee" + "sha256:7424f2c8511c186cd5424bbf31045b77435b37a8d604990b79d4e70d741148bb", + "sha256:a6d9e40ca61ad3ebd0b72fbadd4fba16e4c0e4df0428c041e01e06eb6ee71f32" ], - "version": "==1.4.2" + "version": "==1.5.0.1" }, "pygments": { "hashes": [ - "sha256:78f3f434bcc5d6ee09020f92ba487f95ba50f1e3ef83ae96b9d5ffa1bab25c5d", - "sha256:dbae1046def0efb574852fab9e90209b23f556367b5a320c0bcb871c77c3e8cc" + "sha256:5ffada19f6203563680669ee7f53b64dabbeb100eb51b61996085e99c03b284a", + "sha256:e8218dd399a61674745138520d0d4cf2621d7e032439341bc3f647bff125818d" ], - "version": "==2.2.0" + "version": "==2.3.1" + }, + "pyparsing": { + "hashes": [ + "sha256:66c9268862641abcac4a96ba74506e594c884e3f57690a696d21ad8210ed667a", + "sha256:f6c5ef0d7480ad048c054c37632c67fca55299990fff127850181659eea33fc3" + ], + "version": "==2.3.1" + }, + "pytz": { + "hashes": [ + "sha256:32b0891edff07e28efe91284ed9c31e123d84bea3fd98e1f72be2508f43ef8d9", + "sha256:d5f05e487007e29e03409f9398d074e158d920d36eb82eaf66fb1136b0c5374c" + ], + "version": "==2018.9" }, "readme-renderer": { "hashes": [ - "sha256:219a02f5359b6631f5ab952f6906c6c105bdd8bc4bf19c1ec5ee8bd9ea2dc1eb", - "sha256:f8f122ad9fd6d138337531379575a01a0b6ca70aedca78f094cb833da38c8c0c" + "sha256:bb16f55b259f27f75f640acf5e00cf897845a8b3e4731b5c1a436e4b8529202f", + "sha256:c8532b79afc0375a85f10433eca157d6b50f7d6990f337fa498c96cd4bfc203d" ], - "version": "==23.0" + "version": "==24.0" }, "requests": { "hashes": [ - "sha256:99dcfdaaeb17caf6e526f32b6a7b780461512ab3f1d992187801694cba42770c", - "sha256:a84b8c9ab6239b578f22d1c21d51b696dcfe004032bb80ea832398d6909d7279" + "sha256:502a824f31acdacb3a35b6690b5fbf0bc41d63a24a45c4004352b0242707598e", + "sha256:7bf2a778576d825600030a110f3c0e3e8edc51dfaafe1c146e39a2027784957b" ], - "markers": "python_version < '4' and python_version != '3.2.*' and python_version != '3.1.*' and python_version != '3.0.*' and python_version != '3.3.*' and python_version >= '2.7'", - "version": "==2.20.0" + "version": "==2.21.0" }, "requests-toolbelt": { "hashes": [ - "sha256:42c9c170abc2cacb78b8ab23ac957945c7716249206f90874651971a4acff237", - "sha256:f6a531936c6fa4c6cfce1b9c10d5c4f498d16528d2a54a22ca00011205a187b5" + "sha256:380606e1d10dc85c3bd47bf5a6095f815ec007be7a8b69c878507068df059e6f", + "sha256:968089d4584ad4ad7c171454f0a5c6dac23971e9472521ea3b6d49d610aa6fc0" ], - "markers": "python_version < '4' and python_version != '3.2.*' and python_version != '3.1.*' and python_version != '3.0.*' and python_version != '3.3.*' and python_version >= '2.7'", - "version": "==0.8.0" + "version": "==0.9.1" }, "six": { "hashes": [ - "sha256:70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9", - "sha256:832dc0e10feb1aa2c68dcc57dbb658f1c7e65b9b61af69048abc87a2db00a0eb" + "sha256:3350809f0555b11f552448330d0b52d5f24c91a322ea4a15ef22629740f3761c", + "sha256:d16a0141ec1a18405cd4ce8b4613101da75da0e9a7aec5bdd4fa804d0e0eba73" ], - "version": "==1.11.0" + "version": "==1.12.0" + }, + "snowballstemmer": { + "hashes": [ + "sha256:919f26a68b2c17a7634da993d91339e288964f93c274f1343e3bbbe2096e1128", + "sha256:9f3bcd3c401c3e862ec0ebe6d2c069ebc012ce142cce209c098ccb5b09136e89" + ], + "version": "==1.2.1" + }, + "sphinx": { + "hashes": [ + "sha256:b53904fa7cb4b06a39409a492b949193a1b68cc7241a1a8ce9974f86f0d24287", + "sha256:c1c00fc4f6e8b101a0d037065043460dffc2d507257f2f11acaed71fd2b0c83c" + ], + "index": "pypi", + "version": "==1.8.4" + }, + "sphinx-rtd-theme": { + "hashes": [ + "sha256:00cf895504a7895ee433807c62094cf1e95f065843bf3acd17037c3e9a2becd4", + "sha256:728607e34d60456d736cc7991fd236afb828b21b82f956c5ea75f94c8414040a" + ], + "index": "pypi", + "version": "==0.4.3" + }, + "sphinxcontrib-websupport": { + "hashes": [ + "sha256:68ca7ff70785cbe1e7bccc71a48b5b6d965d79ca50629606c7861a21b206d9dd", + "sha256:9de47f375baf1ea07cdb3436ff39d7a9c76042c10a769c52353ec46e4e8fc3b9" + ], + "version": "==1.1.0" }, "tqdm": { "hashes": [ - "sha256:3c4d4a5a41ef162dd61f1edb86b0e1c7859054ab656b2e7c7b77e7fbf6d9f392", - "sha256:5b4d5549984503050883bc126280b386f5f4ca87e6c023c5d015655ad75bdebb" + "sha256:d385c95361699e5cf7622485d9b9eae2d4864b21cd5a2374a9c381ffed701021", + "sha256:e22977e3ebe961f72362f6ddfb9197cc531c9737aaf5f607ef09740c849ecd05" ], - "markers": "python_version != '3.0.*' and python_version != '3.1.*' and python_version >= '2.6'", - "version": "==4.28.1" + "version": "==4.31.1" }, "twine": { "hashes": [ - "sha256:7d89bc6acafb31d124e6e5b295ef26ac77030bf098960c2a4c4e058335827c5c", - "sha256:fad6f1251195f7ddd1460cb76d6ea106c93adb4e56c41e0da79658e56e547d2c" + "sha256:0fb0bfa3df4f62076cab5def36b1a71a2e4acb4d1fa5c97475b048117b1a6446", + "sha256:d6c29c933ecfc74e9b1d9fa13aa1f87c5d5770e119f5a4ce032092f0ff5b14dc" ], "index": "pypi", - "version": "==1.12.1" + "version": "==1.13.0" }, "urllib3": { "hashes": [ - "sha256:41c3db2fc01e5b907288010dec72f9d0a74e37d6994e6eb56849f59fea2265ae", - "sha256:8819bba37a02d143296a4d032373c4dd4aca11f6d4c9973335ca75f9c8475f59" + "sha256:61bf29cada3fc2fbefad4fdf059ea4bd1b4a86d2b6d15e1c7c0b582b9752fe39", + "sha256:de9529817c93f27c8ccbfead6985011db27bd0ddfcdb2d86f3f663385c6a9c22" ], - "markers": "python_version < '4' and python_version != '3.2.*' and python_version != '3.1.*' and python_version != '3.0.*' and python_version != '3.3.*' and python_version >= '2.7'", - "version": "==1.24" + "version": "==1.24.1" }, "webencodings": { "hashes": [ diff --git a/anime_downloader/sites/anime.py b/anime_downloader/sites/anime.py index 39c532b..4835a2e 100644 --- a/anime_downloader/sites/anime.py +++ b/anime_downloader/sites/anime.py @@ -1,19 +1,43 @@ +""" +anime.py contains the base classes required for other anime classes. +""" +import requests from bs4 import BeautifulSoup import os import logging import copy -from anime_downloader import session from anime_downloader.sites.exceptions import AnimeDLError, NotFoundError from anime_downloader import util -from anime_downloader.sites import helpers -from anime_downloader.const import desktop_headers from anime_downloader.extractors import get_extractor from anime_downloader.downloader import get_downloader class Anime: + """ + Base class for all anime classes. + + Parameters + ---------- + url: string + URL of the anime. + quality: One of ['360p', '480p', '720p', '1080p'] + Quality of episodes + fallback_qualities: list + The order of fallback. + + Attributes + ---------- + sitename: string + name of the site + title: string + Title of the anime + meta: dict + metadata about the anime. [Can be empty] + QUALITIES: list + Possible qualities for the site + """ sitename = '' title = '' meta = dict() @@ -24,6 +48,12 @@ class Anime: @classmethod def search(cls, query): + """ + Search searches for the anime using the query given. + + query : + query is + """ return def __init__(self, url=None, quality='720p', diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..298ea9e --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,19 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +SOURCEDIR = . +BUILDDIR = _build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) \ No newline at end of file diff --git a/docs/advanced/custom_site.rst b/docs/advanced/custom_site.rst new file mode 100644 index 0000000..d99a8c1 --- /dev/null +++ b/docs/advanced/custom_site.rst @@ -0,0 +1,3 @@ +Writing your own custom site class +********************************** + diff --git a/docs/api/anime.rst b/docs/api/anime.rst new file mode 100644 index 0000000..a6cfdab --- /dev/null +++ b/docs/api/anime.rst @@ -0,0 +1,7 @@ +Base classes +************ + +.. automodule:: anime_downloader.sites.anime + +.. autoclass:: anime_downloader.sites.anime.BaseAnime + :members: search diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 0000000..cfda85d --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,185 @@ +# -*- coding: utf-8 -*- +# +# Configuration file for the Sphinx documentation builder. +# +# This file does only contain a selection of the most common options. For a +# full list see the documentation: +# http://www.sphinx-doc.org/en/master/config + +# -- Path setup -------------------------------------------------------------- + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +# import os +# import sys +# sys.path.insert(0, os.path.abspath('.')) + + +# -- Project information ----------------------------------------------------- + +project = 'anime-downloader' +copyright = '2018, Vishnunarayan K I' +author = 'Vishnunarayan K I' + +# The short X.Y version +version = '' +# The full version, including alpha/beta/rc tags +release = '3.5.0' + + +# -- General configuration --------------------------------------------------- + +# If your documentation needs a minimal Sphinx version, state it here. +# +# needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + 'sphinx.ext.autodoc', + 'sphinx.ext.todo', + 'sphinx.ext.viewcode', +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix(es) of source filenames. +# You can specify multiple suffix as a list of string: +# +# source_suffix = ['.rst', '.md'] +source_suffix = '.rst' + +# The master toctree document. +master_doc = 'index' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = None + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path. +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = None + + +# -- Options for HTML output ------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +# html_theme = 'alabaster' +html_theme = "sphinx_rtd_theme" + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +# +# html_theme_options = {} + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +# Custom sidebar templates, must be a dictionary that maps document names +# to template names. +# +# The default sidebars (for documents that don't match any pattern) are +# defined by theme itself. Builtin themes are using these templates by +# default: ``['localtoc.html', 'relations.html', 'sourcelink.html', +# 'searchbox.html']``. +# +# html_sidebars = {} + + +# -- Options for HTMLHelp output --------------------------------------------- + +# Output file base name for HTML help builder. +htmlhelp_basename = 'anime-downloaderdoc' + + +# -- Options for LaTeX output ------------------------------------------------ + +latex_elements = { + # The paper size ('letterpaper' or 'a4paper'). + # + # 'papersize': 'letterpaper', + + # The font size ('10pt', '11pt' or '12pt'). + # + # 'pointsize': '10pt', + + # Additional stuff for the LaTeX preamble. + # + # 'preamble': '', + + # Latex figure (float) alignment + # + # 'figure_align': 'htbp', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + (master_doc, 'anime-downloader.tex', 'anime-downloader Documentation', + 'Vishnunarayan K I', 'manual'), +] + + +# -- Options for manual page output ------------------------------------------ + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + (master_doc, 'anime-downloader', 'anime-downloader Documentation', + [author], 1) +] + + +# -- Options for Texinfo output ---------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + (master_doc, 'anime-downloader', 'anime-downloader Documentation', + author, 'anime-downloader', 'One line description of project.', + 'Miscellaneous'), +] + + +# -- Options for Epub output ------------------------------------------------- + +# Bibliographic Dublin Core info. +epub_title = project + +# The unique identifier of the text. This can be a ISBN number +# or the project homepage. +# +# epub_identifier = '' + +# A unique identification for the text. +# +# epub_uid = '' + +# A list of files that should not be packed into the epub file. +epub_exclude_files = ['search.html'] + + +# -- Extension configuration ------------------------------------------------- + +# -- Options for todo extension ---------------------------------------------- + +# If true, `todo` and `todoList` produce output, else they produce nothing. +todo_include_todos = True diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 0000000..e7bf4b4 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,45 @@ +.. anime-downloader documentation master file, created by + sphinx-quickstart on Tue Oct 9 19:36:23 2018. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to anime-downloader's documentation! +============================================ + +anime-downloader helps you download your favorite anime + +Features +-------- + +- Download or stream any episode or episode range of any anime. +- Specify the quality you want to stream or download. +- Search and download. +- Save yourselves from those malicious ads. +- Add any anime to your watch list using `anime watch` and let anime downloader take care of everything for you. +- Download using external downloader ([aria2](https://aria2.github.io/) recommended). +- Configurable using `config.json`. See [doc](https://github.com/vn-ki/anime-downloader/wiki/Config). + +Supported Sites +--------------- + +- 9anime +- twist.moe +- KissAnime [cloudflare] +- Masterani.me [cloudlfare] +- KissCartoon [cloudflare] +- Gogoanime +- AnimePahe [cloudflare] + +NOTE: To download from sites marked `[cloudflare]`, anime-downloader has to be installed with cloudflare support(See below). + +.. toctree:: + :maxdepth: 2 + :hidden: + :caption: Contents: + + usage/installation + usage/dl + usage/watch + usage/config + advanced/custom_site + api/anime.rst diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 0000000..27f573b --- /dev/null +++ b/docs/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +set BUILDDIR=_build + +if "%1" == "" goto help + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% + +:end +popd diff --git a/docs/usage/config.rst b/docs/usage/config.rst new file mode 100644 index 0000000..c153b75 --- /dev/null +++ b/docs/usage/config.rst @@ -0,0 +1,39 @@ +Config +------ + +You can configure the tool to suit your needs by using ``config.json``. + +This can be found under: + +- ``~/.config/anime-downloader`` on Linux + +- ``C:\Users\[Username]\AppData\Roaming\anime downloader`` on Windows + +You can override the settings in the ``config.json``, with command line +arguments. + +The default config file is given below. + +.. code:: json + + { + "dl": { + "download_dir": ".", + "force_download": false, + "file_format": "{anime_title}/{anime_title}_{ep_no}", + "log_level": "INFO", + "player": null, + "quality": "720p", + "skip_download": false, + "url": false + }, + "watch": { + "log_level": "INFO", + "quality": "720p" + } + } + +.. note:: + - For the key ``file_format``, you can set ``anime_title``\ (which refers to the title of the anime) and ``ep_no`` which is the number of the epiosde. + - If you set ``player`` in ``dl``, the tool will never download, only play in the set player. + - If you set ``force_download``, it will redownload even if the epiosde has already been downloaded. diff --git a/docs/usage/dl.rst b/docs/usage/dl.rst new file mode 100644 index 0000000..f684885 --- /dev/null +++ b/docs/usage/dl.rst @@ -0,0 +1,59 @@ +``anime dl`` +============ + +.. note:: + **It is recommended to use the external downloader functionality with aria2c because it will be faster than the internal downloader**: Use the argument ``-xd "{aria2}"`` + +.. note:: + Run ``anime dl --help`` to get the latest cli options. + +Search and download +^^^^^^^^^^^^^^^^^^^ + +- To search and download all episodes. + +.. code:: bash + + anime dl 'code geass' + +To search on kissanime, + +.. code:: bash + + anime dl 'code geass' --provider kissanime + +Run ``anime dl --help`` for help text on ``dl`` subcommand. + +Download directly +^^^^^^^^^^^^^^^^^ + +- To download Fullmetal Alchemist: Brotherhood all episodes + +:: + + anime dl 'https://www7.9anime.is/watch/fullmetal-alchemist-brotherhood.0r7/j69y93' + +- To download Fullmetal Alchemist: Brotherhood episode 1 + +:: + + anime dl 'https://www7.9anime.is/watch/fullmetal-alchemist-brotherhood.0r7/j69y93' --episodes 1 + +- To download Fullmetal Alchemist: Brotherhood episode 1 to 20 + +:: + + anime dl 'https://www7.9anime.is/watch/fullmetal-alchemist-brotherhood.0r7/j69y93' --episodes 1:21 + +- To get stream url of Fullmetal Alchemist: Brotherhood episode 1. + +:: + + anime dl 'https://www7.9anime.is/watch/fullmetal-alchemist-brotherhood.0r7/j69y93' --url --episodes 1 + +- To play using vlc. (On windows use path to exe) + +:: + + anime dl 'https://www7.9anime.is/watch/fullmetal-alchemist-brotherhood.0r7/j69y93' --play vlc --episodes 1 + diff --git a/docs/usage/installation.rst b/docs/usage/installation.rst new file mode 100644 index 0000000..f447fd5 --- /dev/null +++ b/docs/usage/installation.rst @@ -0,0 +1,108 @@ + +Installation +------------ + +The following are extended installation instructions for Windows and +Linux users. (For windows choco users, scroll to last) + +Windows +~~~~~~~ + +This tool requires python >= 3.3. + +- Go to python windows `downloads section`_. Choose the option + ``Latest python 3 release``. *Note, not python 2 but python 3* +- Download and install it like any other application. **Don’t forget to + select ‘Add Python to PATH’ in the installation screen** +- After installation open a command prompt and type in the following + command. + +:: + + pip install anime-downloader[cloudflare] + +- Enjoy downloading anime. + +NOTE: If you want to use ``watch`` you have to do some more steps. +(Trust me, it is work the additional steps) - Download mpv from `here`_. +- Extract the zip and place ``mpv.exe`` in the folder your command +prompt opens. (The path you see when you open command prompt). - Enjoy. +Read documentation for watch to know more. + +Windows via ``choco`` +~~~~~~~~~~~~~~~~~~~~~ + + Contributed by @CodaTheOtaku + +.. note:: + make sure you are running the Command Prompt in "Run as Adminstrator" mode + +- Using the Chocolatey Package Manager:: + + choco install -y git mpv python3 aria2 nodejs +- Once these are installed:: + + pip3 install -U git+https://github.com/vn-ki/anime-downloader.git#egg=anime-downloader[cloudflare] + +- then the commands to view a show would be:: + + anime watch --provider *Insert provider name* --new + +Linux +~~~~~ + +If you are using linux, you most probably already have python installed. + +Type ``pip --version`` into your terminal. If it says python2, replace +all the following ``pip`` with ``pip3``. + +- You only need one command. + +:: + + pip install anime-downloader[cloudflare] + +- Enjoy. +- You can download mpv with your package manager. You can follow `this + guide`_, to install it on ubuntu. + + +Windows via ``choco`` (Method 2) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + Contributed by @1ijack + +- Using the `Chocolatey`_ Package manager (via Windows Nuget) to + + - Install these pre-reqs: `git`_ `python3`_ `aria2`_ `mpv`_ + - Refresh/Update environment changes (choco ``refreshenv`` command) + - clone this repository to + ``[C:]\Users\[USERNAME]\anime-downloader`` + - setup/build anime-downloader from + ``"%userprofile%\anime-downloader"`` + - run ``anime watch`` command + +- the ``choco install`` command SHOULD be run with an administrator + privledged ``cmd.exe`` console: + + - ``[WindowsKey] > "cmd.exe" > [Shift]+[Ctrl]+[Enter] > (Click "Yes")`` + + :: + + choco install -y git python3 aria2 mpv + +- the rest of the commands SHOULD be run in an un-privledged/normal + ``cmd.exe`` console: + + - ``[WindowsKey] > "cmd.exe" > [Enter]`` \``\` refreshenv git clone + https://github.com/vn-ki/anime-downloader + “%userprofile%:raw-latex:`\anime`-downloader” cd /d " + +.. _downloads section: https://www.python.org/downloads/windows/ +.. _here: https://mpv.srsfckn.biz/ +.. _this guide: http://ubuntuhandbook.org/index.php/2017/12/install-mpv-0-28-0-in-ubuntu-18-04-16-04/ +.. _Chocolatey: https://chocolatey.org/install +.. _git: https://chocolatey.org/packages/git +.. _python3: https://chocolatey.org/packages/python3 +.. _aria2: https://chocolatey.org/packages/aria2 +.. _mpv: https://chocolatey.org/packages/mpv diff --git a/docs/usage/watch.rst b/docs/usage/watch.rst new file mode 100644 index 0000000..f2bd772 --- /dev/null +++ b/docs/usage/watch.rst @@ -0,0 +1,94 @@ +``watch`` +========= +.. note:: + You need `mpv`_ to use this subcommand. + +.. figure:: https://thumbs.gfycat.com/FrailSmallGosling-size_restricted.gif + :alt: gif + + anime watch in action + +``anime watch`` can be a all in one solution for your anime needs. +Currently only supports 9anime. + +``watch`` will track your progress through an anime and thus make your +life easier. + +:: + + CONTROLS IN MPV: + > : Next episode + < : Previous episode + q : Quit + +:: + + $ anime watch --help + Usage: anime watch [OPTIONS] [ANIME_NAME] + + With watch you can keep track of any anime you watch. + + Available Commands after selection of an anime: + set : set episodes_done and title. Ex: set episodes_done=3 + remove : remove selected anime from watch list + update : Update the episodes of the currrent anime + watch : Watch selected anime + download : Download episodes of selected anime + + Options: + -n, --new Create a new anime to watch + -l, --list List all animes in watch list + -r, --remove Remove the specified anime + -q, --quality [360p|480p|720p|1080p] + Specify the quality of episode. + -ll, --log-level [DEBUG|INFO|WARNING|ERROR] + Sets the level of logger + --help Show this message and exit. + +``anime watch --new`` +--------------------- + +This command adds an anime to your watch list. + +If you run ``anime watch --new``, you will be prompted to enter a search +term. If you already know what to search for, use +``anime watch --new``. You can then select an anime to be +added to the watch list. + +:: + + $ anime watch 'code geass' --new + 1: Code Geass: Nunnally in Wonderland OVA + 2: Code Geass: Fukkatsu no Lelouch Preview | Ep 2 Previ + 3: Code Geass: Lelouch of the Rebellion (Du DUB | Ep 25/25 + 4: Code Geass: Hangyaku no Lelouch Recaps Special | Ep 2/2 + 5: Code Geass: Lelouch of the Rebellion R2 Ep 25/25 + 6: Code Geass: Hangyaku no Lelouch III - Ou Preview + 7: Code Geass: Hangyaku no Lelouch I - Koud Movie + 8: Code Geass: Hangyaku no Lelouch II - Han Preview + 9: Code Geass: Lelouch of the Rebellion Ep 25/25 + 10: Code Geass: Lelouch of the Rebellion R2 DUB | Ep 25/25 + + Enter the anime no: [1]: 9 + INFO:Selected Code Geass: Lelouch of the Rebellion + INFO:Extracting episode info from page + INFO:Added Code Geass: Lelouch of the Rebellion to watch list. + +``anime watch --list`` +---------------------- + +This command lists your watch list. + +:: + + $ anime watch --list + SlNo | Name | Eps | Type + ----------------------------------------------------------------- + 1 | Code Geass: Lelouch of the Rebellio | 0/25 | TV Series + +You can select an anime from this list and perform an action on it. +\``\` Available Commands after selection of an anime: set : set +episodes_done and title. Ex: set episodes_done=3 remove : remove +selected anime fro + +.. _mpv: https://mpv.io/