<commit_before># Copyright (c) 2009 StudioNow, Inc <<EMAIL>>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

from pybrightcove.enums import EconomicsEnum


class Rendition(object):

    def __init__(self, data=None):
        self._url = None
        self._encodingRate = None
        self._frameHeight = None
        self._frameWidth = None
        self._size = None

        if data:
            self._url = data['url']
            self._encodingRate = data['encodingRate']
            self._frameHeight = data['frameHeight']
            self._frameWidth = data['frameWidth']
            self._size = data['size']

    def get_url(self):
        return self._url

    def get_encodingRate(self):
        return self._encodingRate

    def get_frameHeight(self):
        return self._frameHeight

    def get_frameWidth(self):
        return self._frameWidth

    def get_size(self):
        return self._size

    url = property(get_url,
        doc="The URL of the rendition file.")
    encodingRate = property(get_encodingRate,
        doc="The rendition's encoding rate in bits per second.")
    frameHeight = property(get_frameHeight,
        doc="The rendition's display height, in pixels.")
    frameWidth = property(get_frameWidth,
        doc="The rendition's display width, in pixels.")
    size = property(get_size,
        doc="The file size of the rendition, in bytes.")


class CuePoint(object):

    def __init__(self, data=None):
        self._name = None
        self._video_id = None
        self._time = None
        self._forceStop = None
        self._type = None
        self._metadata = None

        if data:
            self.name = data['name']
            self._video_id = data['video_id']
            self._time = data['time']
            self.forceStop = data['forceStop']
            self._type = data['type']
            self.metadata = data['metadata']

    def get_name(self):
        return self._name

    def get_video_id(self):
        return self._video_id

    def get_time(self):
        return self._time

    def get_forceStop(self):
        return self._forceStop

    def set_forceStop(self, force_stop):
        self._forceStop = force_stop

    def get_type(self):
        return self._type

    def get_metadata(self):
        return self._metadata

    def set_metadata(self, meta):
        self._metadata = meta

    name = property(get_name,
        doc = "A name for the cue point, so that you can refer to it.")
    video_id = property(get_video_id,
        doc = """A comma-separated list of the ids of one or more videos
                that this cue point applies to.""")
    time = property(get_time,
        doc = """The time of the cue point, measured in milliseconds from
                the beginning of the video.""")
    forceStop = property(get_forceStop, set_forceStop,
        doc = """If true, the video stops playback at the cue point. This
                setting is valid only for AD type cue points.""")
    cue_type = property(get_type,
        doc = """An integer code corresponding to the type of cue point.
                One of 0 (AD), 1 (CODE), or 2 (CHAPTER). An AD cue point
                is used to trigger mid-roll ad requests. A CHAPTER cue
                point indicates a chapter or scene break in the video.
                A CODE cue point causes an event that you can listen
                for and respond to.""")
    metadata = property(get_metadata, set_metadata,
        doc = "A string that can be passed along with a CODE cue point.")


class Video(object):

    def __init__(self, data=None):
        self._name = None
        self._id = None
        self._referenceId = None
        self._accountId = None
        self._shortDescription = None
        self._longDescription = None
        self._FLVURL = None
        self._renditions = None
        self._creationDate = None
        self._publishedDate = None
        self._lastModifiedDate = None
        self._startDate = None
        self._endDate = None
        self._linkURL = None
        self._linkText = None
        self._tags = None
        self._videoStillURL = None
        self._thumbnailURL = None
        self._length = None
        self._economics = None
        self._cuePoints = None
        self._playsTotal = None
        self._playsTrailingWeek = None

        if data:
            self.name = data.get('name', None)
            self._id = data.get('id', None)
            self.referenceId = data.get('referenceId', None)
            self._accountId = data.get('accountId', None)
            self.shortDescription = data.get('shortDescription', None)
            self.longDescription = data.get('longDescription', None)
            self._FLVURL = data.get('FLVURL', None)
            self._creationDate = data.get('creationDate', None)
            self._publishedDate = data.get('publishedDate', None)
            self._lastModifiedDate = data.get('lastModifiedDate', None)
            self._startDate = data.get('startDate', None)
            self._endDate = data.get('endDate', None)
            self.linkURL = data.get('linkURL', None)
            self.linkText = data.get('linkText', None)
            self.tags = data.get('tags', None)
            self._videoStillURL = data.get('videoStillURL', None)
            self._thumbnailURL = data.get('thumbnailURL', None)
            self._length = data.get('length', None)
            self.economics = data.get('economics', None)
            self._playsTotal = data.get('playsTotal', None)
            self._playsTrailingWeek = data.get('playsTrailingWeek', None)

            for rendition in data.get('renditions', []):
                self.renditions.append(Rendition(data=rendition))
            for cuePoint in data.get('cuePoints', []):
                self.cuePoints.append(CuePoint(data=cuePoint))

    def get_name(self):
        return self._name

    def set_name(self, name):
        self._name = name[:60]

    def get_id(self):
        return self._id<commit_msg>added unix timestamp conversions to Video object<commit_after># Copyright (c) 2009 StudioNow, Inc <<EMAIL>>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

from datetime import datetime
from pybrightcove.enums import EconomicsEnum


def _convert_tstamp(val):
    if val:
        return datetime.fromtimestamp(float(val)/1000)


class Rendition(object):

    def __init__(self, data=None):
        self._url = None
        self._encodingRate = None
        self._frameHeight = None
        self._frameWidth = None
        self._size = None

        if data:
            self._url = data['url']
            self._encodingRate = data['encodingRate']
            self._frameHeight = data['frameHeight']
            self._frameWidth = data['frameWidth']
            self._size = data['size']

    def get_url(self):
        return self._url

    def get_encodingRate(self):
        return self._encodingRate

    def get_frameHeight(self):
        return self._frameHeight

    def get_frameWidth(self):
        return self._frameWidth

    def get_size(self):
        return self._size

    url = property(get_url,
        doc="The URL of the rendition file.")
    encodingRate = property(get_encodingRate,
        doc="The rendition's encoding rate in bits per second.")
    frameHeight = property(get_frameHeight,
        doc="The rendition's display height, in pixels.")
    frameWidth = property(get_frameWidth,
        doc="The rendition's display width, in pixels.")
    size = property(get_size,
        doc="The file size of the rendition, in bytes.")


class CuePoint(object):

    def __init__(self, data=None):
        self._name = None
        self._video_id = None
        self._time = None
        self._forceStop = None
        self._type = None
        self._metadata = None

        if data:
            self.name = data['name']
            self._video_id = data['video_id']
            self._time = data['time']
            self.forceStop = data['forceStop']
            self._type = data['type']
            self.metadata = data['metadata']

    def get_name(self):
        return self._name

    def get_video_id(self):
        return self._video_id

    def get_time(self):
        return self._time

    def get_forceStop(self):
        return self._forceStop

    def set_forceStop(self, force_stop):
        self._forceStop = force_stop

    def get_type(self):
        return self._type

    def get_metadata(self):
        return self._metadata

    def set_metadata(self, meta):
        self._metadata = meta

    name = property(get_name,
        doc = "A name for the cue point, so that you can refer to it.")
    video_id = property(get_video_id,
        doc = """A comma-separated list of the ids of one or more videos
                that this cue point applies to.""")
    time = property(get_time,
        doc = """The time of the cue point, measured in milliseconds from
                the beginning of the video.""")
    forceStop = property(get_forceStop, set_forceStop,
        doc = """If true, the video stops playback at the cue point. This
                setting is valid only for AD type cue points.""")
    cue_type = property(get_type,
        doc = """An integer code corresponding to the type of cue point.
                One of 0 (AD), 1 (CODE), or 2 (CHAPTER). An AD cue point
                is used to trigger mid-roll ad requests. A CHAPTER cue
                point indicates a chapter or scene break in the video.
                A CODE cue point causes an event that you can listen
                for and respond to.""")
    metadata = property(get_metadata, set_metadata,
        doc = "A string that can be passed along with a CODE cue point.")


class Video(object):

    def __init__(self, data=None):
        self._name = None
        self._id = None
        self._referenceId = None
        self._accountId = None
        self._shortDescription = None
        self._longDescription = None
        self._FLVURL = None
        self._renditions = None
        self._creationDate = None
        self._publishedDate = None
        self._lastModifiedDate = None
        self._startDate = None
        self._endDate = None
        self._linkURL = None
        self._linkText = None
        self._tags = None
        self._videoStillURL = None
        self._thumbnailURL = None
        self._length = None
        self._economics = None
        self._cuePoints = None
        self._playsTotal = None
        self._playsTrailingWeek = None

        if data:
            self.name = data.get('name', None)
            self._id = data.get('id', None)
            self.referenceId = data.get('referenceId', None)
            self._accountId = data.get('accountId', None)
            self.shortDescription = data.get('shortDescription', None)
            self.longDescription = data.get('longDescription', None)
            self._FLVURL = data.get('FLVURL', None)
            self._creationDate = _convert_tstamp(
                data.get('creationDate', None))
            self._publishedDate = _convert_tstamp(
                data.get('publishedDate', None))
            self._lastModifiedDate = _convert_tstamp(
                data.get('lastModifiedDate', None))
            self._startDate = _convert_tstamp(data.get('startDate', None))
            self._endDate = _convert_tstamp(data.get('endDate', None))
            self.linkURL = data.get('linkURL', None)
            self.linkText = data.get('linkText', None)
            self.tags = data.get('tags', None)
            self._videoStillURL = data.get('videoStillURL', None)
            self._thumbnailURL = data.get('thumbnailURL', None)
            self._length = data.get('length', None)
            self.economics = data.get('economics', None)
            self._playsTotal = data.get('playsTotal', None)
            self._playsTrailingWeek = data.get('playsTrailingWeek', None)

            for rendition in data.get('renditions', []):
                self.renditions.append(Rendition(data=rendition))
            for cuePoint in data.get('cuePoints', []):
                self.cuePoints.append(CuePoint(data=cuePoint))

    def get_name(self):
        return self._name

    def set_name(self, name):
        self._name = name[:60]

    def get_id(self):
        return self._id
{'fraction_non_alphanumeric': 0.08905354396756605, 'fraction_numerical': 0.001537816300852789, 'mean_word_length': 2.3521555763823807, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2447175', 'n_tokens_mistral': 3955, 'n_tokens_neox': 3730, 'n_words': 1264}