rejetto forum

Software => HFS ~ HTTP File Server => F.A.Q.s => Topic started by: est on July 07, 2009, 10:57:55 AM

Title: m3u or rss templates for HFS (customize MIME needed)
Post by: est on July 07, 2009, 10:57:55 AM
Hi all,

I need to share a folder in dir listing mode, as well as .m3u or rss podcast feeds,

I tried to edit the template to make the output looks like .m3u or rss, but some media player seems having a trouble parsing the MIME. Is there a way to define MIME in HFS template? Or more advanced, customize a HTTP header?

Or why not HFS provide a way of multiple views of dir listing, like

normal dir listing: http://127.0.0.1/mp3/
m3u for current dir: http://127.0.0.1/mp3/:m3u
m3u for .mp3 files only: http://127.0.0.1/mp3/:m3u?filter=*.mp3

currently I am using a mongoose+python script (http://www.donationcoder.com/Forums/bb/index.php?topic=19080.msg170908#msg170908) to do this, I really HFS could provide such a funtion directly
Title: Re: .m3u or rss templates for HFS (customize MIME needed)
Post by: rejetto on July 07, 2009, 11:37:43 AM
> Is there a way to define MIME in HFS template?

switch to expert mode
menu > other options > mime types

> Or more advanced, customize a HTTP header?

in HFS 2.3 you can use command {.add header.}
refer official documentation for details
Title: Re: .m3u or rss templates for HFS (customize MIME needed)
Post by: est on July 07, 2009, 01:37:36 PM
> Is there a way to define MIME in HFS template?

switch to expert mode
menu > other options > mime types

> Or more advanced, customize a HTTP header?

in HFS 2.3 you can use command {.add header.}
refer official documentation for details

thanks rejetto

place this filelist.tpl under the same dir as hfs242.exe,

Code: [Select]
#EXTM3U
%files%
[style]

[files]
{.mime|audio/x-mpegurl.}

%list%

[file]
%item-url%

[folder]
%item-name%/

http://localhost/mp3/~files.lst.m3u

works great!
Title: Re: .m3u or rss templates for HFS (customize MIME needed)
Post by: Mijo on October 19, 2010, 08:46:40 AM
I made some modifications, to support both normal lists and m3u files.

I added conditional statements which recognize a new GET parameter "filetype". If it is there, and its value is "m3u", then a .m3u file is generated.

filelist.tpl
Code: [Select]
{.if|{.=|{.urlvar|filetype.}|m3u.}|#EXTM3U.}
%files%

[style]

[files]
{.if|{.=|{.urlvar|filetype.}|m3u.}|{:{.mime|audio/x-mpegurl.}:}.}
%list%

[file]
%item-url%

[folder]
%item-name%/

Then in the hfs.tpl add a line like this in the menu's div. I used it right after the normal File list.

hfs.tpl
Code: [Select]
<li class="last"><a href="{.get|url|tpl=list|filetype=m3u|folders-filter=\|recursive.}">File list (.M3U)</a></li>
Enjoy!
Mijo
Title: Re: .m3u or rss templates for HFS (customize MIME needed)
Post by: Mijo on December 17, 2010, 05:19:59 PM
Other small modifications:

Code: [Select]
{.if|{.=|{.urlvar|filetype.}|m3u.}|#EXTM3U.}
%files%

[style]

[files]
{.if|{.=|{.urlvar|filetype.}|m3u.}|{:{.mime|audio/x-mpegurl.}:}.}
%list%

[file.mp3 = file.mpeg = file.mp4 = file.wmv = file.wma = file.avi = file.flac = file.wav = file.ogg = file.ogm = file.mkv = file.mka]
%item-full-url%

[folder]
%item-name%/

It only includes media files, but probably the list is far from complete.
%item-full-url% returns the correct absolute link, but it is not listed here: http://www.rejetto.com/wiki/index.php/HFS:_Template_symbols (http://www.rejetto.com/wiki/index.php/HFS:_Template_symbols).

Mijo
Title: Re: .m3u or rss templates for HFS (customize MIME needed)
Post by: bmartino1 on June 17, 2014, 02:06:18 AM
using live rarw template:

See posts:
http://www.rejetto.com/forum/hfs-~-http-file-server/information-(mime-types)-embed-pdfsvideo-and-audio/

and/or

http://www.rejetto.com/forum/hfs-~-http-file-server/video-(-avi-or-other)-preview-doesn't-work-on-folder-lock-11213/
windows media player doesn't suport "auth" stream(with out some major fiddling), use vlc for it

also, you can do it with html coding and a playlist file. have you ever herd of a "*.M3U"?
A m3u is a pre made cod elist of songs you put there via program or notepad...
using a msu file helps stream multiple files, and can put authentication in the file itself, so you create a list of music and put it in a m3u file the m3u become the single file that you play on a media player...

( yes these are going over music, but video formats also port over with them... )

http://en.wikipedia.org/wiki/M3U

Here a site that may work for you as well:

http://howto.wired.com/wiki/Stream_Your_Music_Online#Extended_M3U

please note:
--------------------------
Don't Feed the Lawyers:

You could be fined for broadcasting music/movies you don't own the copyright to, and in most cases the penalties are pretty severe. There are also plenty of rabid music industry lawyers with a history of going to great lengths to prosecute copyright violators. That said, be careful how you distribute your streams.
Some of the software solutions listed here have built-in password protection. Otherwise, you'll have to know some SSL and/or password protection web hosting configurations to lock down your stream.
Your other option -- and probably the safest -- is to just keep your station under wraps. You can listen to it freely, but don't go spreading the word. Remember, the internet has ears!
-------------------------------