anderbytes 140 Posted July 20, 2016 Posted July 20, 2016 (edited) As of today, the 1st parameter of each item in https://github.com/MediaBrowser/Emby/blob/master/MediaBrowser.Server.Implementations/Localization/iso6392.txt is a 3-digit format of the language and dictates the matcheable text to be searched in a subtitle file name, for autodetection of preferred language. my example here: preferred language: pt-BR (Portuguese from Brazil) subtitle files already recognized: #######.pob.srt PROBLEMs: - VLC doesn't translates the 3-digit format, so in list it only says "pob" instead of "Portuguese (Brazil)". He only understands it when the file has "pt-BR" instead. - Subtitle downloaders usually don't use the 3-digit format, be it Windows or Linux versions - Users are forced to always rename everything to 3-digit, no choice is given to us. It happens that there's another correct way of storing the language name... using exactly the other parameters seen in the file above. in my case... a subtitle called #######.pt-BR.srt is VERY common in subtitle downloaders around the web. My question here is: is it possible to... when Emby finds a file #######.LANG.srt but no LANG as one of the 1st parameter of iso6932.txt, that it fallbacks into search the 2nd and 3rd parameters? I know that this won't impact 90% of the users. But the rest of us appreciate the help. ps: it has to be a case-insensitive search, or else the format 2-digit-lowercase-2-digit-uppercase has to be enforced in that txt. Edited July 20, 2016 by anderbytes
Luke 38980 Posted July 20, 2016 Posted July 20, 2016 I looked into this and we're already doing this, so you should be ok naming with pt-br
anderbytes 140 Posted July 20, 2016 Author Posted July 20, 2016 (edited) Remember that other topic where we discussed the reason to respect the official format of 5-digit as (lo-HI) for metadata download? Well... I guess it's the same here. He doesn't recognize pt-BR as the same as pt-br. I guess if we just substitute the lowercase pt-br for pt-BR in iso6932.txt , it might just work. I'm perfectionist. Sue me :-) :-) I can create a simple pull request for this later (and maybe even searching for more occurrences in the whole code) Edited July 20, 2016 by anderbytes
Luke 38980 Posted July 20, 2016 Posted July 20, 2016 I don't think any changes are necessary because we don't really do anything with the value you enter. it could just as easily be elephant instead of pt-br.
anderbytes 140 Posted July 20, 2016 Author Posted July 20, 2016 I know. I'm just trying to polish it. Renaming everything from pt-BR to pt-br is as bad as renaming to pob. It's just extra work that shouldn't happen. Understand?
Luke 38980 Posted July 20, 2016 Posted July 20, 2016 but our string comparisons are already case-insensitive so that's why that shouldn't matter.
anderbytes 140 Posted July 20, 2016 Author Posted July 20, 2016 (edited) I'm trying to explain that it seems that if the cases aren't exact, the fallback won't work, it won't find anything, and that's what happens today Edited July 20, 2016 by anderbytes
anderbytes 140 Posted July 20, 2016 Author Posted July 20, 2016 but our string comparisons are already case-insensitive so that's why that shouldn't matter. Very strange! Emby doesn't plays automatically my pt-BR external sub, only when it is pob :-(
anderbytes 140 Posted July 20, 2016 Author Posted July 20, 2016 what won't find anything? Find = auto-select from preferred language when in playback
anderbytes 140 Posted July 20, 2016 Author Posted July 20, 2016 (edited) In short: When I have pt-BR instead of pob external subtitle file, when I go to play something there are no subtitles playing in default. I have to manually select it Edited July 20, 2016 by anderbytes
anderbytes 140 Posted July 21, 2016 Author Posted July 21, 2016 (edited) @@Luke, @@ebr, Just did some more tests... and I guarantee that it's not working as it should. Downloaded subtitles: fr.srt (French) , por.srt (Portuguese Portugal), pt-BR.srt (mine, for Brazil) and created a copy of the last one with pt-br.srt extension (for testing case sensitivity). Now look how strange Emby has chosen the default playback subtitle "Marked with symbol of CHECK" for different scenarios in the attached files. The name of the attached jpeg file indicates what external subs were at the folder while that test and were refreshed in the movie. Also, the items below that are in bold point which files were in folder, too. #################################################################################################################### fr - pob - por - pt-br - pt-BR "pob" brought correctly... So as I understood, the 1st column of iso6932.txt is a top priority. Good. fr - POB - por - pt-br - pt-BR changed "pob" to "POB", and that alone messed up with Emby. For some bizzarre reason he gave me FR as the default playback subtitle. Bad case sensivity! Bad! fr - por - pt-br - pt-BR He chose to give me "por", which is wrong, even more because there are pt-br and pt-BR in the folder! fr - pt-br - pt-BR Erased "por" and now he correctly brought me "pt-br". I can tell because it appears "Ptbr" and not "PtBR". pt-br Removing "fr"and leaving "pt-br" alone in the folder messes up with Emby that before in test above had recognized correctly that subtitle file as default. He choses no subtitle, and "Off" is chosen by default. pt-BR Same as above pob Now this works... "pob" alone in folder works OK POB Same as above. #################################################################################################################### What I see is: Emby choses differently depending on some weird conditions that I haven't learned the pattern yet. Edited July 21, 2016 by anderbytes
anderbytes 140 Posted July 21, 2016 Author Posted July 21, 2016 (edited) Stuff has just got weirder! I just remembered that @@Luke coded something in the past to "remember" last used or most used languages , the more the user playbacks and chooses... Well, whether I change the subtitles within playback, next playback default subtitle changes. With the scenarios where a lot of subtitle are available, we have to learn if is it wrong or not... BUT, in the scenarios where pt-BR or pt-br are alone... should work whatever, and they don't, as described in the last post. Edited July 21, 2016 by anderbytes
anderbytes 140 Posted July 21, 2016 Author Posted July 21, 2016 Ok, I'm adding a fix, thanks. Tnx. Looking forward to it.
anderbytes 140 Posted July 22, 2016 Author Posted July 22, 2016 (edited) Ok, I'm adding a fix, thanks. Now that I use Docker, I could create a Beta envinronment, and I'm happy to report that the issue is 90% gone. I still couldn't re-do all those test scenarios just like before with this Beta... but I can state these, for now: #1 -> Alone pt-BR in folder now is recognized correctly... for some reason it shows itself as "pob" in Media Details and Subtitles list in Playback (even if there no "pob" in folder). But that's the least of the problems!! :-) #2 -> When some other languages were in the folder and "por" was included, he incorrectly chose default as "por" (that is related to pt-PT) over "pt-BR" or "pt-br" . This shouldn't happen. If I see anything in the new code that explains this... I'll gladly point it. Maybe he is getting "pt" from "pt-BR" and deciding it only with that? If yes... wrong behaviour. ------------ Complemeting #1 above, about the language name shown in "Media Details" and Playback subtitles options, today it shows the [1] (first field) of iso6392.txt, but actually it had to show the [3] (third field) , example: English, Portuguese (Brazil), French, German, Portuguese (Portugal), etc... OR EVEN BETTER : There could be a [5] (fifth field) where it stores how is the language called in it's own language. So the before would be: English, Português (Brasil), Français, Portugais (Portugal), etc...etc... to be shown in playback subtitles list and Media Details. That would be neat! Thanks!!! Edited July 22, 2016 by anderbytes 1
anderbytes 140 Posted July 22, 2016 Author Posted July 22, 2016 (edited) Thanks for confirming. Now it's time for some jaw-dropping :D . In this latest Beta.... I believe he's now using ALPHABETICAL ORDER to choose the default subtitle to start playback! Look at this sequence of tests using BETA (each time deleting the chosen one in the previous test), see if you recognize Emby's chosing pattern.... #################################################################################################################### en - eng - fr - pob - por - pt-br - pt-BR => chosen: en eng - fr - pob - por - pt-br - pt-BR => chosen: eng fr - pob - por - pt-br - pt-BR => chosen: fr pob - por - pt-br - pt-BR => chosen: pob (can tell the difference because I put text -pob- inside this subtitle file, to tell them apart) - Blue here... but it was alphabetical luck por - pt-br - pt-BR => chosen: por pt-br - pt-BR => chosen: pt-br (can tell the difference because I put text -pt-br- inside this subtitle file, to tell them apart) pt-BR => chosen: pt-BR (yay! no more "Off" like the reported yesterday) #################################################################################################################### I'll be taking a closer look at the code... use my time today to try to find what could be done in the code. See ya Edited July 22, 2016 by anderbytes
Luke 38980 Posted July 22, 2016 Posted July 22, 2016 The display order in the menu doesn't matter. For external subtitles, that's just going to be the order of the file names.
anderbytes 140 Posted July 22, 2016 Author Posted July 22, 2016 (edited) The display order in the menu doesn't matter. For external subtitles, that's just going to be the order of the file names. If it were only the display order in list... there would be no problem. What I'm saying IS: the default subtitle played at start of playback is alwas the first in alphabetical order, if we have more than 1 subtitle in folder. Edited July 22, 2016 by anderbytes
anderbytes 140 Posted July 22, 2016 Author Posted July 22, 2016 (edited) I could just use ONE subtitle for each movie... but I'm trying to help free Emby of nasty bugs like this one. Ignoring it is not an option for me. and more...showing the "3 letter" in Subtitle List is also unpleasant... showing the readable name ( [3] in iso6392.txt ) is way more beautiful, you just have to create another private variable in CultureDto object for it... fill it along the other when they are filled... and use it at the right moment. ps: can you imagine Netflix showing 3-letter options for audio and subtitles options? Edited July 22, 2016 by anderbytes
Luke 38980 Posted July 22, 2016 Posted July 22, 2016 What I'm saying IS: the default subtitle played at start of playback is alwas the first in alphabetical order, if we have more than 1 subtitle in folder. Not necessarily. If they have different characteristics such as default/forced flags, then that will affect which one is chosen. If all three have the same characteristics, then yes, the first one is chosen. Sorry but this isn't a bug. It just so happens you want the second one to be chosen, but if they're all pt-BR or pob then they're all the same.
Luke 38980 Posted July 22, 2016 Posted July 22, 2016 and more...showing the "3 letter" in Subtitle List is also unpleasant... showing the readable name ( [3] in iso6392.txt ) is way more beautiful, you just have to create another private variable in CultureDto object for it... fill it along the other when they are filled... and use it at the right moment. ps: can you imagine Netflix showing 3-letter options for audio and subtitles options? Yes, this we can definitely improve on.
anderbytes 140 Posted July 22, 2016 Author Posted July 22, 2016 Not necessarily. If they have different characteristics such as default/forced flags, then that will affect which one is chosen. If all three have the same characteristics, then yes, the first one is chosen. Sorry but this isn't a bug. It just so happens you want the second one to be chosen, but if they're all pt-BR or pob then they're all the same. C'mon Luke... I took some time to do those tests above, please read carefully, and understand that they're not all pob and pt-BR. - I have nothing "default" or "forced", don't like those concepts. - at first the folder had "en" , "eng" , "fr" , "pob" , "por" , "pt-br" , "pt-BR" and he ALWAYS ended up chosing the first of them alphabetically.. no matter my preferred language in settings. - If I re-do all the tests only using "en" , "fr" and "pt-BR" , you'll see that he'l choose "en", because "e" comes first.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now