is just to be clean so that if a slash is missing it'll get added, or not adding too many.. [git-p4: depot-paths = "//depot/": change = 1275]main
@@ -12,6 +12,7 @@ import itertools | |||||
import os | import os | ||||
import sets | import sets | ||||
import stat | import stat | ||||
import urlparse | |||||
from DIDLLite import Container, StorageFolder, Item, VideoItem, AudioItem, TextItem, ImageItem, Resource, ResourceList | from DIDLLite import Container, StorageFolder, Item, VideoItem, AudioItem, TextItem, ImageItem, Resource, ResourceList | ||||
from twisted.web import resource, server, static | from twisted.web import resource, server, static | ||||
@@ -198,7 +199,7 @@ class FSItem(FSObject, Item): | |||||
kwargs['content'] = DynamicTrans(self.FSpath, | kwargs['content'] = DynamicTrans(self.FSpath, | ||||
static.File(self.FSpath, mimetype)) | static.File(self.FSpath, mimetype)) | ||||
Item.__init__(self, *args, **kwargs) | Item.__init__(self, *args, **kwargs) | ||||
self.url = '%s/%s' % (self.cd.urlbase, self.id) | |||||
self.url = urlparse.urljoin(self.cd.urlbase, self.id) | |||||
self.mimetype = mimetype | self.mimetype = mimetype | ||||
self.checkUpdate() | self.checkUpdate() | ||||
@@ -8,6 +8,8 @@ import itertools | |||||
import os.path | import os.path | ||||
import sets | import sets | ||||
import time | import time | ||||
import urlparse | |||||
import iterzipfile | import iterzipfile | ||||
zipfile = iterzipfile | zipfile = iterzipfile | ||||
import itertarfile | import itertarfile | ||||
@@ -170,7 +172,7 @@ class ZipFile(ZipItem, Item): | |||||
kwargs['content'] = ZipResource(self.zf, self.name, | kwargs['content'] = ZipResource(self.zf, self.name, | ||||
self.mimetype) | self.mimetype) | ||||
Item.__init__(self, *args, **kwargs) | Item.__init__(self, *args, **kwargs) | ||||
self.url = '%s/%s' % (self.cd.urlbase, self.id) | |||||
self.url = urlparse.urljoin(self.cd.urlbase, self.id) | |||||
self.res = Resource(self.url, 'http-get:*:%s:*' % self.mimetype) | self.res = Resource(self.url, 'http-get:*:%s:*' % self.mimetype) | ||||
self.res.size = self.zi.file_size | self.res.size = self.zi.file_size | ||||
@@ -10,6 +10,7 @@ default_audio_lang = 'en' | |||||
import itertools | import itertools | ||||
import os | import os | ||||
import sets | import sets | ||||
import urlparse | |||||
import sys | import sys | ||||
sys.path.append('mpegts') | sys.path.append('mpegts') | ||||
@@ -114,7 +115,7 @@ class DVDChapter(VideoItem): | |||||
p = audio.pos: audiofilter(i, 0x80 + p)) | p = audio.pos: audiofilter(i, 0x80 + p)) | ||||
VideoItem.__init__(self, *args, **kwargs) | VideoItem.__init__(self, *args, **kwargs) | ||||
self.url = '%s/%s' % (self.cd.urlbase, self.id) | |||||
self.url = urlparse.urljoin(self.cd.urlbase, self.id) | |||||
self.res = Resource(self.url, 'http-get:*:video/mpeg:*') | self.res = Resource(self.url, 'http-get:*:video/mpeg:*') | ||||
#self.res.size = self.chapter.size | #self.res.size = self.chapter.size | ||||
@@ -132,7 +133,7 @@ class DVDTitle(StorageFolder): | |||||
p = audio.pos: audiofilter(itertools.chain(*dt), 0x80 + p)) | p = audio.pos: audiofilter(itertools.chain(*dt), 0x80 + p)) | ||||
StorageFolder.__init__(self, *args, **kwargs) | StorageFolder.__init__(self, *args, **kwargs) | ||||
self.url = '%s/%s' % (self.cd.urlbase, self.id) | |||||
self.url = urlparse.urljoin(self.cd.urlbase, self.id) | |||||
self.res = Resource(self.url, 'http-get:*:video/mpeg:*') | self.res = Resource(self.url, 'http-get:*:video/mpeg:*') | ||||
# mapping from path to objectID | # mapping from path to objectID | ||||
@@ -13,6 +13,7 @@ import itertools | |||||
import os | import os | ||||
import sets | import sets | ||||
import struct | import struct | ||||
import urlparse | |||||
import sys | import sys | ||||
mpegtspath = 'mpegts' | mpegtspath = 'mpegts' | ||||
@@ -293,7 +294,7 @@ class MPEGTS(FSObject, VideoItem): | |||||
VideoItem.__init__(self, *args, **kwargs) | VideoItem.__init__(self, *args, **kwargs) | ||||
FSObject.__init__(self, path) | FSObject.__init__(self, path) | ||||
self.url = '%s/%s' % (self.cd.urlbase, self.id) | |||||
self.url = urlparse.urljoin(self.cd.urlbase, self.id) | |||||
self.res = Resource(self.url, 'http-get:*:video/mpeg:*') | self.res = Resource(self.url, 'http-get:*:video/mpeg:*') | ||||
def doUpdate(self): | def doUpdate(self): | ||||
@@ -106,7 +106,10 @@ def makeService(config): | |||||
if uuid is None: | if uuid is None: | ||||
uuid = generateuuid() | uuid = generateuuid() | ||||
urlbase = 'http://%s:%d/' % (listenAddr, listenPort) | |||||
# XXX - may cause troubles if people aren't using urljoin, add a / to | |||||
# the first empty string arg to troubleshoot | |||||
urlbase = urlparse.urlunparse(('http', '%s:%s' % (listenAddr, | |||||
listenPort), '', '', '', '')) | |||||
# Create SOAP server and content server | # Create SOAP server and content server | ||||
from twisted.web import server, resource, static | from twisted.web import server, resource, static | ||||
@@ -15,6 +15,7 @@ import ConfigParser | |||||
import StringIO | import StringIO | ||||
import os.path | import os.path | ||||
import random | import random | ||||
import urlparse | |||||
import traceback | import traceback | ||||
@@ -284,11 +285,11 @@ class ShoutStation(AudioItem): | |||||
kwargs['content'] = ShoutProxy(self.station['PLS_URL'], | kwargs['content'] = ShoutProxy(self.station['PLS_URL'], | ||||
self.station['MimeType'].encode('ascii')) | self.station['MimeType'].encode('ascii')) | ||||
AudioItem.__init__(self, *args, **kwargs) | AudioItem.__init__(self, *args, **kwargs) | ||||
self.url = '%s/%s' % (self.cd.urlbase, self.id) | |||||
self.url = urlparse.urljoin(self.cd.urlbase, self.id) | |||||
self.res = Resource(self.url, 'http-get:*:%s:*' % \ | self.res = Resource(self.url, 'http-get:*:%s:*' % \ | ||||
self.station['MimeType'].encode('ascii')) | self.station['MimeType'].encode('ascii')) | ||||
#self.res = Resource(self.url + '/pcm', 'http-get:*:%s:*' % \ | |||||
# 'audio/x-wav') | |||||
#self.res = Resource(urlparse.urljoin(self.url, 'pcm'), | |||||
# 'http-get:*:%s:*' % 'audio/x-wav') | |||||
self.bitrate = self.station['Bitrate'] * 128 # 1024k / 8bit | self.bitrate = self.station['Bitrate'] * 128 # 1024k / 8bit | ||||
class ShoutGenre(MusicGenre): | class ShoutGenre(MusicGenre): | ||||