obs使用

模板

链接:视频链接

一Books (Templater Advanced Version)

---
<%*
let title = tp.file.title;
if (title.startsWith("Untitled")) {
title = await tp.system.prompt("Enter the title of the book");
if(!title) return;
}
if (title == "") {
title = "Untitled";
} else {
await tp.file.rename(title);
}
await tp.file.move("/books/" + title)
-%>
type: books
title: "[[<% title %>]]"
cover:
author: '[[<% tp.system.prompt("Enter the author of the book")%>]]'
genre: <% tp.system.suggester(["fiction", "non-fiction"], ["fiction", "non-fiction"], true, 'genre')%>
status: <% tp.system.suggester(["done", "reading", "to-read"], ["done", "reading", "to-read"], true, 'status')%>
rating:
myRating:
summary:
date_creation: <% tp.file.creation_date("YYYY-MM-DD") %>
date_start:
date_finish:
---
## 3 sentences to describe the book
1. <% tp.file.cursor() %>
2.
3. 
## 5 take aways
1.
2.
3.
4.
5. 
## Review
## Related
## Reference

 

二Books (Templater Basic Version)

---
type: books
title: "[[<% tp.file.title %>]]"
cover: 
author:
  - '[[<% tp.system.prompt("请输入作者")%>]]'
genre: <% tp.system.suggester(["fiction", "non-fiction"], ["fiction", "non-fiction"], true, 'genre')%>
status: <% tp.system.suggester(["to-read", "reading", "done"], ["to-read", "reading", "done"], true, 'status')%>
rating: 
myRating: 
summary: 
date_creation: <% tp.file.creation_date("YYYY-MM-DD") %>
date_start: 
date_finish:
---
## 3 sentences to describe the book
1. 
2. 
3. 

## 5 take aways
1. 
2. 
3. 
4. 
5. 

## Review
<% tp.file.cursor() %>


## Related



## Reference

三Books (Templates Version)

---
type: books
title: 
cover: 
author: 
genre: 
status: 
rating: 
myRating: 
summary: 
date_creation: {{date:}}
date_start: 
date_finish:
---
## 3 sentences to describe the book
1. 
2. 
3. 

## 5 take aways
1. 
2. 
3. 
4. 
5. 

## Review



## Related



## Reference

四Capture

<%*
const file = tp.file.find_tfile(tp.date.now("YYYY-MM-DD"))
if (file) {
	const loggedItem = await tp.system.prompt("What's Up?")
	const time = tp.date.now("HH:mm")
	const content = (await app.vault.read(file)).split("\n")
	const index = content.indexOf("### What happened today?")
	content.splice(index + 1, 0, `- ${time} - ${loggedItem}`)
	await app.vault.modify(file, content.join("\n"))
} else {
new Notification("No Daily Note Found!")
}
-%>

五Insert Callouts

<%*
const callouts = {
note: '🔵 ✏ Note',
info: '🔵 ℹ Info',
todo: '🔵 🔳 Todo',
tip: '🌐 🔥 Tip / Hint / Important',
abstract: '🌐 📋 Abstract / Summary / TLDR',
question: '🟡 ❓ Question / Help / FAQ',
quote: '🔘 💬 Quote / Cite',
example: '🟣 📑 Example',
success: '🟢 ✔ Success / Check / Done',
warning: '🟠 ⚠ Warning / Caution / Attention',
failure: '🔴 ❌ Failure / Fail / Missing',
danger: '🔴 ⚡ Danger / Error',
bug: '🔴 🐞 Bug',
};

const type = await tp.system.suggester(Object.values(callouts), Object.keys(callouts), true, 'Select callout type.');
const fold = await tp.system.suggester(['None', 'Expanded', 'Collapsed'], ['', '+', '-'], true, 'Select callout fold option.');

const title = await tp.system.prompt('Title:', '', true);
let content = await tp.system.prompt('Content (New line -> Shift + Enter):', '', true, true);
content = content.split('\n').map(line => `> ${line}`).join('\n')  

const calloutHead = `> [!${type}]${fold} ${title}\n`;

tR += calloutHead + content
-%>
在华为云的函数工作流中,可以通过搭配OBS(对象存储服务)来实现文件的上传、下载和管理等操作。下面是一种常见的搭配使用方式: 1. 准备工作:首先,在华为云上创建一个OBS存储桶,并确保你有访问该存储桶的权限。获取存储桶的访问凭证,包括Access Key和Secret Key。 2. 创建函数:在函数工作流中创建一个函数节点,并设置函数的执行代码。可以使用Python、Node.js等编程语言。 3. 配置OBS访问凭证:在函数节点的代码中,配置OBS的访问凭证,以便能够正常连接和操作OBS服务。示例代码如下(Python): ```python import obs ak = 'your_access_key' sk = 'your_secret_key' obs_client = obs.ObsClient(access_key_id=ak, secret_access_key=sk, server='your_obs_endpoint') ``` 4. 实现OBS操作:在函数节点的代码中,使用OBS SDK提供的方法来执行OBS操作,如上传文件、下载文件、列出桶中的对象等。示例代码如下(Python): ```python # 上传文件到OBS def upload_file(file_path, bucket_name, obs_key): with open(file_path, 'rb') as file: obs_client.put_object(bucket_name=bucket_name, key=obs_key, body=file) # 下载OBS对象到本地 def download_object(bucket_name, obs_key, local_path): result = obs_client.get_object(bucket_name=bucket_name, key=obs_key) with open(local_path, 'wb') as file: file.write(result['Body'].read()) # 列出OBS桶中的对象 def list_objects(bucket_name): result = obs_client.list_objects(bucket_name=bucket_name) for content in result['Contents']: print(content['Key']) ``` 5. 在函数工作流中配置输入参数:根据实际需求,可以在函数节点中配置输入参数,以接收触发器传递的数据。例如,可以配置一个输入参数用于接收要上传的文件路径。 6. 在函数工作流中配置输出参数:根据实际需求,可以在函数节点中配置输出参数,以返回OBS操作的结果或者其他需要传递给后续节点的数据。 通过以上步骤,你可以在函数工作流中搭配OBS使用,实现文件的上传、下载和管理等功能。根据具体场景和需求,你可以在函数工作流中添加更多的节点,并使用OBS SDK提供的方法来完成更复杂的操作。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值