-
Notifications
You must be signed in to change notification settings - Fork 11
Added Language Module #1
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
Open
Entree3k
wants to merge
105
commits into
x1ao4:main
Choose a base branch
from
Entree3k:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
105 commits
Select commit
Hold shift + click to select a range
1a05d51
Added Language.py
Entree3k 99b073b
Added Languge.py
Entree3k ed37659
Update Language.py
Entree3k 3a65a5b
Update README.md
Entree3k beb658f
Update Language.py
Entree3k 9076dd6
Delete Dockerfile
Entree3k 0c29a70
Delete start.sh
Entree3k 2f70487
Delete template directory
Entree3k 0daf80a
Delete edition-manager-for-plex.py
Entree3k 5ab0028
Delete emp-all.bat
Entree3k af287e5
Delete emp-all.command
Entree3k 11ce251
Delete emp-new.command
Entree3k 074777f
Delete emp-reset.bat
Entree3k ef1b026
Delete emp-new.bat
Entree3k e85ab70
Delete emp-reset.command
Entree3k fae57b8
Delete requirements.txt
Entree3k 15e049d
Delete modules/AudioCodec.py
Entree3k 5d6712a
Delete modules directory
Entree3k 4108f2d
Update config.ini
Entree3k 4046817
Add files via upload
Entree3k 8031fce
Rename edition-manager-for-plex.py to edition-manager.py
Entree3k 79e674f
Create dockerfile
Entree3k fe0b495
Rename dockerfile to Dockerfile
Entree3k 870526a
Delete compose/edition-manager-for-plex-reset directory
Entree3k 57a3c80
Delete compose/edition-manager-for-plex directory
Entree3k a1f468d
Create compose.yml
Entree3k 9820efa
Update compose.yml
Entree3k d30a0fb
Update Dockerfile
Entree3k 1d1cabf
Add files via upload
Entree3k 8367628
Update edition-manager.py
Entree3k 036f948
Update edition-manager.py
Entree3k ae34bdf
Update config.ini
Entree3k f0005bb
Update compose.yml
Entree3k 73cd891
Update Dockerfile
Entree3k fa966e7
Update README.md
Entree3k a47c5e4
Update README.md
Entree3k 8e8da77
Update README.md
Entree3k c8cde95
Update README.md
Entree3k 3e9b9e5
Update edition-manager.py
Entree3k 58aa1bd
Added new modules
Entree3k 0449c18
Update README.md
Entree3k 23a7212
Update README.md
Entree3k 9726480
Update README.md
Entree3k 747a823
Add files via upload
Entree3k 41b347e
Update config.ini
Entree3k 57a393c
Update edition-manager-gui.py
Entree3k 36c15d7
Update requirements.txt
Entree3k 439f1c7
Update edition-manager.py
Entree3k 97689da
Update edition-manager.py
Entree3k 9a1f08c
Update Language.py
Entree3k 1727a78
Create Edition Manager Modules.md
Entree3k 9aa5130
Update README.md
Entree3k 1c791c4
Update README.md
Entree3k c254d09
Add files via upload
Entree3k fcc9c67
Update requirements.txt
Entree3k 59c397a
Removed - cache_ttl
Entree3k 3a4d7d5
Update edition-manager-gui.py
Entree3k e482ed9
Create Edition Manager GUI.md
Entree3k ee02eb5
Update README.md
Entree3k 1448920
Add files via upload
Entree3k 2c4692f
Add files via upload
Entree3k e027243
Update Edition Manager GUI.md
Entree3k 94f5dc6
Update README.md
Entree3k 6cc159d
Update README.md
Entree3k e3bfa28
Update README.md
Entree3k 5bd3f98
Delete compose.yml
Entree3k de914fe
Delete Dockerfile
Entree3k db95061
Delete edition-manager-gui.bat
Entree3k de6072b
Add files via upload
Entree3k c9fb9fd
Update config.ini
Entree3k f06daa1
Update README.md
Entree3k 1f8a022
Add files via upload
Entree3k e0d2edc
Add files via upload
Entree3k 162061e
Add files via upload
Entree3k 0185228
Update README.md
Entree3k e95adf3
Update README.md
Entree3k 8f866d9
Add files via upload
Entree3k 3b9701c
Add files via upload
Entree3k 1853af4
Add files via upload
Entree3k 54f62f8
Update Edition Manager Modules.md
Entree3k 3c6b762
Update Edition Manager GUI.md
Entree3k c1ca91d
Update README.md
Entree3k b8eceac
Update README.md
Entree3k fe352e3
Add files via upload
Entree3k 7778fb0
Delete edition-manager-gui.py
Entree3k a428856
Delete edition-manager-gui.sh
Entree3k 80159ed
Delete edition-manager-gui.pyw
Entree3k 5bdde21
Delete edition-manager.py
Entree3k ed8b970
Update config.ini
Entree3k cbc27e0
Add files via upload
Entree3k 69a00c8
Create file_delete.txt
Entree3k aa9d0d8
Add files via upload
Entree3k b36f75b
Delete assets/file_delete.txt
Entree3k ff715ed
Update messages.txt
Entree3k c40c316
Add files via upload
Entree3k 8bf5c70
Update messages.txt
Entree3k ec04e06
Update README.md
Entree3k c633a72
Add files via upload
Entree3k 19c9275
Add files via upload
Entree3k d19f630
Update README.md
Entree3k dfefd57
Update Edition Manager GUI.md
Entree3k e7f5acb
Fixed issue where it wasn't reading from config
Entree3k 1a1d2f6
Added short code patterns for Cut editions
Entree3k c6f88bd
Update config.ini
Entree3k 36d7c9b
Add files via upload
Entree3k File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,139 @@ | ||
| import requests | ||
|
|
||
| def get_Language(server, token, movie_id): | ||
| headers = {'X-Plex-Token': token, 'Accept': 'application/json'} | ||
| response = requests.get(f'{server}/library/metadata/{movie_id}', headers=headers) | ||
| data = response.json() | ||
|
|
||
| media = data['MediaContainer']['Metadata'][0]['Media'][0]['Part'][0] | ||
| if 'Stream' in media: | ||
| audio_streams = [stream for stream in media['Stream'] if stream['streamType'] == 2] | ||
|
|
||
| # Skip processing if there are multiple audio tracks | ||
| if len(audio_streams) > 1: | ||
| return None | ||
|
|
||
| # Mapping of common language codes to full names in alphabetical order | ||
| language_mapping = { | ||
| 'af': 'Afrikaans', | ||
| 'am': 'Amharic', | ||
| 'ar': 'Arabic', | ||
| 'as': 'Assamese', | ||
| 'ay': 'Aymara', | ||
| 'az': 'Azerbaijani', | ||
| 'bh': 'Bihari', | ||
| 'bi': 'Bislama', | ||
| 'bn': 'Bengali', | ||
| 'bo': 'Tibetan', | ||
| 'bs': 'Bosnian', | ||
| 'bg': 'Bulgarian', | ||
| 'ca': 'Catalan', | ||
| 'cs': 'Czech', | ||
| 'cy': 'Welsh', | ||
| 'da': 'Danish', | ||
| 'de': 'German', | ||
| 'dz': 'Dzongkha', | ||
| 'el': 'Greek', | ||
| 'en': 'English', | ||
| 'es': 'Spanish', | ||
| 'et': 'Estonian', | ||
| 'eu': 'Basque', | ||
| 'fa': 'Persian', | ||
| 'fi': 'Finnish', | ||
| 'fj': 'Fijian', | ||
| 'fr': 'French', | ||
| 'ga': 'Irish', | ||
| 'gu': 'Gujarati', | ||
| 'he': 'Hebrew', | ||
| 'hi': 'Hindi', | ||
| 'hr': 'Croatian', | ||
| 'hu': 'Hungarian', | ||
| 'hy': 'Armenian', | ||
| 'id': 'Indonesian', | ||
| 'ig': 'Igbo', | ||
| 'is': 'Icelandic', | ||
| 'it': 'Italian', | ||
| 'iu': 'Inuktitut', | ||
| 'ja': 'Japanese', | ||
| 'jv': 'Javanese', | ||
| 'ka': 'Georgian', | ||
| 'kk': 'Kazakh', | ||
| 'km': 'Khmer', | ||
| 'kn': 'Kannada', | ||
| 'ko': 'Korean', | ||
| 'ks': 'Kashmiri', | ||
| 'ky': 'Kyrgyz', | ||
| 'lo': 'Lao', | ||
| 'lt': 'Lithuanian', | ||
| 'lv': 'Latvian', | ||
| 'mg': 'Malagasy', | ||
| 'mi': 'Maori', | ||
| 'mk': 'Macedonian', | ||
| 'ml': 'Malayalam', | ||
| 'mn': 'Mongolian', | ||
| 'mr': 'Marathi', | ||
| 'ms': 'Malay', | ||
| 'mt': 'Maltese', | ||
| 'my': 'Burmese', | ||
| 'ne': 'Nepali', | ||
| 'nl': 'Dutch', | ||
| 'no': 'Norwegian', | ||
| 'ny': 'Chichewa', | ||
| 'oj': 'Ojibwe', | ||
| 'om': 'Oromo', | ||
| 'or': 'Odia', | ||
| 'pa': 'Punjabi', | ||
| 'pl': 'Polish', | ||
| 'pt': 'Portuguese', | ||
| 'qu': 'Quechua', | ||
| 'ro': 'Romanian', | ||
| 'ru': 'Russian', | ||
| 'rw': 'Kinyarwanda', | ||
| 'si': 'Sinhala', | ||
| 'sk': 'Slovak', | ||
| 'sl': 'Slovenian', | ||
| 'sm': 'Samoan', | ||
| 'so': 'Somali', | ||
| 'sq': 'Albanian', | ||
| 'sr': 'Serbian', | ||
| 'ss': 'Swati', | ||
| 'st': 'Sotho', | ||
| 'su': 'Sundanese', | ||
| 'sv': 'Swedish', | ||
| 'sw': 'Swahili', | ||
| 'ta': 'Tamil', | ||
| 'te': 'Telugu', | ||
| 'th': 'Thai', | ||
| 'ti': 'Tigrinya', | ||
| 'tl': 'Tagalog', | ||
| 'tn': 'Tswana', | ||
| 'to': 'Tonga', | ||
| 'tr': 'Turkish', | ||
| 'ts': 'Tsonga', | ||
| 'tt': 'Tatar', | ||
| 'uk': 'Ukrainian', | ||
| 'ur': 'Urdu', | ||
| 'uz': 'Uzbek', | ||
| 've': 'Venda', | ||
| 'vi': 'Vietnamese', | ||
| 'xh': 'Xhosa', | ||
| 'yo': 'Yoruba', | ||
| 'zh': 'Chinese', | ||
| 'zu': 'Zulu', | ||
| 'nv': 'Navajo', | ||
| 'cr': 'Cree', | ||
| 'mh': 'Marshallese', | ||
| 'ho': 'Hiri Motu', | ||
| 'hz': 'Herero', | ||
| 'ty': 'Tahitian', | ||
| 'to': 'Tonga', | ||
| } | ||
|
|
||
| # Proceed only if there is a single audio track | ||
| if len(audio_streams) == 1: | ||
| language_code = audio_streams[0].get('language') | ||
| if language_code: | ||
| language = language_mapping.get(language_code, language_code) | ||
| return language | ||
|
|
||
| return None | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be possible to extend this to also support language tags?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like mi, en, da, etc? or what tag format?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also referred to as
locales. Here's another reference.Personally example much of my library includes Arabic that's either dubbed into both classical/modern standard arabic (
ar) or egyptian arabic (ar-eg).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another thing that will need to be updated along with this is the main README
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My languages are based on language codes you would find in mkvtoolnix to define audio tracks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. So would I be using this designation going forward for any
ar-egfiles?