please help creating an update script

Get help with all aspects of SABnzbd
Forum rules
Help us help you:
  • Are you using the latest stable version of SABnzbd? Downloads page.
  • Tell us what system you run SABnzbd on.
  • Adhere to the forum rules.
  • Do you experience problems during downloading?
    Check your connection in Status and Interface settings window.
    Use Test Server in Config > Servers.
    We will probably ask you to do a test using only basic settings.
  • Do you experience problems during repair or unpacking?
    Enable +Debug logging in the Status and Interface settings window and share the relevant parts of the log here using [ code ] sections.
Droyellis
Newbie
Newbie
Posts: 18
Joined: March 21st, 2022, 3:36 pm

please help creating an update script

Post by Droyellis »

hi all

I'm creating a python script on windows that will download the portable zip version and extract it to a neutral folder name (without version numbers), in place of the folder I have it running from.

I pretty much had everything working the way I wanted it until I realized the web link will always point to version 4.1.0 :(

is there a weblink that will always point to the latest portable release?
User avatar
sander
Release Testers
Release Testers
Posts: 9264
Joined: January 22nd, 2008, 2:22 pm

Re: please help creating an update script

Post by sander »

Do you use github, or sabnzbd.org?

On github:

https://github.com/sabnzbd/sabnzbd/releases/latest
which now will lead to
https://github.com/sabnzbd/sabnzbd/releases/tag/4.1.0

which contains the files.

Ah: https://api.github.com/repos/sabnzbd/sa ... ses/latest is better / more technical, and gives what you want:

Code: Select all

$ lynx --dump https://api.github.com/repos/sabnzbd/sabnzbd/releases/latest | tr '"' '\n' | grep -i download | grep github
https://github.com/sabnzbd/sabnzbd/releases/download/4.1.0/README.mkd
https://github.com/sabnzbd/sabnzbd/releases/download/4.1.0/SABnzbd-4.1.0-osx.dmg
https://github.com/sabnzbd/sabnzbd/releases/download/4.1.0/SABnzbd-4.1.0-src.tar.gz
https://github.com/sabnzbd/sabnzbd/releases/download/4.1.0/SABnzbd-4.1.0-win-setup.exe
https://github.com/sabnzbd/sabnzbd/releases/download/4.1.0/SABnzbd-4.1.0-win32-bin.zip
https://github.com/sabnzbd/sabnzbd/releases/download/4.1.0/SABnzbd-4.1.0-win64-bin.zip




On https://sabnzbd.org/downloads


Code: Select all

$ lynx --dump https://sabnzbd.org/downloads | grep /download/ | grep -vi -e alpha -e beta
  20. https://github.com/sabnzbd/sabnzbd/releases/download/4.1.0/SABnzbd-4.1.0-win-setup.exe
  21. https://github.com/sabnzbd/sabnzbd/releases/download/4.1.0/SABnzbd-4.1.0-win64-bin.zip
  22. https://github.com/sabnzbd/sabnzbd/releases/download/4.1.0/SABnzbd-4.1.0-win32-bin.zip
  23. https://github.com/sabnzbd/sabnzbd/releases/download/4.1.0/SABnzbd-4.1.0-osx.dmg
  24. https://github.com/sabnzbd/sabnzbd/releases/download/4.1.0/SABnzbd-4.1.0-src.tar.gz
Droyellis
Newbie
Newbie
Posts: 18
Joined: March 21st, 2022, 3:36 pm

Re: please help creating an update script

Post by Droyellis »

this is the link i was using:
https://github.com/sabnzbd/sabnzbd/rele ... 64-bin.zip

so your first link takes me to the GitHub page where I'd need to somehow have the right zip file selected, and that zip file will always have a newer filename with the version number.

the better link you provided opens up a wall of text, I tried looking through the links but they all seem to point directly to version 4.1.0

I'm on windows so cant use grep :(
User avatar
safihre
Administrator
Administrator
Posts: 5580
Joined: April 30th, 2015, 7:35 am
Contact:

Re: please help creating an update script

Post by safihre »

On Windows it's a bit difficult.. All kind of magic possible with grep. But not sure how to do it on Windows.
If you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate
Droyellis
Newbie
Newbie
Posts: 18
Joined: March 21st, 2022, 3:36 pm

Re: please help creating an update script

Post by Droyellis »

most linux distros would have a repo or an app image, so kinda pointless. would building self/auto update into sabnzbd be a possible thing? would running it from source be a better option? would i be able to script / automate the update process???
User avatar
sander
Release Testers
Release Testers
Posts: 9264
Joined: January 22nd, 2008, 2:22 pm

Re: please help creating an update script

Post by sander »

to me, https://api.github.com/repos/sabnzbd/sa ... ses/latest looks like JSON.

So parse it as JSON!

A few lines op python3 code:

Code: Select all

import urllib.request, json
myurl = "https://api.github.com/repos/sabnzbd/sabnzbd/releases/latest"
with urllib.request.urlopen(myurl) as url:
    data = json.load(url)
    for j in data['assets']:
    	print(j["browser_download_url"])
which gives

Code: Select all

$ python3 bla2.py  
https://github.com/sabnzbd/sabnzbd/releases/download/4.1.0/README.mkd
https://github.com/sabnzbd/sabnzbd/releases/download/4.1.0/SABnzbd-4.1.0-osx.dmg
https://github.com/sabnzbd/sabnzbd/releases/download/4.1.0/SABnzbd-4.1.0-src.tar.gz
https://github.com/sabnzbd/sabnzbd/releases/download/4.1.0/SABnzbd-4.1.0-win-setup.exe
https://github.com/sabnzbd/sabnzbd/releases/download/4.1.0/SABnzbd-4.1.0-win32-bin.zip
https://github.com/sabnzbd/sabnzbd/releases/download/4.1.0/SABnzbd-4.1.0-win64-bin.zip
... and there you have it. You want the win64-zbin.zip ... so get it!
Droyellis
Newbie
Newbie
Posts: 18
Joined: March 21st, 2022, 3:36 pm

Re: please help creating an update script

Post by Droyellis »

thanks heaps for that, its a good start. how would i automate the download of the latest win64-bin.zip regardless of listed version number?
User avatar
sander
Release Testers
Release Testers
Posts: 9264
Joined: January 22nd, 2008, 2:22 pm

Re: please help creating an update script

Post by sander »

Droyellis wrote: November 9th, 2023, 6:22 pm thanks heaps for that, its a good start. how would i automate the download of the latest win64-bin.zip regardless of listed version number?
In your OP you said "I pretty much had everything working the way I wanted it until I realized the web link will always point to version 4.1.0", so I'm surprised by your question.

I'm not going to do all the work for you.
Droyellis
Newbie
Newbie
Posts: 18
Joined: March 21st, 2022, 3:36 pm

Re: please help creating an update script

Post by Droyellis »

and yet the new web link still points to version 4.1.0, we're still at square one.

I asked for help, you didn't have to... "help"

I understand that script will always parse the latest results, I'd still need code to process newer links with newer version numbers. I'll start figuring out how to use json, you don't have to help if you don't want to.

just so I know for sure tho, this is the general help section isn't it?
User avatar
sander
Release Testers
Release Testers
Posts: 9264
Joined: January 22nd, 2008, 2:22 pm

Re: please help creating an update script

Post by sander »

Droyellis wrote: November 9th, 2023, 8:48 pm and yet the new web link still points to version 4.1.0, we're still at square one.
Oh? I thought you wanted the current version, which is version 4.1.0?
Droyellis
Newbie
Newbie
Posts: 18
Joined: March 21st, 2022, 3:36 pm

Re: please help creating an update script

Post by Droyellis »

No I want a link in the script to always download the latest version. So that when 4.2 is released my script will update
User avatar
sander
Release Testers
Release Testers
Posts: 9264
Joined: January 22nd, 2008, 2:22 pm

Re: please help creating an update script

Post by sander »

Droyellis wrote: November 10th, 2023, 1:01 am No I want a link in the script to always download the latest version. So that when 4.2 is released my script will update
And what do you think that https://api.github.com/repos/sabnzbd/sa ... ses/latest will yield as soon as 4.2 is there?
Droyellis
Newbie
Newbie
Posts: 18
Joined: March 21st, 2022, 3:36 pm

Re: please help creating an update script

Post by Droyellis »

A new WebLink with the number 4.2.0 in it, my script would still download version 4.1.0
User avatar
sander
Release Testers
Release Testers
Posts: 9264
Joined: January 22nd, 2008, 2:22 pm

Re: please help creating an update script

Post by sander »

I see. Maybe you can wait until 4.2.0 appears, and then verify your hypothesis / assumption?
Droyellis
Newbie
Newbie
Posts: 18
Joined: March 21st, 2022, 3:36 pm

Re: please help creating an update script

Post by Droyellis »

https://github.com/sabnzbd/sabnzbd/rele ... 64-bin.zip

Have a good look at this link, and think about what it's going to download, compare it with previous versions if you like...

here's the exact same link for version 2.0.0

https://github.com/sabnzbd/sabnzbd/rele ... 64-bin.zip

it still downloads version 2.0.0
Post Reply