diff --git a/nodes.json b/nodes.json index 22c2778..f0692d2 100644 --- a/nodes.json +++ b/nodes.json @@ -1,55 +1,28 @@ [ { "name":"YGGtracker", - "description":"YGGtracker official", - "url":"http://[201:23b4:991a:634d:8359:4521:5576:15b7]/yggtracker/api/torrents?%s", - "categories": - { - "all":[ - "movie", - "series", - "tv", - "animation", - "music", - "game", - "audiobook", - "podcast", - "book", - "archive", - "picture", - "software", - "other" - ], - "anime":[ - "animation" - ], - "books": - [ - "book", - "audiobook" - ], - "games":[ - "game" - ], - "movies":[ - "movie", - "series" - ], - "music":[ - "music" - ], - "pictures":[ - "picture" - ], - "software":[ - "software", - "archive" - ], - "tv":[ - "tv", - "podcast", - "series" - ] - } + "description":"YGGtracker official node", + "url":"http://[201:23b4:991a:634d:8359:4521:5576:15b7]/yggtracker/", + "api":"http://[201:23b4:991a:634d:8359:4521:5576:15b7]/yggtracker/api/torrents?%s", + "sensitive":null, + "yggdrasil":null, + "locale":"en", + "locales": + [ + "en", + "cs", + "eo", + "fr", + "ka", + "de", + "he", + "it", + "lv", + "pl", + "pt", + "ru", + "es", + "uk" + ] } ] \ No newline at end of file diff --git a/yggtracker.py b/yggtracker.py index 53e06d3..050dcac 100644 --- a/yggtracker.py +++ b/yggtracker.py @@ -1,4 +1,4 @@ -# VERSION: 1.1.0 +# VERSION: 1.00 # LICENSE: MIT # AUTHORS: https://github.com/YGGverse/qbittorrent-yggtracker-search-plugin @@ -12,17 +12,6 @@ class yggtracker(object): name = 'YGGtracker' url = 'https://github.com/YGGverse/YGGtracker' - supported_categories = { - 'all':[], - 'anime':[], - 'books':[], - 'games':[], - 'movies':[], - 'music':[], - 'pictures':[], - 'software':[], - 'tv':[] - } def __init__(self): pass @@ -43,20 +32,27 @@ class yggtracker(object): # apply query request what = unquote(what) params = { - 'query': what, - 'filter': 'true' + 'query': what } - # apply categories filter - categories = [] - for category in node['categories'][cat]: - categories.append(category) + # apply locales filter + if len(node['locales']) > 0: + params['locales'] = '|'.join(node['locales']) - if len(categories) > 0: - params['categories'] = '|'.join(categories) + # apply sensitive filter + if node['sensitive'] is True: + params['sensitive'] = '1' + if node['sensitive'] is False: + params['sensitive'] = '0' + + # apply yggdrasil filter + if node['yggdrasil'] is True: + params['yggdrasil'] = '1' + if node['yggdrasil'] is False: + params['yggdrasil'] = '0' # send api request - response = retrieve_url(node['url'] % urlencode(params)) + response = retrieve_url(node['api'] % urlencode(params)) response_json = json.loads(response) # check empty response @@ -71,7 +67,7 @@ class yggtracker(object): 'size': str(item['torrent']['file']['size']) + " B", 'seeds': item['torrent']['scrape']['seeders'], 'leech': item['torrent']['scrape']['leechers'], - 'engine_url': response_json['tracker']['url'], - 'desc_link': item['torrent']['url'] + 'engine_url': node['url'], + 'desc_link': item['torrent']['url'][node['locale']] } prettyPrinter(res) \ No newline at end of file