Remove this ad

Lead

May 7 13 12:39 AM

Tags : :

It feels pointless, counter-intuitive, and strange for aMule to only let users open/preview video files. (And I do mean to mention both previewing and opening. For example, it should be possible to get a list of a zip file's contents as long as the first chunk and last chunk have been downloaded.)

It'd be much better to simply let the user's default file-type associations figure it out.

It's been a long time since I've used wxWidgets and only via wxPython, but I believe this is the basic code you'd want:

[code]#ifdef __WXMSW__
#define EXEC_CMD "start"
#elif defined __WXOSX__
#define EXEC_CMD "open"
#else
#define EXEC_CMD "xdg-open"
#endif

#include

wxExecute([EXEC_CMD, path_to_file, NULL])
[/code]

There's sample code for doing this in the Exec sample.

This also has the advantage that passing an argv array will ensure that quoting filenames containing spaces or quote characters isn't a problem.

The current implementation required me to wrap %PARTFILE in quotes and pray I never download a file with the same kind of quotes in the filename.
Quote    Reply   
Remove this ad
Remove this ad

#1 [url]

May 9 13 10:58 AM

Re: Allow preview/open of any kind of file from within aMule

This won't work for ongoing downloads (because the file is named .part).
And for finished files just use your explorer/nautilus/whatever.

Quote    Reply   

#2 [url]

May 9 13 6:01 PM

Re: Allow preview/open of any kind of file from within aMule

StuRedman wrote:
This won't work for ongoing downloads (because the file is named .part).
And for finished files just use your explorer/nautilus/whatever.


Point. When I'm not so horrendously overworked, would you accept a patch that does one or both of these two things?


  • If the file is completed, does what I already said.[/*:m]
  • On X11-based platforms, uses the "file" command to look up the mimetype by header, then manually resolves the mimetype to a command to use. (I don't know enough about Windows or MacOS to look up a file association the manual way.)[/*:m]


I've already explained my reasons for not considering the file manager adequate in my comment on the request for an "open" option in Shared Files. (It's awkward and, when two or more files have very similar names, quite error prone.)

Quote    Reply   

#3 [url]

May 9 13 11:24 PM

Re: Allow preview/open of any kind of file from within aMule

Autorunning a random file downloaded from very untrusty source is a great way to get trojaned. You know, your OS might be intelligent (and stupid) enough to determine, "hey, this file called hotchick.jpg is actually a perl script, so let's just execute it instead of running the picture viewer".

And regarding partial files - most apps barf on partially completed downloads. VLC being an exception, but video preview is what we already have.

Quote    Reply   

#4 [url]

May 10 13 1:53 AM

Re: Allow preview/open of any kind of file from within aMule

StuRedman wrote:
Autorunning a random file downloaded from very untrusty source is a great way to get trojaned. You know, your OS might be intelligent (and stupid) enough to determine, "hey, this file called hotchick.jpg is actually a perl script, so let's just execute it instead of running the picture viewer".

And regarding partial files - most apps barf on partially completed downloads. VLC being an exception, but video preview is what we already have.


Makes sense. I was actually thinking of either a hard requirement for the first and last chunks to be available or a mimetype whitelist but both would be even better. (I considered looking up the mimetype by extension but, if the first chunk isn't present, even MPlayer is liable to get confused about what filetype it's dealing with.)

It's been my experience that, as long as the first and last chunks are present, a surprising number of formats can return useful information without being complete.

For example, video and audio aside, zip files store their directory record at the end of the file, so you can get pretty much all the metadata you could ever want from a partial.

Still, I suppose that is getting a little involved.

Quote    Reply   
Add Reply

Quick Reply

bbcode help