-
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
|
||||
Copyright (C) 2014-2016 bromix (plugin.video.youtube)
|
||||
Copyright (C) 2016-2025 plugin.video.youtube
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only
|
||||
See LICENSES/GPL-2.0-only for more information.
|
||||
"""
|
||||
+1584
File diff suppressed because it is too large
Load Diff
+1584
File diff suppressed because it is too large
Load Diff
+1584
File diff suppressed because it is too large
Load Diff
+1584
File diff suppressed because it is too large
Load Diff
+1584
File diff suppressed because it is too large
Load Diff
+1595
File diff suppressed because it is too large
Load Diff
+1780
File diff suppressed because it is too large
Load Diff
+1592
File diff suppressed because it is too large
Load Diff
+1594
File diff suppressed because it is too large
Load Diff
+2081
File diff suppressed because it is too large
Load Diff
+1584
File diff suppressed because it is too large
Load Diff
+2169
File diff suppressed because it is too large
Load Diff
+2244
File diff suppressed because it is too large
Load Diff
+2075
File diff suppressed because it is too large
Load Diff
+1584
File diff suppressed because it is too large
Load Diff
+1590
File diff suppressed because it is too large
Load Diff
+1584
File diff suppressed because it is too large
Load Diff
+1625
File diff suppressed because it is too large
Load Diff
+1642
File diff suppressed because it is too large
Load Diff
+1584
File diff suppressed because it is too large
Load Diff
+2402
File diff suppressed because it is too large
Load Diff
+2079
File diff suppressed because it is too large
Load Diff
+1584
File diff suppressed because it is too large
Load Diff
+1584
File diff suppressed because it is too large
Load Diff
+1584
File diff suppressed because it is too large
Load Diff
+1584
File diff suppressed because it is too large
Load Diff
+2225
File diff suppressed because it is too large
Load Diff
+1583
File diff suppressed because it is too large
Load Diff
+1584
File diff suppressed because it is too large
Load Diff
+1584
File diff suppressed because it is too large
Load Diff
+2116
File diff suppressed because it is too large
Load Diff
+1584
File diff suppressed because it is too large
Load Diff
+1583
File diff suppressed because it is too large
Load Diff
+1584
File diff suppressed because it is too large
Load Diff
+1583
File diff suppressed because it is too large
Load Diff
+1901
File diff suppressed because it is too large
Load Diff
+1584
File diff suppressed because it is too large
Load Diff
+2073
File diff suppressed because it is too large
Load Diff
+2062
File diff suppressed because it is too large
Load Diff
+1584
File diff suppressed because it is too large
Load Diff
+2073
File diff suppressed because it is too large
Load Diff
+1583
File diff suppressed because it is too large
Load Diff
+1584
File diff suppressed because it is too large
Load Diff
+2410
File diff suppressed because it is too large
Load Diff
+1584
File diff suppressed because it is too large
Load Diff
+1584
File diff suppressed because it is too large
Load Diff
+2166
File diff suppressed because it is too large
Load Diff
+1584
File diff suppressed because it is too large
Load Diff
+1584
File diff suppressed because it is too large
Load Diff
+1584
File diff suppressed because it is too large
Load Diff
+1584
File diff suppressed because it is too large
Load Diff
+1584
File diff suppressed because it is too large
Load Diff
+1584
File diff suppressed because it is too large
Load Diff
+1584
File diff suppressed because it is too large
Load Diff
+1584
File diff suppressed because it is too large
Load Diff
+1584
File diff suppressed because it is too large
Load Diff
+1845
File diff suppressed because it is too large
Load Diff
+2086
File diff suppressed because it is too large
Load Diff
+1583
File diff suppressed because it is too large
Load Diff
+1584
File diff suppressed because it is too large
Load Diff
+2246
File diff suppressed because it is too large
Load Diff
+1583
File diff suppressed because it is too large
Load Diff
+2147
File diff suppressed because it is too large
Load Diff
+2042
File diff suppressed because it is too large
Load Diff
+1825
File diff suppressed because it is too large
Load Diff
+2073
File diff suppressed because it is too large
Load Diff
+1584
File diff suppressed because it is too large
Load Diff
+2121
File diff suppressed because it is too large
Load Diff
+1584
File diff suppressed because it is too large
Load Diff
+1584
File diff suppressed because it is too large
Load Diff
+1584
File diff suppressed because it is too large
Load Diff
+1584
File diff suppressed because it is too large
Load Diff
+1729
File diff suppressed because it is too large
Load Diff
+1584
File diff suppressed because it is too large
Load Diff
+1584
File diff suppressed because it is too large
Load Diff
+1584
File diff suppressed because it is too large
Load Diff
+1584
File diff suppressed because it is too large
Load Diff
+1584
File diff suppressed because it is too large
Load Diff
+2089
File diff suppressed because it is too large
Load Diff
+1942
File diff suppressed because it is too large
Load Diff
+1584
File diff suppressed because it is too large
Load Diff
+1624
File diff suppressed because it is too large
Load Diff
+2089
File diff suppressed because it is too large
Load Diff
+2069
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
|
||||
Copyright (C) 2014-2016 bromix (plugin.video.youtube)
|
||||
Copyright (C) 2016-2025 plugin.video.youtube
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only
|
||||
See LICENSES/GPL-2.0-only for more information.
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import, division, unicode_literals
|
||||
|
||||
|
||||
__all__ = ('youtube_plugin',)
|
||||
@@ -0,0 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
|
||||
Copyright (C) 2014-2016 bromix (plugin.video.youtube)
|
||||
Copyright (C) 2016-2025 plugin.video.youtube
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only
|
||||
See LICENSES/GPL-2.0-only for more information.
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import, division, unicode_literals
|
||||
|
||||
from youtube_plugin.kodion import plugin_runner
|
||||
|
||||
|
||||
plugin_runner.run()
|
||||
@@ -0,0 +1,17 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
|
||||
Copyright (C) 2024-2025 plugin.video.youtube
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only
|
||||
See LICENSES/GPL-2.0-only for more information.
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import, division, unicode_literals
|
||||
|
||||
import sys
|
||||
|
||||
from youtube_plugin.kodion import script_actions
|
||||
|
||||
|
||||
script_actions.run(sys.argv)
|
||||
@@ -0,0 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
|
||||
Copyright (C) 2014-2016 bromix (plugin.video.youtube)
|
||||
Copyright (C) 2016-2025 plugin.video.youtube
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only
|
||||
See LICENSES/GPL-2.0-only for more information.
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import, division, unicode_literals
|
||||
|
||||
from youtube_plugin.kodion import service_runner
|
||||
|
||||
|
||||
service_runner.run()
|
||||
@@ -0,0 +1,149 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
|
||||
Copyright (C) 2018-2025 plugin.video.youtube
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only
|
||||
See LICENSES/GPL-2.0-only for more information.
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import, division, unicode_literals
|
||||
|
||||
from youtube_plugin.kodion import logging
|
||||
from youtube_plugin.kodion.constants import ADDON_ID
|
||||
from youtube_plugin.kodion.context import XbmcContext
|
||||
from youtube_plugin.youtube.helper import yt_login
|
||||
from youtube_plugin.youtube.provider import Provider
|
||||
from youtube_plugin.youtube.youtube_exceptions import LoginException
|
||||
|
||||
|
||||
__all__ = (
|
||||
'LoginException',
|
||||
'reset_access_tokens',
|
||||
'sign_in',
|
||||
'sign_out',
|
||||
)
|
||||
|
||||
|
||||
def _auth(addon_id, mode=yt_login.SIGN_IN):
|
||||
"""
|
||||
|
||||
:param addon_id: id of the add-on being signed in
|
||||
:param mode: SIGN_IN or SIGN_OUT
|
||||
:return: addon provider, context and client
|
||||
"""
|
||||
if not addon_id or addon_id == ADDON_ID:
|
||||
logging.error_trace('Invalid addon_id: %r', addon_id)
|
||||
return False
|
||||
|
||||
provider = Provider()
|
||||
context = XbmcContext(params={'addon_id': addon_id})
|
||||
|
||||
access_manager = context.get_access_manager()
|
||||
if access_manager.add_new_developer(addon_id):
|
||||
logging.debug('Creating developer user: %r', addon_id)
|
||||
|
||||
client = provider.get_client(context=context)
|
||||
|
||||
if mode == yt_login.SIGN_IN:
|
||||
if client.logged_in:
|
||||
yt_login.process(yt_login.SIGN_OUT,
|
||||
provider,
|
||||
context,
|
||||
client=client,
|
||||
refresh=False)
|
||||
client = None
|
||||
elif mode != yt_login.SIGN_OUT:
|
||||
raise Exception('Unknown mode: %r' % mode)
|
||||
|
||||
yt_login.process(mode, provider, context, client=client, refresh=False)
|
||||
|
||||
logged_in = provider.get_client(context=context).logged_in
|
||||
if mode == yt_login.SIGN_IN:
|
||||
return logged_in
|
||||
return not logged_in
|
||||
|
||||
|
||||
def sign_in(addon_id):
|
||||
"""
|
||||
To use the signed in context, see youtube_registration.py and youtube_requests.py
|
||||
Usage:
|
||||
|
||||
addon.xml
|
||||
---
|
||||
<import addon="plugin.video.youtube" version="6.1.0"/>
|
||||
---
|
||||
|
||||
.py
|
||||
---
|
||||
import youtube_registration
|
||||
import youtube_authentication
|
||||
|
||||
youtube_registration.register_api_keys(addon_id='plugin.video.example',
|
||||
api_key='A1zaSyA0b5sTjgxzTzYLmVtradlFVBfSHNOJKS0',
|
||||
client_id='825419953561-ert5tccq1r0upsuqdf5nm3le39czk23a.apps.googleusercontent.com',
|
||||
client_secret='Y5cE1IKzJQe1NZ0OsOoEqpu3')
|
||||
|
||||
try:
|
||||
signed_in = youtube_authentication.sign_in(addon_id='plugin.video.example') # refreshes access tokens if already signed in
|
||||
except youtube_authentication.LoginException as exc:
|
||||
error_message = exc.get_message()
|
||||
# handle error
|
||||
signed_in = False
|
||||
|
||||
if signed_in:
|
||||
pass # see youtube_registration.py and youtube_requests.py to use the signed in context
|
||||
---
|
||||
|
||||
:param addon_id: id of the add-on being signed in
|
||||
:return: boolean, True when signed in
|
||||
"""
|
||||
|
||||
return _auth(addon_id, mode=yt_login.SIGN_IN)
|
||||
|
||||
|
||||
def sign_out(addon_id):
|
||||
"""
|
||||
Usage:
|
||||
|
||||
addon.xml
|
||||
---
|
||||
<import addon="plugin.video.youtube" version="6.1.0"/>
|
||||
---
|
||||
|
||||
.py
|
||||
---
|
||||
import youtube_registration
|
||||
import youtube_authentication
|
||||
|
||||
youtube_registration.register_api_keys(addon_id='plugin.video.example',
|
||||
api_key='A1zaSyA0b5sTjgxzTzYLmVtradlFVBfSHNOJKS0',
|
||||
client_id='825419953561-ert5tccq1r0upsuqdf5nm3le39czk23a.apps.googleusercontent.com',
|
||||
client_secret='Y5cE1IKzJQe1NZ0OsOoEqpu3')
|
||||
|
||||
signed_out = youtube_authentication.sign_out(addon_id='plugin.video.example')
|
||||
if signed_out:
|
||||
pass
|
||||
---
|
||||
|
||||
:param addon_id: id of the add-on being signed out
|
||||
:return: boolean, True when signed out
|
||||
"""
|
||||
|
||||
return _auth(addon_id, mode=yt_login.SIGN_OUT)
|
||||
|
||||
|
||||
def reset_access_tokens(addon_id):
|
||||
"""
|
||||
|
||||
:param addon_id: id of the add-on having it's access tokens reset
|
||||
:return:
|
||||
"""
|
||||
if not addon_id or addon_id == ADDON_ID:
|
||||
logging.error_trace('Invalid addon_id: %r', addon_id)
|
||||
return
|
||||
|
||||
context = XbmcContext(params={'addon_id': addon_id})
|
||||
context.get_access_manager().update_access_token(
|
||||
addon_id, access_token='', expiry=-1, refresh_token=''
|
||||
)
|
||||
@@ -0,0 +1,34 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
|
||||
Copyright (C) 2014-2016 bromix (plugin.video.youtube)
|
||||
Copyright (C) 2016-2025 plugin.video.youtube
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only
|
||||
See LICENSES/GPL-2.0-only for more information.
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import, division, unicode_literals
|
||||
|
||||
|
||||
key_sets = {
|
||||
'youtube-tv': {
|
||||
'api_key': 'QUl6YVN5QzZmdlpTSkhBN1Z6NWo4akNpS1J0N3RVSU9xakUyTjNn',
|
||||
'client_id': 'ODYxNTU2NzA4NDU0LWQ2ZGxtM2xoMDVpZGQ4bnBlazE4azZiZThiYTNvYzY4',
|
||||
'client_secret': 'U2JvVmhvRzlzMHJOYWZpeENTR0dLWEFU',
|
||||
},
|
||||
'youtube-vr': {
|
||||
'api_key': '',
|
||||
'client_id': 'NjUyNDY5MzEyMTY5LTRsdnM5Ym5ocjlscG5zOXY0NTFqNW9pdmQ4MXZqdnUx',
|
||||
'client_secret': 'M2ZUV3JCSkk1VW9qbTFUSzdfaUpDVzVa',
|
||||
},
|
||||
'provided': {
|
||||
'0': {
|
||||
'api_key': '',
|
||||
'client_id': '',
|
||||
'client_secret': '',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
__all__ = ('kodion', 'youtube', 'key_sets',)
|
||||
BIN
Binary file not shown.
+26
@@ -0,0 +1,26 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
|
||||
Copyright (C) 2014-2016 bromix (plugin.video.youtube)
|
||||
Copyright (C) 2016-2025 plugin.video.youtube
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only
|
||||
See LICENSES/GPL-2.0-only for more information.
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import, division, unicode_literals
|
||||
|
||||
from .abstract_provider import (
|
||||
# Abstract provider for implementation by the user
|
||||
AbstractProvider,
|
||||
)
|
||||
# import base exception of kodion directly into the kodion namespace
|
||||
from .exceptions import KodionException
|
||||
|
||||
|
||||
__all__ = (
|
||||
'AbstractProvider',
|
||||
'KodionException',
|
||||
)
|
||||
|
||||
__version__ = '1.5.4'
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user