def run_text_tool(commentator, handler): print commentator #first, get a mapping of hebrew book names to english ones so we can correctly store the OnYourWay xml data that is listed by hebrew title book_titles = Helper.build_title_map('Mishnah', 'heTitle', 'title') #now get the OnYourWay table of contents in order to list the books we want file_ids_tree = ET.parse(xml_index_file) root = file_ids_tree.getroot() #find the Mishnah for child in root: if child.get('name') == xml_main_node_name: root = child break #iterate over all the masechtot. nested loop to account for them being listed inside their Sedarim for child in root: for gchild in child: print gchild.get('name').encode('utf-8'), ' in file: ', gchild.get('nid') #either parsing or posting handler(commentator, book_titles[gchild.get('name')], gchild.get('nid'))
def run_text_tool(handler): #first, get a mapping of hebrew book names to english ones so we can correctly store the OnYourWay xml data that is listed by hebrew title book_titles = Helper.build_title_map('Tanach', 'heTitle', 'title') #now get the OnYourWay table of contents in order to list the books we want file_ids_tree = ET.parse(xml_index_file) root = file_ids_tree.getroot() #find the top node for child in root: if child.get('name') == xml_main_node_name: root = child break #iterate over all the books. they are nested in the 3 top bible categories (Torah, Prophets and Writings) for child in root: for gchild in child: if (book and book.lower() == book_titles[gchild.get('name')].lower()) or book is None: #print gchild.get('name').encode('utf-8'), ' in file: ', gchild.get('nid') #either parsing or posting handler(book_titles[gchild.get('name')], gchild.get('nid'))
def run_text_tool(handler): #first, get a mapping of hebrew book names to english ones so we can correctly store the OnYourWay xml data that is listed by hebrew title book_titles = Helper.build_title_map('Tanach', 'heTitle', 'title') #now get the OnYourWay table of contents in order to list the books we want file_ids_tree = ET.parse(xml_index_file) root = file_ids_tree.getroot() #find the top node for child in root: if child.get('name') == xml_main_node_name: root = child break #iterate over all the books. they are nested in the 3 top bible categories (Torah, Prophets and Writings) for child in root: for gchild in child: if (book and book.lower() == book_titles[gchild.get( 'name')].lower()) or book is None: #print gchild.get('name').encode('utf-8'), ' in file: ', gchild.get('nid') #either parsing or posting handler(book_titles[gchild.get('name')], gchild.get('nid'))
def run_text_tool(commentator, handler): print commentator #first, get a mapping of hebrew book names to english ones so we can correctly store the OnYourWay xml data that is listed by hebrew title book_titles = Helper.build_title_map('Mishnah', 'heTitle', 'title') #now get the OnYourWay table of contents in order to list the books we want file_ids_tree = ET.parse(xml_index_file) root = file_ids_tree.getroot() #find the Mishnah for child in root: if child.get('name') == xml_main_node_name: root = child break #iterate over all the masechtot. nested loop to account for them being listed inside their Sedarim for child in root: for gchild in child: print gchild.get('name').encode('utf-8'), ' in file: ', gchild.get( 'nid') #either parsing or posting handler(commentator, book_titles[gchild.get('name')], gchild.get('nid'))