Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • December 09, 2016, 07:25:29 AM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: tiny http server with podcast feeds?  (Read 5318 times)

electronixtar

  • Member
  • Joined in 2007
  • **
  • Posts: 141
    • View Profile
    • Donate to Member
tiny http server with podcast feeds?
« on: July 06, 2009, 08:15:44 PM »
Hi all,

I have a Windows Mobile phone with wifi, there's a CorePlayer which could play podcast feeds, now I need a tiny HTTP server under Windows for my laptop, that I specify a movies/mp3 folder, it starts up as a http server, and generate a podcast feed as well as deliver the .avi/.mp3 files. So my phone connect to my laptop via wifi, and I can listening to my mp3 lib everywhere at home.

I know IIS/apache could make it, it's just too big. Any tiny solutions?

Thanks in advance.

Ehtyar

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 1,237
    • View Profile
    • Donate to Member
Re: tiny http server with podcast feeds?
« Reply #1 on: July 06, 2009, 08:40:42 PM »
I can recommend nginx and mongoose. I've had more experience with nginx, and it's quite a widely used, but little known web sever. Let us know what you decide on and if you run into trouble.

Ehtyar.

electronixtar

  • Member
  • Joined in 2007
  • **
  • Posts: 141
    • View Profile
    • Donate to Member
Re: tiny http server with podcast feeds?
« Reply #2 on: July 06, 2009, 09:48:44 PM »
I can recommend nginx and mongoose. I've had more experience with nginx, and it's quite a widely used, but little known web sever. Let us know what you decide on and if you run into trouble.

Ehtyar.

mongoose is super cool. Thanks

I need to extend Mongoose to something like
http://127.0.0.1:808.../mp3/?format=podcast
or
http://127.0.0.1:8080/E/mp3/?format=m3u

any ideas?

Fixed it with some python script:

#!/usr/bin/env python
#coding:utf-8

import os
import mongoose
import sys


def m3u_handler(conn, info, data):
    conn.printf('%s', 'HTTP/1.0 200 OK\r\n')
    conn.printf('%s', 'Content-Type: audio/x-mpegurl\r\n')
    r = '#EXTM3U\n\n' + '\n'.join( os.listdir(os.path.join(server.root,info.uri.replace('/:m3u', ''))))
    conn.printf('%s', 'Content-Length: %d\r\n\r\n' % len(r))
    conn.printf(r)

server = mongoose.Mongoose(ports='80', root='E:/Media') #os.getcwd())

server.set_uri_callback(r'*/:m3u', m3u_handler, 0)
#server.set_error_callback(404, error_404_handler, 0)

# Mongoose options can be retrieved by asking an attribute
print 'Starting Mongoose %s on port(s) %s ' % (server.version, server.ports)
print 'CGI extensions: %s' % server.cgi_ext

# Serve connections until 'enter' key is pressed on a console
sys.stdin.read(1)

# Deleting server object stops all serving threads
print 'Stopping server.'
del server

Usage: run the python script, it will share your E:\Media folder on http://127.0.0.1/

use http://127.0.0.1/:m3u to change the output format to .m3u with correct MIME
« Last Edit: July 07, 2009, 05:48:57 AM by electronixtar »

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,475
    • View Profile
    • Donate to Member
Re: tiny http server with podcast feeds?
« Reply #3 on: July 07, 2009, 01:53:43 AM »
There's also the always handy HFS and in the forum there's a templates board where people share ones they've made - like the Thunderchicken of Glory.

Ehtyar

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 1,237
    • View Profile
    • Donate to Member
Re: tiny http server with podcast feeds?
« Reply #4 on: July 07, 2009, 02:28:44 AM »
electronixtar: niiiiice :Thmbsup:

Ehtyar.

electronixtar

  • Member
  • Joined in 2007
  • **
  • Posts: 141
    • View Profile
    • Donate to Member
Re: tiny http server with podcast feeds?
« Reply #5 on: July 07, 2009, 05:17:55 AM »
There's also the always handy HFS and in the forum there's a templates board where people share ones they've made - like the Thunderchicken of Glory.

Wow, I didn't expect HFS has a template feature. Thanks.

Update:

HFS template seems to be HTML only, the players having a MIME trouble while parsing it as .m3u I believe.
« Last Edit: July 07, 2009, 05:49:58 AM by electronixtar »

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,475
    • View Profile
    • Donate to Member
Re: tiny http server with podcast feeds?
« Reply #6 on: July 07, 2009, 07:37:23 AM »
HFS template seems to be HTML only, the players having a MIME trouble while parsing it as .m3u I believe.

A search for m3u turned up these:
.m3u or rss templates for HFS (customize MIME needed)
generate m3u playlist - folder-streaming

You might need to grab the latest beta for some of the new functions.
« Last Edit: July 07, 2009, 07:40:44 AM by 4wd »

electronixtar

  • Member
  • Joined in 2007
  • **
  • Posts: 141
    • View Profile
    • Donate to Member
Re: tiny http server with podcast feeds?
« Reply #7 on: July 07, 2009, 08:38:12 AM »
HFS template seems to be HTML only, the players having a MIME trouble while parsing it as .m3u I believe.

A search for m3u turned up these:
.m3u or rss templates for HFS (customize MIME needed)
generate m3u playlist - folder-streaming

You might need to grab the latest beta for some of the new functions.

Thanks 4wd.

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

#EXTM3U
%files%
[style]

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

%list%

[file]
%item-url%

[folder]
%item-name%/

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

works great!