forked from CopyBot/sptnr
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 816444e309 | |||
| fce99b39cb | |||
| f3fe277017 |
Executable
+19
@@ -0,0 +1,19 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Ensure the script stops if there is an error
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Read version from the VERSION file
|
||||||
|
VERSION=$(cat VERSION)
|
||||||
|
|
||||||
|
# Build the Docker image with the version tag
|
||||||
|
docker build -t krestaino/sptnr:$VERSION .
|
||||||
|
|
||||||
|
# Tag the built image as latest
|
||||||
|
docker tag krestaino/sptnr:$VERSION krestaino/sptnr:latest
|
||||||
|
|
||||||
|
# Push both tags to the Docker registry
|
||||||
|
docker push krestaino/sptnr:$VERSION
|
||||||
|
docker push krestaino/sptnr:latest
|
||||||
|
|
||||||
|
echo "Docker images tagged and pushed: $VERSION and latest"
|
||||||
@@ -143,6 +143,11 @@ parser.add_argument(
|
|||||||
help="limit to processing [NUM] artists from the start index",
|
help="limit to processing [NUM] artists from the start index",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
"-v", "--version", action="version", version=f"%(prog)s {__version__}"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
ARTIST_IDs = args.artist if args.artist else []
|
ARTIST_IDs = args.artist if args.artist else []
|
||||||
@@ -150,6 +155,8 @@ ALBUM_IDs = args.album if args.album else []
|
|||||||
START = args.start
|
START = args.start
|
||||||
LIMIT = args.limit
|
LIMIT = args.limit
|
||||||
|
|
||||||
|
logging.info(f"{BOLD}Version:{RESET} {LIGHT_YELLOW}sptnr v{__version__}{RESET}")
|
||||||
|
|
||||||
if args.preview:
|
if args.preview:
|
||||||
logging.info(f"{LIGHT_YELLOW}Preview mode, no changes will be made.{RESET}")
|
logging.info(f"{LIGHT_YELLOW}Preview mode, no changes will be made.{RESET}")
|
||||||
PREVIEW = 1
|
PREVIEW = 1
|
||||||
@@ -254,6 +261,15 @@ def process_track(track_id, artist_name, album, track_name):
|
|||||||
)
|
)
|
||||||
found_track = len(spotify_data.get("tracks", {}).get("items", [])) > 0
|
found_track = len(spotify_data.get("tracks", {}).get("items", [])) > 0
|
||||||
|
|
||||||
|
if not found_track:
|
||||||
|
# Tertiary Search (replace 'Part' with 'Pt.')
|
||||||
|
modified_track_name = track_name.replace("Part", "Pt.")
|
||||||
|
encoded_modified_track_name = url_encode(modified_track_name)
|
||||||
|
spotify_data = search_spotify(
|
||||||
|
f"{encoded_modified_track_name}%20artist:{encoded_artist_name}"
|
||||||
|
)
|
||||||
|
found_track = len(spotify_data.get("tracks", {}).get("items", []))
|
||||||
|
|
||||||
if found_track:
|
if found_track:
|
||||||
popularity = spotify_data["tracks"]["items"][0].get("popularity", 0)
|
popularity = spotify_data["tracks"]["items"][0].get("popularity", 0)
|
||||||
rating = get_rating_from_popularity(popularity)
|
rating = get_rating_from_popularity(popularity)
|
||||||
|
|||||||
Reference in New Issue
Block a user