From c6d6dc43e0d8b455dc4d0383747a33386c8a32c8 Mon Sep 17 00:00:00 2001 From: oldnapalm <38410858+oldnapalm@users.noreply.github.com> Date: Thu, 9 Mar 2023 10:04:14 -0300 Subject: [PATCH] Update instructions Steps 3, 4 and 5 can now be done in launcher also for single player, but if using the scripts, player_id 1 should be used --- README.md | 10 +++++----- zwift_offline.py | 22 ---------------------- 2 files changed, 5 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index c9d4367..a57c65d 100644 --- a/README.md +++ b/README.md @@ -243,9 +243,9 @@ To obtain your current profile: * Ensure zoffline is disabled. * Run ``scripts/get_profile.py -u `` * Or, if using the Windows zoffline.exe version without Python installed you can run ``get_profile.exe`` obtained from https://github.com/zoffline/zwift-offline/releases/tag/zoffline_helper in place of ``scripts/get_profile.py`` -* Move the resulting ``profile.bin`` (saved in whatever directory you ran get_profile.py in) into the ``storage`` directory. - * If using zoffline.exe on Windows, create a ``storage`` directory within the same folder as zoffline.exe if it does not already exist. - * If using Docker, move ``profile.bin`` into the path you passed to ``-v`` +* Move the resulting ``profile.bin`` and ``achievements.bin`` (saved in whatever directory you ran get_profile.py in) into the ``storage/1`` directory. + * If using zoffline.exe on Windows, create a ``storage/1`` directory within the same folder as zoffline.exe if it does not already exist. + * If using Docker, the directory ``1`` should be in the path you passed to ``-v`` @@ -259,7 +259,7 @@ To obtain your current profile: * Or, if using the Windows zoffline.exe version without Python installed you can run ``strava_auth.exe`` obtained from https://github.com/zoffline/zwift-offline/releases/tag/zoffline_helper in place of ``scripts/strava_auth.py`` * Run without arguments to use default values. * Open http://localhost:8000/ and authorize. -* Move the resulting ``strava_token.txt`` (saved in whatever directory you ran ``strava_auth.py`` in) into the ``storage/`` directory. +* Move the resulting ``strava_token.txt`` (saved in whatever directory you ran ``strava_auth.py`` in) into the ``storage/1`` directory. * If testing, ride at least 300 meters, shorter activities won't be uploaded. @@ -271,7 +271,7 @@ To obtain your current profile: * If running from source, install garmin-uploader: ``pip install git+https://github.com/oldnapalm/garmin-uploader.git`` * If the upload fails you can try the selenium method: ``pip uninstall -y garmin-uploader ; pip install git+https://github.com/ursoft/garmin-uploader.git@cloudscraper selenium webdriver_manager`` * __NOTE:__ instead of performing the step below you can instead use the "Settings - Garmin" button in the launcher window to enter your credentials (Windows and macOS only). -* Create a file ``garmin_credentials.txt`` in the ``storage/`` directory containing your login credentials +* Create a file ``garmin_credentials.txt`` in the ``storage/1`` directory containing your login credentials ``` diff --git a/zwift_offline.py b/zwift_offline.py index 81ab333..5e04895 100644 --- a/zwift_offline.py +++ b/zwift_offline.py @@ -3035,27 +3035,6 @@ def teardown_request(exception): print('Exception: %s' % exception) -def move_old_profile(): - # Before multi profile support only a single profile located in storage - # named profile.bin existed. If upgrading from this, convert to - # multi profile file structure. - profile_file = '%s/profile.bin' % STORAGE_DIR - if os.path.isfile(profile_file): - with open(profile_file, 'rb') as fd: - profile = profile_pb2.PlayerProfile() - profile.ParseFromString(fd.read()) - profile_dir = '%s/%s' % (STORAGE_DIR, profile.id) - try: - if not os.path.isdir(profile_dir): - os.makedirs(profile_dir) - except IOError as e: - logger.error("failed to create profile dir (%s): %s", profile_dir, str(e)) - sys.exit(1) - os.rename(profile_file, '%s/profile.bin' % profile_dir) - strava_file = '%s/strava_token.txt' % STORAGE_DIR - if os.path.isfile(strava_file): - os.rename(strava_file, '%s/strava_token.txt' % profile_dir) - def save_fit(player_id, name, data): fit_dir = os.path.join(STORAGE_DIR, str(player_id), 'fit') try: @@ -3210,7 +3189,6 @@ def send_server_back_online_message(): with app.app_context(): - move_old_profile() db.create_all() db.session.commit() check_columns(User, 'user')