Skip to content

Commit 3b587fe

Browse files
committed
a few nits
[skip ci]
1 parent 7e8d638 commit 3b587fe

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

‎scripts/gdrive_cache.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ def find_unread_doc_files() -> list[dict]:
214214

215215
add_backup_level(10, "High", "All valuable items in need of backing up")
216216

217-
@backup_level(12, "site tag avs", "all AV files in website tag folders")
217+
@backup_level(18, "site tag avs", "all AV files in website tag folders")
218218
def find_all_tag_content() -> list[dict]:
219219
ret = []
220220
for tag in website.tags:
@@ -223,7 +223,7 @@ def find_all_tag_content() -> list[dict]:
223223
ret.extend(all_files)
224224
return ret
225225

226-
@backup_level(18, "nonsite unreads", "unread, non-av files in tags below site-level")
226+
@backup_level(12, "nonsite unreads", "unread, non-av files in tags below site-level")
227227
def find_nonwebsite_tag_files() -> list[dict]:
228228
FOLDERS_DATA = gdrive.FOLDERS_DATA()
229229
folder_slugs = set(FOLDERS_DATA.keys()) - set(gdrive.UNIMPORTANT_SLUGS) - set(tag.slug for tag in website.tags)

‎scripts/local_gdrive.py‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ def row_dict_to_api_dict(self, table_row: Dict[str, Any]) -> Dict[str, Any]:
469469
return ret
470470

471471
@locked
472-
def sql_query(self, query: str, data: tuple) -> List[Dict[str, Any]]:
472+
def sql_query(self, query: str, data: tuple=tuple()) -> List[Dict[str, Any]]:
473473
"""
474474
Directly run a query and return the matching rows.
475475
@@ -651,6 +651,12 @@ def get_regular_children(self, parent_id: str) -> List[Dict[str, Any]]:
651651
"parent_id = ? AND shortcut_target IS NULL AND mime_type != ?",
652652
(parent_id, 'application/vnd.google-apps.folder',)
653653
)
654+
655+
def get_root_my_drive_children(self) -> List[Dict[str, Any]]:
656+
return self.sql_query("length(parent_id) = 19")
657+
658+
def get_root_shared_with_me_items(self) -> List[Dict[str, Any]]:
659+
return self.sql_query("owner > 1 AND parent_id IS NULL")
654660

655661
def search_by_name_containing(self, partial_name: str, additional_filters: str = None, additional_params: tuple = None) -> List[Dict[str, Any]]:
656662
"""
@@ -726,6 +732,8 @@ def get_cache_path_for_file(self, file: dict) -> Path | None:
726732
return self.file_cache_dir / hashval[:2] / f"{hashval[2:]}{extension}"
727733

728734
def download_file_to_cache(self, file: dict, verbose: bool=False) -> Path | None:
735+
if not self.file_cache_dir:
736+
return None
729737
if file['mimeType'] == 'application/vnd.google-apps.shortcut':
730738
tfile = self.get_item(file['shortcutDetails']['targetId'])
731739
if not tfile:

0 commit comments

Comments
 (0)