mirror of
				https://github.com/advplyr/audiobookshelf.git
				synced 2025-10-27 11:18:14 +01:00 
			
		
		
		
	Narrators successfully isolated from path. Next steps: parse multiple narrators and save to disk
This commit is contained in:
		
							parent
							
								
									139ee013a7
								
							
						
					
					
						commit
						67523095d6
					
				@ -4,6 +4,7 @@ const Logger = require('../Logger')
 | 
			
		||||
const { recurseFiles, getFileTimestampsWithIno } = require('./fileUtils')
 | 
			
		||||
const globals = require('./globals')
 | 
			
		||||
const LibraryFile = require('../objects/files/LibraryFile')
 | 
			
		||||
const { response } = require('express')
 | 
			
		||||
 | 
			
		||||
function isMediaFile(mediaType, ext) {
 | 
			
		||||
  // if (!path) return false
 | 
			
		||||
@ -212,7 +213,8 @@ function getBookDataFromDir(folderPath, relPath, parseSubtitle = false) {
 | 
			
		||||
  var splitDir = relPath.split('/')
 | 
			
		||||
 | 
			
		||||
  // Audio files will always be in the directory named for the title
 | 
			
		||||
  var title = splitDir.pop()
 | 
			
		||||
  var [title, narrators] = getTitleAndNarrator(splitDir.pop())
 | 
			
		||||
 | 
			
		||||
  var series = null
 | 
			
		||||
  var author = null
 | 
			
		||||
  // If there are at least 2 more directories, next furthest will be the series
 | 
			
		||||
@ -298,6 +300,12 @@ function getBookDataFromDir(folderPath, relPath, parseSubtitle = false) {
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function getTitleAndNarrator(folder) {
 | 
			
		||||
  let pattern = /^(?<title>.*)\[(?<narrators>.*)\] *$/
 | 
			
		||||
  let match = folder.match(pattern)
 | 
			
		||||
  return match ? [match.groups.title.trimEnd(), match.groups.narrators] : [folder, null]
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function getPodcastDataFromDir(folderPath, relPath) {
 | 
			
		||||
  relPath = relPath.replace(/\\/g, '/')
 | 
			
		||||
  var splitDir = relPath.split('/')
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user