Skip to content

Commit

Permalink
add619c follow-up: Replace JSON info-file if it's actually going to b…
Browse files Browse the repository at this point in the history
…e uploaded
  • Loading branch information
drzraf committed Sep 26, 2023
1 parent e32cee9 commit 6f9cc30
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tubeup/TubeUp.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,11 +307,6 @@ def upload_ia(self, videobasename, use_upload_archive=False, custom_meta=None):
with open(json_metadata_filepath, 'r', encoding='utf-8') as f:
vid_meta = json.load(f)

mod, new_meta = strip_ip_from_meta(vid_meta)
if mod:
with open(json_metadata_filepath, 'w') as f:
json.dump(new_meta, f)

# Exit if video download did not complete, don't upload .part files to IA
# One glob() + fnmatch() is ten times less expensive than 8 globs(),
# (Half a second vs 5 seconds on 250k files, what is significant when resuming large playlists)
Expand Down Expand Up @@ -372,6 +367,11 @@ def upload_ia(self, videobasename, use_upload_archive=False, custom_meta=None):
print(msg)
raise Exception(msg)

mod, new_meta = strip_ip_from_meta(vid_meta)
if mod:
with open(json_metadata_filepath, 'w') as f:
json.dump(new_meta, f)

item.upload(files_to_upload, metadata=metadata, retries=15,
request_kwargs=dict(timeout=60), delete=not use_upload_archive,
verbose=self.verbose, access_key=s3_access_key,
Expand Down

0 comments on commit 6f9cc30

Please sign in to comment.