Added docstring to functions and removed unused print statements.
This commit is contained in:
		| @@ -88,6 +88,10 @@ def getConfig(): | |||||||
|    return config |    return config | ||||||
|  |  | ||||||
| def createJSONList(torrents): | def createJSONList(torrents): | ||||||
|  |    """ | ||||||
|  |    Iterates over all torrent objects in torrents and gets all attributes which are appended to a list | ||||||
|  |    Returns: List of torrents with all their info in a JSON format | ||||||
|  |    """ | ||||||
|    jsonList = [] |    jsonList = [] | ||||||
|    for torrent in torrents: |    for torrent in torrents: | ||||||
|       jsonList.append(torrent.get_all_attr()) |       jsonList.append(torrent.get_all_attr()) | ||||||
| @@ -100,6 +104,10 @@ def createJSONList(torrents): | |||||||
| # PS: Is it the right move to use a shared standard? What | # PS: Is it the right move to use a shared standard? What | ||||||
| # happens if it is no longer public? | # happens if it is no longer public? | ||||||
| def chooseCandidate(torrent_list): | def chooseCandidate(torrent_list): | ||||||
|  |    """ | ||||||
|  |    Takes a list of torrents and filtes then on a given release type | ||||||
|  |    Returns: JSON list of torrents only matching release type | ||||||
|  |    """ | ||||||
|    interesting_torrents = [] |    interesting_torrents = [] | ||||||
|    match_release_type = ['bdremux', 'brremux', 'remux', 'bdrip', 'brrip', 'blu-ray', 'bluray', 'bdmv', 'bdr', 'bd5'] |    match_release_type = ['bdremux', 'brremux', 'remux', 'bdrip', 'brrip', 'blu-ray', 'bluray', 'bdmv', 'bdr', 'bd5'] | ||||||
|  |  | ||||||
| @@ -119,13 +127,15 @@ def chooseCandidate(torrent_list): | |||||||
|  |  | ||||||
|  |  | ||||||
| def searchTorrentSite(config, query, site, print_result): | def searchTorrentSite(config, query, site, print_result): | ||||||
|  |    """ | ||||||
|  |    Selects site based on input and finds torrents for that site based on query | ||||||
|  |    Returns json list with results. If print_results is True in args then also prints the output to terminal | ||||||
|  |    """ | ||||||
|    logger.debug('Searching for query {} at {}'.format(query, site)) |    logger.debug('Searching for query {} at {}'.format(query, site)) | ||||||
|  |  | ||||||
|    if site == 'piratebay': |    if site == 'piratebay': | ||||||
|       pirate = Piratebay(config['PIRATEBAY']['HOST'], config['PIRATEBAY']['PATH'], |       pirate = Piratebay(config['PIRATEBAY']['HOST'], config['PIRATEBAY']['PATH'], | ||||||
|          config['PIRATEBAY']['LIMIT'], config['PIRATEBAY']['SSL']) |          config['PIRATEBAY']['LIMIT'], config['PIRATEBAY']['SSL']) | ||||||
|       print(pirate) |  | ||||||
|       print('why no here?') |  | ||||||
|       torrents_found = pirate.search(query) |       torrents_found = pirate.search(query) | ||||||
|    elif site == 'jackett': |    elif site == 'jackett': | ||||||
|       jackett = Jackett(config['JACKETT']['APIKEY'], config['JACKETT']['HOST'],  |       jackett = Jackett(config['JACKETT']['APIKEY'], config['JACKETT']['HOST'],  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user