mirror of
https://github.com/krestaino/sptnr.git
synced 2026-06-12 14:05:21 -04:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ffc501a48d | |||
| e20f9155cb | |||
| 816444e309 | |||
| fce99b39cb | |||
| f3fe277017 |
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2024 Kevin Restaino
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
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)
|
||||||
|
|
||||||
|
# Set up the builder instance (only needs to be done once, so you can comment this out after the first run)
|
||||||
|
# docker buildx create --name mybuilder --use
|
||||||
|
# docker buildx inspect mybuilder --bootstrap
|
||||||
|
|
||||||
|
# Build and push the Docker image for both arm64 and amd64 platforms with the version tag
|
||||||
|
docker buildx build --platform linux/arm64,linux/amd64 -t krestaino/sptnr:$VERSION . --push
|
||||||
|
|
||||||
|
# Build and push the 'latest' tag as well
|
||||||
|
docker buildx build --platform linux/arm64,linux/amd64 -t krestaino/sptnr:latest . --push
|
||||||
|
|
||||||
|
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