예제 #1
0
    def __init__(self, store, parent, id, title, enclosure):
        BackendItem.__init__(self)
        self.store = store
        self.parent = parent
        self.external_id = id
        self.name = title
        self.location = RedirectingReverseProxyUriResource(
            enclosure.url.encode('latin-1'))

        # doing this because some (Fraunhofer Podcast) feeds say there mime type is audio/x-mpeg
        # which at least my XBOX doesn't like
        ext = enclosure.url.rsplit('.', 1)[0]
        if ext in MIME_TYPES_EXTENTION_MAPPING:
            mime_type = MIME_TYPES_EXTENTION_MAPPING[ext]
        else:
            mime_type = enclosure.type
        if (enclosure.type.startswith('audio')):
            self.item = DIDLLite.AudioItem(id, parent, self.name)
        elif (enclosure.type.startswith('video')):
            self.item = DIDLLite.VideoItem(id, parent, self.name)
        elif (enclosure.type.startswith('image')):
            self.item = DIDLLite.ImageItem(id, parent, self.name)

        res = DIDLLite.Resource("%s%d" % (store.urlbase, id),
                                'http-get:*:%s:*' % mime_type)

        self.item.res.append(res)
예제 #2
0
    def __init__(self, parent_id, id, title, url):
        BackendItem.__init__(self)
        self.parentid = parent_id  # used to be able to 'go back'

        self.update_id = 0

        self.id = id  # each item has its own and unique id

        self.location = url  # the url of the picture

        self.name = title  # the title of the picture. Inside
        # coherence this is called 'name'

        # Item.item is a special thing. This is used to explain the client what
        # kind of data this is. For e.g. A VideoItem or a MusicTrack. In our
        # case, we have an image.
        self.item = DIDLLite.ImageItem(id, parent_id, self.name)

        # each Item.item has to have one or more Resource objects
        # these hold detailed information about the media data
        # and can represent variants of it (different sizes, transcoded formats)
        res = DIDLLite.Resource(self.location, 'http-get:*:image/jpeg:*')
        res.size = None  # FIXME: we should have a size here
        #       and a resolution entry would be nice too
        self.item.res.append(res)
예제 #3
0
    def get_item(self, parent_id=None):
        self.debug(f'Image get_item {self.id} @ {self.parent_id}')

        # create item
        item = DIDLLite.ImageItem(self.id, self.parent_id)
        # item.date =
        item.title = self.title

        # add http resource
        res = DIDLLite.Resource(self.url, f'http-get:*:{self.mimetype}:*')
        if self.size > 0:
            res.size = self.size
        item.res.append(res)

        return item
예제 #4
0
    def get_item(self, parent_id=None):

        self.debug("Image get_item %r @ %r", self.id, self.parent_id)

        # create item
        item = DIDLLite.ImageItem(self.id, self.parent_id)
        #item.date =
        item.title = self.title

        # add http resource
        res = DIDLLite.Resource(self.url, 'http-get:*:%s:*' % self.mimetype)
        if self.size > 0:
            res.size = self.size
        item.res.append(res)

        return item