def __init__(self, givenFolderName, givenName=None, encoding='utf-8'): """ Create the internal USX Bible object. """ # Setup and initialise the base class first Bible.__init__(self) self.objectNameString = "USX XML Bible object" self.objectTypeString = "USX" self.givenFolderName, self.givenName, self.encoding = givenFolderName, givenName, encoding # Remember our parameters # Now we can set our object variables self.name = self.givenName if not self.name: self.name = os.path.basename(self.givenFolderName) if not self.name: self.name = os.path.basename( self.givenFolderName[:-1]) # Remove the final slash if not self.name: self.name = "USX Bible" # Do a preliminary check on the readability of our folder if not os.access(self.givenFolderName, os.R_OK): logging.error("USXXMLBible: File {!r} is unreadable".format( self.givenFolderName)) # Find the filenames of all our books self.USXFilenamesObject = USXFilenames(self.givenFolderName) self.possibleFilenameDict = {} for BBB, filename in self.USXFilenamesObject.getConfirmedFilenames(): self.possibleFilenameDict[BBB] = filename
def __init__(self, sourceFolder, givenName, encoding='utf-8'): """ Constructor: just sets up the Bible object. """ if BibleOrgSysGlobals.verbosityLevel > 2: print( _("DrupalBible__init__ ( {!r}, {!r}, {!r} )").format( sourceFolder, givenName, encoding)) assert sourceFolder assert givenName # Setup and initialise the base class first Bible.__init__(self) self.objectNameString = 'DrupalBible Bible object' self.objectTypeString = 'DrupalBible' # Now we can set our object variables self.sourceFolder, self.givenName, self.encoding = sourceFolder, givenName, encoding self.sourceFilepath = os.path.join(self.sourceFolder, self.givenName + '.bc') # Do a preliminary check on the readability of our file if not os.access(self.sourceFilepath, os.R_OK): logging.critical( _("DrupalBible: File {!r} is unreadable").format( self.sourceFilepath)) self.name = self.givenName
def __init__(self, sourceFolder, givenName, encoding='utf-8'): """ Constructor: just sets up the Zefania Bible object. """ # Setup and initialise the base class first Bible.__init__(self) self.objectNameString = "Zefania XML Bible object" self.objectTypeString = "Zefania" # Now we can set our object variables self.sourceFolder, self.givenName, self.encoding = sourceFolder, givenName, encoding self.sourceFilepath = os.path.join(self.sourceFolder, self.givenName) self.tree = self.header = None # Will hold the XML data # Get the data tables that we need for proper checking #self.ISOLanguages = ISO_639_3_Languages().loadData() self.genericBOS = BibleOrganizationalSystem("GENERIC-KJV-66-ENG") # Do a preliminary check on the readability of our file if not os.access(self.sourceFilepath, os.R_OK): print("ZefaniaXMLBible: File '{}' is unreadable".format( self.sourceFilepath)) self.name = self.givenName
def __init__(self, sourceFolder, sourceFilename, encoding=None): """ Constructor: just sets up the Bible object. encoding is irrelevant because it's a binary format. """ # Setup and initialise the base class first Bible.__init__(self) self.objectNameString = 'EasyWorship Bible object' self.objectTypeString = 'EWB' # Now we can set our object variables self.sourceFolder, self.sourceFilename, self.encoding = sourceFolder, sourceFilename, encoding self.sourceFilepath = os.path.join(self.sourceFolder, self.sourceFilename) # Do a preliminary check on the readability of our file if not os.access(self.sourceFilepath, os.R_OK): logging.critical( _("EasyWorshipBible: File {!r} is unreadable").format( self.sourceFilepath)) global BOS if BOS is None: BOS = BibleOrganizationalSystem('GENERIC-KJV-66-ENG') self.abbreviation = self.sourceFilename[:-4] # Remove file extension
def __init__( self, sourceFolder, givenName, encoding='utf-8' ): """ Constructor: just sets up the XML Bible file converter object. """ # Setup and initialise the base class first if BibleOrgSysGlobals.debugFlag: print( "OpenSongXMLBible( {}, {}, {} )".format( sourceFolder, givenName, encoding ) ) Bible.__init__( self ) self.objectNameString = "OpenSong XML Bible object" self.objectTypeString = "OpenSong" # Now we can set our object variables self.sourceFolder, self.givenName, self.encoding = sourceFolder, givenName, encoding self.sourceFilepath = os.path.join( self.sourceFolder, self.givenName ) self.tree = None # Will hold the XML data # Get the data tables that we need for proper checking #self.ISOLanguages = ISO_639_3_Languages().loadData() self.genericBOS = BibleOrganizationalSystem( "GENERIC-KJV-66-ENG" ) # Do a preliminary check on the readability of our file if not os.access( self.sourceFilepath, os.R_OK ): print( "OpenSongXMLBible: File {!r} is unreadable".format( self.sourceFilepath ) ) self.name = self.givenName
def __init__( self, givenFolderName, givenName=None, encoding='utf-8' ): """ Create the internal USX Bible object. """ # Setup and initialise the base class first Bible.__init__( self ) self.objectNameString = "USX XML Bible object" self.objectTypeString = "USX" self.givenFolderName, self.givenName, self.encoding = givenFolderName, givenName, encoding # Remember our parameters # Now we can set our object variables self.name = self.givenName if not self.name: self.name = os.path.basename( self.givenFolderName ) if not self.name: self.name = os.path.basename( self.givenFolderName[:-1] ) # Remove the final slash if not self.name: self.name = "USX Bible" # Do a preliminary check on the readability of our folder if not os.access( self.givenFolderName, os.R_OK ): logging.error( "USXXMLBible: File {!r} is unreadable".format( self.givenFolderName ) ) # Find the filenames of all our books self.USXFilenamesObject = USXFilenames( self.givenFolderName ) self.possibleFilenameDict = {} for BBB,filename in self.USXFilenamesObject.getConfirmedFilenames(): self.possibleFilenameDict[BBB] = filename
def __init__(self, sourceFolder, givenName, encoding='utf-8'): """ Constructor: just sets up the XML Bible file converter object. """ # Setup and initialise the base class first if BibleOrgSysGlobals.debugFlag: print("OpenSongXMLBible( {}, {}, {} )".format( sourceFolder, givenName, encoding)) Bible.__init__(self) self.objectNameString = 'OpenSong XML Bible object' self.objectTypeString = 'OpenSong' # Now we can set our object variables self.sourceFolder, self.givenName, self.encoding = sourceFolder, givenName, encoding self.sourceFilepath = os.path.join(self.sourceFolder, self.givenName) self.tree = None # Will hold the XML data # Get the data tables that we need for proper checking #self.ISOLanguages = ISO_639_3_Languages().loadData() self.genericBOS = BibleOrganizationalSystem('GENERIC-KJV-66-ENG') # Do a preliminary check on the readability of our file if not os.access(self.sourceFilepath, os.R_OK): print("OpenSongXMLBible: File {!r} is unreadable".format( self.sourceFilepath)) self.name = self.givenName
def main(forRange, version): for i in range(forRange[0], forRange[1]): bookNamePtBR = Bible().getBooksPtBRName(i) bookAbbreviation = Bible().getBooksPtBRAbbreviation(i) numChapters = int(Bible().getbooksChapterNumber(i)) fileName = "biblia-" + version + ".txt" with open(fileName, 'a+', encoding='utf-8') as file: file.write('"{}/{}":{}'.format(bookNamePtBR, bookAbbreviation, '{')) for j in range(1, numChapters + 1): chapter = str(j) with open(fileName, 'a+', encoding='utf-8') as file: file.write('"{}":{}'.format(chapter, '{')) site = "https://www.bibliaonline.com.br/" url = site + version + "/" + bookNamePtBR.lower().replace(" ", "") + "/" + chapter verses = Book().getInfo(url, bookAbbreviation) with open(fileName, 'a+', encoding='utf-8') as file: for numVerse, verse in enumerate(verses): file.write('"{}":"{}",'.format((numVerse + 1), verse)) file.write('},') with open(fileName, 'a+', encoding='utf-8') as file: file.write('},') print("\nLivro de " + bookNamePtBR + " concluído.") print("\nArquivo gerado com sucesso.")
def __init__( self, sourceFileOrFolder, givenName=None ): """ Constructor: just sets up the Bible object. """ if debuggingThisModule or BibleOrgSysGlobals.debugFlag: print( f"GoBible.__init__( '{sourceFileOrFolder}', {givenName!r} )" ) # Setup and initialise the base class first Bible.__init__( self ) self.objectNameString = 'Go Bible object' self.objectTypeString = 'GoBible' # Now we can set our object variables self.sourceFileOrFolder, self.givenName = sourceFileOrFolder, givenName if sourceFileOrFolder.endswith( GOBIBLE_FILENAME_END ): assert os.path.isfile( sourceFileOrFolder ) self.sourceFilepath = sourceFileOrFolder self.sourceFolder = os.path.dirname( sourceFileOrFolder ) else: # assume it's a folder assert os.path.isdir( sourceFileOrFolder ) self.sourceFolder = sourceFileOrFolder self.sourceFilepath = os.path.join( self.sourceFolder, self.givenName+GOBIBLE_FILENAME_END ) # Do a preliminary check on the readability of our file if not os.access( self.sourceFilepath, os.R_OK ): logging.critical( _("GoBible: File '{}' is unreadable").format( self.sourceFilepath ) ) self.name = self.givenName
def __init__( self, sourceFolder, givenName=None, givenAbbreviation=None ): """ Create the internal ESFM Bible object. """ # Setup and initialise the base class first Bible.__init__( self ) self.objectNameString = "ESFM Bible object" self.objectTypeString = "ESFM" # Now we can set our object variables self.sourceFolder, self.givenName, self.abbreviation = sourceFolder, givenName, givenAbbreviation # Do a preliminary check on the contents of our folder foundFiles, foundFolders = [], [] for something in os.listdir( self.sourceFolder ): somepath = os.path.join( self.sourceFolder, something ) if os.path.isdir( somepath ): foundFolders.append( something ) elif os.path.isfile( somepath ): foundFiles.append( something ) else: logging.error( "Not sure what {!r} is in {}!".format( somepath, self.sourceFolder ) ) if foundFolders: unexpectedFolders = [] for folderName in foundFolders: if folderName.startswith( 'Interlinear_'): continue if folderName in ('__MACOSX'): continue unexpectedFolders.append( folderName ) if unexpectedFolders: logging.info( "ESFMBible.load: Surprised to see subfolders in {!r}: {}".format( self.sourceFolder, unexpectedFolders ) ) if not foundFiles: if BibleOrgSysGlobals.verbosityLevel > 0: print( "ESFMBible: Couldn't find any files in {!r}".format( self.sourceFolder ) ) return # No use continuing self.USFMFilenamesObject = USFMFilenames( self.sourceFolder ) if BibleOrgSysGlobals.verbosityLevel > 3 or (BibleOrgSysGlobals.debugFlag and debuggingThisModule): print( self.USFMFilenamesObject ) # Attempt to load the SSF file self.ssfFilepath, self.settingsDict = {}, {} ssfFilepathList = self.USFMFilenamesObject.getSSFFilenames( searchAbove=True, auto=True ) if len(ssfFilepathList) == 1: # Seems we found the right one self.ssfFilepath = ssfFilepathList[0] self.loadSSFData( self.ssfFilepath ) self.name = self.givenName if self.name is None: for field in ('FullName','Name',): if field in self.settingsDict: self.name = self.settingsDict[field]; break if not self.name: self.name = os.path.basename( self.sourceFolder ) if not self.name: self.name = os.path.basename( self.sourceFolder[:-1] ) # Remove the final slash if not self.name: self.name = "ESFM Bible" # Find the filenames of all our books self.maximumPossibleFilenameTuples = self.USFMFilenamesObject.getMaximumPossibleFilenameTuples() # Returns (BBB,filename) 2-tuples self.possibleFilenameDict = {} for BBB, filename in self.maximumPossibleFilenameTuples: self.possibleFilenameDict[BBB] = filename self.dontLoadBook = [] self.spellingDict, self.StrongsDict, self.hyphenationDict, self.semanticDict = {}, {}, {}, {}
def __init__( self, sourceFolder, givenName=None, givenAbbreviation=None ): """ Create the internal ESFM Bible object. """ # Setup and initialise the base class first Bible.__init__( self ) self.objectNameString = "ESFM Bible object" self.objectTypeString = "ESFM" # Now we can set our object variables self.sourceFolder, self.givenName, self.abbreviation = sourceFolder, givenName, givenAbbreviation # Do a preliminary check on the contents of our folder foundFiles, foundFolders = [], [] for something in os.listdir( self.sourceFolder ): somepath = os.path.join( self.sourceFolder, something ) if os.path.isdir( somepath ): foundFolders.append( something ) elif os.path.isfile( somepath ): foundFiles.append( something ) else: logging.error( "Not sure what '{}' is in {}!".format( somepath, self.sourceFolder ) ) if foundFolders: unexpectedFolders = [] for folderName in foundFolders: if folderName.startswith( 'Interlinear_'): continue if folderName in ('__MACOSX'): continue unexpectedFolders.append( folderName ) if unexpectedFolders: logging.info( "ESFMBible.load: Surprised to see subfolders in '{}': {}".format( self.sourceFolder, unexpectedFolders ) ) if not foundFiles: if Globals.verbosityLevel > 0: print( "ESFMBible: Couldn't find any files in '{}'".format( self.sourceFolder ) ) return # No use continuing self.USFMFilenamesObject = USFMFilenames( self.sourceFolder ) if Globals.verbosityLevel > 3 or (Globals.debugFlag and debuggingThisModule): print( self.USFMFilenamesObject ) # Attempt to load the SSF file self.ssfFilepath, self.settingsDict = {}, {} ssfFilepathList = self.USFMFilenamesObject.getSSFFilenames( searchAbove=True, auto=True ) if len(ssfFilepathList) == 1: # Seems we found the right one self.ssfFilepath = ssfFilepathList[0] self.loadSSFData( self.ssfFilepath ) self.name = self.givenName if self.name is None: for field in ('FullName','Name',): if field in self.settingsDict: self.name = self.settingsDict[field]; break if not self.name: self.name = os.path.basename( self.sourceFolder ) if not self.name: self.name = os.path.basename( self.sourceFolder[:-1] ) # Remove the final slash if not self.name: self.name = "ESFM Bible" # Find the filenames of all our books self.maximumPossibleFilenameTuples = self.USFMFilenamesObject.getMaximumPossibleFilenameTuples() # Returns (BBB,filename) 2-tuples self.possibleFilenameDict = {} for BBB, filename in self.maximumPossibleFilenameTuples: self.possibleFilenameDict[BBB] = filename self.dontLoadBook = [] self.spellingDict, self.StrongsDict, self.hyphenationDict, self.semanticDict = {}, {}, {}, {}
def __init__( self, sourceFolder, givenName=None, givenAbbreviation=None, encoding=None ): """ Create the internal BCV Bible object. Note that sourceFolder can be None if we don't know that yet. """ # Setup and initialise the base class first Bible.__init__( self ) self.objectNameString = 'BCV Bible object' self.objectTypeString = 'BCV' # Now we can set our object variables self.sourceFolder, self.givenName, self.abbreviation, self.encoding = sourceFolder, givenName, givenAbbreviation, encoding
def __init__( self, sourceFolder, givenName=None, givenAbbreviation=None ): """ Create the internal ESFM Bible object. """ # Setup and initialise the base class first Bible.__init__( self ) self.objectNameString = 'ESFM Bible object' self.objectTypeString = 'ESFM' # Now we can set our object variables self.sourceFolder, self.givenName, self.abbreviation = sourceFolder, givenName, givenAbbreviation self.dontLoadBook = [] self.spellingDict, self.StrongsDict, self.hyphenationDict, self.semanticDict = {}, {}, {}, {}
def __init__(self, sourceFolder, givenName=None, givenAbbreviation=None): """ Create the internal ESFM Bible object. """ # Setup and initialise the base class first Bible.__init__(self) self.objectNameString = 'ESFM Bible object' self.objectTypeString = 'ESFM' # Now we can set our object variables self.sourceFolder, self.givenName, self.abbreviation = sourceFolder, givenName, givenAbbreviation self.dontLoadBook = [] self.spellingDict, self.StrongsDict, self.hyphenationDict, self.semanticDict = {}, {}, {}, {}
def __init__(self, sourceFolder, givenName, encoding="utf-8"): """ Constructor: just sets up the Bible object. """ # Setup and initialise the base class first Bible.__init__(self) self.objectNameString = "Unbound Bible object" self.objectTypeString = "Unbound" # Now we can set our object variables self.sourceFolder, self.givenName, self.encoding = sourceFolder, givenName, encoding self.sourceFilepath = os.path.join(self.sourceFolder, self.givenName + "_utf8.txt") # Do a preliminary check on the readability of our file if not os.access(self.sourceFilepath, os.R_OK): logging.critical(_("UnboundBible: File {!r} is unreadable").format(self.sourceFilepath)) self.name = self.givenName
def __init__( self, sourceFolder, givenName, encoding='utf-8' ): """ Constructor: just sets up the Bible object. """ # Setup and initialise the base class first Bible.__init__( self ) self.objectNameString = 'VPL Bible object' self.objectTypeString = 'VPL' # Now we can set our object variables self.sourceFolder, self.givenName, self.encoding = sourceFolder, givenName, encoding self.sourceFilepath = os.path.join( self.sourceFolder, self.givenName+'.txt' ) # Do a preliminary check on the readability of our file if not os.access( self.sourceFilepath, os.R_OK ): logging.critical( _("VPLBible: File {!r} is unreadable").format( self.sourceFilepath ) ) self.name = self.givenName
def __init__( self, givenFolderName, givenName=None, encoding='utf-8' ): """ Create the internal USX Bible object. """ # Setup and initialise the base class first Bible.__init__( self ) self.objectNameString = 'USX XML Bible object' self.objectTypeString = 'USX' self.givenFolderName, self.givenName, self.encoding = givenFolderName, givenName, encoding # Remember our parameters self.sourceFolder = self.givenFolderName # Now we can set our object variables self.name = self.givenName if not self.name: self.name = os.path.basename( self.givenFolderName ) if not self.name: self.name = os.path.basename( self.givenFolderName[:-1] ) # Remove the final slash if not self.name: self.name = "USX Bible" self.ssfFilepath = None
def __init__(self, givenFolderName, givenName=None, encoding='utf-8'): """ Create the internal USX Bible object. """ # Setup and initialise the base class first Bible.__init__(self) self.objectNameString = 'USX XML Bible object' self.objectTypeString = 'USX' self.givenFolderName, self.givenName, self.encoding = givenFolderName, givenName, encoding # Remember our parameters self.sourceFolder = self.givenFolderName # Now we can set our object variables self.name = self.givenName if not self.name: self.name = os.path.basename(self.givenFolderName) if not self.name: self.name = os.path.basename( self.givenFolderName[:-1]) # Remove the final slash if not self.name: self.name = "USX Bible"
def __init__( self, sourceFolder, givenFilename, encoding='utf-8' ): """ Constructor: just sets up the Bible object. """ # Setup and initialise the base class first Bible.__init__( self ) self.objectNameString = 'e-Sword Bible object' self.objectTypeString = 'e-Sword' # Now we can set our object variables self.sourceFolder, self.sourceFilename, self.encoding = sourceFolder, givenFilename, encoding self.sourceFilepath = os.path.join( self.sourceFolder, self.sourceFilename ) # Do a preliminary check on the readability of our file if not os.access( self.sourceFilepath, os.R_OK ): logging.critical( _("ESwordBible: File {} is unreadable").format( repr(self.sourceFilepath) ) ) filenameBits = os.path.splitext( self.sourceFilename ) self.name = filenameBits[0] self.fileExtension = filenameBits[1]
def __init__(self, sourceFilepath, givenName=None, encoding='utf-8'): """ Constructor: expects the filepath of the source folder. Loads (and crudely validates the file(s)) into ???. """ # Setup and initialise the base class first Bible.__init__(self) self.objectNameString = 'Greek NT Bible object' self.objectTypeString = 'GreekNT' # Now we can set our object variables self.sourceFilepath, self.givenName, self.encoding = sourceFilepath, givenName, encoding self.title = self.version = self.date = None self.XMLTree = self.header = self.frontMatter = self.divs = self.divTypesString = None #self.bkData, self.USFMBooks = OrderedDict(), OrderedDict() self.lang = self.language = None # Do a preliminary check on the readability of our files self.possibleFilenames = [] if os.path.isdir( self.sourceFilepath ): # We've been given a folder -- see if we can find the files # There's no standard for OSIS xml file naming fileList = os.listdir(self.sourceFilepath) #print( len(fileList), fileList ) # First try looking for OSIS book names for filename in fileList: if filename.lower().endswith('.txt'): thisFilepath = os.path.join(self.sourceFilepath, filename) #if BibleOrgSysGlobals.debugFlag: print( "Trying {}…".format( thisFilepath ) ) if os.access(thisFilepath, os.R_OK): # we can read that file self.possibleFilenames.append(filename) elif not os.access(self.sourceFilepath, os.R_OK): logging.critical("GreekNT: File {!r} is unreadable".format( self.sourceFilepath)) return # No use continuing #print( self.possibleFilenames ); halt self.name = self.givenName
def __init__(self, sourceFolder, givenName=None, givenAbbreviation=None, encoding=None): """ Create the internal USFM Bible object. Note that sourceFolder can be None if we don't know that yet. """ # Setup and initialise the base class first Bible.__init__(self) self.objectNameString = "USFM Bible object" self.objectTypeString = "USFM" # Now we can set our object variables self.sourceFolder, self.givenName, self.abbreviation, self.encoding = sourceFolder, givenName, givenAbbreviation, encoding self.ssfFilepath, self.ssfDict, self.settingsDict = None, {}, {} if sourceFolder is not None: self.preload(sourceFolder)
def main(forRange, version): for i in range(forRange[0], forRange[1]): numChapters = int(Bible().getbooksChapterNumber(i)) for j in range(1, numChapters + 1): site = "https://www.bibliaonline.com.br/" bookNamePtBR = Bible().getBooksPtBRName(i) chapter = str(j) url = site + version + "/" + bookNamePtBR + "/" + chapter bookName = Bible().getBooksName(i) bookAbbreviation = Bible().getBooksAbbreviation(i) fileName = Book().getInfo(url, bookName, bookAbbreviation) with open(bookAbbreviation + '.usx', 'a+', encoding='utf-8') as file: file.write('</usx>') print("\n" + fileName + " gerada com sucesso.")
def __init__( self, sourceFolder, givenName, encoding='utf-8' ): """ Constructor: just sets up the Bible object. """ if BibleOrgSysGlobals.verbosityLevel > 2: print( _("DrupalBible__init__ ( {!r}, {!r}, {!r} )").format( sourceFolder, givenName, encoding ) ) assert sourceFolder assert givenName # Setup and initialise the base class first Bible.__init__( self ) self.objectNameString = 'DrupalBible Bible object' self.objectTypeString = 'DrupalBible' # Now we can set our object variables self.sourceFolder, self.givenName, self.encoding = sourceFolder, givenName, encoding self.sourceFilepath = os.path.join( self.sourceFolder, self.givenName+'.bc' ) # Do a preliminary check on the readability of our file if not os.access( self.sourceFilepath, os.R_OK ): logging.critical( _("DrupalBible: File {!r} is unreadable").format( self.sourceFilepath ) ) self.name = self.givenName
def __init__( self, sourceFolder, sourceFilename ): """ Constructor: just sets up the Bible object. """ # Setup and initialise the base class first Bible.__init__( self ) self.objectNameString = 'EasyWorship Bible object' self.objectTypeString = 'EWB' # Now we can set our object variables self.sourceFolder, self.sourceFilename = sourceFolder, sourceFilename self.sourceFilepath = os.path.join( self.sourceFolder, self.sourceFilename ) # Do a preliminary check on the readability of our file if not os.access( self.sourceFilepath, os.R_OK ): logging.critical( _("EasyWorshipBible: File {!r} is unreadable").format( self.sourceFilepath ) ) global BOS if BOS is None: BOS = BibleOrganizationalSystem( 'GENERIC-KJV-66-ENG' ) assert FILENAME_ENDING in self.sourceFilename.upper() self.abbreviation = os.path.splitext( self.sourceFilename)[0] # Remove file extension
def __init__( self, sourceFilepath, givenName=None, encoding='utf-8' ): """ Constructor: expects the filepath of the source folder. Loads (and crudely validates the file(s)) into ???. """ # Setup and initialise the base class first Bible.__init__( self ) self.objectNameString = "Greek NT Bible object" self.objectTypeString = "GreekNT" # Now we can set our object variables self.sourceFilepath, self.givenName, self.encoding = sourceFilepath, givenName, encoding self.title = self.version = self.date = None self.tree = self.header = self.frontMatter = self.divs = self.divTypesString = None #self.bkData, self.USFMBooks = OrderedDict(), OrderedDict() self.lang = self.language = None # Do a preliminary check on the readability of our files self.possibleFilenames = [] if os.path.isdir( self.sourceFilepath ): # We've been given a folder -- see if we can find the files # There's no standard for OSIS xml file naming fileList = os.listdir( self.sourceFilepath ) #print( len(fileList), fileList ) # First try looking for OSIS book names for filename in fileList: if filename.lower().endswith('.txt'): thisFilepath = os.path.join( self.sourceFilepath, filename ) #if Globals.debugFlag: print( "Trying {}...".format( thisFilepath ) ) if os.access( thisFilepath, os.R_OK ): # we can read that file self.possibleFilenames.append( filename ) elif not os.access( self.sourceFilepath, os.R_OK ): logging.critical( "GreekNT: File '{}' is unreadable".format( self.sourceFilepath ) ) return # No use continuing #print( self.possibleFilenames ); halt self.name = self.givenName
def __init__( self, sourceFolder, givenName, encoding='utf-8' ): """ Constructor: just sets up the Haggai Bible object. """ # Setup and initialise the base class first Bible.__init__( self ) self.objectNameString = 'Haggai XML Bible object' self.objectTypeString = 'Haggai' # Now we can set our object variables self.sourceFolder, self.givenName, self.encoding = sourceFolder, givenName, encoding self.sourceFilepath = os.path.join( self.sourceFolder, self.givenName ) self.XMLTree = self.header = None # Will hold the XML data # Get the data tables that we need for proper checking #self.ISOLanguages = ISO_639_3_Languages().loadData() self.genericBOS = BibleOrganizationalSystem( 'GENERIC-KJV-66-ENG' ) # Do a preliminary check on the readability of our file if not os.access( self.sourceFilepath, os.R_OK ): print( "HaggaiXMLBible: File {!r} is unreadable".format( self.sourceFilepath ) ) self.name = self.givenName
def __init__(self, sourceFolder=None, moduleName=None, encoding='utf-8'): """ Constructor: just sets up the Bible object. The sourceFolder should be the one containing mods.d and modules folders. The module name (if needed) should be the name of one of the .conf files in the mods.d folder (with or without the .conf on it). """ if BibleOrgSysGlobals.debugFlag and debuggingThisModule: print("SwordBible.__init__( {} {} {} )".format( sourceFolder, moduleName, encoding)) if not sourceFolder and not moduleName: logging.critical( _("SwordBible must be passed either a folder path or a module name!" )) return # Setup and initialise the base class first Bible.__init__(self) self.objectNameString = 'Sword Bible object' self.objectTypeString = 'CrosswireSword' if SwordType == 'CrosswireLibrary' else 'Sword' # Now we can set our object variables self.sourceFolder, self.moduleName, self.encoding = sourceFolder, moduleName, encoding self.SwordInterface = None if self.sourceFolder: # Do a preliminary check on the readability of our folder if not os.access(self.sourceFolder, os.R_OK): logging.critical( _("SwordBible: Folder {!r} is unreadable").format( self.sourceFolder)) if not self.moduleName: # If we weren't passed the module name, we need to assume that there's only one confFolder = os.path.join(self.sourceFolder, 'mods.d/') foundConfs = [] for something in os.listdir(confFolder): somepath = os.path.join(confFolder, something) if os.path.isfile(somepath) and something.endswith( '.conf'): foundConfs.append(something[:-5]) # Drop the .conf bit if foundConfs == 0: logging.critical( "No .conf files found in {}".format(confFolder)) elif len(foundConfs) > 1: logging.critical( "Too many .conf files found in {}".format(confFolder)) else: if BibleOrgSysGlobals.debugFlag and debuggingThisModule: print("SwordBible.__init__ got", foundConfs[0]) self.moduleName = foundConfs[0] self.abbreviation = self.moduleName # First attempt # Load the Sword manager and find our module if self.SwordInterface is None and SwordType is not None: self.SwordInterface = SwordInterface() # Load the Sword library if self.SwordInterface is None: # still logging.critical(exp("SwordBible: no Sword interface available")) return #try: self.SWMgr = Sword.SWMgr() #except NameError: #logging.critical( _("Unable to initialise {!r} module -- no Sword manager available").format( self.moduleName ) ) #return # our Sword import must have failed if BibleOrgSysGlobals.debugFlag and debuggingThisModule and SwordType == 'CrosswireLibrary': availableGlobalOptions = [ str(option) for option in self.SwordInterface.library.getGlobalOptions() ] print("availableGlobalOptions", availableGlobalOptions) # Don't need to set options if we use getRawEntry() rather than stripText() or renderText() #for optionName in ( 'Headings', 'Footnotes', 'Cross-references', "Strong's Numbers", 'Morphological Tags', ): #self.SWMgr.setGlobalOption( optionName, 'On' ) if self.sourceFolder: self.SwordInterface.library.augmentModules( self.sourceFolder, False) # Add our folder to the SW Mgr availableModuleCodes = [] for j, something in enumerate( self.SwordInterface.library.getModules()): # something can be a moduleBuffer (Crosswire) or just a string (BOS) if SwordType == 'CrosswireLibrary': if isinstance(something, str): print("Why did we get a string instead of a module? {}". format(something)) if BibleOrgSysGlobals.strictCheckingFlag: assert not isinstance(something, str) moduleID = something.getRawData() else: if BibleOrgSysGlobals.strictCheckingFlag: assert isinstance(something, str) moduleID = something if BibleOrgSysGlobals.strictCheckingFlag: assert isinstance(moduleID, str) if moduleID.upper() == self.moduleName.upper(): self.moduleName = moduleID # Get the case correct #module = SWMgr.getModule( moduleID ) #if 0: #print( "{} {} ({}) {} {!r}".format( j, module.getName(), module.getType(), module.getLanguage(), module.getEncoding() ) ) #try: print( " {} {!r} {} {}".format( module.getDescription(), module.getMarkup(), module.getDirection(), "" ) ) #except UnicodeDecodeError: print( " Description is not Unicode!" ) #print( "moduleID", repr(moduleID) ) availableModuleCodes.append(moduleID) #print( "Available module codes:", availableModuleCodes ) if self.moduleName not in availableModuleCodes: logging.critical("Unable to find {!r} Sword module".format( self.moduleName)) if BibleOrgSysGlobals.debugFlag and BibleOrgSysGlobals.verbosityLevel > 2: print("Available module codes:", availableModuleCodes) self.abbreviation = self.moduleName # Perhaps a better attempt
def __init__( self, sourceFolder=None, moduleName=None, encoding='utf-8' ): """ Constructor: just sets up the Bible object. The sourceFolder should be the one containing mods.d and modules folders. The module name (if needed) should be the name of one of the .conf files in the mods.d folder (with or without the .conf on it). """ if BibleOrgSysGlobals.debugFlag and debuggingThisModule: print( "SwordBible.__init__( {} {} {} )".format( sourceFolder, moduleName, encoding ) ) if not sourceFolder and not moduleName: logging.critical( _("SwordBible must be passed either a folder path or a module name!" ) ) return # Setup and initialise the base class first Bible.__init__( self ) self.objectNameString = 'Sword Bible object' self.objectTypeString = 'Sword' # Now we can set our object variables self.sourceFolder, self.moduleName, self.encoding = sourceFolder, moduleName, encoding self.SwordInterface = None if self.sourceFolder: # Do a preliminary check on the readability of our folder if not os.access( self.sourceFolder, os.R_OK ): logging.critical( _("SwordBible: Folder {!r} is unreadable").format( self.sourceFolder ) ) if not self.moduleName: # If we weren't passed the module name, we need to assume that there's only one confFolder = os.path.join( self.sourceFolder, 'mods.d/' ) foundConfs = [] for something in os.listdir( confFolder ): somepath = os.path.join( confFolder, something ) if os.path.isfile( somepath ) and something.endswith( '.conf' ): foundConfs.append( something[:-5] ) # Drop the .conf bit if foundConfs == 0: logging.critical( "No .conf files found in {}".format( confFolder ) ) elif len(foundConfs) > 1: logging.critical( "Too many .conf files found in {}".format( confFolder ) ) else: print( "SwordBible.__init__ got", foundConfs[0] ) self.moduleName = foundConfs[0] self.abbreviation = self.moduleName # First attempt # Load the Sword manager and find our module if self.SwordInterface is None and SwordType is not None: self.SwordInterface = SwordInterface() # Load the Sword library if self.SwordInterface is None: # still logging.critical( exp("SwordBible: no Sword interface available") ) return #try: self.SWMgr = Sword.SWMgr() #except NameError: #logging.critical( _("Unable to initialise {!r} module -- no Sword manager available").format( self.moduleName ) ) #return # our Sword import must have failed if BibleOrgSysGlobals.debugFlag and debuggingThisModule and SwordType=='CrosswireLibrary': availableGlobalOptions = [str(option) for option in self.SwordInterface.library.getGlobalOptions()] print( "availableGlobalOptions", availableGlobalOptions ) # Don't need to set options if we use getRawEntry() rather than stripText() or renderText() #for optionName in ( 'Headings', 'Footnotes', 'Cross-references', "Strong's Numbers", 'Morphological Tags', ): #self.SWMgr.setGlobalOption( optionName, 'On' ) if self.sourceFolder: self.SwordInterface.library.augmentModules( self.sourceFolder, False ) # Add our folder to the SW Mgr availableModuleCodes = [] for j,something in enumerate(self.SwordInterface.library.getModules()): # something can be a moduleBuffer (Crosswire) or just a string (BOS) moduleID = something.getRawData() if SwordType=='CrosswireLibrary' else something if moduleID.upper() == self.moduleName.upper(): self.moduleName = moduleID # Get the case correct #module = SWMgr.getModule( moduleID ) #if 0: #print( "{} {} ({}) {} {!r}".format( j, module.getName(), module.getType(), module.getLanguage(), module.getEncoding() ) ) #try: print( " {} {!r} {} {}".format( module.getDescription(), module.getMarkup(), module.getDirection(), "" ) ) #except UnicodeDecodeError: print( " Description is not Unicode!" ) #print( "moduleID", repr(moduleID) ) availableModuleCodes.append( moduleID ) #print( "Available module codes:", availableModuleCodes ) if self.moduleName not in availableModuleCodes: logging.critical( "Unable to find {!r} Sword module".format( self.moduleName ) ) if BibleOrgSysGlobals.debugFlag and BibleOrgSysGlobals.verbosityLevel > 2: print( "Available module codes:", availableModuleCodes ) self.abbreviation = self.moduleName # Perhaps a better attempt
def __init__( self, sourceFolder, givenName=None, encoding='utf-8' ): """ Create the internal USFX Bible object. """ # Setup and initialise the base class first Bible.__init__( self ) self.objectNameString = "USFX XML Bible object" self.objectTypeString = "USFX" self.sourceFolder, self.givenName, self.encoding = sourceFolder, givenName, encoding # Remember our parameters # Now we can set our object variables self.name = self.givenName if not self.name: self.name = os.path.basename( self.sourceFolder ) if not self.name: self.name = os.path.basename( self.sourceFolder[:-1] ) # Remove the final slash if not self.name: self.name = "USFX Bible" if self.name.endswith( '_usfx' ): self.name = self.name[:-5] # Remove end of name for Haiola projects # Do a preliminary check on the readability of our folder if not os.access( self.sourceFolder, os.R_OK ): logging.error( "USFXXMLBible: Folder '{}' is unreadable".format( self.sourceFolder ) ) # Do a preliminary check on the contents of our folder self.sourceFilename = self.sourceFilepath = None foundFiles, foundFolders = [], [] for something in os.listdir( self.sourceFolder ): somepath = os.path.join( self.sourceFolder, something ) if os.path.isdir( somepath ): foundFolders.append( something ) elif os.path.isfile( somepath ): somethingUpper = something.upper() somethingUpperProper, somethingUpperExt = os.path.splitext( somethingUpper ) ignore = False for ending in filenameEndingsToIgnore: if somethingUpper.endswith( ending): ignore=True; break if ignore: continue if not somethingUpperExt[1:] in extensionsToIgnore: # Compare without the first dot foundFiles.append( something ) else: logging.error( "Not sure what '{}' is in {}!".format( somepath, self.sourceFolder ) ) if foundFolders: logging.info( "USFXXMLBible: Surprised to see subfolders in '{}': {}".format( self.sourceFolder, foundFolders ) ) if not foundFiles: if Globals.verbosityLevel > 0: print( "USFXXMLBible: Couldn't find any files in '{}'".format( self.sourceFolder ) ) return # No use continuing #print( self.sourceFolder, foundFolders, len(foundFiles), foundFiles ) numFound = 0 for thisFilename in sorted( foundFiles ): firstLines = Globals.peekIntoFile( thisFilename, sourceFolder, numLines=3 ) if not firstLines or len(firstLines)<2: continue if not firstLines[0].startswith( '<?xml version="1.0"' ) \ and not firstLines[0].startswith( '\ufeff<?xml version="1.0"' ): # same but with BOM if Globals.verbosityLevel > 2: print( "USFXB (unexpected) first line was '{}' in {}".format( firstLines, thisFilename ) ) continue if "<usfx " not in firstLines[0]: continue lastFilenameFound = thisFilename numFound += 1 if numFound: if Globals.verbosityLevel > 2: print( "USFXXMLBible got", numFound, sourceFolder, lastFilenameFound ) if numFound == 1: self.sourceFilename = lastFilenameFound self.sourceFilepath = os.path.join( self.sourceFolder, self.sourceFilename ) elif looksHopeful and Globals.verbosityLevel > 2: print( " Looked hopeful but no actual files found" )
def __init__( self, sourceFolder, givenName=None, givenAbbreviation=None, encoding=None ): """ Create the internal USFM Bible object. """ # Setup and initialise the base class first Bible.__init__( self ) self.objectNameString = "USFM Bible object" self.objectTypeString = "USFM" # Now we can set our object variables self.sourceFolder, self.givenName, self.abbreviation, self.encoding = sourceFolder, givenName, givenAbbreviation, encoding # Do a preliminary check on the contents of our folder foundFiles, foundFolders = [], [] for something in os.listdir( self.sourceFolder ): somepath = os.path.join( self.sourceFolder, something ) if os.path.isdir( somepath ): foundFolders.append( something ) elif os.path.isfile( somepath ): foundFiles.append( something ) else: logging.error( t("__init__: Not sure what '{}' is in {}!").format( somepath, self.sourceFolder ) ) if foundFolders: unexpectedFolders = [] for folderName in foundFolders: if folderName.startswith( 'Interlinear_'): continue if folderName in ('__MACOSX'): continue unexpectedFolders.append( folderName ) if unexpectedFolders: logging.info( t("__init__: Surprised to see subfolders in '{}': {}").format( self.sourceFolder, unexpectedFolders ) ) if not foundFiles: if Globals.verbosityLevel > 0: print( t("__init__: Couldn't find any files in '{}'").format( self.sourceFolder ) ) raise FileNotFoundError # No use continuing self.USFMFilenamesObject = USFMFilenames( self.sourceFolder ) if Globals.verbosityLevel > 3 or (Globals.debugFlag and debuggingThisModule): print( "USFMFilenamesObject", self.USFMFilenamesObject ) # Attempt to load the SSF file self.ssfFilepath, self.settingsDict = {}, {} ssfFilepathList = self.USFMFilenamesObject.getSSFFilenames( searchAbove=True, auto=True ) if len(ssfFilepathList) == 1: # Seems we found the right one self.ssfFilepath = ssfFilepathList[0] self.loadSSFData( self.ssfFilepath ) if self.encoding is None and 'Encoding' in self.ssfDict: # See if the SSF file gives some help to us ssfEncoding = self.ssfDict['Encoding'] if ssfEncoding == '65001': self.encoding = 'utf-8' else: if Globals.verbosityLevel > 0: print( t("__init__: File encoding in SSF is set to '{}'").format( ssfEncoding ) ) if ssfEncoding.isdigit(): self.encoding = 'cp' + ssfEncoding if Globals.verbosityLevel > 0: print( t("__init__: Switched to '{}' file encoding").format( self.encoding ) ) else: logging.critical( t("__init__: Unsure how to handle '{}' file encoding").format( ssfEncoding ) ) self.name = self.givenName if self.name is None: for field in ('FullName','Name',): if field in self.settingsDict: self.name = self.settingsDict[field]; break if not self.name: self.name = os.path.basename( self.sourceFolder ) if not self.name: self.name = os.path.basename( self.sourceFolder[:-1] ) # Remove the final slash if not self.name: self.name = "USFM Bible" # Find the filenames of all our books self.maximumPossibleFilenameTuples = self.USFMFilenamesObject.getMaximumPossibleFilenameTuples() # Returns (BBB,filename) 2-tuples self.possibleFilenameDict = {} for BBB, filename in self.maximumPossibleFilenameTuples: self.possibleFilenameDict[BBB] = filename
def getParsedContent(): bookName = "" bible = Bible() book = Book("Genesis") chapter = Chapter(1) file = open("bible.txt") bookname = "" for line in file: splitLine = line.split() # Aquires Book Title Name of current line if (splitLine[0].isdigit()): bookName = splitLine[0] + " " + splitLine[1] elif (splitLine[0] == "Song"): bookName = splitLine[0] + " " + splitLine[1] + " " + splitLine[2] else: bookName = splitLine[0] # Aquires Book Chapter number and verse number of current line if (splitLine[0].isdigit()): chapNumAndVerseNum = splitLine[2].split(sep=":") elif (splitLine[0] == "Song"): chapNumAndVerseNum = splitLine[3].split(sep=":") else: chapNumAndVerseNum = splitLine[1].split(sep=":") # Uses chapNumandVerseNum to get the chapter number # and the verse Number currentChapNum = chapNumAndVerseNum[0] currentVerseNum = chapNumAndVerseNum[1] verseString = "" # Aquires the Verse String from the current line. if (splitLine[0].isdigit()): for index in range(3, len(splitLine)): verseString += splitLine[index] + " " elif (splitLine[0] == "Song"): for index in range(4, len(splitLine)): verseString += splitLine[index] + " " else: for index in range(2, len(splitLine)): verseString += splitLine[index] + " " # Uses generated verse String to create a new bible verse currentBibleVerse = Verse(currentVerseNum, verseString) # When Book Title Changes, add the current book to the bible. # Then, create new book. if (book.bookTitle != bookName): book.addChapter(chapter) chapter = Chapter(currentChapNum) bible.addBook(book.bookTitle, book) book = Book(bookName) # Resets Book Object book.bookTitle = bookName # When Book Number Changes, add the current chapter to the current book # Then, Create a new book. elif(currentChapNum != chapter.chapterNum): book.addChapter(chapter) chapter = Chapter(currentChapNum) # Adds each verse to the correct chapter chapter.addVerse(currentBibleVerse) # Adds Revelations [Edge Case] book.addChapter(chapter) bible.addBook(bookName, book) return bible
def __init__(self, sourceFolder, givenName=None, givenAbbreviation=None, encoding=None): """ Create the internal USFM Bible object. """ # Setup and initialise the base class first Bible.__init__(self) self.objectNameString = "USFM Bible object" self.objectTypeString = "USFM" # Now we can set our object variables self.sourceFolder, self.givenName, self.abbreviation, self.encoding = sourceFolder, givenName, givenAbbreviation, encoding # Do a preliminary check on the contents of our folder foundFiles, foundFolders = [], [] for something in os.listdir(self.sourceFolder): somepath = os.path.join(self.sourceFolder, something) if os.path.isdir(somepath): foundFolders.append(something) elif os.path.isfile(somepath): foundFiles.append(something) else: logging.error( t("__init__: Not sure what '{}' is in {}!").format( somepath, self.sourceFolder)) if foundFolders: unexpectedFolders = [] for folderName in foundFolders: if folderName.startswith('Interlinear_'): continue if folderName in ('__MACOSX'): continue unexpectedFolders.append(folderName) if unexpectedFolders: logging.info( t("__init__: Surprised to see subfolders in '{}': {}"). format(self.sourceFolder, unexpectedFolders)) if not foundFiles: if Globals.verbosityLevel > 0: print( t("__init__: Couldn't find any files in '{}'").format( self.sourceFolder)) raise FileNotFoundError # No use continuing self.USFMFilenamesObject = USFMFilenames(self.sourceFolder) if Globals.verbosityLevel > 3 or (Globals.debugFlag and debuggingThisModule): print("USFMFilenamesObject", self.USFMFilenamesObject) # Attempt to load the SSF file self.ssfFilepath, self.settingsDict = {}, {} ssfFilepathList = self.USFMFilenamesObject.getSSFFilenames( searchAbove=True, auto=True) if len(ssfFilepathList) == 1: # Seems we found the right one self.ssfFilepath = ssfFilepathList[0] self.loadSSFData(self.ssfFilepath) if self.encoding is None and 'Encoding' in self.ssfDict: # See if the SSF file gives some help to us ssfEncoding = self.ssfDict['Encoding'] if ssfEncoding == '65001': self.encoding = 'utf-8' else: if Globals.verbosityLevel > 0: print( t("__init__: File encoding in SSF is set to '{}'"). format(ssfEncoding)) if ssfEncoding.isdigit(): self.encoding = 'cp' + ssfEncoding if Globals.verbosityLevel > 0: print( t("__init__: Switched to '{}' file encoding"). format(self.encoding)) else: logging.critical( t("__init__: Unsure how to handle '{}' file encoding" ).format(ssfEncoding)) self.name = self.givenName if self.name is None: for field in ( 'FullName', 'Name', ): if field in self.settingsDict: self.name = self.settingsDict[field] break if not self.name: self.name = os.path.basename(self.sourceFolder) if not self.name: self.name = os.path.basename( self.sourceFolder[:-1]) # Remove the final slash if not self.name: self.name = "USFM Bible" # Find the filenames of all our books self.maximumPossibleFilenameTuples = self.USFMFilenamesObject.getMaximumPossibleFilenameTuples( ) # Returns (BBB,filename) 2-tuples self.possibleFilenameDict = {} for BBB, filename in self.maximumPossibleFilenameTuples: self.possibleFilenameDict[BBB] = filename
def __init__( self, sourceFolder, givenName=None, encoding='utf-8' ): """ Create the internal USFX Bible object. """ # Setup and initialise the base class first Bible.__init__( self ) self.objectNameString = "USFX XML Bible object" self.objectTypeString = "USFX" self.sourceFolder, self.givenName, self.encoding = sourceFolder, givenName, encoding # Remember our parameters # Now we can set our object variables self.name = self.givenName if not self.name: self.name = os.path.basename( self.sourceFolder ) if not self.name: self.name = os.path.basename( self.sourceFolder[:-1] ) # Remove the final slash if not self.name: self.name = "USFX Bible" if self.name.endswith( '_usfx' ): self.name = self.name[:-5] # Remove end of name for Haiola projects # Do a preliminary check on the readability of our folder if not os.access( self.sourceFolder, os.R_OK ): logging.error( "USFXXMLBible: Folder {!r} is unreadable".format( self.sourceFolder ) ) # Do a preliminary check on the contents of our folder self.sourceFilename = self.sourceFilepath = None foundFiles, foundFolders = [], [] for something in os.listdir( self.sourceFolder ): somepath = os.path.join( self.sourceFolder, something ) if os.path.isdir( somepath ): foundFolders.append( something ) elif os.path.isfile( somepath ): somethingUpper = something.upper() somethingUpperProper, somethingUpperExt = os.path.splitext( somethingUpper ) ignore = False for ending in filenameEndingsToIgnore: if somethingUpper.endswith( ending): ignore=True; break if ignore: continue if not somethingUpperExt[1:] in extensionsToIgnore: # Compare without the first dot foundFiles.append( something ) else: logging.error( "Not sure what {!r} is in {}!".format( somepath, self.sourceFolder ) ) if foundFolders: logging.info( "USFXXMLBible: Surprised to see subfolders in {!r}: {}".format( self.sourceFolder, foundFolders ) ) if not foundFiles: if BibleOrgSysGlobals.verbosityLevel > 0: print( "USFXXMLBible: Couldn't find any files in {!r}".format( self.sourceFolder ) ) return # No use continuing #print( self.sourceFolder, foundFolders, len(foundFiles), foundFiles ) numFound = 0 for thisFilename in sorted( foundFiles ): firstLines = BibleOrgSysGlobals.peekIntoFile( thisFilename, sourceFolder, numLines=3 ) if not firstLines or len(firstLines)<2: continue if not firstLines[0].startswith( '<?xml version="1.0"' ) \ and not firstLines[0].startswith( '\ufeff<?xml version="1.0"' ): # same but with BOM if BibleOrgSysGlobals.verbosityLevel > 2: print( "USFXB (unexpected) first line was {!r} in {}".format( firstLines, thisFilename ) ) continue if "<usfx " not in firstLines[0]: continue lastFilenameFound = thisFilename numFound += 1 if numFound: if BibleOrgSysGlobals.verbosityLevel > 2: print( "USFXXMLBible got", numFound, sourceFolder, lastFilenameFound ) if numFound == 1: self.sourceFilename = lastFilenameFound self.sourceFilepath = os.path.join( self.sourceFolder, self.sourceFilename ) elif looksHopeful and BibleOrgSysGlobals.verbosityLevel > 2: print( " Looked hopeful but no actual files found" )