Skip to content

Commit 677232c

Browse files
committed
Add gdrive comment func
[skip ci]
1 parent 34c9752 commit 677232c

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

scripts/gdrive_base.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,13 @@ def create_drive_shortcut(gfid, filename, folder_id, custom_properties: dict[str
399399
))
400400
return shortcut.get('id')
401401

402+
def create_drive_comment(target_file_id: str, comment_text: str) -> str:
403+
service = session()
404+
res = execute(service.comments().create(fileId=target_file_id, fields="id", body={
405+
'content': comment_text,
406+
}))
407+
return res.get('id')
408+
402409
def deref_possible_shortcut(gfid):
403410
"""Returns the id of what gfid is pointing to OR gfid"""
404411
service = session()

scripts/gdrive_cache.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ def sideload_file(file: Path, cache_dir: Path, parent_folder: str | None, move:
467467
target_path.unlink()
468468
target_path.parent.mkdir(exist_ok=True, parents=is_in_trash)
469469
if move:
470-
file.rename(target_path)
470+
shutil.move(src=file, dst=target_path)
471471
else:
472472
shutil.copy2(file, target_path)
473473

0 commit comments

Comments
 (0)