Skip to content

Commit

Permalink
Fix long_description_content_type missing error in setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Samfun75 committed Feb 2, 2021
1 parent f0a769e commit a0532f1
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 21 deletions.
22 changes: 10 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# LibGenesis
# libgenesis

Asynchronous python library for Libgen.rs to search and download books.

## Installing libgenesis

using the command line
```python
pip install libgenesis
```
Expand All @@ -23,8 +23,8 @@ or
```python
lg = Libgen(sort= 'year', sort_mode= 'ASC', result_limit= '50')
```
When creating an instance of LibGen, you can set 3 option.

When creating an instance of LibGen, you can set 3 option.
- **sort**: You can use this to choose a sorting method from allowed fields ( 'id', 'author', 'title', 'publisher', 'year', 'pages', 'language', 'size', 'extension'). Defaults to 'def'.
- **sort_mode**: Pick the order of the sort ascending or decending ('ASC', 'DESC'). Defaults to 'DESC'.
- **result_limit**: Limit the number of results based on the allowed limit (25, 50, 100). Defaults to 25.
Expand All @@ -34,12 +34,12 @@ When creating an instance of LibGen, you can set 3 option.
async def search():
q = 'japan history'
result = await lg.search(q)

for item in result:
print('id = ' + item)
print('title = ' + result[item]['title'])
print('md5 = ' + result[item]['md5'])
```

The returned data looks like this:

```python
Expand Down Expand Up @@ -112,35 +112,33 @@ The returned data looks like this:
'gnutella': 'magnet:?xt=urn:sha1:ZZYRRG56BOX3XAQ5D2IWAV2FUUC35ELG&xl=29750320&dn=a382109f7fdde3be5b2cb4f82d97443b.pdf',
'ed2k': 'ed2k://|file|A382109F7FDDE3BE5B2CB4F82D97443B.pdf|29750320|A63EEBB71C46DAE130725C07F2CDC67C|h=733CLKTMCYOGD4W5PIG2GMA7CMLAFN2V|/',
'dc++': 'magnet:?xt=urn:tree:tiger:O4O5Z7UL2YAOUG57PINCLOAN63HVZPCSDYACT6Q&xl=29750320&dn=a382109f7fdde3be5b2cb4f82d97443b.pdf'
}
}
},
},
'id_of_book':{
...
...
...
}
},
'id_of_book':{
...
...
...
}
},
}
```

Note that the above information except for mirrors is fecthed as is from Libgen and it is up to the uploader of the books to include the metadata of the books.

## Downloading a book

Downloading is only supported for the top **3** mirrors in the returned result ('main', 'libgen.lc', 'z-library'). Pass one of the 3 links to the download method of the Libgen object. Optionaly a destination Path can be passed with the url using **dest_folder** argument. The output of the download method is a Path to the downloaded file.

```python
async def download():
q = 'japan history'
result = await lg.search(q)

download_location = []
for item in result:
file_path = await lg.download(result[item]['mirrors']['main'])
# path = Path('Downloads')
# file_path = await lg.download(result[item]['mirrors']['main'], dest_folder=path)
download_location.append(file_path)
```
```
43 changes: 34 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,49 @@
with open('requirements.txt') as f:
install_requires = f.read().splitlines()

with open('README.md', 'r', encoding='utf-8') as rm_file:
readme = rm_file.read()

long_desc = '''Asynchronous python library for Libgen.rs to search and download books.\n\n Installing libgenesis\n \
using the command line\n \
pip install libgenesis\n\n \
Importing libgenesis\n \
from libgenesis import Libgen\n\n \
Creating libgenesis object\n \
lg = Libgen()\n \
or\n \
lg = Libgen(sort= "year", sort_mode= "ASC", result_limit= 50)\n\n \
Searching for a book\n \
async def search():\n \
q = "japan history"\n \
result = await lg.search(q)\n \
for item in result:\n \
print("id = " + item)\n \
print("title = " + result[item]["title"])\n \
print("md5 = " + result[item]["md5"])\n\n
Downloading for a book\n
async def download():\n
q = "japan history"\n
result = await lg.search(q)\n
download_location = []\n
for item in result:\n
file_path = await lg.download(result[item]["mirrors"]["main"])\n
# path = Path("Downloads")\n
# file_path = await lg.download(result[item]["mirrors"]["main"]], dest_folder=path)\n
download_location.append(file_path)'''

setup(name='LibGenesis',

setup(name='libgenesis',
version='0.1.0',
packages=find_packages(exclude=('tests')),
zip_safe=False,
url='https://github.com/Samfun75/LibGenesis',
description='Asynchronous python lib for Libgen.rs API to search and download books.',
download_url='https://github.com/Samfun75/libgenesis/archive/v0.1.0.tar.gz',
long_description=readme,
url='https://github.com/Samfun75/libgenesis',
long_description_content_type='text/markdown',
description='Asynchronous python lib for Libgen.rs',
download_url='https://github.com/Samfun75/libgenesis/archive/v0.1.0.tar.gz',
long_description=long_desc,
author='Samson Misganaw',
author_email='samfunn75@gmail.com',
license='MIT',
license='MIT License',
install_requires=install_requires,
python_requires="~=3.9",
classifiers=[
'Intended Audience :: Developers',
'Operating System :: OS Independent',
Expand Down

0 comments on commit a0532f1

Please sign in to comment.