Browse Source

detect when media isn't a directory and report it... I did this once

and it causes some weird errors in the cds...

[git-p4: depot-paths = "//depot/": change = 1230]
v0.5
John-Mark Gurney 16 years ago
parent
commit
55252ae726
1 changed files with 10 additions and 1 deletions
  1. +10
    -1
      pymediaserv

+ 10
- 1
pymediaserv View File

@@ -104,7 +104,16 @@ class RootDevice(static.Data):
root = WebServer()
debug.insertnamespace('root', root)
content = resource.Resource()
cds = ContentDirectoryServer('My Media Server', klass = FSDirectory, path = 'media', urlbase = os.path.join(urlbase, 'content'), webbase = content) # This sets up the root to be the media dir so we don't have to enumerate the directory
mediapath = 'media'
if not os.path.isdir(mediapath):
print >>sys.stderr, \
'Sorry, %s is not a directory, no content to serve.' % `mediapath`
sys.exit(1)

# This sets up the root to be the media dir so we don't have to
# enumerate the directory
cds = ContentDirectoryServer('My Media Server', klass=FSDirectory,
path=mediapath, urlbase=os.path.join(urlbase, 'content'), webbase=content)
debug.insertnamespace('cds', cds)
root.putChild('ContentDirectory', cds)
cds = cds.control


Loading…
Cancel
Save