api key can be set from console

also the art finally displays as 1:1 in the playlist display but its not fully done yet
This commit is contained in:
Dylan 2024-09-09 16:03:05 -04:00
parent b16487bf60
commit 792d1bdd3f
2 changed files with 5 additions and 2 deletions

View file

@ -132,6 +132,7 @@ h4 {
.playlist > .item > img { .playlist > .item > img {
display: inline-flex; display: inline-flex;
max-width: 100px; max-width: 100px;
max-height: 100px;
width:30%; width:30%;
margin: 0; margin: 0;
aspect-ratio: 1/1; aspect-ratio: 1/1;

View file

@ -2,15 +2,17 @@ import os
from mutagen.easyid3 import EasyID3 from mutagen.easyid3 import EasyID3
from mutagen.mp3 import MP3 from mutagen.mp3 import MP3
import requests, ast, time, math, argparse, json import requests, ast, time, math, argparse, json
# place your lastfm key in the slot below
apikeylastfm="YourLastfmKeyHere"
loading = ["-","\\","|","/"] loading = ["-","\\","|","/"]
songFiles = os.listdir(r'./sound') songFiles = os.listdir(r'./sound')
parser=argparse.ArgumentParser(description="Options for the generation of the song database") parser=argparse.ArgumentParser(description="Options for the generation of the song database")
parser.add_argument('-k','--apikey', help='String: LastFM api key', default="")
parser.add_argument('-m', '--mode', help='new/update: Remake database or update current', default= "update") parser.add_argument('-m', '--mode', help='new/update: Remake database or update current', default= "update")
parser.add_argument('-a', '--art', help="True/False: Add art to the database using LastFm (takes minimum 0.25s per song)", default="True") parser.add_argument('-a', '--art', help="True/False: Add art to the database using LastFm (takes minimum 0.25s per song)", default="True")
args = parser.parse_args() args = parser.parse_args()
apikeylastfm = args.apikey
# if you want to set the api key permenantly for your setup just uncomment the next line
# apikeylastfm = "KeyHere"
if args.mode == "update": if args.mode == "update":
try: try:
with open('songDatabase.json', 'r') as handle: with open('songDatabase.json', 'r') as handle: