From ea8a06149f1753a00121fd0b54a83b66887fb44d Mon Sep 17 00:00:00 2001 From: Courville Software Date: Sat, 17 Aug 2024 14:56:40 +0200 Subject: [PATCH] Rationalize tmdb and opensubtitles Chinese languages See https://github.com/nova-video-player/aos-AVP/issues/1129 See https://github.com/nova-video-player/aos-AVP/issues/1228 --- res/values/strings.xml | 5 ++++- .../video/utils/VideoPreferencesCommon.java | 19 +++++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 3cef34f5..3fb5c567 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -378,6 +378,10 @@ Chinese Simplified Chinese Traditional Chinese + Chinese bilingual + Chinese (Mainland China) + Chinese (Hong Kong) + Chinese (Taiwan) Spanish (LA) Extremaduran Montenegrin @@ -388,7 +392,6 @@ Santali Syriac Toki Pona - Chinese bilingual None diff --git a/src/main/java/com/archos/mediacenter/video/utils/VideoPreferencesCommon.java b/src/main/java/com/archos/mediacenter/video/utils/VideoPreferencesCommon.java index 21217124..e415aa4a 100644 --- a/src/main/java/com/archos/mediacenter/video/utils/VideoPreferencesCommon.java +++ b/src/main/java/com/archos/mediacenter/video/utils/VideoPreferencesCommon.java @@ -96,14 +96,29 @@ public class VideoPreferencesCommon implements OnSharedPreferenceChangeListener // update with: `curl --request GET --url https://api.opensubtitles.com/api/v1/infos/languages | jq -r '.data[].language_code' | sort -u | gpaste -sd "|"` // list exceptions via `| grep -E '.{3,}' | gpaste -sd "|"` "zh-cn|pt-pt|pt-br|zh-tw" - private static final String OPENSUBTITLES_LANGUAGES = "ab|af|an|ar|as|at|az|be|bg|bn|br|bs|ca|cs|cy|da|de|ea|el|en|eo|es|et|eu|ex|fa|fi|fr|ga|gd|gl|he|hi|hr|hu|hy|ia|id|ig|is|it|ja|ka|kk|km|kn|ko|ku|lb|lt|lv|ma|me|mk|ml|mn|mr|ms|my|ne|nl|no|nv|oc|or|pl|pm|pr|ps|pt-br|pt-pt|ro|ru|sd|se|si|sk|sl|so|sp|sq|sr|sv|sw|sx|sy|ta|te|th|tk|tl|tp|tr|tt|uk|ur|uz|vi|ze|zh-cn|zh-tw"; + private static final String OPENSUBTITLES_LANGUAGES = "ab|af|an|ar|as|at|az|be|bg|bn|br|bs|ca|cs|cy|da|de|ea|el|en|eo|es|et|eu|ex|fa|fi|fr|ga|gd|gl|he|hi|hr|hu|hy|ia|id|ig|is|it|ja|ka|kk|km|kn|ko|ku|lb|lt|lv|ma|me|mk|ml|mn|mr|ms|my|ne|nl|no|nv|oc|or|pl|pm|pr|ps|pt-br|pt-pt|ro|ru|sd|se|si|sk|sl|so|sp|sq|sr|sv|sw|sx|sy|ta|te|th|tk|tl|tp|tr|tt|uk|ur|uz|vi|ze|zh-cn|zh-tw|zh-ca"; // see https://developer.themoviedb.org/docs/languages // curl --request GET --url 'https://api.themoviedb.org/3/configuration/languages?api_key=APIKEY' | jq '.[] | .iso_639_1' | sed 's/"\([^"]*\)"/\1/g' | grep -v mo | grep -v xx | sort -u | paste -sd "|" - // to do after: add manually pt-br and substitute cn=zh-tw and zh=zh-cn // zh = Mandarin -> Chinese Simplified (zh-cn) or Chinese // cn = Cantonese -> Chinese Traditional (zh-tw) - public final static String TMDB_LANGUAGES = "aa|ab|ae|af|ak|am|an|ar|as|av|ay|az|ba|be|bg|bi|bm|bn|bo|br|bs|ca|ce|ch|zh-tw|co|cr|cs|cu|cv|cy|da|de|dv|dz|ee|el|en|eo|es|et|eu|fa|ff|fi|fj|fo|fr|fy|ga|gd|gl|gn|gu|gv|ha|he|hi|ho|hr|ht|hu|hy|hz|ia|id|ie|ig|ii|ik|io|is|it|iu|ja|jv|ka|kg|ki|kj|kk|kl|km|kn|ko|kr|ks|ku|kv|kw|ky|la|lb|lg|li|ln|lo|lt|lu|lv|mg|mh|mi|mk|ml|mn|mr|ms|mt|my|na|nb|nd|ne|ng|nl|nn|no|nr|nv|ny|oc|oj|om|or|os|pa|pi|pl|ps|pt|pt-br|qu|rm|rn|ro|ru|rw|sa|sc|sd|se|sg|sh|si|sk|sl|sm|sn|so|sq|sr|ss|st|su|sv|sw|ta|te|tg|th|ti|tk|tl|tn|to|tr|ts|tt|tw|ty|ug|uk|ur|uz|ve|vi|vo|wa|wo|xh|yi|yo|za|zh-cn|zu"; + public final static String TMDB_LANGUAGES = "aa|ab|ae|af|ak|am|an|ar|as|av|ay|az|ba|be|bg|bi|bm|bn|bo|br|bs|ca|ce|ch|zh-tw|co|cr|cs|cu|cv|cy|da|de|dv|dz|ee|el|en|eo|es|et|eu|fa|ff|fi|fj|fo|fr|fy|ga|gd|gl|gn|gu|gv|ha|he|hi|ho|hr|ht|hu|hy|hz|ia|id|ie|ig|ii|ik|io|is|it|iu|ja|jv|ka|kg|ki|kj|kk|kl|km|kn|ko|kr|ks|ku|kv|kw|ky|la|lb|lg|li|ln|lo|lt|lu|lv|mg|mh|mi|mk|ml|mn|mr|ms|mt|my|na|nb|nd|ne|ng|nl|nn|no|nr|nv|ny|oc|oj|om|or|os|pa|pi|pl|ps|pt|pt-br|qu|rm|rn|ro|ru|rw|sa|sc|sd|se|sg|sh|si|sk|sl|sm|sn|so|sq|sr|ss|st|su|sv|sw|ta|te|tg|th|ti|tk|tl|tn|to|tr|ts|tt|tw|ty|ug|uk|ur|uz|ve|vi|vo|wa|wo|xh|yi|yo|za|zh-cn|zh-hk|zu"; + + // basic Chinese howto + // zh-cn Chinese (Mainland China): Mandarin (mostly in Simplified charset) + // zh-tw Chinese (Taiwan): Min (mostly in Traditional charset) + // zh-hk Chinese (Hong Kong): Cantonese + // Character set = Simplified or Traditional + // opensubtitles + // zh-ca = Chinese (Cantonese) -> zh-hk Chinese (Hong Kong), + // zh-cn = Chinese (simplified) -> zh-cn Chinese (Mainland China), + // zh-tw = Chinese (traditional) -> zh-tw Chinese (Taiwan) + // ze = Chinese bilingual -> Chinese Cantonese + English + // tmdb (proposed by Yu) + // do not use zh Mandarin = zh-cn, Chinese (Mainland China) + // do not use cn Cantonese = zh-hk, Chinese (Hong Kong) + // add zh-tw, Chinese (Taiwan) // should we provide adaptive refresh rate for all (not only on TV) private static final boolean REFRESHRATE_FORALL = true;