Skip to content
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

upgrading api. fix auth. fix exceptions #16

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 43 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,7 +1,48 @@
[submodule "addon/lib/yandex-music-api"]
path = addon/lib/yandex-music-api
url = https://github.com/MarshalX/yandex-music-api.git
branch=development
branch = main
[submodule "addon/lib/mutagen"]
path = addon/lib/mutagen
url = https://github.com/quodlibet/mutagen.git
branch = master
url = https://github.com/quodlibet/mutagen.git
[submodule "addon/lib/aiofiles"]
path = addon/lib/aiofiles
url = https://github.com/Tinche/aiofiles
branch = main
[submodule "addon/lib/aiohttp"]
path = addon/lib/aiohttp
url = https://github.com/aio-libs/aiohttp
branch = master
[submodule "addon/lib/aiosignal"]
path = addon/lib/aiosignal
url = https://github.com/aio-libs/aiosignal
branch = master
[submodule "addon/lib/async_timeout"]
path = addon/lib/async_timeout
url = https://github.com/aio-libs/async-timeout
branch = master
[submodule "addon/lib/cchardet"]
path = addon/lib/cchardet
url = https://github.com/PyYoshi/cChardet
branch = master
[submodule "addon/lib/charset_normalizer"]
path = addon/lib/charset_normalizer
url = https://github.com/Ousret/charset_normalizer
branch = master
[submodule "addon/lib/frozenlist"]
path = addon/lib/frozenlist
url = https://github.com/aio-libs/frozenlist
branch = master
[submodule "addon/lib/multidict"]
path = addon/lib/multidict
url = https://github.com/aio-libs/multidict
branch = master
[submodule "addon/lib/typing_extensions"]
path = addon/lib/typing_extensions
url = https://github.com/python/typing_extensions
branch = main
[submodule "addon/lib/yarl"]
path = addon/lib/yarl
url = https://github.com/aio-libs/yarl
branch = master
1 change: 1 addition & 0 deletions addon/lib/aiofiles
Submodule aiofiles added at 564b11
1 change: 1 addition & 0 deletions addon/lib/aiohttp
Submodule aiohttp added at 4b59d5
1 change: 1 addition & 0 deletions addon/lib/aiosignal
Submodule aiosignal added at cd7387
1 change: 1 addition & 0 deletions addon/lib/async_timeout
Submodule async_timeout added at 327e9c
1 change: 1 addition & 0 deletions addon/lib/cchardet
Submodule cchardet added at bd1cc3
1 change: 1 addition & 0 deletions addon/lib/charset_normalizer
Submodule charset_normalizer added at 8e7e96
1 change: 1 addition & 0 deletions addon/lib/frozenlist
Submodule frozenlist added at 6cc358
1 change: 1 addition & 0 deletions addon/lib/multidict
Submodule multidict added at a05f1f
2 changes: 1 addition & 1 deletion addon/lib/mutagen
Submodule mutagen updated 58 files
+10 −9 .github/workflows/test.yml
+1 −1 .mypy.ini
+9 −0 .readthedocs.yaml
+0 −1 MANIFEST.in
+17 −0 NEWS
+4 −3 README.rst
+8 −2 docs/Makefile
+4 −4 docs/conf.py
+2 −0 docs/requirements.txt
+35 −37 fuzzing/fuzztools.py
+3 −1 fuzzing/run.sh
+1 −1 mutagen/__init__.py
+9 −7 mutagen/_file.py
+23 −10 mutagen/_iff.py
+2 −2 mutagen/_tags.py
+1 −1 mutagen/_tools/mid3iconv.py
+1 −1 mutagen/_tools/mutagen_inspect.py
+1 −1 mutagen/_tools/mutagen_pony.py
+29 −23 mutagen/_util.py
+4 −4 mutagen/_vorbis.py
+2 −2 mutagen/ac3.py
+7 −2 mutagen/apev2.py
+1 −1 mutagen/asf/__init__.py
+5 −4 mutagen/asf/_util.py
+9 −9 mutagen/easyid3.py
+4 −4 mutagen/easymp4.py
+14 −5 mutagen/flac.py
+1 −1 mutagen/id3/_file.py
+6 −6 mutagen/id3/_frames.py
+1 −1 mutagen/id3/_specs.py
+17 −11 mutagen/id3/_tags.py
+7 −4 mutagen/id3/_util.py
+5 −1 mutagen/mp3/__init__.py
+8 −5 mutagen/mp4/__init__.py
+3 −3 mutagen/ogg.py
+4 −3 mutagen/smf.py
+5 −0 mutagen/tak.py
+5 −3 mutagen/trueaudio.py
+2 −2 mutagen/wave.py
+11 −12 pyproject.toml
+20 −29 setup.py
+1 −8 tests/__init__.py
+13 −0 tests/conftest.py
+ tests/data/no-tags.mp3
+0 −6 tests/quality/__init__.py
+0 −33 tests/quality/test_flake8.py
+2 −1 tests/test___init__.py
+3 −3 tests/test__vorbis.py
+5 −0 tests/test_ac3.py
+1 −1 tests/test_apev2.py
+2 −2 tests/test_asf.py
+13 −13 tests/test_easyid3.py
+6 −6 tests/test_easymp4.py
+1 −1 tests/test_flac.py
+21 −1 tests/test_id3.py
+5 −0 tests/test_tak.py
+5 −0 tests/test_trueaudio.py
+2 −2 tests/test_wave.py
1 change: 1 addition & 0 deletions addon/lib/typing_extensions
Submodule typing_extensions added at 688fbd
2 changes: 1 addition & 1 deletion addon/lib/yandex-music-api
Submodule yandex-music-api updated 395 files
1 change: 1 addition & 0 deletions addon/lib/yarl
Submodule yarl added at 1f94e1
20 changes: 15 additions & 5 deletions addon/yandex_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,22 @@
sys.path.append("./")
sys.path.append(os.path.join(os.path.dirname(__file__), "lib/yandex-music-api/"))
sys.path.append(os.path.join(os.path.dirname(__file__), "lib/mutagen/"))
sys.path.append(os.path.join(os.path.dirname(__file__), "lib/aiohttp/"))
sys.path.append(os.path.join(os.path.dirname(__file__), "lib/multidict/"))
sys.path.append(os.path.join(os.path.dirname(__file__), "lib/typing_extensions/src"))
sys.path.append(os.path.join(os.path.dirname(__file__), "lib/yarl/"))
sys.path.append(os.path.join(os.path.dirname(__file__), "lib/async_timeout/"))
sys.path.append(os.path.join(os.path.dirname(__file__), "lib/charset_normalizer/"))
sys.path.append(os.path.join(os.path.dirname(__file__), "lib/cchardet/src"))
sys.path.append(os.path.join(os.path.dirname(__file__), "lib/aiosignal/"))
sys.path.append(os.path.join(os.path.dirname(__file__), "lib/frozenlist/"))
sys.path.append(os.path.join(os.path.dirname(__file__), "lib/aiofiles/src"))

import xbmcaddon
import xbmcgui

from yandex_music import Client
from yandex_music.exceptions import Unauthorized, BadRequest, NetworkError
from yandex_music.exceptions import UnauthorizedError, BadRequestError, NetworkError


def tr(value):
Expand All @@ -25,9 +35,9 @@ def check_login(settings):
return False, Client()

try:
client = Client.from_token(token)
client = Client(token).init()
return True, client
except Unauthorized as _:
except UnauthorizedError as _:
return False, Client()


Expand Down Expand Up @@ -62,9 +72,9 @@ def do_login(settings, username, password):
client = Client().from_credentials(username, password)
settings.setSetting('token', client.token)
return True, -1
except Unauthorized:
except UnauthorizedError:
return False, 1
except BadRequest:
except BadRequestError:
return False, 2
except NetworkError:
return False,2
Expand Down