Jump to content
Ketarin forum

Finding out download filename components


appyface
 Share

Recommended Posts

I think I just cannot accomplish this with Ketarin today, but if that's wrong please move topic to General Discussion... thanks!

 

I have a download where the name of the downloaded file is a generic one. I can scrape a version number from somewhere on the site to add to the output filename. All this is working as it should.

 

Here's my issue. There is just no place on the site where I can determine what the downloaded filename is going to be. Add to that, sometimes the file served is a self-extracting ZIP file, other times it is an EXE. The 'generic' name portion varies a bit from release to release too.

 

Right now I have Ketarin hard-coded to download to a file called myfilename_{vers}.exe

(path portion omitted in example)

 

This obviously does not provide the actual generic base filename portion and also does not name it with .ZIP if that is how the file was served.

 

Is it possible to provide built in variables for the base filename (w/o extension), and file extension portions of the download name? I can then easily construct my output filename something like {basename}_{vers}.{ext}

 

Alternately perhaps allow for a regex to be applied on the builtin variable {file} (which would have to be available other than for commands)?

 

Any thoughts on how to solve this one easily?

 

Thanks and regards,

--appyface

Link to comment
Share on other sites

From paragraph 3 of my post:

 

>>>Here's my issue. There is just no place on the site where I can determine what the downloaded filename is going to be

 

I can't scrape the info from this site. It is flat out not available. The download URL does not contain the eventual filename at all, it is a redirect which works fine in Ketarin as far as using it for a download URL.

 

I tried loading it into Ketarin for scraping a variable but Ketarin cannot do that, it ends up trying to download the file from within the variable definition which seems to cause all sorts of havoc.

 

So again my question: How I can find out the actual base filename and extension being served to Ketarin as a result of the download URL I provided?

 

--appyface

Link to comment
Share on other sites

Yes that is right, Ketarin takes the URL I have given, comes up with the correct download URL, and can download the file.

 

Currently I am hard-coding the base portion of the filename and the extension into my download filename, because I cannot get this info from the site. This is often the wrong filename but more importantly, is the wrong file extension, since I have no way of knowing in advance whether I am going to get a .exe or a .zip.

 

My personal naming convention always puts the version at the end of the basefilename portion of the downloaded file. So for me just having access to the basefilename separate from the file extension, is good enough. If Ketarin can give me {basename} and {ext}, then I can build {basename}_{vers}.{ext} just as you mentioned, because I *can* scrape the version info I want.

 

Most flexible would be to allow variables to access and scrape from the determined download path and filename using regex or selection start/end as the current variable function can do. But how difficult to implement?

 

--appyface

Edited by appyface
Link to comment
Share on other sites

>>>your last idea sounds to complicated to me.

 

It does to me too, but just in case it did turn out to be easy :-) no harm in asking!

 

Thanks for providing the pieces of the determined download URL's file. I have several downloads where I'm scraping those pieces because they ARE available on a page somewhere. Now I won't have to do that for any of my downloads :-)

 

Thanks as always,

--appyface

Link to comment
Share on other sites

See my post in my other thread, 'Ketarin 0.9.9.11 old version?'... I just downloaded and got a file named Ketarin-0.9.9.13.zip, but inside there the 'about' shows '12' not '13'. I also just tried {basename} and {ext} but they didn't substitute, and I can't find the 'don't update URL' checkbox mentioned in the other thread.

 

???

 

Thanks and regards,

--appyface

Link to comment
Share on other sites

I still don't have the 'don't update URL's' pop-up... when does that come up?

 

The new variables do work, thank you. The new log file is great, too. Would you consider adding the new variables' substitution process in the log file also? Currently only the scrape variables are shown.

 

Thanks and regards,

--appyface

 

EDIT: The new variables' substitution is already shown in the log file, but only if an update is required. Could we see the substitution process even if no update will be performed?

Edited by appyface
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.