MCPcopy
hub / github.com/DeppWang/youdaonote-pull / _get_ydnote_dir_id

Method _get_ydnote_dir_id

pull.py:107–126  ·  view source on GitHub ↗

获取指定有道云笔记指定目录 ID :param ydnote_dir: 指定有道云笔记指定目录 :return: dir_id, error_msg

(self, ydnote_dir)

Source from the content-addressed store, hash-verified

105 return local_dir, ""
106
107 def _get_ydnote_dir_id(self, ydnote_dir) -> Tuple[str, str]:
108 """
109 获取指定有道云笔记指定目录 ID
110 :param ydnote_dir: 指定有道云笔记指定目录
111 :return: dir_id, error_msg
112 """
113 root_dir_info = self.youdaonote_api.get_root_dir_info_id()
114 root_dir_id = root_dir_info["fileEntry"]["id"]
115
116 # 如果不指定文件夹,取根目录 ID
117 if not ydnote_dir:
118 return root_dir_id, ""
119
120 dir_info = self.youdaonote_api.get_dir_info_by_id(root_dir_id)
121 for entry in dir_info["entries"]:
122 file_entry = entry["fileEntry"]
123 if file_entry["name"] == ydnote_dir:
124 return file_entry["id"], ""
125
126 return "", "有道云笔记指定顶层目录不存在"
127
128 def get_ydnote_dir_id(self) -> Tuple[str, str]:
129 """

Callers 2

get_ydnote_dir_idMethod · 0.95
test_get_dir_idMethod · 0.95

Calls 2

get_root_dir_info_idMethod · 0.80
get_dir_info_by_idMethod · 0.80

Tested by 1

test_get_dir_idMethod · 0.76