Skip to content

Commit

Permalink
Removed references to Bazarr config and languages modules
Browse files Browse the repository at this point in the history
Now call pycountry methods directly to get language name
  • Loading branch information
JaiZed committed Dec 27, 2023
1 parent 4a82c4f commit 6fcc00d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions libs/subliminal_patch/providers/whisperai.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@

from babelfish.exceptions import LanguageReverseError

from languages.get_languages import alpha3_from_alpha2, language_from_alpha2, language_from_alpha3
from app.config import settings
# from languages.get_languages import alpha3_from_alpha2, language_from_alpha2, language_from_alpha3
# from app.config import settings
import pycountry

import ffmpeg
import functools
Expand Down Expand Up @@ -128,16 +129,12 @@

logger = logging.getLogger(__name__)

def set_log_level(newLevel=None):
if newLevel == None:
# set logging level as specified by user in settings
newLevel = settings.whisperai.loglevel
def set_log_level(newLevel="INFO"):
newLevel = newLevel.upper()

# print(f'WhisperAI log level changing from {logging._levelToName[logger.getEffectiveLevel()]} to {newLevel}')
logger.setLevel(getattr(logging, newLevel))

# initialize from settings
# initialize to default above
set_log_level()

@functools.lru_cache(2)
Expand Down Expand Up @@ -179,6 +176,9 @@ def whisper_get_language_reverse(alpha3):
return wl
raise ValueError

def language_from_alpha3(lang):
language = pycountry.languages.get(alpha_3=lang)
return language.name

class WhisperAISubtitle(Subtitle):
'''Whisper AI Subtitle.'''
Expand Down

0 comments on commit 6fcc00d

Please sign in to comment.