2 Commits
4 changed files with 11 additions and 3 deletions
+2
View File
@@ -1,2 +1,4 @@
config.json
__pycache__/
.venv
.DS_Store
+1
View File
@@ -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")
+4
View File
@@ -12,6 +12,8 @@ def process_directories(directory):
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, 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)
+1
View File
@@ -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):