Browse Source

reverse the urljoin patch... turns out urljoin doesn't work

exactly like os.path.join..  it'll dirname the base and then add
the component...  not very useful as paths and files cannot be
told apart..  urljoin is only useful for relative browsing, not
for my use..

[git-p4: depot-paths = "//depot/": change = 1278]
main
John-Mark Gurney 16 years ago
parent
commit
68aa0ccec6
6 changed files with 9 additions and 18 deletions
  1. +1
    -2
      FSStorage.py
  2. +1
    -3
      ZipStorage.py
  3. +2
    -3
      dvd.py
  4. +1
    -2
      mpegtsmod.py
  5. +1
    -4
      pymeds.py
  6. +3
    -4
      shoutcast.py

+ 1
- 2
FSStorage.py View File

@@ -12,7 +12,6 @@ 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
@@ -199,7 +198,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 = urlparse.urljoin(self.cd.urlbase, self.id)
self.url = '%s/%s' % (self.cd.urlbase, self.id)
self.mimetype = mimetype self.mimetype = mimetype
self.checkUpdate() self.checkUpdate()




+ 1
- 3
ZipStorage.py View File

@@ -8,8 +8,6 @@ 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
@@ -172,7 +170,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 = urlparse.urljoin(self.cd.urlbase, self.id)
self.url = '%s/%s' % (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




+ 2
- 3
dvd.py View File

@@ -10,7 +10,6 @@ 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')
@@ -115,7 +114,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 = urlparse.urljoin(self.cd.urlbase, self.id)
self.url = '%s/%s' % (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


@@ -133,7 +132,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 = urlparse.urljoin(self.cd.urlbase, self.id)
self.url = '%s/%s' % (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


+ 1
- 2
mpegtsmod.py View File

@@ -13,7 +13,6 @@ import itertools
import os import os
import sets import sets
import struct import struct
import urlparse


import sys import sys
mpegtspath = 'mpegts' mpegtspath = 'mpegts'
@@ -294,7 +293,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 = urlparse.urljoin(self.cd.urlbase, self.id)
self.url = '%s/%s' % (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):


+ 1
- 4
pymeds.py View File

@@ -124,10 +124,7 @@ def makeService(config):
if uuid is None: if uuid is None:
uuid = generateuuid() uuid = generateuuid()


# 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), '', '', '', ''))
urlbase = 'http://%s:%d/' % (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


+ 3
- 4
shoutcast.py View File

@@ -15,7 +15,6 @@ import ConfigParser
import StringIO import StringIO
import os.path import os.path
import random import random
import urlparse


import traceback import traceback


@@ -285,11 +284,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 = urlparse.urljoin(self.cd.urlbase, self.id)
self.url = '%s/%s' % (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(urlparse.urljoin(self.url, 'pcm'),
# 'http-get:*:%s:*' % 'audio/x-wav')
#self.res = Resource(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):


Loading…
Cancel
Save