python:deezer-album-tracker
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
python:deezer-album-tracker [2024/03/30 15:18] – Wulf Rajek | python:deezer-album-tracker [2024/04/21 20:05] (current) – Wulf Rajek | ||
---|---|---|---|
Line 25: | Line 25: | ||
Example output: | Example output: | ||
< | < | ||
- | $ ./dat.py --days 7 | + | $ /dat.py --days 7 |
Albums released in the past 7 days: | Albums released in the past 7 days: | ||
- | Release Date: 2024-03-29 | ||
- | Artist: Beyoncé | ||
- | Album Name: COWBOY CARTER [EXPLICIT] | ||
- | Link: https:// | ||
- | Release Date: 2024-03-29 | + | Release Date: 2024-04-19 |
- | Artist: | + | Artist: |
- | Album Name: Lonely Cowboy | + | Album Name: Better Days (feat. Dorothy) (1 track) |
- | Link: https:// | + | Link: https:// |
- | Release Date: 2024-03-29 | + | Release Date: 2024-04-19 |
- | Artist: | + | Artist: |
- | Album Name: Be Okay | + | Album Name: Nova (3 tracks) |
- | Link: https:// | + | Link: https:// |
+ | |||
+ | Release Date: 2024-04-19 | ||
+ | Artist: Taylor Swift | ||
+ | Album Name: THE TORTURED POETS DEPARTMENT [EXPLICIT] (16 tracks) | ||
+ | Link: https:// | ||
</ | </ | ||
Line 91: | Line 92: | ||
# Constants for file paths | # Constants for file paths | ||
- | CONFIG_FILE | + | CONFIG_FILENAME |
+ | SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) | ||
+ | CONFIG_FILE = os.path.join(SCRIPT_DIR, | ||
Line 195: | Line 198: | ||
if (datetime.strptime(earliest_release, | if (datetime.strptime(earliest_release, | ||
datetime.strptime(today, | datetime.strptime(today, | ||
+ | trackresponse = requests.get(album[' | ||
+ | request_count += 1 | ||
+ | if trackresponse.status_code == 200: | ||
+ | tracklist = trackresponse.json() | ||
+ | trackamount = tracklist[' | ||
+ | else: | ||
+ | trackamount = 0 | ||
+ | |||
albums.append({ | albums.append({ | ||
' | ' | ||
' | ' | ||
' | ' | ||
+ | ' | ||
' | ' | ||
' | ' | ||
Line 244: | Line 256: | ||
for index, (artist_name, | for index, (artist_name, | ||
print(f" | print(f" | ||
- | | + | |
- | if 0 <= choice_index < len(choices): | + | if choice_input.isnumeric(): |
- | artist_name = choices[choice_index][0] | + | choice_index = int(choice_input) - 1 |
- | artist_id = [key for key, value in subscribed_artists.items() if value == artist_name][0] | + | if 0 <= choice_index < len(choices): |
- | del config[' | + | artist_name = choices[choice_index][0] |
- | save_config(config) | + | artist_id = [key for key, value in subscribed_artists.items() if value == artist_name][0] |
- | print(f" | + | del config[' |
+ | save_config(config) | ||
+ | print(f" | ||
+ | else: | ||
+ | print(" | ||
else: | else: | ||
- | print(" | + | print(" |
Line 280: | Line 296: | ||
albums = get_albums(artist_ids, | albums = get_albums(artist_ids, | ||
- | output = f" | + | output = f" |
for album in albums: | for album in albums: | ||
output += f" | output += f" | ||
output += f" | output += f" | ||
+ | output += f" | ||
if album[' | if album[' | ||
- | output += f"Album Name: {album[' | + | output += " [EXPLICIT]" |
- | | + | |
- | output += f"Album Name: {album[' | + | output += f" |
+ | if album[' | ||
+ | output += " | ||
+ | output += " | ||
+ | output += "\n" | ||
output += f" | output += f" | ||
output += " | output += " |
python/deezer-album-tracker.1711811915.txt.gz · Last modified: 2024/03/30 15:18 by Wulf Rajek