def get(self, name): """ Loads UCI package from openwrt, or new package if name doesn't exit :name: package name (ex: network, system, etc...) """ uci = UCI(name) try: with settings(shell=self.WRT_SHELL, abort_exception=UCIError): ucistr = j.sal.process.execute('uci export %s' % name) uci.loads(ucistr) except UCIError: pass return uci
# start number: 373652 # end number: 377993 # Book No: 6 ######################### import fireo import json from uci import UCI from models.hadiths.ibnemaja import IbneMaja ibnemaja_file = open('./data/hadiths/ibne_maja.json', "r", encoding="utf8") ibnemaja = json.load(ibnemaja_file) hadith_batch = fireo.batch() count = 0 overall_count = 0 uci = UCI(373652) for hadith in ibnemaja: ibnemaja = IbneMaja() ibnemaja.id = str(hadith['hadees_number']) ibnemaja.hadith_number = int(hadith['hadees_number']) ibnemaja.book_number = int(hadith['Kitab_ID']) ibnemaja.book_name = { "urdu": hadith['Kitab'], "english": hadith['Kitab_Eng'] } ibnemaja.chapter = { "urdu": hadith['Baab'], "english": hadith['Baab_Eng'] } ibnemaja.text = {
def _getFactoryEnabledClasses(self): return (("", "UCI", UCI()), ("", "DNS", DNS()), ("", "DHCP", DHCP()), ("", "PureFTP", PureFTP()), ("", "Network", Network()), ("", "Firewall", Firewall()), ("", "OpenWRTManager", OpenWRTManager()))
######### UCI ########### # start number: 337185 # end number: 343534 ######################### import fireo from uci import UCI from models.quran.ayah import Ayah ar_quran = open('./data/quran/ar.quran_rtl.txt', "r", encoding="utf8") en_quran = open('./data/quran/en.sahih_ltr.txt', "r", encoding="utf8") ur_quran = open('./data/quran/ur.maududi_rtl.txt', "r", encoding="utf8") ayah_batch = fireo.batch() count = 0 line_count = 0 uci = UCI(337185) for ar, en, ur in zip(ar_quran, en_quran, ur_quran): if not en.strip(): print('English file end') break surah_number, ayah_number, en_text = en.strip().split('|') _, _, ur_text = ur.strip().split('|') _, _, ar_text = ar.strip().split('|') print(' writing line...' + str(line_count) + ' ...Surah ' + surah_number + ' ...Ayah ' + ayah_number) line_count += 1
# start number: 367891 # end number: 373652 # Book No: 5 ######################### import fireo import json from uci import UCI from models.hadiths.nasai import Nasai nasai_file = open('./data/hadiths/nasai.json', "r", encoding="utf8") nasai = json.load(nasai_file) hadith_batch = fireo.batch() count = 0 overall_count = 0 uci = UCI(367891) for hadith in nasai: nasai = Nasai() nasai.id = str(hadith['hadees_number']) nasai.hadith_number = int(hadith['hadees_number']) nasai.book_number = int(hadith['Kitab_ID']) nasai.book_name = {"urdu": hadith['Kitab'], "english": hadith['Kitab_Eng']} nasai.chapter = {"urdu": hadith['Baab'], "english": hadith['Baab_Eng']} nasai.text = { "arabic": hadith['Arabic'], "urdu": hadith['Ravi'] + hadith['Urdu'], "english": hadith['English'] } nasai.is_sahih = bool(hadith['Sahih_Zaeef']) nasai.uci = uci.next
# start number: 000000 # end number: 000000 # Book No: 9 ######################### import fireo import json from uci import UCI from models.hadiths.mishkat import Mishkat mishkat_file = open('./data/hadiths/mishkat.json', "r", encoding="utf8") mishkat = json.load(mishkat_file) hadith_batch = fireo.batch() count = 0 overall_count = 0 uci = UCI(400000) for hadith in mishkat: mishkat = Mishkat() mishkat.id = str(hadith['hadees_number']) mishkat.hadith_number = int(hadith['hadees_number']) mishkat.book_number = int(hadith['Kitab_ID']) mishkat.book_name = { "urdu": hadith['Kitab'], "english": hadith['Kitab_Eng'] } mishkat.chapter = {"urdu": hadith['Baab'], "english": hadith['Baab_Eng']} mishkat.text = { "arabic": hadith['Arabic'], "urdu": hadith['Ravi'] + hadith['Urdu'], "english": hadith['English']
# start number: 362617 # end number: 367891 # Book No: 4 ######################### import fireo import json from uci import UCI from models.hadiths.abudawud import AbuDawud abudawud_file = open('./data/hadiths/abu_dawud.json', "r", encoding="utf8") abudawud = json.load(abudawud_file) hadith_batch = fireo.batch() count = 0 overall_count = 0 uci = UCI(362617) for hadith in abudawud: abudawud = AbuDawud() abudawud.id = str(hadith['hadees_number']) abudawud.hadith_number = int(hadith['hadees_number']) abudawud.book_number = int(hadith['Kitab_ID']) abudawud.book_name = { "urdu": hadith['Kitab'], "english": hadith['Kitab_Eng'] } abudawud.chapter = {"urdu": hadith['Baab'], "english": hadith['Baab_Eng']} abudawud.text = { "arabic": hadith['Arabic'], "urdu": hadith['Ravi'] + hadith['Urdu'], "english": hadith['English']
# start number: 351097 # end number: 358661 # Book No: 2 ######################### import fireo import json from uci import UCI from models.hadiths.muslim import Muslim muslim_file = open('./data/hadiths/muslim.json', "r", encoding="utf8") muslim = json.load(muslim_file) hadith_batch = fireo.batch() count = 0 overall_count = 0 uci = UCI(351097) for hadith in muslim: muslim = Muslim() muslim.id = str(hadith['hadees_number']) muslim.hadith_number = int(hadith['hadees_number']) muslim.international_number = int(hadith['internationalNumber']) muslim.book_number = int(hadith['Kitab_ID']) muslim.book_name = { "urdu": hadith['Kitab'], "english": hadith['Kitab_Eng'] } muslim.chapter = {"urdu": hadith['Baab'], "english": hadith['Baab_Eng']} ravi = "" if hadith['Ravi']:
# start number: 343534 # end number: 351097 # Book No: 1 ######################### import fireo import json from uci import UCI from models.hadiths.bukhari import Bukhari bukhari_file = open('./data/hadiths/bukhari.json', "r", encoding="utf8") bukhari = json.load(bukhari_file) hadith_batch = fireo.batch() count = 0 overall_count = 0 uci = UCI(343534) for hadith in bukhari: bukhari = Bukhari() bukhari.id = str(hadith['hadees_number']) bukhari.hadith_number = int(hadith['hadees_number']) bukhari.book_number = int(hadith['Kitab_ID']) bukhari.book_name = { "urdu": hadith['Kitab'], "english": hadith['Kitab_Eng'] } bukhari.chapter = { "urdu": hadith['Baab'], "english": hadith['Baab_Eng'] } bukhari.text = {
# start number: 358661 # end number: 362617 # Book No: 3 ######################### import fireo import json from uci import UCI from models.hadiths.tirmidhi import Tirmidhi tirmidhi_file = open('./data/hadiths/tirmidhi.json', "r", encoding="utf8") tirmidhi = json.load(tirmidhi_file) hadith_batch = fireo.batch() count = 0 overall_count = 0 uci = UCI(358661) for hadith in tirmidhi: tirmidhi = Tirmidhi() tirmidhi.id = str(hadith['hadees_number']) tirmidhi.hadith_number = int(hadith['hadees_number']) tirmidhi.book_number = int(hadith['Kitab_ID']) tirmidhi.book_name = { "urdu": hadith['Kitab'], "english": hadith['Kitab_Eng'] } tirmidhi.chapter = {"urdu": hadith['Baab'], "english": hadith['Baab_Eng']} tirmidhi.text = { "arabic": hadith['Arabic'], "urdu": hadith['Ravi'] + hadith['Urdu'], "english": hadith['English']