Updated progress bar to be more accurate and added .DS_Store ignores
This commit is contained in:
@@ -39,6 +39,7 @@ def split_mp3s(annex, circulation):
|
||||
combined = AudioSegment.empty()
|
||||
for mp3_file in mp3_files:
|
||||
combined += AudioSegment.from_file(os.path.join(folder_path, mp3_file))
|
||||
overall_progress_bar.update(1)
|
||||
combined = combined.set_channels(1) # Assuming you want mono audio
|
||||
|
||||
labels_file = os.path.join(folder_path, "overdrive_chapters_ms_spans.txt")
|
||||
|
||||
@@ -10,8 +10,10 @@ def process_directories(directory):
|
||||
'''Iterate through all subfolders in each author's directory & create cleaned_metadata.json'''
|
||||
for author_name in os.listdir(directory):
|
||||
author_path = os.path.join(directory, author_name)
|
||||
if os.path.isdir(author_path):
|
||||
for book_title in os.listdir(author_path):
|
||||
if os.path.isdir(author_path):
|
||||
for book_title in os.listdir(author_path):
|
||||
if book_title == '.DS_Store': # Skip .DS_Store files/folders at this level, update for your systems specs
|
||||
continue
|
||||
book_path = os.path.join(author_path, book_title)
|
||||
metadata_file = os.path.join(book_path, "cleaned_metadata.json")
|
||||
if os.path.exists(metadata_file):
|
||||
@@ -104,6 +106,8 @@ def meta_to_mp3(directory, bookshelf):
|
||||
author_path = os.path.join(directory, author_name)
|
||||
if os.path.isdir(author_path):
|
||||
for book_title in os.listdir(author_path):
|
||||
if book_title == '.DS_Store': # Skip .DS_Store files/folders at this level
|
||||
continue
|
||||
book_path = os.path.join(author_path, book_title)
|
||||
destination_path = os.path.join(bookshelf, author_name, book_title)
|
||||
os.makedirs(os.path.dirname(destination_path), exist_ok=True)
|
||||
|
||||
@@ -22,6 +22,7 @@ def get_chapter_count(directory):
|
||||
file_path = os.path.join(root, filename)
|
||||
with open(file_path, 'r') as f:
|
||||
total_chapters += sum(1 for _ in f)
|
||||
total_chapters += len(fnmatch.filter(files, '*.mp3'))
|
||||
return total_chapters
|
||||
|
||||
def process_progress(total_chapters):
|
||||
|
||||
Reference in New Issue
Block a user