angrycuban13 / Just-A-Bunch-Of-Starr-Scripts

Just a bunch of scripts for Starr apps
97 stars 10 forks source link

bad url #46

Closed bulfinch closed 1 year ago

bulfinch commented 1 year ago

Not sure if you provide support for this script...

I can get the script to work on a Windows machine, but not on a Linux machine with PowerShell docker.

Running this command sudo docker run --rm -it -v "/volume1/docker/upgradinatorr:/upgradinatorr" mcr.microsoft.com/powershell:latest pwsh /upgradinatorr/Upgradinatorr/upgradinatorr.ps1 -apps radarr-4k,radarr,sonarr -verbose

Exception: Your URL for Radarr-4k,Radarr,Sonarr is not formatted correctly, it should start with http(s):// and not end in /

this is my config [General] discordWebhook=https://discordapp.com/api/webhooks/[redacted]

[Radarr-4k] radarrApiKey=[redacted] radarrCount=0 radarrMonitored=true radarrMovieStatus=released radarrTagName=upgradinatorr radarrUnattended=false radarrUrl=http://192.168.1.100:17878

[Radarr] radarrApiKey=[redacted] radarrCount=1 radarrMonitored=true radarrMovieStatus=released radarrTagName=upgradinatorr radarrUnattended=false radarrUrl=http://192.168.1.100:7878

[Sonarr] sonarrApiKey=[redacted] sonarrCount=0 sonarrMonitored=true sonarrSeriesStatus= sonarrTagName=upgradinatorr sonarrUnattended=false sonarrUrl=http://192.168.1.100:8989

FonduemangVI commented 1 year ago

Hey @bulfinch take a look at the latest config example the config parameters have been updated. I ran into the same issue last night

They look like this now [Radarr] ApiKey= Count=10 Monitored=true MovieStatus=released TagName= Unattended=false Url=

phishyphun commented 1 year ago

Hello,

I'm actually getting the same error for radarr and radarr-4k:

Your URL for Radarr,Radarr-4K is not formatted correctly, it should start with http(s):// and not end in /

My conf is using the latest example:

[General] discordWebhook=https://discord.com/api/webhooks/[redacted]

[Radarr] ApiKey=[redacted] Count=10 Monitored=true MovieStatus=released TagName= Unattended=false Url=http://192.168.1.122:7878

[Radarr4K] ApiKey=[redacted] Count=10 Monitored=true MovieStatus=released TagName= Unattended=false Url=http://192.168.1.122:7879

FonduemangVI commented 1 year ago

@phishyphun are your powershell files updated to the latest version as well?

phishyphun commented 1 year ago

@phishyphun are your powershell files updated to the latest version as well?

Yes. I'm using the latest Powershell 7 version from MS:

PS C:\Users\[redacted]> winget search Microsoft.PowerShell
Name               Id                           Version Source
---------------------------------------------------------------
PowerShell         Microsoft.PowerShell         7.2.7.0 winget
PowerShell Preview Microsoft.PowerShell.Preview 7.3.8.0 winget
PS C:\Users\[redacted]> pwsh C:\linux\Upgradinatorr\upgradinatorr.ps1 -apps radarr,radarr-4k
Exception: Your URL for Radarr,Radarr-4K is not formatted correctly, it should start with http(s):// and not end in /
FonduemangVI commented 1 year ago

Ah sorry I mean the latest ps1 and psm1 file from GH

phishyphun commented 1 year ago

Ah sorry I mean the latest ps1 and psm1 file from GH

Yes went ahead and cloned again to be sure.

PS C:\Program Files\PowerShell\7> git clone "https://github.com/angrycuban13/Scripts.git" "C:\linux\"
Cloning into 'C:\linux'...
remote: Enumerating objects: 461, done.
remote: Counting objects: 100% (189/189), done.
remote: Compressing objects: 100% (113/113), done.
remote: Total 461 (delta 104), reused 126 (delta 70), pack-reused 272
Receiving objects: 100% (461/461), 119.89 KiB | 8.56 MiB/s, done.
Resolving deltas: 100% (237/237), done.
PS C:\Program Files\PowerShell\7> pwsh C:\linux\Upgradinatorr\upgradinatorr.ps1 -apps radarr,radarr-4k -verbose
VERBOSE: Loading module from path 'C:\linux\Upgradinatorr\upgradinatorr.psm1'.
VERBOSE: Exporting function 'Add-Tag'.
VERBOSE: Exporting function 'Confirm-AppConnectivity'.
VERBOSE: Exporting function 'Confirm-AppURL'.
VERBOSE: Exporting function 'Get-TagId'.
VERBOSE: Exporting function 'Read-IniFile'.
VERBOSE: Exporting function 'Remove-Tag'.
VERBOSE: Exporting function 'Search-Movies'.
VERBOSE: Exporting function 'Search-Series'.
VERBOSE: Exporting function 'Send-DiscordWebhook'.
VERBOSE: Importing function 'Add-Tag'.
VERBOSE: Importing function 'Confirm-AppConnectivity'.
VERBOSE: Importing function 'Confirm-AppURL'.
VERBOSE: Importing function 'Get-TagId'.
VERBOSE: Importing function 'Read-IniFile'.
VERBOSE: Importing function 'Remove-Tag'.
VERBOSE: Importing function 'Search-Movies'.
VERBOSE: Importing function 'Search-Series'.
VERBOSE: Importing function 'Send-DiscordWebhook'.
VERBOSE: Location for config file is C:\linux\Upgradinatorr\upgradinatorr.conf
VERBOSE: Parsing config file
VERBOSE: Config file parsed successfully
Exception: Your URL for Radarr,Radarr-4K is not formatted correctly, it should start with http(s):// and not end in /
bulfinch commented 1 year ago

Ok, I got it to work.

I went into the DEV branch and copied the code from within, upgradinator.ps1 opened the corresponding file on my NAS and pasted in the updated code.

All this because I don't know how to pull the dev branch using git clone "https://github.com/angrycuban13/Scripts.git" "/volume1/docker/upgradinatorr"

Also updated my config

angrycuban13 commented 1 year ago

@bulfinch sorry just seeing this now. The dev branch is a WIP and removes the dependency on the PSM1 file and the latest commit is very much not completed so I'd highly recommend against that.

The last merge on the main branch shouldn't be breaking anything but will need to see why the script is detecting your URL ending in / as it looks correctly formatted.

I'll try to spin up the container myself and give it a try

bulfinch commented 1 year ago

ah. so returning to the latest .ps1 still produces the error. Appreciate your time.

angrycuban13 commented 1 year ago

I can't seem to replicate your issue. Can you paste your config file on a gist and remove any sensitive data? I even threw the URLs you provided for your config through a regex check and it seems correct

Example Config

Logic Check

Linux Powershell

Container

Regex

Regex In Powershell

bulfinch commented 1 year ago

Before posting this, I deleted and redownloaded the git to make sure I hadn't done something funky and no change with this config.

https://gist.github.com/bulfinch/540bd56c1c52d05c27adb27dbe5d7ab1

bulfinch commented 1 year ago

I think it must be the version of linux docker powershell I'm using for this as the exact same config works on windows. I've tried the latest and preview versions and still same result latest is version 7.2 preview is 7.3

phishyphun commented 1 year ago

I think it must be the version of linux docker powershell I'm using for this as the exact same config works on windows. I've tried the latest and preview versions and still same result latest is version 7.2 preview is 7.3

Well, I'm trying the same thing and getting the same error on my Windows machine using Powershell.

angrycuban13 commented 1 year ago

I was going to say that it sounds like some funky Linux stuff but I'll see if I can help you figure it out

phishyphun commented 1 year ago

Here's mine:

https://gist.github.com/phishyphun/d7731c8188a8a450187228f4eac68b95

angrycuban13 commented 1 year ago

There's honestly not much to the function. Try to run it standalone and see if you get the same error

function Confirm-AppURL {
    [CmdletBinding()]
    param (
        $app,
        $url
    )

    if ($url -notmatch "https?:\/\/" -or $url.EndsWith("/")){
        throw "Your URL for $((Get-Culture).TextInfo.ToTitleCase($app)) is not formatted correctly, it should start with http(s):// and not end in /"
    }
    else {
        Write-Verbose "$((Get-Culture).TextInfo.ToTitleCase("$app")) URL confirmed"
    }
}

I'm updating to the latest PowerShell on my computer and will test, maybe something got screwed up in the latest release.

angrycuban13 commented 1 year ago

How are you running this on Windows that you are getting an error?

phishyphun commented 1 year ago

image

angrycuban13 commented 1 year ago

Ah, I see the issue. Stupid splatting - I'm merging dev into main so you guys don't need to switch branches.

angrycuban13 commented 1 year ago

Fixed by merging 2787674df812497358c78f1cdd059b6265defb58

phishyphun commented 1 year ago

Thanks. Seemed to fix it for radarr instance. However, I'm still getting this for radarr-4k:

image

phishyphun commented 1 year ago

And again, my conf:

[General]
discordWebhook=https://discord.com/api/webhooks/xxxxxxxxxxxxxxxxxx

[Radarr]
ApiKey=xxxxxxxxxxxxxxxx
Count=10
Monitored=true
MovieStatus=released
TagName=upgradinatorr
Unattended=false
Url=http://100.64.101.74:7878

[Radarr4K]
ApiKey=yyyyyyyyyyyyyyyyyyy
Count=10
Monitored=true
MovieStatus=released
TagName=upgradinatorr
Unattended=false
Url=http://100.64.101.74:7878
angrycuban13 commented 1 year ago

You are passing radarr-4k as an app instead of radarr4K.

phishyphun commented 1 year ago

Good call. We're all good to go now. I appreciate all the help!

bulfinch commented 1 year ago

Hey works for me too. Thank you much.