-
Notifications
You must be signed in to change notification settings - Fork 73
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 #26 from dotX12/dev
Big Update... Fix SEARCH_ARTIST (New API Method) Added black. Micro fixes. Added tests. Change min python 3.6 to 3.8+
- Loading branch information
Showing
37 changed files
with
622 additions
and
527 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 |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: test | ||
|
||
on: pull_request | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
#---------------------------------------------- | ||
# check-out repo and set-up python | ||
#---------------------------------------------- | ||
- name: Check out repository | ||
uses: actions/checkout@v2 | ||
- name: Set up python | ||
id: setup-python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
#---------------------------------------------- | ||
# ----- install & configure poetry ----- | ||
#---------------------------------------------- | ||
- name: Install Poetry | ||
uses: snok/install-poetry@v1 | ||
with: | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
installer-parallel: true | ||
|
||
#---------------------------------------------- | ||
# load cached venv if cache exists | ||
#---------------------------------------------- | ||
- name: Load cached venv | ||
id: cached-poetry-dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: .venv | ||
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} | ||
#---------------------------------------------- | ||
# install dependencies if cache does not exist | ||
#---------------------------------------------- | ||
- name: Install ffmpeg | ||
id: setup-ffmpeg | ||
uses: FedericoCarboni/setup-ffmpeg@v1 | ||
|
||
- name: Install dependencies | ||
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | ||
run: poetry install --no-interaction --no-root | ||
#---------------------------------------------- | ||
# install your root project, if required | ||
#---------------------------------------------- | ||
- name: Install library | ||
run: poetry install --no-interaction | ||
#---------------------------------------------- | ||
# run test suite | ||
#---------------------------------------------- | ||
- name: Check black | ||
run: | | ||
poetry add --dev black --allow-prereleases | ||
poetry run black . --check | ||
- name: Run tests | ||
run: | | ||
source .venv/bin/activate | ||
pytest tests/ |
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 |
---|---|---|
@@ -1,15 +1,16 @@ | ||
import asyncio | ||
from shazamio import Shazam, serialize_artist | ||
from shazamio import Shazam, Serialize | ||
|
||
|
||
async def main(): | ||
shazam = Shazam() | ||
artist_id = 43328183 | ||
about_artist = await shazam.artist_about(artist_id) | ||
serialized = serialize_artist(about_artist) | ||
serialized = Serialize.artist(about_artist) | ||
|
||
print(about_artist) # dict | ||
print(serialized) # serialized from dataclass factory | ||
|
||
|
||
loop = asyncio.get_event_loop() | ||
loop.run_until_complete(main()) |
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,15 +1,16 @@ | ||
import asyncio | ||
from shazamio import Shazam, serialize_track | ||
from shazamio import Shazam, Serialize | ||
|
||
|
||
async def main(): | ||
shazam = Shazam() | ||
track_id = 552406075 | ||
about_track = await shazam.track_about(track_id=track_id) | ||
serialized = serialize_track(data=about_track) | ||
serialized = Serialize.track(data=about_track) | ||
|
||
print(about_track) # dict | ||
print(serialized) # serialized from dataclass factory | ||
|
||
|
||
loop = asyncio.get_event_loop() | ||
loop.run_until_complete(main()) |
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,11 +1,15 @@ | ||
import asyncio | ||
from shazamio import Shazam | ||
from shazamio import Shazam, Serialize | ||
|
||
|
||
async def main(): | ||
shazam = Shazam() | ||
out = await shazam.recognize_song('data/dora.ogg') | ||
out = await shazam.recognize_song("data/dora.ogg") | ||
print(out) | ||
|
||
serialized = Serialize.full_track(out) | ||
print(serialized) | ||
|
||
|
||
loop = asyncio.get_event_loop() | ||
loop.run_until_complete(main()) |
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
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,13 +1,14 @@ | ||
import asyncio | ||
from shazamio import Shazam, serialize_artist | ||
from shazamio import Shazam, Serialize | ||
|
||
|
||
async def main(): | ||
shazam = Shazam() | ||
artists = await shazam.search_artist(query='Lil', limit=5) | ||
for artist in artists['artists']['hits']: | ||
serialized = serialize_artist(data=artist) | ||
artists = await shazam.search_artist(query="LIL", limit=5) | ||
for artist in artists["artists"]["hits"]: | ||
serialized = Serialize.artist(data=artist) | ||
print(serialized) | ||
|
||
|
||
loop = asyncio.get_event_loop() | ||
loop.run_until_complete(main()) |
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
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,14 +1,17 @@ | ||
import asyncio | ||
from shazamio import Shazam, serialize_track | ||
from shazamio import Shazam, Serialize | ||
|
||
|
||
async def main(): | ||
shazam = Shazam() | ||
artist_id = 201896832 | ||
top_three_artist_tracks = await shazam.artist_top_tracks(artist_id=artist_id, limit=3) | ||
for track in top_three_artist_tracks['tracks']: | ||
serialized_track = serialize_track(data=track) | ||
top_three_artist_tracks = await shazam.artist_top_tracks( | ||
artist_id=artist_id, limit=3 | ||
) | ||
for track in top_three_artist_tracks["tracks"]: | ||
serialized_track = Serialize.track(data=track) | ||
print(serialized_track) | ||
|
||
|
||
loop = asyncio.get_event_loop() | ||
loop.run_until_complete(main()) |
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,16 +1,19 @@ | ||
import asyncio | ||
from shazamio import Shazam, serialize_track | ||
from shazamio import Shazam, Serialize | ||
|
||
|
||
async def main(): | ||
shazam = Shazam() | ||
top_ten_moscow_tracks = await shazam.top_city_tracks(country_code='RU', city_name='Moscow', limit=10) | ||
top_ten_moscow_tracks = await shazam.top_city_tracks( | ||
country_code="RU", city_name="Moscow", limit=10 | ||
) | ||
print(top_ten_moscow_tracks) | ||
# ALL TRACKS DICT | ||
for track in top_ten_moscow_tracks['tracks']: | ||
serialized = serialize_track(data=track) | ||
for track in top_ten_moscow_tracks["tracks"]: | ||
serialized = Serialize.track(data=track) | ||
# SERIALIZE FROM DATACLASS FACTORY | ||
print(serialized) | ||
|
||
|
||
loop = asyncio.get_event_loop() | ||
loop.run_until_complete(main()) |
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,14 +1,14 @@ | ||
import asyncio | ||
from shazamio import Shazam, serialize_track | ||
from shazamio import Shazam, Serialize | ||
|
||
|
||
async def main(): | ||
shazam = Shazam() | ||
top_five_track_from_amsterdam = await shazam.top_country_tracks('NL', 5) | ||
for track in top_five_track_from_amsterdam['tracks']: | ||
serialized = serialize_track(data=track) | ||
top_five_track_from_amsterdam = await shazam.top_country_tracks("NL", 5) | ||
for track in top_five_track_from_amsterdam["tracks"]: | ||
serialized = Serialize.track(data=track) | ||
print(serialized) | ||
|
||
|
||
loop = asyncio.get_event_loop() | ||
loop.run_until_complete(main()) | ||
|
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
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,14 +1,15 @@ | ||
import asyncio | ||
from shazamio import Shazam, serialize_track | ||
from shazamio import Shazam, Serialize | ||
|
||
|
||
async def main(): | ||
shazam = Shazam() | ||
top_world_tracks = await shazam.top_world_tracks(limit=10) | ||
print(top_world_tracks) | ||
for track in top_world_tracks['tracks']: | ||
serialized = serialize_track(track) | ||
for track in top_world_tracks["tracks"]: | ||
serialized = Serialize.track(track) | ||
print(serialized) | ||
|
||
|
||
loop = asyncio.get_event_loop() | ||
loop.run_until_complete(main()) |
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 |
---|---|---|
@@ -1,12 +1,16 @@ | ||
aiofiles | ||
aiohttp | ||
async-timeout==3.0.1 | ||
aiofiles~=0.8.0 | ||
aiohttp~=3.8.1 | ||
attrs==20.3.0 | ||
chardet==3.0.4 | ||
dataclass-factory | ||
dataclass-factory==2.10.1 | ||
idna==3.1 | ||
multidict==5.1.0 | ||
numpy | ||
pydub==0.24.1 | ||
numpy~=1.22.1 | ||
pydub==0.25.1 | ||
typing-extensions==3.7.4.3 | ||
yarl==1.6.3 | ||
|
||
pytest~=7.1.2 | ||
setuptools~=60.7.0 | ||
pytest-asyncio~=0.18.3 | ||
anyio~=3.6.1 |
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
Oops, something went wrong.