Thread overview
[std.net.curl] Downloading multiple files using download()
Dec 28, 2014
Jack
Dec 28, 2014
ketmar
Dec 28, 2014
Jack
Dec 28, 2014
ketmar
Dec 28, 2014
Jack
Dec 28, 2014
ketmar
Dec 28, 2014
Jack
Dec 28, 2014
ketmar
Dec 28, 2014
Jack
December 28, 2014
I'm trying to create a sort of "downloader" where it will download multiple pages of "comics" which are in ".jpg" format. Now the problem is, that when I used the "download() function":
>download(url, location);
Where:
url = direct link to the image
location = "/downloads/" ~ to!string(x) ~ ".jpg"; (x is the page number)

It would spew out an error code:
> std.stream.OpenException@std/stream.d(50): Cannot open or create file >'/downloads/1.jpg'

I dug around to see that nothing but the documentation page has an example for this, but unfortunately it was only for one file.

So can anyone help me?

Note: I can't get the url here since the url is a little bit "NSFW"
December 28, 2014
On Sun, 28 Dec 2014 06:14:09 +0000
Jack via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com> wrote:

> I'm trying to create a sort of "downloader" where it will download multiple pages of "comics" which are in ".jpg" format. Now the problem is, that when I used the "download() function":
> >download(url, location);
> Where:
> url = direct link to the image
> location = "/downloads/" ~ to!string(x) ~ ".jpg"; (x is the page
> number)
> 
> It would spew out an error code:
> > std.stream.OpenException@std/stream.d(50): Cannot open or create file >'/downloads/1.jpg'
> 
> I dug around to see that nothing but the documentation page has an example for this, but unfortunately it was only for one file.
> 
> So can anyone help me?
> 
> Note: I can't get the url here since the url is a little bit "NSFW"
you are trying to write the file to "/download" directory, that obviously doesn't exist.

`url` arg is the FULL url -- the one that you'll pass to wget to download the picture. and `location` is the DISK location of the resulting file (i.e. the file that will be created). as you are passing the absolute path for it, it starts searching from the root directory.

now remove that pesky '/' at the start of the `location` and give us the link, as NSFW comics are specially good at sundays! ;-)


December 28, 2014
On Sunday, 28 December 2014 at 06:26:18 UTC, ketmar via Digitalmars-d-learn wrote:
> On Sun, 28 Dec 2014 06:14:09 +0000
> Jack via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com> wrote:
>
>> I'm trying to create a sort of "downloader" where it will download multiple pages of "comics" which are in ".jpg" format. Now the problem is, that when I used the "download() function":
>> >download(url, location);
>> Where:
>> url = direct link to the image
>> location = "/downloads/" ~ to!string(x) ~ ".jpg"; (x is the page number)
>> 
>> It would spew out an error code:
>> > std.stream.OpenException@std/stream.d(50): Cannot open or create file >'/downloads/1.jpg'
>> 
>> I dug around to see that nothing but the documentation page has an example for this, but unfortunately it was only for one file.
>> 
>> So can anyone help me?
>> 
>> Note: I can't get the url here since the url is a little bit "NSFW"
> you are trying to write the file to "/download" directory, that
> obviously doesn't exist.
>
> `url` arg is the FULL url -- the one that you'll pass to wget to
> download the picture. and `location` is the DISK location of the
> resulting file (i.e. the file that will be created). as you are passing
> the absolute path for it, it starts searching from the root directory.
>
> now remove that pesky '/' at the start of the `location` and give us
> the link, as NSFW comics are specially good at sundays! ;-)

As much as my brotherhood senses push me into revealing the links(they're in json), doing that will reveal my guilty pleasures and fetishes. Well, anywho, thanks for that. I appreciate it.
December 28, 2014
On Sun, 28 Dec 2014 06:51:14 +0000
Jack via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com> wrote:

> As much as my brotherhood senses push me into revealing the links(they're in json), doing that will reveal my guilty pleasures and fetishes. Well, anywho, thanks for that. I appreciate it.
ah, 'cmon, nobody knows that you are you here! besides, you can sign as "Jack the Knife", for example. we will never realise that this is your alter-ego!


December 28, 2014
On Sunday, 28 December 2014 at 06:59:02 UTC, ketmar via Digitalmars-d-learn wrote:
> On Sun, 28 Dec 2014 06:51:14 +0000
> Jack via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com> wrote:
>
>> As much as my brotherhood senses push me into revealing the links(they're in json), doing that will reveal my guilty pleasures and fetishes. Well, anywho, thanks for that. I appreciate it.
> ah, 'cmon, nobody knows that you are you here! besides, you can sign as
> "Jack the Knife", for example. we will never realise that this is your
> alter-ego!

Well it's not really that much of a link really. I swear.
It's just like fapping to drawings or some sort of thing.
Not really THAT good of a comic. *sweats*
December 28, 2014
On Sun, 28 Dec 2014 07:24:53 +0000
Jack via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com> wrote:

> Well it's not really that much of a link really. I swear. It's just like fapping to drawings or some sort of thing. Not really THAT good of a comic. *sweats*
so that's not one of that stories where everyone dies right at the first page? no napalm and burning mechas? ah, nevermind, that was one of my perverted dreams...


December 28, 2014
On Sunday, 28 December 2014 at 07:33:23 UTC, ketmar via Digitalmars-d-learn wrote:
> On Sun, 28 Dec 2014 07:24:53 +0000
> Jack via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com> wrote:
>
>> Well it's not really that much of a link really. I swear.
>> It's just like fapping to drawings or some sort of thing.
>> Not really THAT good of a comic. *sweats*
> so that's not one of that stories where everyone dies right at the
> first page? no napalm and burning mechas? ah, nevermind, that was one
> of my perverted dreams...

Replace napalm with mayonaise and mechas with octopus "legs".

Oh anyway, mind answering one more question?

How does one compile for Windows on a Linux Machine using dub? I've been using the "platform" : ["windows"]" configuration in my dub.json to no avail since my Windows installation keeps on screaming out compatibility problems.
December 28, 2014
On Sun, 28 Dec 2014 07:44:33 +0000
Jack via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com> wrote:

> How does one compile for Windows on a Linux Machine using dub? I've been using the "platform" : ["windows"]" configuration in my dub.json to no avail since my Windows installation keeps on screaming out compatibility problems.
i don't think that you can do cross-developement with dub now. i believe that the best thing you can do is to run dub.exe and dmd.exe with wine. yet the last time i checked (that was a while ago) dmd.exe with wine was able to produce only segfaults.

yet i'm not an expert in both dub and windows, so i don't really know. i think that cross-developmenet question worth a separate topic.


December 28, 2014
On Sunday, 28 December 2014 at 07:52:24 UTC, ketmar via Digitalmars-d-learn wrote:
> On Sun, 28 Dec 2014 07:44:33 +0000
> Jack via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com> wrote:
>
>> How does one compile for Windows on a Linux Machine using dub? I've been using the "platform" : ["windows"]" configuration in my dub.json to no avail since my Windows installation keeps on screaming out compatibility problems.
> i don't think that you can do cross-developement with dub now. i
> believe that the best thing you can do is to run dub.exe and dmd.exe
> with wine. yet the last time i checked (that was a while ago) dmd.exe
> with wine was able to produce only segfaults.
>
> yet i'm not an expert in both dub and windows, so i don't really know.
> i think that cross-developmenet question worth a separate topic.

Well that's a shame then. Thanks for the help ketmar.