feat(nyaasi): add static classes instead of object-based ones
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
from enum import Enum
|
||||
|
||||
|
||||
def json_to_class(data):
|
||||
# We check if the data passed is a list or not
|
||||
if isinstance(data, list):
|
||||
@@ -9,9 +12,18 @@ def json_to_class(data):
|
||||
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])
|
||||
|
||||
class TorrentSite(Enum):
|
||||
"""
|
||||
Contains torrent sites
|
||||
"""
|
||||
|
||||
NYAASI = "https://nyaa.si"
|
||||
SUKEBEINYAASI = "https://sukebei.nyaa.si"
|
||||
|
||||
NYAALAND = "https://nyaa.land"
|
||||
Reference in New Issue
Block a user