Ticket #31 (closed defect: fixed)

Opened 5 years ago

Last modified 7 months ago

[elisa store] URIs and/or streaming support

Reported by: philn Assigned to: dev
Priority: major Milestone: 0.1
Component: MediaServer Backend Elisa Version:
Keywords: Cc:

Description

How the Elisa store should behave regarding served data? Should Coherence implement an HTTP server or let Elisa do it?

Change History

27.11.2006 11:16:10 changed by dev

  • status changed from new to assigned.
  • component changed from Coherence - across the board to MediaServer Backend Elisa.
  • milestone set to first public beta.

27.11.2006 11:56:17 changed by dev

There are four possibilities:

  • let Coherence serve the content
    • this implies that we have to restrict content to something that Coherence can access via the FileSystem?, if Elisa and Coherence are on the same box. Not a desirable solution.
    • add a HTTP-Proxy object to Coherence and a HTTP-Server to Elisa or transfer the content via PB between Elisa and Coherence. The PB approach probably only works with newPB, but both are inefficent anyway.
  • let Elisa serve the content
    Send to the ControlPoint in the Browse or Search responses an URL which points to Elisa (HTTP, RTSP/RTP) and hand over the content transfer. But in doing this we lose 'control' over the connection, which leads to
    • don't keep books about ongoing transfers, meaning we have to restrict the number of concurrent connections to one.
    • let Elisa tell us when a connection starts and when it ends.

I have to admit that the need for Elisa to stream the content is only necessary if Coherence and Elisa run separate. But it would be needed in some way for two Elisas sharing their content anyway. ;-)

27.11.2006 20:07:12 changed by dev

One possible way to add this to Elisa:

from twisted.internet import reactor
from twisted.web import resource, server
from twisted.python import util

class WebResource(resource.Resource):
    """ we return content referenced via the Elisa database
        the uri is http://host:port/ID
        with ID we can lookup the real path from the db
        
        cache_mgr.get_media_node_with_id has to return
        elisa_item['location'] = urlbase + elisa_item['id']
    """

    def __init__(self, elisa_database):
        resource.Resource.__init__(self)
        self.elisa_database = elisa_database

    def getChild(self, name, request):
        ch = self.elisa_database.get_by_id(name)
        if ch != None:
            if ch[:7] == 'file://':
                ch = ch[7:]
                if os.path.exists(ch):
                    ch = static.File(ch)
                    new_id = coherence.connection_manager_server.add_connection()
                    print "startup, add %d to connection table" % new_id
                    d = request.notifyFinish()
                    d.addCallback(self.requestFinished, new_id)
                    d.addErrback(self.requestFinished, new_id)
            else:    #FIXME
                ch = None
                pass

        if ch is None:
            p = util.sibpath(__file__, name)
            if os.path.exists(p):
                ch = static.File(p)

        if ch is None:
            request.setResponseCode(404)
            return self
        else:
            return ch

    def requestFinished(self, result, id):
        print "finished, remove %d from connection table" % id
        coherence.connection_manager_server.remove_connection(id)

    def render_HTML(self,request):
        return '<html><body><p>root of the MediaServer</p></body></html>'


port = reactor.listenTCP( 0, server.Site(WebResource(elisa_database)))
urlbase = 'http://%s:%d/' % (elisa_hostname, port._realPortNumber)

This needs to be extended with the two pb calls back to elisa_storage.py to inform it about startup and teardown of the connection.

30.12.2006 15:43:19 changed by dev

  • milestone changed from first public beta to 0.1.

19.01.2007 18:04:03 changed by philn

  • status changed from assigned to closed.
  • resolution set to fixed.