-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #30 Improve the torrent objects
- Loading branch information
1 parent
d3b2892
commit 9db8af3
Showing
7 changed files
with
82 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,6 @@ nyaapy.egg-info | |
.vscode | ||
env/ | ||
*.pyc | ||
test_files | ||
test_files | ||
venv | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,7 @@ | ||
# Info about the module | ||
__version__ = '0.6.0' | ||
__version__ = '0.6.3' | ||
__author__ = 'Juanjo Salvador' | ||
__email__ = '[email protected]' | ||
__url__ = 'http://juanjosalvador.me' | ||
__copyright__ = '2017 Juanjo Salvador' | ||
__license__ = 'MIT license' | ||
|
||
from NyaaPy.nyaa import Nyaa | ||
from NyaaPy.pantsu import Pantsu | ||
from NyaaPy.sukebei import SukebeiNyaa, SukebeiPantsu | ||
__license__ = 'MIT license' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
def json_to_class(data): | ||
# We check if the data passed is a list or not | ||
if isinstance(data, list): | ||
object_list = [] | ||
for item in data: | ||
object_list.append(Torrent(item)) | ||
# Return a list of Torrent objects | ||
return object_list | ||
else: | ||
return Torrent(data) | ||
|
||
|
||
# This deals with converting the dict to an object | ||
class Torrent(object): | ||
def __init__(self, my_dict): | ||
for key in my_dict: | ||
setattr(self, key, my_dict[key]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters