Skip to content

Commit

Permalink
Fix for #31
Browse files Browse the repository at this point in the history
- Closes #31
- Subtitles will now show proper language names instead of 'en', 'es', etc.
  • Loading branch information
Xonshiz committed Jun 7, 2021
1 parent 969681f commit e769dcc
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 5 deletions.
4 changes: 3 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@
- Fixed #27
- Added support to download subtitles of "movies".
- Fix for #29 and #28
- Fix for #25
- Fix for #25
- Fix for #31
- Subtitles will now show proper language names instead of 'en', 'es', etc.
4 changes: 3 additions & 1 deletion docs/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@
- Fixed #27
- Added support to download subtitles of "movies".
- Fix for #29 and #28
- Fix for #25
- Fix for #25
- Fix for #31
- Subtitles will now show proper language names instead of 'en', 'es', etc.
2 changes: 1 addition & 1 deletion hulusubs_dl/__version__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

__version__ = "2021.06.05"
__version__ = "2021.06.07"
9 changes: 9 additions & 0 deletions hulusubs_dl/cust_utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,12 @@ def get_clean_path_name(path_name):
for cha in '\/*?:"<>|,;\'':
path_name = path_name.replace(cha, ' -')
return path_name


def get_language_name(lang_code):
lang_dict = {
'en': 'English',
'es': 'Spanish',
'jp': 'Japanese'
}
return lang_dict.get(lang_code, lang_code)
6 changes: 4 additions & 2 deletions hulusubs_dl/hulu.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,12 @@ def episode_link(self, url, cookie_value, language, extension, download_location
logging.debug('\n----\nvideo_metadata: {0}\n----\n'.format(video_metadata))
video_metadata = dict(list(video_metadata)[0])
series_name = utils.get_clean_path_name(video_metadata.get('series_name', video_metadata.get("name", "No Name Found")))
is_movie = True if video_metadata.get('_type', None) == "movie" else False
season_number = video_metadata.get('season', "01")
episode_number = video_metadata.get('number', "01")
file_name = '{0} - S{1}E{2} [{3} Sub].{4}'.format(series_name, season_number, episode_number,
language, extension)
file_name = '{0} - S{1}E{2} [{3} Sub].{4}'.format(series_name, season_number, episode_number, utils.get_language_name(language), extension)
if is_movie:
file_name = '{0} [{1} Sub].{2}'.format(series_name, utils.get_language_name(language), extension)
logging.debug('\n----\nfile_name: {0}\n----\n'.format(file_name))
print("Downloading Subtitle For {0}".format(file_name))
selected_extension = transcript_urls.get(extension, None)
Expand Down

0 comments on commit e769dcc

Please sign in to comment.