// Menu: Genius Lyrics Searchlet Genius = await npm('genius-lyrics-api')let geniusUserToken = await env("GENIUS_AUTH_TOKEN")import { getLyrics, searchSong } from 'genius-lyrics-api';let songTitle = await arg("Song Title")let options = {apiKey: geniusUserToken,title: songTitle,artist: '',optimizeQuery: true}let returnedSongs = await(searchSong(options).then((r) => r))let returnedSongTitles = returnedSongs.map(s => s.title)let chosenSongTitle = await arg("Which song?", returnedSongTitles)let songData = returnedSongs.filter(s => s.title == chosenSongTitle)let lyrics = await(getLyrics(songData[0].url).then((r) => r))let whatToDo = await arg("", ["Copy", "View", "Visit"])if (whatToDo == "Copy") copy(lyrics)else if (whatToDo == "View") await textarea(lyrics)else if (whatToDo == "Visit") await focusTab(songData[0].url)
let Jimp = await npm('jimp')let width = await arg('New width in pixels')let selectedFiles = await getSelectedFile();let filePaths = selectedFiles.split("\n");for (let filePath of filePaths) {Jimp.read(filePath, (err, image) => {if (err) throw err;image.resize(parseInt(width), Jimp.AUTO).write(filePath); // save});}
let { titleCase } = await npm("title-case");let selectedText = await getSelectedText();let value = titleCase(selectedText);await setSelectedText(value);
let { titleCase } = await npm("title-case");let selectedText = await getSelectedText();let value = titleCase(selectedText) + '™';await setSelectedText(value);
let notionToken = await env('NOTION_USER_TOKEN')let databaseID = "3859b567fda3464ea5a69d5ccb56274b"let {data} = await post(`https://api.notion.com/v1/databases/${databaseID}/query`,{"filter": {"and": [{"property": "Status","select": {"does_not_equal": "Done"}},{"property": "Status","select": {"does_not_equal": "Archive"}}]},page_size: 100},{headers: {Authorization: `Bearer ${notionToken}`,"Content-Type": "application/json","Notion-Version": "2021-05-13"}})let tasks = data.resultslet task = tasks[Math.floor(Math.random() * tasks.length)];let pageID = task.id.replace(/-/g, "");let pageURL = `https://notion.so/${databaseID}?p=${pageID}`copy(pageURL)await focusTab(pageURL, "Google Chrome Beta")
let notionToken = await env('NOTION_USER_TOKEN')let databaseID = "3859b567fda3464ea5a69d5ccb56274b"let {data} = await post(`https://api.notion.com/v1/databases/${databaseID}/query`,{"filter":{"property": "Status","select": {"is_empty": true}},page_size: 50},{headers: {Authorization: `Bearer ${notionToken}`,"Content-Type": "application/json","Notion-Version": "2021-05-13"}})let tasks = data.resultslet task = tasks[Math.floor(Math.random() * tasks.length)];let pageID = task.id.replace(/-/g, "");let pageURL = `https://notion.so/${databaseID}?p=${pageID}`copy(pageURL)await focusTab(pageURL, "Google Chrome Beta")
let notionToken = await env('NOTION_USER_TOKEN')let databaseID = "3859b567fda3464ea5a69d5ccb56274b"let content = await arg('Enter Task')let {data} = await post('https://api.notion.com/v1/pages', {"parent": { "database_id": databaseID },"properties": {"Name": {"title": [{"text": {"content": content}}]}}},{headers: {Authorization: `Bearer ${notionToken}`,}})let pageID = data.id.replace(/-/g, "");let pageURL = `https://notion.so/${databaseID}?p=${pageID}`copy(pageURL)
let notionToken = await env('NOTION_USER_TOKEN')let databaseID = "3859b567fda3464ea5a69d5ccb56274b"let content = await arg('Enter Task')let {data} = await post('https://api.notion.com/v1/pages', {"parent": { "database_id": databaseID },"properties": {"Name": {"title": [{"text": {"content": content}}]}}},{headers: {Authorization: `Bearer ${notionToken}`,"Content-Type": "application/json","Notion-Version": "2021-05-13"}})let bodyContent = await arg('Enter Content')let {bodyData} = await patch(`https://api.notion.com/v1/blocks/${data.id}/children`, {"children": [{"object": "block","type": "paragraph","paragraph": {"text": [{"type": "text","text": {"content": bodyContent}}]}}]},{headers: {Authorization: `Bearer ${notionToken}`,"Content-Type": "application/json","Notion-Version": "2021-05-13"}})let pageID = data.id.replace(/-/g, "");let pageURL = `https://notion.so/${databaseID}?p=${pageID}`copy(pageURL)