TheWicklowWolf / Lidify

Music discovery tool that provides recommendations based on selected Lidarr artists, using Spotify or LastFM.
MIT License
152 stars 0 forks source link

Cannot add artist to lidarr #20

Closed TheLazyGeekGuy closed 4 months ago

TheLazyGeekGuy commented 4 months ago

Try the parameter here : https://github.com/TheWicklowWolf/Lidify/blob/6d4cf2b864e307c410498f7ca23b06cd5acea943/src/Lidify.py#L311-L329

converted to bash thanks to chatgpt and rewrote the wget to match with the busyr box image:

#!/bin/bash

# Replace these variables with your own information
LIDARR_URL="http://your-lidarr-url:port"  # Replace with the URL of your Lidarr instance
API_KEY="your_api_key"  # Replace with your Lidarr API key

# Payload parameters
artist_name="Artist Name"  # Replace with the artist's name
quality_profile_id=1  # Replace with your quality profile ID
metadata_profile_id=1  # Replace with your metadata profile ID
root_folder_path="/path/to/your/root/folder"  # Replace with your root folder path
artist_folder="Artist Folder"  # Replace with the artist folder
mbid="Artist MusicBrainz ID"  # Replace with the artist's MusicBrainz ID
search_for_missing_albums=true  # Replace with your search option

# Construct the API URL to add an artist
API_URL="$LIDARR_URL/api/v1/artist?apikey=$API_KEY"

# Construct the JSON payload
payload=$(cat <<EOF
{
    "ArtistName": "$artist_name",
    "qualityProfileId": $quality_profile_id,
    "metadataProfileId": $metadata_profile_id,
    "path": "$root_folder_path/$artist_folder/",
    "rootFolderPath": "$root_folder_path",
    "foreignArtistId": "$mbid",
    "monitored": true,
    "addOptions": {
        "searchForMissingAlbums": $search_for_missing_albums
    }
}
EOF
)

# Use wget to make the POST request
# wget --quiet \
#      --method POST \
#      --header "Content-Type: application/json" \
#      --body-data "$payload" \
#      --output-document=- \
#      "$API_URL"
wget -S --header "Content-Type: application/json" \
     --post-data "$payload" \
     "$API_URL"

Inside the image, the call to lidarr works.

So i did mount the main script to insert debug line, same call return http 200 from lidarr ... i'm really out of idea here ...

Oh, i do have a reverse proxy url but i'm not shire that will cause the problem here ...

TheWicklowWolf commented 4 months ago

Try the parameter here :

https://github.com/TheWicklowWolf/Lidify/blob/6d4cf2b864e307c410498f7ca23b06cd5acea943/src/Lidify.py#L311-L329

converted to bash thanks to chatgpt and rewrote the wget to match with the busyr box image:

#!/bin/bash

# Replace these variables with your own information
LIDARR_URL="http://your-lidarr-url:port"  # Replace with the URL of your Lidarr instance
API_KEY="your_api_key"  # Replace with your Lidarr API key

# Payload parameters
artist_name="Artist Name"  # Replace with the artist's name
quality_profile_id=1  # Replace with your quality profile ID
metadata_profile_id=1  # Replace with your metadata profile ID
root_folder_path="/path/to/your/root/folder"  # Replace with your root folder path
artist_folder="Artist Folder"  # Replace with the artist folder
mbid="Artist MusicBrainz ID"  # Replace with the artist's MusicBrainz ID
search_for_missing_albums=true  # Replace with your search option

# Construct the API URL to add an artist
API_URL="$LIDARR_URL/api/v1/artist?apikey=$API_KEY"

# Construct the JSON payload
payload=$(cat <<EOF
{
    "ArtistName": "$artist_name",
    "qualityProfileId": $quality_profile_id,
    "metadataProfileId": $metadata_profile_id,
    "path": "$root_folder_path/$artist_folder/",
    "rootFolderPath": "$root_folder_path",
    "foreignArtistId": "$mbid",
    "monitored": true,
    "addOptions": {
        "searchForMissingAlbums": $search_for_missing_albums
    }
}
EOF
)

# Use wget to make the POST request
# wget --quiet \
#      --method POST \
#      --header "Content-Type: application/json" \
#      --body-data "$payload" \
#      --output-document=- \
#      "$API_URL"
wget -S --header "Content-Type: application/json" \
     --post-data "$payload" \
     "$API_URL"

Inside the image, the call to lidarr works.

So i did mount the main script to insert debug line, same call return http 200 from lidarr ... i'm really out of idea here ...

Oh, i do have a reverse proxy url but i'm not shire that will cause the problem here ...

Firstly, could you please clarify your issue? Your message is unclear, and I don't understanding what you're trying to convey. Secondly, what exactly is the issue you're facing? Are there errors, or is it not functioning as expected? Thirdly, what do the logs say?

TheWicklowWolf commented 4 months ago

Presume this is closed

TheLazyGeekGuy commented 4 months ago

@TheWicklowWolf I tried to add an artist, but i had a http 200 on Lidify but no trace on lidarr side ...

TheWicklowWolf commented 4 months ago

But does it actually add the artist? When I do a post to /api/v1/artist I get a 201 response, on successful addition.

Edit: What do the Lidify logs say?

TheLazyGeekGuy commented 4 months ago

Not so much in fact, for exemple :

2024/07/01 21:43:41 stderr No Error Message Returned 2024/07/01 21:43:41 stderr Failed to add artist 'Bonnie Tyler' to Lidarr.

TheWicklowWolf commented 4 months ago

Ok,, have you checked the trace logs in Lidarr? There should be some reference to the API post request, something like [POST] /api/v1/artist

TheLazyGeekGuy commented 4 months ago

Many times but no trace in the logs, like it did not reach lidarr.

That's why i tried with the script, and the script worked. No idea of what does not work for now :/

TheWicklowWolf commented 4 months ago

Many times but no trace in the logs, like it did not reach lidarr.

So that's the issue then, if there is nothing in the Lidarr logs then Lidify cannot reach Lidarr...

reverse proxy url

Why are you using a reverse proxy url, can you not just use the IP address for Lidarr directly?

TheLazyGeekGuy commented 4 months ago

reverse proxy url --> lidarr settings but i was talking of URL Base

All my containers are linked in docker by command
network_mode: service:vpn # run on the vpn network

TheLazyGeekGuy commented 4 months ago

I can get the correct artist list but not add to lidarr ?

TheWicklowWolf commented 4 months ago

I can get the correct artist list but not add to lidarr ?

That sounds like a firewall/network issue as one is a inbound connection and one is an outbound (post/get request)

TheWicklowWolf commented 4 months ago

reverse proxy url --> lidarr settings but i was talking of URL Base

All my containers are linked in docker by command network_mode: service:vpn # run on the vpn network

Maybe you can find the IP address of the Lidarr container on that network and use that...

TheWicklowWolf commented 4 months ago

Closed, as this is not an issue for Lidify; it is more related to a network/Docker setup.

TheLazyGeekGuy commented 4 months ago

@TheWicklowWolf : FOUND !

As i suspected "URL Base" in lidarr , i just need to put the right url :(