~charles/ftpmusync

4f7932164a687e26f7ccd9d4dfb25e3083dc773f — Charles Daniels 1 year, 4 months ago 5e89694 master
0.0.3 release
3 files changed, 23 insertions(+), 5 deletions(-)

M CHANGELOG
M ftpmusync/constants.py
M ftpmusync/ftpwrapper.py
M CHANGELOG => CHANGELOG +5 -0
@@ 5,3 5,8 @@

	* Fixed a bug where providing an incorrect prefix with -e would cause
	  ftp.cwd() to throw an uncaught EOFError.

0.0.3:

	* Directory listing will now be retried if they fail, up to the maximum
	  number of FTP operation retries.

M ftpmusync/constants.py => ftpmusync/constants.py +1 -1
@@ 17,7 17,7 @@ ftp_retries = 5
# maximum number of IP addresses to scan
max_ips = 1000

version = "0.0.2"
version = "0.0.3"

description = """
A tool for syncing music via FTP to applications such as Foobar2000 which

M ftpmusync/ftpwrapper.py => ftpmusync/ftpwrapper.py +17 -4
@@ 151,12 151,25 @@ def get_listing(params, path):
    :param path:
    """

    tries = 0
    listing = []
    with ftplib.FTP() as ftp:
        ftp = setup_connection(ftp, params)
        for element in ftp.mlsd(path):
            listing.append(element)
        ftp.quit()
        while tries < constants.ftp_retries:
            try:
                ftp = setup_connection(ftp, params)
                for element in ftp.mlsd(path):
                    listing.append(element)
                ftp.quit()
                break
            except Exception as e:
                tries += 1
                logging.warning("exception {} while getting directory listing"
                        .format(e))
                util.log_exception(e, logging.debug)

        if tries >= constants.ftp_retries:
            logging.error("exceeded maximum retries while listing directory {}"
                    .format(path))

    return listing