Skip to content

Commit 6afde09

Browse files
authored
Merge pull request #37 from mmarquezs/master
Make develop branch == master.
2 parents f48685f + 643893d commit 6afde09

File tree

5 files changed

+134
-44
lines changed

5 files changed

+134
-44
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Upload Python Package
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
deploy:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v1
12+
- name: Set up Python
13+
uses: actions/setup-python@v1
14+
with:
15+
python-version: '3.x'
16+
- name: Install dependencies
17+
run: |
18+
python -m pip install --upgrade pip
19+
pip install setuptools wheel twine
20+
- name: Build and publish
21+
env:
22+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
23+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
24+
run: |
25+
python setup.py sdist bdist_wheel
26+
twine upload dist/*

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,20 @@ device.downloads.query_packages([{
5858
```
5959
# DOCUMENTATION
6060

61+
Sadly currently broken. In any case the documentation was generated with the pydoc comments inside the code itself so checking the code should be enough for now.
62+
6163
http://myjdownloader-api-python-library.readthedocs.org/en/latest/myjdapi.html#module-myjdapi
6264

65+
66+
# PROJECTS USING THE LIBRARY
67+
Here are example of projects currently using the library. If you want to add your project feel free to open a PR so it gets added.
68+
69+
:warning: **WARNING**: I am not endorsing or curating these projects and neither I am responsible nor liable for any problems, losses or damages caused by any of those libraries. Take your own precautions.
70+
71+
* **PyYoutube2JD** - Allows JDownloader users to get all video links from a Youtube account (or playlist). - https://github.com/MarianoDesivo/PyYoutube2JD
72+
73+
74+
6375
# LICENSE
6476
The MIT License (MIT)
6577

myjdapi/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
from .myjdapi import Myjdapi
2-
__version__ = '1.0.3.dev1'
1+
from .myjdapi import Myjdapi
2+
__version__ = '1.0.6'

myjdapi/myjdapi.py

Lines changed: 58 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,13 @@ def add_links(self,
394394
"""
395395
resp = self.device.action("/linkgrabberv2/addLinks", params)
396396
return resp
397+
398+
def is_collecting(self):
399+
"""
400+
Boolean status query about the collecting process
401+
"""
402+
resp = self.device.action(self.url+"/isCollecting")
403+
return resp
397404

398405
def get_childrenchanged(self):
399406
"""
@@ -458,12 +465,26 @@ def rename_package(self):
458465
"""
459466
pass
460467

461-
def query_packages(self):
462-
"""
463-
No idea what parameters i have to pass and/or i don't know what it does.
464-
If i find out i will implement it :P
465-
"""
466-
pass
468+
def query_packages(self,
469+
params=[{
470+
"availableOfflineCount":True,
471+
"availableOnlineCount":True,
472+
"availableTempUnknownCount":True,
473+
"availableUnknownCount":True,
474+
"bytesTotal":True,
475+
"childCount":True,
476+
"comment":True,
477+
"enabled":True,
478+
"hosts":True,
479+
"maxResults":-1,
480+
"packageUUIDs":[],
481+
"priority":True,
482+
"saveTo":True,
483+
"startAt":0,
484+
"status":True
485+
}]):
486+
resp = self.device.action(self.url + "/queryPackages", params)
487+
return resp
467488

468489
def move_packages(self):
469490
"""
@@ -606,6 +627,36 @@ def force_download(self, link_ids=[], package_ids=[]):
606627
resp = self.device.action(self.url + "/forceDownload", params)
607628
return resp
608629

630+
class Captcha:
631+
"""
632+
Class that represents the captcha interface of a Device
633+
"""
634+
635+
def __init__(self, device):
636+
self.device = device
637+
self.url = "/captcha"
638+
639+
"""
640+
Get the waiting captchas
641+
"""
642+
def list(self):
643+
resp = self.device.action(self.url + "/list", [])
644+
return resp
645+
646+
"""
647+
Get the base64 captcha image
648+
"""
649+
def get(self, captcha_id):
650+
resp = self.device.action(self.url + "/get", (captcha_id,))
651+
return resp
652+
653+
"""
654+
Solve a captcha
655+
"""
656+
def solve(self, captcha_id, solution):
657+
resp = self.device.action(self.url + "/solve", (captcha_id, solution))
658+
return resp
659+
609660

610661
class Jddevice:
611662
"""
@@ -623,6 +674,7 @@ def __init__(self, jd, device_dict):
623674
self.device_type = device_dict["type"]
624675
self.myjd = jd
625676
self.linkgrabber = Linkgrabber(self)
677+
self.captcha = Captcha(self)
626678
self.downloads = Downloads(self)
627679
self.toolbar = Toolbar(self)
628680
self.downloadcontroller = DownloadController(self)

setup.py

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
1-
"""A setuptools based setup module.
2-
See:
3-
https://packaging.python.org/en/latest/distributing.html
4-
https://github.com/pypa/sampleproject
5-
"""
6-
from setuptools import setup, find_packages
7-
from codecs import open
8-
from os import path
9-
here = path.abspath(path.dirname(__file__))
10-
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
11-
long_description = f.read()
12-
setup(
13-
name='myjdapi',
14-
version='1.0.3.dev1',
15-
description='Library to use My.Jdownloader API in an easy way.',
16-
long_description=long_description,
17-
url='https://github.com/mmarquezs/My.Jdownloader-API-Python-Library/',
18-
author='Marc Marquez Santamaria',
19-
author_email='[email protected]',
20-
license='MIT',
21-
classifiers=[
22-
'Development Status :: 3 - Alpha',
23-
'Intended Audience :: Developers',
24-
'Topic :: Software Development :: Libraries',
25-
'License :: OSI Approved :: MIT License',
26-
'Programming Language :: Python :: 3',
27-
'Programming Language :: Python :: 3.2',
28-
'Programming Language :: Python :: 3.3',
29-
'Programming Language :: Python :: 3.4',
30-
'Programming Language :: Python :: 3.5',
31-
],
32-
keywords='myjdapi jdownloader my.jdownloader api development',
33-
packages=find_packages(exclude=['contrib', 'docs', 'tests']),
34-
# py_modules=["libgenapi"],
35-
install_requires=['requests','pycryptodome'],
36-
)
1+
"""A setuptools based setup module.
2+
See:
3+
https://packaging.python.org/en/latest/distributing.html
4+
https://github.com/pypa/sampleproject
5+
"""
6+
from setuptools import setup, find_packages
7+
from codecs import open
8+
from os import path
9+
here = path.abspath(path.dirname(__file__))
10+
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
11+
long_description = f.read()
12+
setup(
13+
name='myjdapi',
14+
version='1.0.6',
15+
description='Library to use My.Jdownloader API in an easy way.',
16+
long_description=long_description,
17+
url='https://github.com/mmarquezs/My.Jdownloader-API-Python-Library/',
18+
author='Marc Marquez Santamaria',
19+
author_email='[email protected]',
20+
license='MIT',
21+
classifiers=[
22+
'Development Status :: 3 - Alpha',
23+
'Intended Audience :: Developers',
24+
'Topic :: Software Development :: Libraries',
25+
'License :: OSI Approved :: MIT License',
26+
'Programming Language :: Python :: 3',
27+
'Programming Language :: Python :: 3.2',
28+
'Programming Language :: Python :: 3.3',
29+
'Programming Language :: Python :: 3.4',
30+
'Programming Language :: Python :: 3.5',
31+
],
32+
keywords='myjdapi jdownloader my.jdownloader api development',
33+
packages=find_packages(exclude=['contrib', 'docs', 'tests']),
34+
# py_modules=["libgenapi"],
35+
install_requires=['requests','pycryptodome'],
36+
)

0 commit comments

Comments
 (0)