-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #70 from oskvr37/2.0
2.0
- Loading branch information
Showing
35 changed files
with
1,629 additions
and
1,667 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
{ | ||
"python.analysis.typeCheckingMode": "basic" | ||
} | ||
"python.analysis.typeCheckingMode": "basic", | ||
"[python]": { | ||
"editor.codeActionsOnSave": { | ||
"source.organizeImports.ruff": "explicit", | ||
} | ||
}, | ||
"ruff.lineLength": 80, | ||
} |
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,29 @@ | ||
[build-system] | ||
requires = ["setuptools>=42", "wheel"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
name = "tiddl" | ||
version = "2.0.0" | ||
description = "Download Tidal tracks with CLI downloader." | ||
readme = "README.md" | ||
requires-python = ">=3.11" | ||
authors = [{ name = "oskvr37" }] | ||
classifiers = [ | ||
"Environment :: Console", | ||
"Programming Language :: Python :: 3", | ||
"Operating System :: OS Independent", | ||
] | ||
dependencies = [ | ||
"pydantic>=2.9.2", | ||
"requests>=2.20.0", | ||
"click>=8.1.7", | ||
"mutagen>=1.47.0", | ||
"ffmpeg-python>=0.2.0", | ||
] | ||
|
||
[project.urls] | ||
homepage = "https://github.com/oskvr37/tiddl" | ||
|
||
[project.scripts] | ||
tiddl = "tiddl.cli:cli" |
This file was deleted.
Oops, something went wrong.
Empty file.
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,78 @@ | ||
import unittest | ||
|
||
from tiddl.config import Config | ||
from tiddl.api import TidalApi | ||
|
||
|
||
class TestApi(unittest.TestCase): | ||
api: TidalApi | ||
|
||
def setUp(self): | ||
config = Config.fromFile() | ||
auth = config.auth | ||
|
||
token, user_id, country_code = ( | ||
auth.token, | ||
auth.user_id, | ||
auth.country_code | ||
) | ||
|
||
assert token, "No token found in config file" | ||
assert user_id, "No user_id found in config file" | ||
assert country_code, "No country_code found in config file" | ||
|
||
self.api = TidalApi(token, user_id, country_code) | ||
|
||
def test_ready(self): | ||
session = self.api.getSession() | ||
|
||
self.assertEqual(session.userId, int(self.api.user_id)) | ||
self.assertEqual(session.countryCode, self.api.country_code) | ||
|
||
def test_track(self): | ||
track = self.api.getTrack(103805726) | ||
self.assertEqual(track.title, "Stronger") | ||
|
||
def test_artist(self): | ||
artist = self.api.getArtist(25022) | ||
self.assertEqual(artist.name, "Kanye West") | ||
|
||
def test_artist_albums(self): | ||
self.api.getArtistAlbums(25022, filter="ALBUMS") | ||
self.api.getArtistAlbums(25022, filter="EPSANDSINGLES") | ||
|
||
def test_album(self): | ||
album = self.api.getAlbum(103805723) | ||
self.assertEqual(album.title, "Graduation") | ||
|
||
def test_album_items(self): | ||
album_items = self.api.getAlbumItems(103805723, limit=10) | ||
self.assertEqual(len(album_items.items), 10) | ||
|
||
album_items = self.api.getAlbumItems(103805723, limit=10, offset=10) | ||
self.assertEqual(len(album_items.items), 4) | ||
|
||
def test_playlist(self): | ||
playlist = self.api.getPlaylist("84974059-76af-406a-aede-ece2b78fa372") | ||
self.assertEqual(playlist.title, "Kanye West Essentials") | ||
|
||
def test_playlist_items(self): | ||
playlist_items = self.api.getPlaylistItems( | ||
"84974059-76af-406a-aede-ece2b78fa372" | ||
) | ||
self.assertEqual(len(playlist_items.items), 25) | ||
|
||
def test_favorites(self): | ||
favorites = self.api.getFavorites() | ||
self.assertGreaterEqual(len(favorites.PLAYLIST), 0) | ||
self.assertGreaterEqual(len(favorites.ALBUM), 0) | ||
self.assertGreaterEqual(len(favorites.VIDEO), 0) | ||
self.assertGreaterEqual(len(favorites.TRACK), 0) | ||
self.assertGreaterEqual(len(favorites.ARTIST), 0) | ||
|
||
def test_search(self): | ||
self.api.getSearch("Kanye West") | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |
Oops, something went wrong.