The My Opera forums have been replaced with forums.opera.com. Please head over there to discuss Opera's products and features

See the new Forums

Winamp and links to mp3

Forums » General Opera topics » Opera extensions

You need to be logged in to post in the forums. If you do not have an account, please sign up first.

Go to last post

2. December 2011, 05:31:14

Alfa2male

Posts: 16

Winamp and links to mp3

Hi.

I just tried to make it simply with opera downloads settings but unfortunately sad

Please, help me to figure out, how can I:
1. Catch the clicked link or link in page with mp3 file inside (not only with .mp3-extension);
2. Copy full direct url to mp3;
3. Open it by Winamp with `winamp.exe /ADD %s`.

OR

1. Same as above;
2. Same as above;
3. Create new virtual file and paste url to it. File must be correct m3u playlist file;
4. When user makes some action, this virtual playlist file is giving to user for download;
5. He can save it on the disk or open it with winamp by default action.

The second approach is preffered.

Please, give me some solution. At least for 3-5 in second approach.

5. December 2011, 23:19:03

spadija

Posts: 1643

I'm not entirely sure what you're trying to do, but you should be able to send the URL of a link directly to an application by using "Open with other application" and checking the "Pass web address directly to application" box. Then, if you enter the command you gave above as the program to run, it will send the URL of the file instead of downloading the file. You may need to use the full path to Winamp.

6. December 2011, 17:45:37

Alfa2male

Posts: 16

I mean, how can I make playlist-file on memory and then call opera download dialog with that virtual file?
Winamp can't eat virtual files and I need physical temporary file on disk. How can I do all of that things?

Create temporary file;
Append lines with URLs in playlist format to this file;
Save it;
Force download dialog.

More complicated for me is to make the temp file and force download acton.

All of this things must be made as opera extension.

6. December 2011, 18:36:21

spadija

Posts: 1643

If you want an extension, you may be out of luck. Extensions cannot write to files on your disk, nor can they manage downloads. It is possible for an extension to build a file as a data URI and open the generated file in a new tab. It cannot force a download on this file unless your download setting for the file type is set to open automatically. Extensions cannot handle downloads, nor can they change context menus though, so I do not know how you would send a link to such an extension.

7. December 2011, 06:47:20

Alfa2male

Posts: 16

I think that I can make virtual file, collect strings to it and then give that virtual file to user. In case of user's download settings he'll get the file and while it downloading the temporary file will be created (cache), right?

Then how the extension can give the file to user?

Offtopic: thank you for great Tab Vault extension! I am your fan wink

7. December 2011, 18:35:09

spadija

Posts: 1643

Thanks!

The temporary file won't really get cached. It would just get opened in a new tab just as if you had opened a link to a .zip file (or anything else) in a new tab. To serve the file, the extension would do something like this (assuming the playlist is an m3u file):

//build the data uri
var mimeType = 'audio/x-mpegurl';
var datauri = 'data:' + mimeType + ';' + playlistData;
// serve the file
opera.extension.tabs.create({ url: datauri, focused: false });

9. December 2011, 03:31:26

Alfa2male

Posts: 16

oh, you mean that...
I've forgot about data-encoding by mime-types.
Thank you!

Is there any step-by-step example how to make, write and design extensions from beginning to adding to repo?

9. December 2011, 18:39:19

spadija

Posts: 1643

dev.opera.com has all the articles you're looking for, though it looks like they've mixed the documentation in with the example articles so things are a little harder to find. The quick documentation overview page is probably a good place to start, and there's a specific Dev.Opera forum for questions about developing extensions too if you want to ask a question.

Also, I use this method in Tab Vault to export session and bookmarks files of the stored tabs, so you can check out my code on github here. (That script also contains the .win and .adr file parsing code. The functions you're interested in are session.write and session.writeAdr.)

11. December 2011, 06:37:57

Alfa2male

Posts: 16

Very huge thanks to you, good man!
I think, that your help and solutions can help me make all my ideas real.
Thank you again for your help.

Forums » General Opera topics » Opera extensions