Skip to content

Commit

Permalink
v0.14.5 - fixed following keep audio
Browse files Browse the repository at this point in the history
  • Loading branch information
FlyingFathead committed Jun 11, 2024
1 parent dbd1354 commit 20568ea
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ After launching the bot, you can interact with it via Telegram:
- `/language` - set the model's transcription language (`auto` = autodetect); if you know the language spoken in the audio, setting the transcription language manually with this command may improve both transcription speed and accuracy.
## Changes
- v0.14.5 - fixed following the "keep/don't keep audio files" config rule
- v0.14.4 - added the `/info` command for viewing current settings & queue status
- v0.14.3 - Whisper model language selection via `/language` command
- v0.14.2 - display duration & estimates
Expand Down
2 changes: 1 addition & 1 deletion src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# openai-whisper transcriber-bot for Telegram

# version of this program
version_number = "0.14.4"
version_number = "0.14.5"

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# https://github.com/FlyingFathead/whisper-transcriber-telegram-bot/
Expand Down
15 changes: 12 additions & 3 deletions src/transcription_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,6 @@ async def transcribe_audio(audio_path, output_dir, youtube_url, video_info_messa

logger.info(f"Whisper transcription completed for: {audio_path}")

# Generate the header if needed
header_content = ""

# Generate the header if needed, now including the model used
ai_transcript_header = f"[ Transcript generated with: https://github.com/FlyingFathead/whisper-transcriber-telegram-bot/ | OpenAI Whisper model: `{model}` | Language: `{language}` ]"
header_content = ""
Expand Down Expand Up @@ -333,6 +330,18 @@ async def transcribe_audio(audio_path, output_dir, youtube_url, video_info_messa
else:
logger.warning(f"Expected transcription file not found or empty: {file_path}")

# Check the keepaudiofiles setting and delete the audio file if necessary
transcription_settings = get_transcription_settings()
keep_audio_files = transcription_settings.get('keep_audio_files', False)
logger.info(f"keepaudiofiles setting: {keep_audio_files}")

if not keep_audio_files and os.path.exists(audio_path):
try:
os.remove(audio_path)
logger.info(f"Deleted audio file: {audio_path}")
except Exception as e:
logger.error(f"Failed to delete audio file {audio_path}: {e}")

return created_files

except Exception as e:
Expand Down

0 comments on commit 20568ea

Please sign in to comment.