コード例 #1
0
ファイル: bliptv.py プロジェクト: GitReadysoft/mediadrop
        meta['description'] = asset.findtext('description')
        meta['duration'] = int(asset.findtext('mediaList/media/duration') or 0) or None
#        meta['bitrate'] = int(xmltree.findtext('audiobitrate') or 0)\
#                        + int(xmltree.findtext('videobitrate') or 0) or None
        return meta

    def get_uris(self, media_file):
        """Return a list of URIs from which the stored file can be accessed.

        :type media_file: :class:`~mediadrop.model.media.MediaFile`
        :param media_file: The associated media file object.
        :rtype: list
        :returns: All :class:`StorageURI` tuples for this file.

        """
        web_id, embed_lookup = media_file.unique_id.split(' ')
        play_url = 'http://blip.tv/play/%s' % embed_lookup

        # Old blip.tv URLs had a numeric ID in the URL, now they're wordy.
        try:
            web_url = 'http://blip.tv/file/%s' % int(web_id, 10)
        except ValueError:
            web_url = 'http://blip.tv/%s' % web_id

        return [
            StorageURI(media_file, 'bliptv', play_url, None),
            StorageURI(media_file, 'www', web_url, None),
        ]

EmbedStorageEngine.register(BlipTVStorage)
コード例 #2
0
            duration_match = self.xml_duration.search(data)
            if thumb_match:
                meta['thumbnail_url'] = decode_entities(thumb_match.group(1))
            if duration_match:
                meta['duration'] = int(duration_match.group(1))

        return meta

    def get_uris(self, media_file):
        """Return a list of URIs from which the stored file can be accessed.

        :type media_file: :class:`~mediadrop.model.media.MediaFile`
        :param media_file: The associated media file object.
        :rtype: list
        :returns: All :class:`StorageURI` tuples for this file.

        """
        uid = media_file.unique_id
        play_url = ('http://video.google.com/googleplayer.swf'
                    '?docid=%s'
                    '&hl=en'
                    '&fs=true') % uid
        web_url = 'http://video.google.com/videoplay?docid=%s' % uid
        return [
            StorageURI(media_file, 'googlevideo', play_url, None),
            StorageURI(media_file, 'www', web_url, None),
        ]


EmbedStorageEngine.register(GoogleVideoStorage)
コード例 #3
0
ファイル: youtube.py プロジェクト: sudheesh001/mediadrop
            raise UserStorageError(yt_result.message)
        video_info = yt_result.meta_info.copy()
        video_info['thumbnail_url'] = yt_result.meta_info['thumbnail']['url']
        del video_info['thumbnail']
        return video_info

    def get_uris(self, media_file):
        """Return a list of URIs from which the stored file can be accessed.

        :type media_file: :class:`~mediadrop.model.media.MediaFile`
        :param media_file: The associated media file object.
        :rtype: list
        :returns: All :class:`StorageURI` tuples for this file.

        """
        params = self._data.get('player_params', {})
        params = dict((k, int(v)) for k, v in params.iteritems())
        play_url = 'http://youtube%s.com/embed/%s?%s' % (
            self._data.get('nocookie', False) and '-nocookie' or '',
            media_file.unique_id,
            urlencode(params, True),
        )
        web_url = 'http://youtube.com/watch?v=%s' % media_file.unique_id
        return [
            StorageURI(media_file, 'youtube', play_url, None),
            StorageURI(media_file, 'www', web_url, None),
        ]


EmbedStorageEngine.register(YoutubeStorage)
コード例 #4
0
ファイル: googlevideo.py プロジェクト: GitReadysoft/mediadrop
            thumb_match = self.xml_thumb.search(data)
            duration_match = self.xml_duration.search(data)
            if thumb_match:
                meta['thumbnail_url'] = decode_entities(thumb_match.group(1))
            if duration_match:
                meta['duration'] = int(duration_match.group(1))

        return meta

    def get_uris(self, media_file):
        """Return a list of URIs from which the stored file can be accessed.

        :type media_file: :class:`~mediadrop.model.media.MediaFile`
        :param media_file: The associated media file object.
        :rtype: list
        :returns: All :class:`StorageURI` tuples for this file.

        """
        uid = media_file.unique_id
        play_url = ('http://video.google.com/googleplayer.swf'
                    '?docid=%s'
                    '&hl=en'
                    '&fs=true') % uid
        web_url = 'http://video.google.com/videoplay?docid=%s' % uid
        return [
            StorageURI(media_file, 'googlevideo', play_url, None),
            StorageURI(media_file, 'www', web_url, None),
        ]

EmbedStorageEngine.register(GoogleVideoStorage)
コード例 #5
0
ファイル: dailymotion.py プロジェクト: GitReadysoft/mediadrop
                temp_data.close()
        except URLError, e:
            log.exception(e)
            data = {}

        return {
            'unique_id': id,
            'display_name': unicode(data.get('title', u'')),
            'thumbnail_url': data.get('thumbnail_url', None),
            'type': VIDEO,
        }

    def get_uris(self, media_file):
        """Return a list of URIs from which the stored file can be accessed.

        :type media_file: :class:`~mediadrop.model.media.MediaFile`
        :param media_file: The associated media file object.
        :rtype: list
        :returns: All :class:`StorageURI` tuples for this file.

        """
        uid = media_file.unique_id
        play_url = 'http://www.dailymotion.com/embed/video/%s' % uid
        web_url = 'http://www.dailymotion.com/video/%s' % uid
        return [
            StorageURI(media_file, 'dailymotion', play_url, None),
            StorageURI(media_file, 'www', web_url, None),
        ]

EmbedStorageEngine.register(DailyMotionStorage)
コード例 #6
0
            asset.findtext('mediaList/media/duration') or 0) or None
        #        meta['bitrate'] = int(xmltree.findtext('audiobitrate') or 0)\
        #                        + int(xmltree.findtext('videobitrate') or 0) or None
        return meta

    def get_uris(self, media_file):
        """Return a list of URIs from which the stored file can be accessed.

        :type media_file: :class:`~mediadrop.model.media.MediaFile`
        :param media_file: The associated media file object.
        :rtype: list
        :returns: All :class:`StorageURI` tuples for this file.

        """
        web_id, embed_lookup = media_file.unique_id.split(' ')
        play_url = 'http://blip.tv/play/%s' % embed_lookup

        # Old blip.tv URLs had a numeric ID in the URL, now they're wordy.
        try:
            web_url = 'http://blip.tv/file/%s' % int(web_id, 10)
        except ValueError:
            web_url = 'http://blip.tv/%s' % web_id

        return [
            StorageURI(media_file, 'bliptv', play_url, None),
            StorageURI(media_file, 'www', web_url, None),
        ]


EmbedStorageEngine.register(BlipTVStorage)
コード例 #7
0
ファイル: vimeo.py プロジェクト: GitReadysoft/mediadrop
            log.exception(e)
            data = {}

        return {
            'unique_id': id,
            'description': unicode(data.get('description', u'')),
            'duration': int(data.get('duration', 0)),
            'display_name': unicode(data.get('title', u'')),
            'thumbnail_url': data.get('thumbnail_large', None),
            'type': VIDEO,
        }

    def get_uris(self, media_file):
        """Return a list of URIs from which the stored file can be accessed.

        :type media_file: :class:`~mediadrop.model.media.MediaFile`
        :param media_file: The associated media file object.
        :rtype: list
        :returns: All :class:`StorageURI` tuples for this file.

        """
        uid = media_file.unique_id
        play_url = 'http://player.vimeo.com/video/%s' % uid
        web_url = 'http://vimeo.com/%s' % uid
        return [
            StorageURI(media_file, 'vimeo', play_url, None),
            StorageURI(media_file, 'www', web_url, None),
        ]

EmbedStorageEngine.register(VimeoStorage)
コード例 #8
0
ファイル: vimeo.py プロジェクト: z0x010/mediadrop
            data = {}

        return {
            'unique_id': id,
            'description': unicode(data.get('description', u'')),
            'duration': int(data.get('duration', 0)),
            'display_name': unicode(data.get('title', u'')),
            'thumbnail_url': data.get('thumbnail_large', None),
            'type': VIDEO,
        }

    def get_uris(self, media_file):
        """Return a list of URIs from which the stored file can be accessed.

        :type media_file: :class:`~mediadrop.model.media.MediaFile`
        :param media_file: The associated media file object.
        :rtype: list
        :returns: All :class:`StorageURI` tuples for this file.

        """
        uid = media_file.unique_id
        play_url = 'http://player.vimeo.com/video/%s' % uid
        web_url = 'http://vimeo.com/%s' % uid
        return [
            StorageURI(media_file, 'vimeo', play_url, None),
            StorageURI(media_file, 'www', web_url, None),
        ]


EmbedStorageEngine.register(VimeoStorage)
コード例 #9
0
ファイル: youtube.py プロジェクト: GitReadysoft/mediadrop
            'duration': duration,
            'display_name': title,
            'description': description,
            'thumbnail_url': thumb,
            'type': VIDEO,
        }

    def get_uris(self, media_file):
        """Return a list of URIs from which the stored file can be accessed.

        :type media_file: :class:`~mediadrop.model.media.MediaFile`
        :param media_file: The associated media file object.
        :rtype: list
        :returns: All :class:`StorageURI` tuples for this file.

        """
        params = self._data.get('player_params', {})
        params = dict((k, int(v)) for k, v in params.iteritems())
        play_url = 'http://youtube%s.com/embed/%s?%s' % (
            self._data.get('nocookie', False) and '-nocookie' or '',
            media_file.unique_id,
            urlencode(params, True),
        )
        web_url = 'http://youtube.com/watch?v=%s' % media_file.unique_id
        return [
            StorageURI(media_file, 'youtube', play_url, None),
            StorageURI(media_file, 'www', web_url, None),
        ]

EmbedStorageEngine.register(YoutubeStorage)
コード例 #10
0
                temp_data.close()
        except URLError, e:
            log.exception(e)
            data = {}

        return {
            'unique_id': id,
            'display_name': unicode(data.get('title', u'')),
            'thumbnail_url': data.get('thumbnail_url', None),
            'type': VIDEO,
        }

    def get_uris(self, media_file):
        """Return a list of URIs from which the stored file can be accessed.

        :type media_file: :class:`~mediadrop.model.media.MediaFile`
        :param media_file: The associated media file object.
        :rtype: list
        :returns: All :class:`StorageURI` tuples for this file.

        """
        uid = media_file.unique_id
        play_url = 'http://www.dailymotion.com/embed/video/%s' % uid
        web_url = 'http://www.dailymotion.com/video/%s' % uid
        return [
            StorageURI(media_file, 'dailymotion', play_url, None),
            StorageURI(media_file, 'www', web_url, None),
        ]

EmbedStorageEngine.register(DailyMotionStorage)