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

Wrong language text in a4ksubtitles #8

Open
peno64 opened this issue Nov 16, 2024 · 4 comments
Open

Wrong language text in a4ksubtitles #8

peno64 opened this issue Nov 16, 2024 · 4 comments

Comments

@peno64
Copy link
Owner

peno64 commented Nov 16, 2024

@newt-sc

Hi,

There is an issue with a4kSubtitles and since there is no issues tab on the repo I can only contact you this way.

image

image

In above printscreen you can see that the flag shows Dutch but the text says English. This happens at least with providers subDL and podnadpisi.

In kodi settings both language Dutch and English are chosen.

As you can see on those printscreens, I made some changes in the code:

def create_listitem(item): # pragma: no cover
(item_name, item_ext) = os.path.splitext(item['name'])
item_name = item_name.replace('.', ' ')
item_ext = item_ext.upper()[1:]
item_service = item['service']
item_color = item.get('color', 'white')

args = {
    'label': item['lang'],

'label2': '%s ([B]%s[/B]) ([B][COLOR %s]%s[/COLOR][/B])' % (item_name, item_ext, item_color, item_service),

    'label2': '%s (>%s<) (>%s<) ([B]%s[/B]) ([B][COLOR %s]%s[/COLOR][/B])' % (item_name, str(item['lang']), str(item['lang_code']), item_ext, item_color, item_service),
    'offscreen': True,
}

I also changed this in subdl.py:

def map_result(result):
    filename = result['release_name']
    lang_code = result['language'].lower()
    lang = meta.languages[lang_ids.index(lang_code)]

    core.logger.debug('subdl: %s >%s< >%s< >%s<' % (filename, lang_code, lang_ids.index(lang_code), lang))

This shows this in the logfile:

2024-11-16 09:34:19.491 T:16860 info : service.subtitles.a4ksubtitles: subdl: Star Trek 2009 >en< >0< >Dutch<
2024-11-16 09:34:19.491 T:16860 info : service.subtitles.a4ksubtitles: subdl: Star.Trek.SCREENER.XviD-ROAR >nl< >1< >English<

As you can see, Dutch and English are switched.

This must have something to do with this:

lang_ids = core.utils.get_lang_ids(meta.languages, core.kodi.xbmc.ISO_639_1)

But I don't know exactly what.

Is this something you can take a look at?

Thank you

@peno64
Copy link
Owner Author

peno64 commented Nov 16, 2024

@newt-sc

I think the issue is the lang_ids.sort() at the end of get_lang_ids

Commenting this out solves the problem

@newt-sc
Copy link

newt-sc commented Nov 16, 2024

@peno64 Thank you for the feedback. You can open a PR with your proposed changes and explain the issue there.

@newt-sc
Copy link

newt-sc commented Nov 17, 2024

Fixed in: a4k-openproject/a4kSubtitles#89

@peno64
Copy link
Owner Author

peno64 commented Nov 17, 2024

@newt-sc

Thank you.

I had it on test and also another user had my change on test and it looked also fine for him. Would have created a PR after some days but I see now that you already made the change. Great.

I do have another change I once made but I don't exactly remember in which case it happened. Maybe when I played a youtube video or so. The comment I added then does explain it a bit.

In service.py, line 28 after

has_done_subs_check = True
has_subtitles = False

I added this:

    # Check if there is an IMDB number for this video
    # If not then this is most probably not a video played from an addon that provides the IMDB number
    # It could also be a local video file of from youtube, a tv station or...
    # In that case don't set the subtitle stream
    # Maybe an option should be added to the settings of a4kSubtitles if this is wanted or not
    IMDBNumber = core.kodi.xbmc.getInfoLabel('VideoPlayer.IMDBNumber')
    if IMDBNumber is None or IMDBNumber == '':
        continue

Maybe you can also take a look at this change if it is (still) needed.

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

No branches or pull requests

2 participants