Ejemplo n.º 1
0
def get_titles():
    titles_english = MdFile.get_metadata_field_values(
        md_files=raamaayana.get_adhyaaya_md_files(md_file_path),
        field_name="title")
    unnumbered_titles = [
        regex.sub("^[०-९0-9]+ ", "", x) for x in titles_english
    ]
    logging.info("\n".join(unnumbered_titles))
Ejemplo n.º 2
0
def get_audio_file_data():
    urls = list(
        library.get_audio_file_urls(
            md_files=raamaayana.get_adhyaaya_md_files(md_file_path)))
    titles_from_urls = [
        regex.match(r".+\d\d\d-(.+?)(_0)?.mp3",
                    url.replace("\n", "")).group(1).replace("_", " ")
        for url in urls
    ]
    logging.info("\n".join(urls))
Ejemplo n.º 3
0
def reformat_audio_tag():
    adhyaaya_to_source_file_map = raamaayana.get_adhyaaya_to_source_file_map()
    # logging.debug(adhyaaya_to_mp3_map)
    dest_md_files = raamaayana.get_adhyaaya_md_files(
        md_file_path=
        "/home/vvasuki/vvasuki-git/kAvya/content/TIkA/padyam/purANam/rAmAyaNam/AndhrapAThaH"
    )
    logging.debug(dest_md_files)
    for md_file in dest_md_files:
        # md_file.replace_in_content("<div class=\"audioEmbed\".+?></div>\n", "")
        logging.debug(md_file.file_path)
        (kaanda, adhyaaya) = raamaayana.get_kaanda_adhyaaya(md_file)
        adhyaaya_id = "%s-%s" % (kaanda, adhyaaya)
        logging.debug(adhyaaya_id)
        (yml, current_content) = md_file._read_yml_md_file()
        audio_tag = regex.findall("<div class.*div>",
                                  current_content.replace("\n", " "))[0]
        (_, target_content
         ) = adhyaaya_to_source_file_map[adhyaaya_id]._read_yml_md_file()
        # logging.debug(adhyaaya_to_source_file_map[adhyaaya_id])
        md_file.replace_content("%s\n\n%s" % (audio_tag, target_content),
                                dry_run=False)
Ejemplo n.º 4
0
import logging

from curation_projects import raamaayana
from doc_curation.md_helper import MdFile

# Remove all handlers associated with the root logger object.
for handler in logging.root.handlers[:]:
    logging.root.removeHandler(handler)
logging.basicConfig(
    level=logging.DEBUG,
    format="%(levelname)s:%(asctime)s:%(module)s:%(lineno)d %(message)s")

md_file_path = "/home/vvasuki/vvasuki-git/kAvya/content/TIkA/padyam/purANam/rAmAyaNam/AndhrapAThaH"
# MdFile.fix_index_files(dir_path=md_file_path, dry_run=False)
# MdFile.fix_titles(
#     md_files=raamaayana.get_adhyaaya_md_files(md_file_path),
#     spreadhsheet_id="1xqVBhDwRzcEL7HlCJhxmnG1aOFFk6B8gGZ4GuBZynf8",
#     worksheet_name="शीर्षिकाः", id_column="id", title_column="अन्तिमशीर्षिका", md_file_to_id=raamaayana.get_adhyaaya_id, dry_run=False
# )
MdFile.devanaagarify_titles(
    md_files=raamaayana.get_adhyaaya_md_files(md_file_path), dry_run=False)
Ejemplo n.º 5
0
def get_numbers():
    titles_english = MdFile.get_metadata_field_values(
        md_files=raamaayana.get_adhyaaya_md_files(md_file_path),
        field_name="title_english")
    numbers = [regex.sub("^([०-९0-9]+) .+", "\\1", x) for x in titles_english]
    logging.info("\n".join(numbers))
Ejemplo n.º 6
0
        kaanda = regex.findall("Kanda_\\d_",
                               str(mp3_path))[0].replace("Kanda",
                                                         "").replace("_", "")
        adhyaaya = regex.findall("\\d\\d\\d", str(mp3_path))[0]
        adhyaaya_id = "%s-%s" % (kaanda, adhyaaya)
        web_mp3_path = str(mp3_path).replace(
            mp3_root,
            "https://archive.org/download/Ramayana-recitation-Sriram-harisItArAmamUrti-Ghanapaati-v2/"
        ).replace("mp3/", "")
        adhyaaya_to_mp3_map[adhyaaya_id] = web_mp3_path
    return adhyaaya_to_mp3_map


if __name__ == '__main__':
    adhyaaya_to_mp3_map = get_adhyaaya_to_mp3_map()
    # logging.debug(adhyaaya_to_mp3_map)
    for md_file in raamaayana.get_adhyaaya_md_files(
            md_file_path=
            "/home/vvasuki/vvasuki-git/kAvya/content/TIkA/padya/purANa/rAmAyaNa/Andhra/"
    ):
        # md_file.replace_in_content("<div class=\"audioEmbed\".+?></div>\n", "")
        logging.debug(md_file.file_path)
        (kaanda, adhyaaya) = raamaayana.get_kaanda_adhyaaya(md_file)
        adhyaaya_id = "%s-%s" % (kaanda, adhyaaya)
        logging.debug(adhyaaya_id)
        (yml, _) = md_file.read_md_file()
        # logging.debug(adhyaaya_to_mp3_map[adhyaaya_id])
        md_file.prepend_to_content(
            '<div class="audioEmbed"  caption="श्रीराम-हरिसीताराममूर्ति-घनपाठिभ्यां वचनम्" src="%s"></div>\n'
            % adhyaaya_to_mp3_map[adhyaaya_id],
            dry_run=False)