-
-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Positive Look Behind Question #34
Comments
Go doesn't seem to support lookarounds |
I think I got it to work correctly with the config below. However it is not showing up in the GUI as up to date, but as no successful query even though the data is in config.xml and matches. Tried it in incognito mode to rule out browser cache. Stopped and restarted the container. Removed and readded the container also. Very odd to me. config.xml
|
So that regex fails with what's returned by the HTTP query. Turning the log level up to DEBUG, you can see that no spaces are returned in the JSON, so the |
Ah, that you can fix by making the type ( |
Using regex_submatch gives me 3.0.8.1507 from v3-stable which is the first occurrence of the word version. I needed to use regex with index of 1 to get to the second match for v3-nightly. http://services.sonarr.tv/v1/releases I think the quickest path will be to write a bash script to curl the page, pull out what is needed, dump it to a text file, host it on a local web server, and get the latest version from there in Argus. Just have cron update it once an hour. |
Ah, the exact use-case for this regex command! The quickest solution would be to use your original regex url_command, then add another one that filters on that regex url_commands:
- type: regex
regex: \"version\":\s?\"[0-9.]+\"
index: 1
- type: regex_submatch
regex: ([0-9.]+) gives me the nightly version ❯ ./argus -config.file test.yml -test.service Sonarr/Sonarr
INFO: Testing (Sonarr/Sonarr),
INFO: Sonarr/Sonarr, Latest Release - "3.0.8.1519" (found that omitting the index causes a crash. I'll fix that! I remember adding a catch on start-up that told you it was missing at some point, but looks like I removed it for some reason. Probably when I was thinking of merging |
This PR fixes that index issue btw |
Yes, that did work. Didn't realize they could be stacked. That is a game changer. I have 5 apps working now. Looks like you added the discussion board. I could add them to the show and tell section if that would be of value. |
Perfect! |
Just added what I have so far. |
@JosephKav I noticed today Sonarr stopped working. When I have semantic versioning set to false I get:
If I comment it out, I then get:
So it seems like the regex is working as it is finding the right version of 3.0.8.1520. This worked yesterday. Possibly one of the updates is impacting this? Current config.xml
|
Hmm, It looks like maybe you're just missing the ❯ ./argus -test.service Sonarr/Sonarr
INFO: Testing (Sonarr/Sonarr),
ERROR: Sonarr/Sonarr, failed converting "3.0.8.1520" to a semantic version. If all versions are in this style, consider adding url_commands to get the version into the style of 'MAJOR.MINOR.PATCH' (https://semver.org/), or disabling semantic versioning (globally with defaults.service.semantic_versioning or just for this service with the semantic_versioning var)
ERROR: Testing (Sonarr/Sonarr), No version matching the conditions specified could be found for "Sonarr/Sonarr" at "http://services.sonarr.tv/v1/releases"
❯ nano config.yml - disable progressive_versioning
❯ ./argus -test.service Sonarr/Sonarr
INFO: Testing (Sonarr/Sonarr),
INFO: Sonarr/Sonarr, Latest Release - "3.0.8.1520"
❯ nano config.yml - remove the ? from the regex
❯ ./argus -test.service Sonarr/Sonarr
INFO: Testing (Sonarr/Sonarr),
ERROR: Testing (Sonarr/Sonarr), No version matching the conditions specified could be found for "Sonarr/Sonarr" at "http://services.sonarr.tv/v1/releases" and btw, that second url_command can be removed once you add the |
Yup. Guess I just cannot wrap my head around why the Also commented out the second regex and it works as expected. |
This issue with the RegEx is that the spaces that appear in our browsers aren't there if you curl the url or when |
❯ curl https://services.sonarr.tv/v1/releases
{"v3-stable":{"releaseChannel":"v3-stable","majorVersion":3,"status":"supported","version":"3.0.8.1507", Using the stable version, the string we'll do the RegEx on is Up to |
I am getting an error using a positive look behind. It works at https://regex101.com/. I tried various escapes for the
?
and<
. Any ideas?Logs
Regex
The text was updated successfully, but these errors were encountered: