Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: subtitle file rename failure in collection #676

Merged
merged 1 commit into from
Apr 12, 2024

Conversation

KotaHv
Copy link
Contributor

@KotaHv KotaHv commented Jan 24, 2024

Fix

#391


另外还有两个问题:

  • 当字幕没有语种信息时([SumiSora][Tanakeda][02]x265_aac.ass)会命名失败,是否可将SubtitleFile.language类型改为Optional[str]?

  • 关于非zh-tw|zh语种,因为语种信息一般是倒数第二个后缀(中二病也要谈恋爱! - S01E01 - 邂逅的…邪王真眼.jpn.ass),代码是否可以改为:

from pathlib import Path

def get_subtitle_lang(subtitle_name: str) -> str:
    for key, value in SUBTITLE_LANG.items():
        for v in value:
            if v in subtitle_name.lower():
                return key
            
    suffixes = Path(subtitle_name).suffixes
    if len(suffixes) > 1:
        lang = suffixes[-2]
        return lang.lstrip(".")

Copy link

vercel bot commented Jan 24, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
auto-bangumi ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 24, 2024 3:20pm

@EstrellaXD EstrellaXD merged commit 5c1c5e2 into EstrellaXD:3.1-dev Apr 12, 2024
2 checks passed
@EstrellaXD
Copy link
Owner

Approved, thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants