Example #1
0
def main():
    try:
        print "Endomondo: export most recent workouts as TCX files"
        cred = credenciales()

        if len(cred) > 1:
            email, password, proxy = cred  # cred[0], cred[1]
            s_proxy = necesita_proxy(proxy)
            if s_proxy == ERROR_NO_INTERNET:
                print("No Internet Access. Impossible to continue!")
                return 0
        else:
            email = raw_input("Email: ")
            password = getpass.getpass()

        maximum_workouts = raw_input(
            "Maximum number of workouts (press Enter to ignore) ")
        endomondo = Endomondo(email, password, s_proxy)

        workouts = endomondo.get_workouts(maximum_workouts)
        print "Fetched latest", len(workouts), "workouts"
        for workout in workouts:
            create_tcx_file(workout)
        print "Export done!!"
        return 0

    except ValueError, exception:
        sys.stderr.write(str(exception) + "\n")
        return 1
def main():
    try:
        print "Endomondo: export most recent n workouts (or ALL) as TCX files."
        mail = raw_input("Email: ")
        password = getpass.getpass()
        maximum_workouts = raw_input("Maximum number of workouts n (press Enter to download ALL OF THEM): ")
        garmin = raw_input("Format for Garmin Connect? (press Enter to ignore): ")
        endomondo = Endomondo(mail, password, garmin)
        if garmin:
            print "Files will be formatted to be compatible with Garmin Connects import function."

        if not maximum_workouts:
            days_per_year = 365.24
            maximum_workouts = 500
            print "Downloading workouts from the last 15 years in chunks. (If you logged more than 500 workouts per year, this won't work)"
            for years in range(0,20):
                before=(datetime.datetime.now()-datetime.timedelta(days=(days_per_year*years)))
                after=before-datetime.timedelta(days=(days_per_year*(1)))
                print "Chunk before:" +str(before)
                print "Chunk after:" +str(after)
                workouts = endomondo.get_workouts(maximum_workouts, before, after)
                for workout in workouts:
                    create_tcx_file(workout)
            print "done."
            return 0

        workouts = endomondo.get_workouts(maximum_workouts, before=None, after=None)
        print "fetched latest", len(workouts), "workouts"
        for workout in workouts:
            create_tcx_file(workout)
        print "done."
        return 0

    except ValueError, exception:
        sys.stderr.write(str(exception) + "\n")
        return 1
def main():
    try:
        print "Endomondo: export most recent workouts as TCX files"

        email = raw_input("Email: ")
        password = getpass.getpass()
        maximum_workouts = raw_input("Maximum number of workouts (press Enter to ignore)")
        endomondo = Endomondo(email, password)

        workouts = endomondo.get_workouts(maximum_workouts)
        print "fetched latest", len(workouts), "workouts"
        for workout in workouts:
            create_tcx_file(workout)
        print "done."
        return 0

    except ValueError, exception:
        sys.stderr.write(str(exception) + "\n")
        return 1
Example #4
0
def main():
    try:
        print "Endomondo: export most recent workouts as TCX files"

        email = raw_input("Email: ")
        password = getpass.getpass()
        maximum_workouts = raw_input(
            "Maximum number of workouts (press Enter to ignore)")
        endomondo = Endomondo(email, password)

        workouts = endomondo.get_workouts(maximum_workouts)
        print "fetched latest", len(workouts), "workouts"
        for workout in workouts:
            create_tcx_file(workout)
        print "done."
        return 0

    except ValueError, exception:
        sys.stderr.write(str(exception) + "\n")
        return 1