def plenum_meeting_number(self): res = None parts = self.parts.filter(body__contains=u'ישיבה') if parts.count() > 0: r = re.search(u'ישיבה (.*)$', self.parts.filter(body__contains=u'ישיבה').first().body) if r: res = gematria_to_int(r.groups()[0]) return res
def get_file_stem(self, s): sefer, perek = s.split('/') if sefer == 'ספר בראשית': if gematria_to_int(perek) < 12: return 'ספר בראשית - א-יא' elif gematria_to_int(perek) < 37: return 'ספר בראשית - יב-לו' else: return 'ספר בראשית - לז-נ' elif sefer == 'ספר תהלים': if gematria_to_int(perek) < 42: return 'ספר תהלים - ראשון' elif gematria_to_int(perek) < 73: return 'ספר תהלים - שני' elif gematria_to_int(perek) < 90: return 'ספר תהלים - שלישי' elif gematria_to_int(perek) < 107: return 'ספר תהלים - רביעי' else: return 'ספר תהלים - חמישי' elif ' ' in perek: section = perek.split(' ')[0] # replace quotes, which can make a filename invalid, with proper gershayim section = section.replace('"', chr(0x05f4)) return '{} - {}'.format(sefer, section) else: return sefer
def parse(line, songname, set): if line.__contains__('origin'): startIndex = line.find('\'origin\': \'') endIndex = line.find('\'score\':') index = -(len(line) - endIndex) s = line[startIndex:index] arr = s.split('\'') name = arr[3].split(',') filename = name[0] + '.txt' pasuk = gematria_to_int(name[1][1:]) new_line = str(pasuk) + " : " + songname + '\n' if not set.__contains__(new_line): file = open(filename, 'a') file.write(new_line) file.close() set += new_line return set
def booklet_meeting_num(self): return gematria_to_int(self.booklet_meeting_num_heb.decode('utf-8'))
def get_ref_string(matches_index): ans_link = "" ans = "" index_in_loop = 0 for match2 in matches_index: link = match2['origin'] link_arr = link.split(',') link_arr = link_arr[0] link_arr = link_arr.split(' ') # print(link_arr[0]) if (link_arr[0] in books): index_link = books.index(link_arr[0]) if (index_link < 10): index_link = '0' + str(index_link) if (len(link_arr) == 3): if (link_arr[1] == 'א'): str_g = gematria_to_int(link_arr[2]) if (str_g < 10): str_g = '0' + str(str_g) ans_link = 't' + str(index_link) + 'a' + str(str_g) else: str_g = gematria_to_int(link_arr[2]) ans_link = 't' + str(index_link) + 'b' + str(str_g) else: str_g = gematria_to_int(link_arr[1]) if (str_g < 10): str_g = '0' + str(str_g) ans_link = 't' + str(index_link) + str(str_g) else: if (link_arr[0] == 'עזרא'): str_g = gematria_to_int(link_arr[1]) if (str_g < 10): str_g = '0' + str(str_g) ans_link = 't35a' + str(str_g) elif (link_arr[0] == 'נחמיה'): str_g = gematria_to_int(link_arr[1]) if (str_g < 10): str_g = '0' + str(str_g) ans_link = 't35b' + str(str_g) else: index_link = books.index(link_arr[0] + " " + link_arr[1]) if (index_link < 10): index_link = '0' + str(index_link) episode = gematria_to_int(link_arr[2]) if (episode < 10): episode = '0' + str(episode) ans_link = 't' + str(index_link) + str(episode) # index_link=books.index(link_arr[0]) # if(index_link==-1): # print(ans_link) if (index_in_loop == 0): ans = ans + """ <A HREF=""" + "'" + ans_link + """.htm' class="button"> """ + \ match2['text'] + " - " + match2[ 'origin'] + """ </A> """ else: ans = ans + """<br> <A HREF=""" + "'" + ans_link + """.htm' class="button"> """ + \ match2['text'] + " - " + match2[ 'origin'] + """ </A> """ index_in_loop = index_in_loop + 1 ans = ans + """</div> </div> </div>""" return ans
def booklet_num(self): return gematria_to_int(decode(self.booklet_num_heb, 'utf-8'))
def Func(update, context, chapter): """ ---- imports ---- import Program.Get_Bot_Variables as Get_Bot_Variables from Program.Send import Send as Send from Program.Button import Button as Button """ Bot_Variables = Get_Bot_Variables.Func([update, context]) # - Variables - # """ TOKEN = Bot_Variables[0] Chat_ID = Bot_Variables[1] First_Name = Bot_Variables[2] UserName = Bot_Variables[3] Message = Bot_Variables[4] Message_ID = Bot_Variables[5] File_ID = Bot_Variables[6] Virtual_Location = Bot_Variables[7] User_Privileges = Bot_Variables[8] User_Lang = Bot_Variables[9] Mongo_Collections = Bot_Variables[10] Json_Message = Bot_Variables[11] Update = Bot_Variables[12] Other_Variables = Bot_Variables[13] Context = Bot_Variables[14] """ """ --- Send Class --- Send.Message(Bot_Variables,"Paste Text Here") Send.Keyboard(Bot_Variables, "Text Here", Button.Markup("button 1"), Button.Markup(Button.Markup_Location("Send_Location")), Button.Markup( Button.Markup_Phone("Send_Phone") , "button 5", "button 6")) #NOTE: when when you used Button.Inline() for creating buttons for inline keyboard this is the syntax: # ["URL/CALLBACK Button type( u/c )","button text","the url or callback name"] # the callback name is the name you gave to the file you created in "Inline_Function" folder (not include the .py extinction) Send.Inline_Keyboard(Bot_Variables, "Text Here" , Button.Inline( ["U","URL Button","https://www.google.co.il/"] , ["C","Callback Button","Template"] ) , Button.Inline(["C","Callback Button","Template"] ,["U","URL Button","https://www.google.co.il/"]) ) # send edited keyboard, its edit current inline keyboard and change buttons give deep navigation effect Send.Edited_Inline_Keyboard(Bot_Variables,"Text Here", Button.Inline(["u","URL Button","www.google.co.il"]) ) Send.Callback_Answer(Bot_Variables,"Callback Query Answer") Send.Callback_Alert(Bot_Variables,"Callback Query Alert") Send.Forword(Bot_Variables,from_chat_id,to_chat_id,message_id) # send any file by file id , type : video/voice message/photo/document/sticker Send.Any_File(Bot_Variables,file_id,caption) --- Buttons Types --- # regular markup button Button.Markup("button text1","button text2") # make button markup to send user location Button.Markup_Location("button text") # make button markup to send user phone number Button.Markup_Phone("button text") # regular inline button Button.Inline( ["URL/CALLBACK Button type( u/c )","button text","the url or callback name"]) #syntax: * each time activated gives 1 rows of buttons #Markup synatx Send.Keyboard(Bot_Variables, "Text Here", Button.Markup("button 1"), Button.Markup(Button.Markup_Location("Send_Location")), Button.Markup( Button.Markup_Phone("Send_Phone") , "button 5", "button 6")) #Inline synatx #NOTE: when when you used Button.Inline() for creating buttons for inline keyboard this is the syntax: # ["URL/CALLBACK Button type( u/c )","button text","the url or callback name"] # the callback name is the name you gave to the file you created in "Inline_Function" folder (not include the .py extinction) Send.Inline_Keyboard(Bot_Variables, "Text Here" , Button.Inline( ["U","URL Button","https://www.google.co.il/"] , ["C","Callback Button","Template"] ) , Button.Inline(["C","Callback Button","Template"] ,["U","URL Button","https://www.google.co.il/"]) ) """ try: chapter = int(chapter) except: chapter = gematria_to_int(chapter) chapter = chapter - 1 if chapter > -1 and chapter < 151: Chat_ID = Bot_Variables[1] Users = Bot_Variables[10][0] user = Users.find_one({"chat_id": Chat_ID}) book_chapters = user["book"]["chapters"] write_type = user["write_type"] Users.update_one({"chat_id": Chat_ID}, {"$set": { "book.bookmark": chapter }}) Send.Inline_Keyboard( Bot_Variables, Send_Book.Func(chapter, Bot_Variables), Button.Inline([ "C", "⬅️", rolling_left.Func(chapter, book_chapters, write_type) ], ["C", favoriets_name.Func(update, context), "Favorite"], [ "C", "➡️", rolling_right.Func(chapter, book_chapters, write_type) ]), Button.Inline(["C", is_read_name.Func(update, context), "is_read"])) else: Send.Message( Bot_Variables, '❌ חיפוש שגוי, מספר הפרקים בתהילים הוא 150 , ניתן לחפש בטווח 1 - 150 א - ק"נ ❌' )