Jump to content

"HTML <a> download" problem when handling MIME types that should open in external application


LehA

Recommended Posts

Hi,

I'm running Linux on single-board computer as a music player connected to my old amplifier; playing radio, Youtube music and my ripped CD collection.
For several usability and maintainability reasons, I'm storing the radio channels in Firefox bookmarks as playlist files, .pls, .m3u and similar.
Firefox is configured to automatically open those files in Audacious, that I'm also using to play ripped CDs. My bookmark thus contains links like
    http://s6.onweb.gr:8054/listen.pls

Unfortunately there are also some radio channels that will open (but are not automatically played) in Firefox instead of Audacious when opened from bookmarks, like
    https://stream.rcs.revma.com/0btynq5r4a0uv
This makes radio selection inconvenient when there can be two radios playing simultaneously when selecting a new channel. I have solved that by creating playlist files of those files using Audacious, and stored them to my web page space given by my ISP, like
    http://www.example.com/me/playlists/playlist.pls

Because Firefox only stores download history of 60 days, and opening a pls is handled as download, I'm missing "Last time listened" (Last visit) information from the history in 60 days. That's why I'm now creating a small html page, that automatically opens the pls, and thus stays in history as long as any other web page.

This is where my problem appears. I'm using "HTML <a> download" to start listening the pls file given as URL parameter, like
    http://www.example.com/me/open.html?q=<pls file>

This works fine when I open link containing "external" files like following, music starts playing normally
    http://www.example.com/me/open.html?q=http://s6.onweb.gr:8054/listen.pls


But if I'm opening link that is internal to my own web page space,
    http://www.example.com/me/open.html?q=http://www.example.com/me/playlists/playlist.pls
Firefox always asks me if I want to save or open the playlist. Even the "Do this automatically for files like this from now on" checkbox is selected in the view, but still Firefox does not honor that selection.

Referring the exact same HTML file located to the exact same place using FTP plays the same PLS file without extra dialogs
    file:///run/user/ME/gvfs/ftp:host=www.example.com,user=me/open.html?q=http://www.example.com/me/playlist.pls

Using local copy of the html also plays the pls as expected
    file:///open.html?q=http://www.example.com/me/playlist.pls

Is there any standard way to handle file according to it's MIME type without additional dialogs when both code (HTML) and file to download (PLS) are at the same web page - in this case automatically download and open using Audacious? Or is the only way to handle this keep the files on different addresses? I don't like to use the "file://" versions because I want to have OS-independent bookmarks.

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
×
×
  • Create New...