-
Notifications
You must be signed in to change notification settings - Fork 10
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
Added Language Module #1
Open
Entree3k
wants to merge
44
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
44 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 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 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 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-eg
files?