Skip to content

Commit

Permalink
Merge pull request #740 from anxdpanic/pr
Browse files Browse the repository at this point in the history
6.7.0~alpha1
  • Loading branch information
anxdpanic authored Feb 26, 2020
2 parents 7257751 + 3174e11 commit 63e35e7
Show file tree
Hide file tree
Showing 34 changed files with 246 additions and 82 deletions.
23 changes: 8 additions & 15 deletions addon.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.youtube" name="YouTube" version="6.6.0" provider-name="anxdpanic, bromix">
<addon id="plugin.video.youtube" name="YouTube" version="6.7.0~alpha1" provider-name="anxdpanic, bromix">
<requires>
<import addon="xbmc.python" version="2.20.0"/>
<import addon="script.module.six" version="1.11.0"/>
Expand All @@ -13,20 +13,13 @@
<extension point="xbmc.python.module" library="resources/lib/"/>
<extension point="xbmc.addon.metadata">
<news>
[add] 'Play (Ask for quality)' context menu
[add] search by channel or playlist id
[add] hide_folders, hide_playlists, hide_search, and hide_live to /channel/&lt;channel_id&gt;/ end-point
- ie. plugin://plugin.video.youtube/channel/UC4PooiX37Pld1T8J5SYT-SQ/?hide_folders=true will hide all folders(Playlists, Search, and Live) in the channel listing
[fix] playback for some videos (ie. music videos)
[fix] playback of some videos with no adaptive video streams
[fix] don't update watch history when incognito/screensaver/live |contrib: regseb|
[fix] search prompting for input after video playback or refresh
[lang] el_gr strings |contrib: twilight0|
[lang] es_es strings |contrib: roliverosc|
[lang] pt_br strings |contrib: MediaBrasil|
[lang] cs_cz strings |contrib: llzn.cz|
[lang] it_it strings |contrib: SebastianoPistore|
[lang] de_de strings |contrib: tweimer|
[add] send PlaybackStarted notification containing video_id of the playing video
[fix] allow playback regardless of API status
- fixes playback for strm, playlists, other add-ons, and sharing videos from devices
[fix] fix possible loop due to invalid keys and login information
[fix] fix playback of mpeg-dash streams if HTTP Server - Listen on IP is blank
[upd] use a dialog to notify users of API key requirements with link to wiki
- https://ytaddon.page.link/keys
</news>
<assets>
<icon>icon.png</icon>
Expand Down
9 changes: 9 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
6.7.0
[add] send PlaybackStarted notification containing video_id of the playing video
[fix] allow playback regardless of API status
- fixes playback for strm, playlists, other add-ons, and sharing videos from devices
[fix] fix possible loop due to invalid keys and login information
[fix] fix playback of mpeg-dash streams if HTTP Server - Listen on IP is blank
[upd] use a dialog to notify users of API key requirements with link to wiki
- https://ytaddon.page.link/keys

6.6.0
[add] 'Play (Ask for quality)' context menu
[add] search by channel or playlist id
Expand Down
4 changes: 4 additions & 0 deletions resources/language/resource.language.bg_bg/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -1189,3 +1189,7 @@ msgstr ""
msgctxt "#30730"
msgid "Play (Ask for quality)"
msgstr ""

msgctxt "#30731"
msgid "The YouTube add-on now requires that you use your own API keys.[CR]For more information see the wiki: [B]https://ytaddon.page.link/keys[/B][CR][CR]Sorry for the inconvenience."
msgstr ""
4 changes: 4 additions & 0 deletions resources/language/resource.language.cs_cz/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -1206,3 +1206,7 @@ msgstr ""
msgctxt "#30730"
msgid "Play (Ask for quality)"
msgstr ""

msgctxt "#30731"
msgid "The YouTube add-on now requires that you use your own API keys.[CR]For more information see the wiki: [B]https://ytaddon.page.link/keys[/B][CR][CR]Sorry for the inconvenience."
msgstr ""
4 changes: 4 additions & 0 deletions resources/language/resource.language.de_de/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -1206,3 +1206,7 @@ msgstr "Fernbedienungsfreundliche Suche"
msgctxt "#30730"
msgid "Play (Ask for quality)"
msgstr "Abspielen (nach Qualität fragen)"

msgctxt "#30731"
msgid "The YouTube add-on now requires that you use your own API keys.[CR]For more information see the wiki: [B]https://ytaddon.page.link/keys[/B][CR][CR]Sorry for the inconvenience."
msgstr ""
4 changes: 4 additions & 0 deletions resources/language/resource.language.el_gr/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -1205,3 +1205,7 @@ msgstr "Αναζήτηση φιλική για χειριστήριο"
msgctxt "#30730"
msgid "Play (Ask for quality)"
msgstr "Αναπαραγωγή (Ερώτηση για ποιότητα)"

msgctxt "#30731"
msgid "The YouTube add-on now requires that you use your own API keys.[CR]For more information see the wiki: [B]https://ytaddon.page.link/keys[/B][CR][CR]Sorry for the inconvenience."
msgstr ""
4 changes: 4 additions & 0 deletions resources/language/resource.language.en_gb/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -1206,3 +1206,7 @@ msgstr ""
msgctxt "#30730"
msgid "Play (Ask for quality)"
msgstr ""

msgctxt "#30731"
msgid "The YouTube add-on now requires that you use your own API keys.[CR]For more information see the wiki: [B]https://ytaddon.page.link/keys[/B][CR][CR]Sorry for the inconvenience."
msgstr ""
4 changes: 4 additions & 0 deletions resources/language/resource.language.en_us/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -1207,3 +1207,7 @@ msgstr ""
msgctxt "#30730"
msgid "Play (Ask for quality)"
msgstr ""

msgctxt "#30731"
msgid "The YouTube add-on now requires that you use your own API keys.[CR]For more information see the wiki: [B]https://ytaddon.page.link/keys[/B][CR][CR]Sorry for the inconvenience."
msgstr ""
4 changes: 4 additions & 0 deletions resources/language/resource.language.es_es/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -1206,3 +1206,7 @@ msgstr ""
msgctxt "#30730"
msgid "Play (Ask for quality)"
msgstr ""

msgctxt "#30731"
msgid "The YouTube add-on now requires that you use your own API keys.[CR]For more information see the wiki: [B]https://ytaddon.page.link/keys[/B][CR][CR]Sorry for the inconvenience."
msgstr ""
4 changes: 4 additions & 0 deletions resources/language/resource.language.es_mx/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -1206,3 +1206,7 @@ msgstr ""
msgctxt "#30730"
msgid "Play (Ask for quality)"
msgstr ""

msgctxt "#30731"
msgid "The YouTube add-on now requires that you use your own API keys.[CR]For more information see the wiki: [B]https://ytaddon.page.link/keys[/B][CR][CR]Sorry for the inconvenience."
msgstr ""
4 changes: 4 additions & 0 deletions resources/language/resource.language.fi_fi/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -1191,3 +1191,7 @@ msgstr ""
msgctxt "#30730"
msgid "Play (Ask for quality)"
msgstr ""

msgctxt "#30731"
msgid "The YouTube add-on now requires that you use your own API keys.[CR]For more information see the wiki: [B]https://ytaddon.page.link/keys[/B][CR][CR]Sorry for the inconvenience."
msgstr ""
4 changes: 4 additions & 0 deletions resources/language/resource.language.fr_fr/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -1192,3 +1192,7 @@ msgstr ""
msgctxt "#30730"
msgid "Play (Ask for quality)"
msgstr ""

msgctxt "#30731"
msgid "The YouTube add-on now requires that you use your own API keys.[CR]For more information see the wiki: [B]https://ytaddon.page.link/keys[/B][CR][CR]Sorry for the inconvenience."
msgstr ""
4 changes: 4 additions & 0 deletions resources/language/resource.language.he_il/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -1200,3 +1200,7 @@ msgstr ""
msgctxt "#30730"
msgid "Play (Ask for quality)"
msgstr ""

msgctxt "#30731"
msgid "The YouTube add-on now requires that you use your own API keys.[CR]For more information see the wiki: [B]https://ytaddon.page.link/keys[/B][CR][CR]Sorry for the inconvenience."
msgstr ""
4 changes: 4 additions & 0 deletions resources/language/resource.language.hu_hu/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -1188,3 +1188,7 @@ msgstr ""
msgctxt "#30730"
msgid "Play (Ask for quality)"
msgstr ""

msgctxt "#30731"
msgid "The YouTube add-on now requires that you use your own API keys.[CR]For more information see the wiki: [B]https://ytaddon.page.link/keys[/B][CR][CR]Sorry for the inconvenience."
msgstr ""
4 changes: 4 additions & 0 deletions resources/language/resource.language.it_it/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -1201,3 +1201,7 @@ msgstr ""
msgctxt "#30730"
msgid "Play (Ask for quality)"
msgstr ""

msgctxt "#30731"
msgid "The YouTube add-on now requires that you use your own API keys.[CR]For more information see the wiki: [B]https://ytaddon.page.link/keys[/B][CR][CR]Sorry for the inconvenience."
msgstr ""
4 changes: 4 additions & 0 deletions resources/language/resource.language.ko_kr/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -1189,3 +1189,7 @@ msgstr ""
msgctxt "#30730"
msgid "Play (Ask for quality)"
msgstr ""

msgctxt "#30731"
msgid "The YouTube add-on now requires that you use your own API keys.[CR]For more information see the wiki: [B]https://ytaddon.page.link/keys[/B][CR][CR]Sorry for the inconvenience."
msgstr ""
4 changes: 4 additions & 0 deletions resources/language/resource.language.nb_no/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -1206,3 +1206,7 @@ msgstr ""
msgctxt "#30730"
msgid "Play (Ask for quality)"
msgstr ""

msgctxt "#30731"
msgid "The YouTube add-on now requires that you use your own API keys.[CR]For more information see the wiki: [B]https://ytaddon.page.link/keys[/B][CR][CR]Sorry for the inconvenience."
msgstr ""
4 changes: 4 additions & 0 deletions resources/language/resource.language.nl_nl/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -1198,3 +1198,7 @@ msgstr ""
msgctxt "#30730"
msgid "Play (Ask for quality)"
msgstr ""

msgctxt "#30731"
msgid "The YouTube add-on now requires that you use your own API keys.[CR]For more information see the wiki: [B]https://ytaddon.page.link/keys[/B][CR][CR]Sorry for the inconvenience."
msgstr ""
4 changes: 4 additions & 0 deletions resources/language/resource.language.pl_pl/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -1188,3 +1188,7 @@ msgstr ""
msgctxt "#30730"
msgid "Play (Ask for quality)"
msgstr ""

msgctxt "#30731"
msgid "The YouTube add-on now requires that you use your own API keys.[CR]For more information see the wiki: [B]https://ytaddon.page.link/keys[/B][CR][CR]Sorry for the inconvenience."
msgstr ""
4 changes: 4 additions & 0 deletions resources/language/resource.language.pt_br/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -1187,3 +1187,7 @@ msgstr ""
msgctxt "#30730"
msgid "Play (Ask for quality)"
msgstr ""

msgctxt "#30731"
msgid "The YouTube add-on now requires that you use your own API keys.[CR]For more information see the wiki: [B]https://ytaddon.page.link/keys[/B][CR][CR]Sorry for the inconvenience."
msgstr ""
4 changes: 4 additions & 0 deletions resources/language/resource.language.pt_pt/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -1189,3 +1189,7 @@ msgstr ""
msgctxt "#30730"
msgid "Play (Ask for quality)"
msgstr ""

msgctxt "#30731"
msgid "The YouTube add-on now requires that you use your own API keys.[CR]For more information see the wiki: [B]https://ytaddon.page.link/keys[/B][CR][CR]Sorry for the inconvenience."
msgstr ""
4 changes: 4 additions & 0 deletions resources/language/resource.language.ro_ro/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -1189,3 +1189,7 @@ msgstr ""
msgctxt "#30730"
msgid "Play (Ask for quality)"
msgstr ""

msgctxt "#30731"
msgid "The YouTube add-on now requires that you use your own API keys.[CR]For more information see the wiki: [B]https://ytaddon.page.link/keys[/B][CR][CR]Sorry for the inconvenience."
msgstr ""
4 changes: 4 additions & 0 deletions resources/language/resource.language.ru_ru/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -1206,3 +1206,7 @@ msgstr ""
msgctxt "#30730"
msgid "Play (Ask for quality)"
msgstr ""

msgctxt "#30731"
msgid "The YouTube add-on now requires that you use your own API keys.[CR]For more information see the wiki: [B]https://ytaddon.page.link/keys[/B][CR][CR]Sorry for the inconvenience."
msgstr ""
4 changes: 4 additions & 0 deletions resources/language/resource.language.sk_sk/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -1189,3 +1189,7 @@ msgstr ""
msgctxt "#30730"
msgid "Play (Ask for quality)"
msgstr ""

msgctxt "#30731"
msgid "The YouTube add-on now requires that you use your own API keys.[CR]For more information see the wiki: [B]https://ytaddon.page.link/keys[/B][CR][CR]Sorry for the inconvenience."
msgstr ""
4 changes: 4 additions & 0 deletions resources/language/resource.language.tr_tr/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -1207,3 +1207,7 @@ msgstr ""
msgctxt "#30730"
msgid "Play (Ask for quality)"
msgstr ""

msgctxt "#30731"
msgid "The YouTube add-on now requires that you use your own API keys.[CR]For more information see the wiki: [B]https://ytaddon.page.link/keys[/B][CR][CR]Sorry for the inconvenience."
msgstr ""
4 changes: 4 additions & 0 deletions resources/language/resource.language.uk_ua/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -1189,3 +1189,7 @@ msgstr ""
msgctxt "#30730"
msgid "Play (Ask for quality)"
msgstr ""

msgctxt "#30731"
msgid "The YouTube add-on now requires that you use your own API keys.[CR]For more information see the wiki: [B]https://ytaddon.page.link/keys[/B][CR][CR]Sorry for the inconvenience."
msgstr ""
4 changes: 4 additions & 0 deletions resources/language/resource.language.zh_cn/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -1189,3 +1189,7 @@ msgstr ""
msgctxt "#30730"
msgid "Play (Ask for quality)"
msgstr ""

msgctxt "#30731"
msgid "The YouTube add-on now requires that you use your own API keys.[CR]For more information see the wiki: [B]https://ytaddon.page.link/keys[/B][CR][CR]Sorry for the inconvenience."
msgstr ""
4 changes: 4 additions & 0 deletions resources/language/resource.language.zh_tw/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -1204,3 +1204,7 @@ msgstr ""
msgctxt "#30730"
msgid "Play (Ask for quality)"
msgstr ""

msgctxt "#30731"
msgid "The YouTube add-on now requires that you use your own API keys.[CR]For more information see the wiki: [B]https://ytaddon.page.link/keys[/B][CR][CR]Sorry for the inconvenience."
msgstr ""
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,14 @@ def httpd_port(self):
return self.get_int(constants.setting.HTTPD_PORT, 50152)

def httpd_listen(self):
return self.get_string(constants.setting.HTTPD_LISTEN, '0.0.0.0')
ip_address = self.get_string(constants.setting.HTTPD_LISTEN, '0.0.0.0')
try:
ip_address = ip_address.strip()
except AttributeError:
pass
if not ip_address:
ip_address = '0.0.0.0'
return ip_address

def set_httpd_listen(self, value):
return self.set_string(constants.setting.HTTPD_LISTEN, value)
Expand Down
6 changes: 6 additions & 0 deletions resources/lib/youtube_plugin/kodion/utils/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,13 @@ def run(self):
plugin_play_path = 'plugin://plugin.video.youtube/play/'
video_id_param = 'video_id=%s' % self.video_id

notification_sent = False

while player.isPlaying() and not self.context.abort_requested() and not self.stopped():
if not notification_sent:
notification_sent = True
self.context.send_notification('PlaybackStarted', {'video_id': self.video_id})

last_total_time = self.total_time
last_current_time = self.current_time
last_segment_start = self.segment_start
Expand Down
36 changes: 27 additions & 9 deletions resources/lib/youtube_plugin/youtube/helper/resource_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
See LICENSES/GPL-2.0-only for more information.
"""

from ..youtube_exceptions import YouTubeException
from ...kodion.utils import FunctionCache, DataCache, strip_html_from_text


Expand Down Expand Up @@ -80,7 +81,7 @@ def _update_channels(self, channel_ids):

return result

def _update_videos(self, video_ids, live_details=False):
def _update_videos(self, video_ids, live_details=False, suppress_errors=False):
result = dict()
json_data = dict()
video_ids_to_update = list()
Expand Down Expand Up @@ -118,7 +119,7 @@ def _update_videos(self, video_ids, live_details=False):
for k in list(result.keys()):
result[k]['play_data'] = played_items.get(k, dict())

if self.handle_error(json_data):
if self.handle_error(json_data, suppress_errors) or suppress_errors:
return result

@staticmethod
Expand All @@ -130,12 +131,12 @@ def _make_list_of_50(list_of_ids):
pos += 50
return list_of_50

def get_videos(self, video_ids, live_details=False):
def get_videos(self, video_ids, live_details=False, suppress_errors=False):
list_of_50s = self._make_list_of_50(video_ids)

result = {}
for list_of_50 in list_of_50s:
result.update(self._update_videos(list_of_50, live_details))
result.update(self._update_videos(list_of_50, live_details, suppress_errors))
return result

def _update_playlists(self, playlists_ids):
Expand Down Expand Up @@ -225,18 +226,35 @@ def get_fanarts(self, channel_ids):

return result

def handle_error(self, json_data):
def handle_error(self, json_data, suppress_errors=False):
context = self._context
if json_data and 'error' in json_data:
ok_dialog = False
message_timeout = 5000
message = json_data['error'].get('message', '')
message = strip_html_from_text(message)
reason = json_data['error']['errors'][0].get('reason', '')
title = '%s: %s' % (context.get_name(), reason)
message_timeout = 5000
error_message = 'Error reason: |%s| with message: |%s|' % (reason, message)

context.log_error(error_message)

if reason == 'accessNotConfigured':
message = context.localize(30731)
ok_dialog = True

if reason == 'quotaExceeded' or reason == 'dailyLimitExceeded':
message_timeout = 7000
context.get_ui().show_notification(message, title, time_milliseconds=message_timeout)
error_message = 'Error reason: |%s| with message: |%s|' % (reason, message)
raise Exception(error_message)

if not suppress_errors:
if ok_dialog:
context.get_ui().on_ok(title, message)
else:
context.get_ui().show_notification(message, title,
time_milliseconds=message_timeout)

raise YouTubeException(error_message)

return False

return True
Loading

0 comments on commit 63e35e7

Please sign in to comment.