articles = client.open("Bitcoin Resources").worksheet("Links") NO_DATE = "1111-11-11" NO_AUTHOR_LINKS = "" for row in articles.get_all_values(): if row[0] == 'Author': continue link_author = row[0] link_title = row[1].lstrip().rstrip() link_link = row[2].lstrip().rstrip() link_date = row[3] if row[3] != '' else NO_DATE link_lesson = row[4].lstrip().rstrip() md_file_path = title_to_file_path(link_title, 'links') if md_file_path == "": continue md_file = (f"---\n" f"layout: page\n" f"author: {link_author}\n" f"title: {link_title}\n" f"link: {link_link}\n" f"date: {link_date}\n" f"lesson: {link_lesson}\n" f"---\n") with open(md_file_path, 'w') as f: f.write(md_file)
NO_DATE = "1111-11-11" NO_AUTHOR_LINKS = "" for row in articles.get_all_values(): if row[0] == 'Author': continue article_author = row[0] article_title = row[1].lstrip().rstrip() article_link = row[2].lstrip().rstrip() article_category = row[3] article_date = row[4] if row[4] != '' else NO_DATE article_lesson = row[5].lstrip().rstrip() article_audio = row[6].lstrip().rstrip() md_file_path = title_to_file_path(article_title, 'articles') if md_file_path == "": continue md_file = ( f"---\n" f"layout: page\n" f"author: {article_author}\n" f"title: {article_title}\n" f"link: {article_link}\n" f"category: {article_category}\n" f"date: {article_date}\n" f"lesson: {article_lesson}\n" f"audio: {article_audio}\n" f"---\n")
for author in resource_authors: author_slug = get_valid_author_slug(author) author_file_path = author_to_file_path(author_slug) if os.path.exists(author_file_path) or author_file_path == "": continue author_file = (f"---\n" f"name: {author.strip()}\n" f"slug: {author_slug}\n" f"permalink: /author/{author_slug}\n" f"---") with open(author_file_path, 'w') as f: f.write(author_file) md_file_path = title_to_file_path(resource_title, resource_type) if os.path.exists(md_file_path) or md_file_path == "": continue md_file = (f"---\n" f"layout: {resource_type}\n" f"title: {resource_title}\n" f"date: {resource_date}\n" f"categories: {resource_categories}\n" f"author: {resource_authors}\n" f"excerpt: {resource_excerpt}\n" f"external_url: {resource_url}\n" f"---") with open(md_file_path, 'w') as f: f.write(md_file)
'client_secret.json', scope) client = gspread.authorize(creds) articles = client.open("Bitcoin Resources").worksheet("Curations") for idx, row in enumerate(articles.get_all_values()): if row[0] == 'Title': continue curation_title = row[0].lstrip().rstrip() curation_link = row[1] curation_author = row[2].lstrip().rstrip() curation_type = row[3].lstrip().rstrip() curation_star = row[4].lstrip().rstrip() md_file_path = title_to_file_path(curation_title, 'curations') if md_file_path == "": continue md_file = (f"---\n" f"layout: page\n" f"title: {curation_title}\n" f"link: {curation_link}\n" f"author: {curation_author}\n" f"type: {curation_type}\n" f"star: {curation_star}\n" f"order: {idx}\n" f"---\n") with open(md_file_path, 'w') as f: f.write(md_file)