i like this progress
This commit is contained in:
parent
9d4ce342ca
commit
b42b1aeef5
8 changed files with 12875 additions and 73740 deletions
|
|
@ -1 +1 @@
|
|||
{"access_token": "BQDf6gK9LVTuA9IzYMV-DfgRBFjNlkLHCp_lN76-Fn0Fe2pLarZFYsYGbO7IX2ZEjJAB3hzzACkmqr4t3q48W-U9WBFcgNzExwUpJcLFi4xupyHKtcDeWRn7xWZ3_60mQStSax_wbZB7m5iU0_kzJv-r-ObWnW3q7yWeQfUTcjP3B9xfLyqcw0FFSv578C4nJ3XmPhhybgiDRkZUlf89SO24VFqcDcfZOZaiUAD4JG0Ypt_6F3PQsJOsITzz1zMn", "token_type": "Bearer", "expires_in": 3600, "scope": "user-library-read user-read-private playlist-read-private playlist-read-collaborative user-read-email", "expires_at": 1752527488, "refresh_token": "AQDmfQkPCGObfJeTUIbW1hAAwhSqkuHRA3Qh2dqVYMRh0eCkFMQgPNJDDzF8y-BiaVbj80zePkK_XSfYH1aJutMtNbnsqRKWuxP31BTrMc7pdUdbE7Fma4oH8wpDUKdG3MM"}
|
||||
{"access_token": "BQBV3J80UTFPrCM5cWbrN00DAauBeT6OykJaRhh3UYkDQHuaThaxxzNvxFPw2nxNWgEd4qk37NpIvWxBUdFl3_tZjZP6Gp2ZJr6U06QjYa5__x2VIQ5Av6pUiA6Iu0IgSfC49AhXjjmBG5wPiw7Q6l24MmB9yHfs7zgVlfqREAs5_qkD0GFAPlpTEYQamOgfOp9BtGawOQZje5m9ddrKOdSLOCQ77Hc5XGZIMmJpKvwSIJdFIs5YXm7Uy7vBhSFy", "token_type": "Bearer", "expires_in": 3600, "scope": "user-library-read user-read-private playlist-read-private playlist-read-collaborative user-read-email", "expires_at": 1752544984, "refresh_token": "AQDmfQkPCGObfJeTUIbW1hAAwhSqkuHRA3Qh2dqVYMRh0eCkFMQgPNJDDzF8y-BiaVbj80zePkK_XSfYH1aJutMtNbnsqRKWuxP31BTrMc7pdUdbE7Fma4oH8wpDUKdG3MM"}
|
||||
Binary file not shown.
Binary file not shown.
|
|
@ -98,6 +98,35 @@ class Artist:
|
|||
external_urls=artist_data.get('external_urls')
|
||||
)
|
||||
|
||||
@dataclass
|
||||
class Album:
|
||||
id: str
|
||||
name: str
|
||||
artists: List[str]
|
||||
release_date: str
|
||||
total_tracks: int
|
||||
album_type: str
|
||||
image_url: Optional[str] = None
|
||||
external_urls: Optional[Dict[str, str]] = None
|
||||
|
||||
@classmethod
|
||||
def from_spotify_album(cls, album_data: Dict[str, Any]) -> 'Album':
|
||||
# Get the largest image URL if available
|
||||
image_url = None
|
||||
if album_data.get('images') and len(album_data['images']) > 0:
|
||||
image_url = album_data['images'][0]['url']
|
||||
|
||||
return cls(
|
||||
id=album_data['id'],
|
||||
name=album_data['name'],
|
||||
artists=[artist['name'] for artist in album_data['artists']],
|
||||
release_date=album_data.get('release_date', ''),
|
||||
total_tracks=album_data.get('total_tracks', 0),
|
||||
album_type=album_data.get('album_type', 'album'),
|
||||
image_url=image_url,
|
||||
external_urls=album_data.get('external_urls')
|
||||
)
|
||||
|
||||
@dataclass
|
||||
class Playlist:
|
||||
id: str
|
||||
|
|
@ -258,6 +287,26 @@ class SpotifyClient:
|
|||
logger.error(f"Error searching artists: {e}")
|
||||
return []
|
||||
|
||||
@rate_limited
|
||||
def search_albums(self, query: str, limit: int = 20) -> List[Album]:
|
||||
"""Search for albums using Spotify API"""
|
||||
if not self.is_authenticated():
|
||||
return []
|
||||
|
||||
try:
|
||||
results = self.sp.search(q=query, type='album', limit=limit)
|
||||
albums = []
|
||||
|
||||
for album_data in results['albums']['items']:
|
||||
album = Album.from_spotify_album(album_data)
|
||||
albums.append(album)
|
||||
|
||||
return albums
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Error searching albums: {e}")
|
||||
return []
|
||||
|
||||
@rate_limited
|
||||
def get_track_details(self, track_id: str) -> Optional[Dict[str, Any]]:
|
||||
"""Get detailed track information including album data and track number"""
|
||||
|
|
|
|||
85744
logs/app.log
85744
logs/app.log
File diff suppressed because it is too large
Load diff
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue