RE: How to get information from the download manager?
RE: How to get information from the download manager?
- Subject: RE: How to get information from the download manager?
- From: Manish Padmajan <email@hidden>
- Date: Thu, 30 Jun 2005 09:52:22 +0530
Hi Dev,
Yes I am referring to Safari's download manager.
I wanted to get the information of the downloaded items from the download
manager.
As you mentioned Safari does store the download history in
"~/Library/Safari/Downloads.plist" file.
But one thing I noticed is Safari doesn't update the Downloads.plist file
with the download history till Safari is open. Once Safari is closed, the
history is written to the Downloads.plist file.
I wanted to know is there any way out to get the download information
without closing Safari.
Thanks.
With rgds,
pmanish
-----Original Message-----
From: SA Dev [mailto:email@hidden]
Sent: Wednesday, June 29, 2005 7:22 PM
To: SA Dev
Cc: Manish Padmajan; 'email@hidden'
Subject: Re: How to get information from the download manager?
As a followup, a few thoughts. First, this *only* gives you the
download history for Safari. If the user used another browser, it
obviously won't show up here. If this is *only* a Safari-related
task, you should be fine.
Also, for a 'live' view, you'd probably want to use Uli's UKKQueue
to monitor it (the .plist file) for changes. He just posted an update
to it a few messages ago, but if you want your app to update when a
new download is put into this plist, you'll need a way of monitoring
the file for changes (which is what UKKQueue is all about). Any time
the file changes, you'll need to reload the plist file to see the
changes.
Finally, I forgot to mention how you'd use the plist file. In this
particular circumstance (for the downloads file), you'll want to load
it as a dictionary.
NSDictionary * downloadsDict = [NSDictionary
dictionaryWithContentsOfFile:[@"~/Library/Safari/Downloads.plist"
stringByStandardizingPath]];
This code assumes the file exists. You'll want to error check to
make sure downloadsDict is not nil (if it's nil, the file failed to
load and you have no dictionary). Also, hard-coding the path probably
isn't 'best-practice', but it'll get the job done.
Finally, this was typed from memory. I'm using a company computer
today and don't have my Cocoa references handy. List, please check
the above and comment for accuracy. ;-)
On Jun 29, 2005, at 9:38 AM, SA Dev wrote:
> Manish:
>
> Are you referring to Safari's download manager? If so, you might
> try looking at the file: ~/Library/Safari/Downloads.plist ... this
> is the file Safari uses to track the download history.
>
>
>
>
> On Jun 29, 2005, at 9:30 AM, Manish Padmajan wrote:
>
>
>>
>>
>>
>> Hi All,
>>
>>
>>
>> I wanted to get information about the downloaded items from the
>> download
>> manager.
>>
>> Are there any specific API's (cocoa / carbon) for doing the same?
>>
>>
>>
>> Thanks.
>>
>>
>>
>> With rgds,
>>
>> pmanish
>>
>>
>>
>> This message is free from Virus - IMSS
>> <image001.gif>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Cocoa-dev mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>> 40silentalcove.net
>>
>> This email sent to email@hidden
>>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> 40silentalcove.net
>
> This email sent to email@hidden
>
This message is free from Virus - IMSS
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden