diff --git a/torrentSearch/config.example.py b/torrentSearch/config.example.py deleted file mode 100644 index ea0be32..0000000 --- a/torrentSearch/config.example.py +++ /dev/null @@ -1,8 +0,0 @@ -[DEFAULT] - - -[JACKETT] -JACKETT_HOST = '10.0.0.41' -JACKETT_PORT = '9117' -JACKETT_MAX_SEARCH_RESULT = 1000 -RESULTS_PER_PAGE = 75 diff --git a/torrentSearch/config.example.ini b/torrentSearch/config.ini similarity index 63% rename from torrentSearch/config.example.ini rename to torrentSearch/config.ini index fd98b57..31937fc 100644 --- a/torrentSearch/config.example.ini +++ b/torrentSearch/config.ini @@ -1,18 +1,17 @@ [DEFAULT] - [JACKETT] -HOST = CHANGE_THIS_TO_YOUR_JACKETT_HOST_ADDRESS +HOST = CHANGE_THIS_TO_THE_IP_AND_PORT_OF_JACKETT PATH = torznab/all LIMIT = 150 JACKETT_MAX_SEARCH_RESULT = 1000 SSL = false RESULTS_PER_PAGE = 75 -apikey = CHANGE_THIS_TO_YOUR_JACKETT_API_KEY +APIKEY = CHANGE_THIS_TO_YOUR_JACKETT_API_KEY [PIRATEBAY] HOST = thepiratebay.org PATH = search LIMIT = 150 -SSL = true \ No newline at end of file +SSL = true diff --git a/torrentSearch/search.py b/torrentSearch/search.py index 1a30e0f..8b93fa9 100755 --- a/torrentSearch/search.py +++ b/torrentSearch/search.py @@ -1,13 +1,16 @@ #!/usr/bin/env python3.6 import configparser -import sys, argparse, json +import sys, argparse, json, os from jackett import Jackett from piratebay import Piratebay +BASE_DIR = os.path.dirname(os.path.abspath(__file__)) + def getConfig(): config = configparser.ConfigParser() - config.read('config.example.ini') + config_dir = os.path.join(BASE_DIR, 'config.example.ini') + config.read(config_dir) jackett_host = config['JACKETT']['HOST'] jackett_use_ssl = config['JACKETT']['SSL'] @@ -44,7 +47,7 @@ def searchTorrentSite(config, query, site): config['PIRATEBAY']['LIMIT'], config['PIRATEBAY']['SSL']) torrents_found = pirate.search(query) elif site == 'jackett': - jackett = Jackett(config['JACKETT']['apikey'], config['JACKETT']['HOST'], + jackett = Jackett(config['JACKETT']['APIKEY'], config['JACKETT']['HOST'], config['JACKETT']['PATH'], config['JACKETT']['LIMIT'], config.getboolean('JACKETT', 'SSL')) torrents_found = jackett.search(query) @@ -87,4 +90,4 @@ def main(): searchTorrentSite(config, args.query, args.site) if __name__ == '__main__': - main() \ No newline at end of file + main()