★🔊📖

★Economics

◇Economics / Economic Theory

Chinese Title English Title Author Book ID
国富论——国民财富的性质和原因 The Wealth of Nations
Alternate Title: An Inquiry into the Nature and Causes of the Wealth of Nations
Adam Smith (UK) Book 1–5

★Military

◇Military / Military Theory

Chinese Title English Title Author Book ID
孙子兵法
Alternate Title: 孙武兵法
The Art of War Sun Tzu Book 6

★Politics

◇Politics / Political Fiction

Chinese Title English Title Author Book ID
一九八四 Nineteen Eighty-Four George Orwell (UK) Book 7–9

★Audiobook Production Scripts

◇Download MP3 from YouTube

youtube-dl -x --audio-format mp3 --audio-quality 0 "https://www.youtube.com/watch?v=VIDEO_ID"
# yt_mp3_download.py
import subprocess

def download_youtube_mp3():
    yt_dlp_path = "/Users/dev/Library/Python/3.9/bin/yt-dlp"
    url = input("Please enter the YouTube video link: ").strip()
    
    command = [
        yt_dlp_path,
        "-x",  # Extract audio
        "--audio-format", "mp3",  # Convert to MP3 format
        url
    ]

    try:
        subprocess.run(command, check=True)
        print("✅ Download completed")
    except subprocess.CalledProcessError as e:
        print("❌ Download failed:", e)

if __name__ == "__main__":
    download_youtube_mp3()

◇Split Audio by Chapters

# split_audio.py
import os
import subprocess

input_file = "/Users/dev/Downloads/aaa/xxx.mp3"
output_dir = "output_chapters"
os.makedirs(output_dir, exist_ok=True)

chapters = [
    ("a0", "00:00:00"),
    ("1-chapter1", "00:00:09"),
    ("1-chapter2", "00:39:31"),
    ("2-chapter1", "03:35:20"),
    ("2-chapter2", "04:00:13"),
    ("3-chapter1", "07:48:41"),
    ("3-chapter2", "08:18:27")
]

for i in range(len(chapters)):
    title, start = chapters[i]
    end = chapters[i+1][1] if i+1 < len(chapters) else None

    output_file = os.path.join(output_dir, f"{title}.mp3")
    cmd = ["ffmpeg", "-y", "-i", input_file, "-ss", start]
    if end:
        cmd += ["-to", end]
    cmd += ["-c", "copy", output_file]

    subprocess.run(cmd)
    print(f"Exported: {output_file}")

print("All chapters have been successfully split.")

◇Merge Audio Files

# merge_audio.py
from pydub import AudioSegment
import os

# Set the path to the audio directory
audio_dir = "/Users/dev/Downloads/aaa/irodori-mp3/X_audio_all"
# Get all mp3 files and sort them by filename (optional)
audio_files = sorted([f for f in os.listdir(audio_dir) if f.endswith(".mp3")])

# Create an empty audio segment
combined = AudioSegment.empty()

# Append each audio file
for file in audio_files:
    file_path = os.path.join(audio_dir, file)
    audio = AudioSegment.from_mp3(file_path)
    combined += audio
    print(f"Added: {file}")

# Export the merged audio
output_path = os.path.join(audio_dir, "combined_output.mp3")
combined.export(output_path, format="mp3")
print(f"Merged audio saved as: {output_path}")