Author: jruchaud Date: 2015-06-09 15:42:18 +0000 (Tue, 09 Jun 2015) New Revision: 1669 Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/1669 Log: Use class Modified: oipf/lib/js/impl/model/Programme.js oipf/lib/js/impl/model/Query.js oipf/lib/js/impl/model/Recording.js oipf/lib/js/impl/model/ScheduledRecording.js oipf/lib/js/impl/model/ScheduledRecordingCollection.js Modified: oipf/lib/js/impl/model/Programme.js =================================================================== --- oipf/lib/js/impl/model/Programme.js 2015-06-09 15:39:44 UTC (rev 1668) +++ oipf/lib/js/impl/model/Programme.js 2015-06-09 15:42:18 UTC (rev 1669) @@ -8,7 +8,7 @@ * the (scheduled) recording with programme metadata. The use of these metadata properties is optional. If such programme * metadata is provided, it is retained in the ScheduledRecording object that is returned if the recording of the * programme was scheduled successfully. -* +* * Metadata extensions to Programme: * The OITF SHALL extend the Programme class defined in section 7.16.2 with the properties and methods described * below. @@ -26,351 +26,325 @@ * Clients supporting the recording management APIs defined in this section SHALL indicate this by adding the attribute * " manageRecordings " to the <recording> element with a value unequal to ‘ none ’ in the client capability * description as defined in section 9.3.3. -* */ +class Programme { -var Programme = Class.extend({ - /* - * Description: - * The short name of the programme, e.g. 'Star Trek: DS9'. - */ - name: null, + * FIXME: + * Yannis - 30/04/2015 - The properties initialized here must be disappear + * in future. + * + * @param {Object} initObject + * @returns {undefined} + */ + constructor(initObject) { + /* + * Description: + * The short name of the programme, e.g. 'Star Trek: DS9'. + */ + this.name = null; - /* - * Description: - * The long name of the programme, e.g. 'Star Trek: Deep Space Nine'. If the long name is not available, this property will be undefined. - */ - longName: null, + /* + * Description: + * The long name of the programme, e.g. 'Star Trek: Deep Space Nine'. If the long name is not available, this property will be undefined. + */ + this.longName = null; - /* - * Description: - * The description of the programme, e.g. an episode synopsis. If no description is available, this property will be undefined. - */ - description: null, + /* + * Description: + * The description of the programme, e.g. an episode synopsis. If no description is available, this property will be undefined. + */ + this.description = null; - /* - * Description: - * The long description of the programme. If no description is available, this property will be undefined . - */ - longDescription: null, - - /* - * Description: - * The long description of the programme. If no description is available, this property will be undefined . - */ - startTime: null, + /* + * Description: + * The long description of the programme. If no description is available, this property will be undefined . + */ + this.longDescription = null; - /* - * Description: - * The duration of the programme (in seconds). - */ - duration: null, - - /* - * Description: - * The identifier of the channel from which the broadcasted content is to be recorded. Specifies either a ccid or - * ipBroadcastID (as defined by the Channel object in section 7.13.11) - */ - channelID: null, - - /* - * Description: - * The episode number for the programme if it is part of a series. This property is undefined when the - * programme is not part of a series or the information is not available. - */ - episode: null, + /* + * Description: + * The long description of the programme. If no description is available, this property will be undefined . + */ + this.startTime = null; - /* - * Description: - * If the programme is part of a series, the total number of episodes in the series. This property is undefined - * when the programme is not part of a series or the information is not available. - */ - totalEpisodes: null, + /* + * Description: + * The duration of the programme (in seconds). + */ + this.duration = null; - /* - * Description: - * Flag indicating whether the programme has 3D video. - * - * Visibility Type: readonly Boolean - */ - is3D: null, + /* + * Description: + * The identifier of the channel from which the broadcasted content is to be recorded. Specifies either a ccid or + * ipBroadcastID (as defined by the Channel object in section 7.13.11) + */ + this.channelID = null; - /* - * Description: - * The unique identifier of the programme or series, e.g., a TV-Anytime CRID (Content Reference Identifier). - */ - programmeID: null, + /* + * Description: + * The episode number for the programme if it is part of a series. This property is undefined when the + * programme is not part of a series or the information is not available. + */ + this.episode = null; - /* - * Description: - * The type of identification used to reference the programme, as indicated by one of the ID_* constants - * defined above. - */ - programmeIDType: null, + /* + * Description: + * If the programme is part of a series, the total number of episodes in the series. This property is undefined + * when the programme is not part of a series or the information is not available. + */ + this.totalEpisodes = null; - /* - * Description: - * The TV-Anytime Instance Metadata ID for this programme. - * - * Visibility Type: readonly String - */ - IMI: null, - - /* - * Description: - * A collection of parental rating values for the programme for zero or more parental rating schemes supported - * by the OITF. For instances of the Programme class created by the createProgramme() method defined in - * section 7.10.1.1, the initial value of this property (upon creation of the Programme object) is an instance of - * the ParentalRatingCollection object (as defined in section 7.9.5) with length 0. Parental rating values - * can be added to this empty readonly parental rating collection by using the addParentalRating() method - * of the ParentalRatingCollection object. The ParentalRatingCollection is defined in section 7.9.5. - * The related ParentalRating and ParentalRatingScheme objects are defined in section 7.9.4 and 7.9.2 - * respectively. - * For instances of the Programme class returned through the metadata APIs defined in section 7.12 or through - * the programmes property of the video/broadcast object defined in section 7.13.3, the initial value of this - * property SHALL include the parental rating value(s) carried in the metadata or DVB-SI entry describing the - * programme, if this information is included. - * Note that if the service provider specifies a certain parental rating (e.g. PG-13) through this property and the - * actual parental rating extracted from the stream says that the content is rated PG-16, then the conflict - * resolution is implementation dependent. - * - * Visibility Type: readonly ParentalRatingCollection - */ - parentalRatings: null, - - /* - * Description: - * The group CRIDs associated with this programme. - * - * Visibility Type: readonly StringCollection - */ - groupCRIDs: null, + /* + * Description: + * Flag indicating whether the programme has 3D video. + * + * Visibility Type: readonly Boolean + */ + this.is3D = null; - - - - /* - * Description: - * Reference to the broadcast channel where the programme is available. - * The value of this field is derived from the serviceIDref attribute of the Schedule element that refers to this - * programme. - * - * Visibility Type: readonly Channel - */ - channel: null, - - /* - * Description: - * Reference to the broadcast channel where the programme is available. - * The value of this field is derived from the serviceIDref attribute of the Schedule element that refers to this - * programme. - * Flag indicating whether the programme is blocked due to parental control settings or conditional access - * restrictions. - * The blocked and locked properties work together to provide a tri-state flag describing the status of a - * programme. This can best be described by the following table: - * ------------------------------------------------------------------------------------------------------- - * Description | blocked | locked - * ------------------------------------------------------------------------------ ----------- ------------ - * No parental control applies. | false | false - * ------------------------------------------------------------------------------ ----------- ------------ - * Item is above the parental rating threshold (or manually blocked); no PIN has | true | true - * been entered to view it and so the item cannot currently be viewed. | | - * ------------------------------------------------------------------------------ ----------- ------------ - * Item is above the parental rating threshold (or manually blocked); the PIN has| true | false - * been entered and so the item can be viewed. | | - * ------------------------------------------------------------------------------ ----------- ------------ - * Invalid combination – OITFs SHALL NOT support this combination | false | true - * ------------------------------------------------------------------------------------------------------- - * - * Visibility Type: readonly Boolean - */ - blocked: null, - - /* - * Description: - * Flag indicating the type of show (live, first run, rerun, etc,). - * The value of this property is determined by the child elements of the programme’s BroadcastEvent or - * ScheduleEvent element from the Program Location Table. Values are determined as follows: - * programme. - * Flag indicating whether the programme is blocked due to parental control settings or conditional access - * restrictions. - * The blocked and locked properties work together to provide a tri-state flag describing the status of a - * programme. This can best be described by the following table: - * ---------------------------------------------------------------------------------- - * Value | Description - * ---------------------------------------------------------------------------------- - * 1 | The programme is live; indicated by the presence of a Live element with - * | a value attribute set to true. - * ---------------------------------------------------------------------------------- - * 2 | The programme is a first-run show; indicated by the presence of a - * | FirstShowing element with a value attribute set to true. - * ---------------------------------------------------------------------------------- - * 3 | The programme is a rerun; indicated by the presence of a Repeat - * | element with a value attribute set to true. - * ---------------------------------------------------------------------------------- - * - * If none of the above conditions are met, the default value of this field SHALL be 2. - * - * Visibility Type: readonly Boolean - */ - showType: null, - - /* - * Description: - * Flag indicating whether subtitles or closed-caption information is available. - * This flag SHALL be true if one or more BCG CaptionLanguage elements are present in this programme’s - * description, false otherwise. - * - * Type: Boolean - */ - subtitles: null, - - /* - * Description: - * Flag indicating whether the programme has high-definition video. - * This flag SHALL be true if a VerticalSize element is present in the programme’s description and has a - * value greater than 576, false otherwise. - * - * Type: Boolean - */ - isHD: null, - - /* - * Description: - * Bitfield indicating the type of audio that is available for the programme. - * The value of this field is determined by the NumOfChannels elements in a programme’s A/V attributes. - * Values are determined as follows: - * - * ------------------------------------------------------------------------------------------------------- - * Value | Description - * ------------------------------------------------------------------------------------------------------- - * 1 | A mono audio stream is available (at least one AvAttributes.AudioAttributes element is present - * | which has a child NumOfChannels element whose value is 1). - * ------------------------------------------------------------------------------------------------------- - * 2 | A mono audio stream is available (at least one AvAttributes.AudioAttributes element is present - * | which has a child NumOfChannels element whose value is 2). - * ------------------------------------------------------------------------------------------------------- - * 4 | A mono audio stream is available (at least one AvAttributes.AudioAttributes element is present - * | which has a child NumOfChannels element whose value is 4). - * ------------------------------------------------------------------------------------------------------- - * For programmes with multiple audio streams, these values may be ORed together. - */ - audioType: null, - - /* - * Description: - * Flag indicating whether more than one audio language is available for the programme. - * This flag SHALL be true if more than one BCG Language element is present in the programme’s - * description, false otherwise. - * - * Visibility Type: Boolean - */ - isMultilingual: null, + /* + * Description: + * The unique identifier of the programme or series, e.g., a TV-Anytime CRID (Content Reference Identifier). + */ + this.programmeID = null; - /* - * Description: - * A collection of genres that describe this programme. - * The value of this field is the concatenation of the values of any Name elements that are children of Genre - * elements in the programme’s description. - * - * Type: StringCollection - */ - genre: null, + /* + * Description: + * The type of identification used to reference the programme, as indicated by one of the ID_* constants + * defined above. + */ + this.programmeIDType = null; - /* - * Description: - * Flag indicating whether the Programme has a recording associated with it (either scheduled, in progress, or - * completed). - * - * Type: readonly Boolean - */ - hasRecording: null, + /* + * Description: + * The TV-Anytime Instance Metadata ID for this programme. + * + * Visibility Type: readonly String + */ + this.IMI = null; - /* - * Description: - * Supported audio languages, indicated by their ISO.639-2 language codes as defined in [ISO 639-2]. - * - * Type: StringCollection - */ - audioLanguages: null, + /* + * Description: + * A collection of parental rating values for the programme for zero or more parental rating schemes supported + * by the OITF. For instances of the Programme class created by the createProgramme() method defined in + * section 7.10.1.1, the initial value of this property (upon creation of the Programme object) is an instance of + * the ParentalRatingCollection object (as defined in section 7.9.5) with length 0. Parental rating values + * can be added to this empty readonly parental rating collection by using the addParentalRating() method + * of the ParentalRatingCollection object. The ParentalRatingCollection is defined in section 7.9.5. + * The related ParentalRating and ParentalRatingScheme objects are defined in section 7.9.4 and 7.9.2 + * respectively. + * For instances of the Programme class returned through the metadata APIs defined in section 7.12 or through + * the programmes property of the video/broadcast object defined in section 7.13.3, the initial value of this + * property SHALL include the parental rating value(s) carried in the metadata or DVB-SI entry describing the + * programme, if this information is included. + * Note that if the service provider specifies a certain parental rating (e.g. PG-13) through this property and the + * actual parental rating extracted from the stream says that the content is rated PG-16, then the conflict + * resolution is implementation dependent. + * + * Visibility Type: readonly ParentalRatingCollection + */ + this.parentalRatings = null; - /* - * Description: - * Supported subtitle languages, indicated by their ISO.639-2 language codes as defined in [ISO 639-2]. - * - * Visibility Type: readonly StringCollection - */ - subtitleLanguages: null, + /* + * Description: + * The group CRIDs associated with this programme. + * + * Visibility Type: readonly StringCollection + */ + this.groupCRIDs = null; - /* - * Description: - * Flag indicating whether the current state of the parental control system prevents the programme from being - * viewed (e.g. a correct parental control PIN has not been entered to allow the programme to be viewed). - * - * Visibility Type: readonly Boolean - */ - locked: null, - - /* - * Description: - * If available, this property represents the recording associated with this programme (either scheduled, in- - * progress or completed). Has value undefined if this programme has no scheduled recording associated with - * it. - * - * Visibility Type: readonly ScheduledRecording - */ - recording: null, + /* + * Description: + * Reference to the broadcast channel where the programme is available. + * The value of this field is derived from the serviceIDref attribute of the Schedule element that refers to this + * programme. + * + * Visibility Type: readonly Channel + */ + this.channel = null; - /* - * FIXME: - * Yannis - 30/04/2015 - The properties initialized here must be disappear - * in future. - * - * @param {Object} initObject - * @returns {undefined} - */ - init: function(initObject) { - oipf.utils.initProperties.call(this, initObject); + /* + * Description: + * Reference to the broadcast channel where the programme is available. + * The value of this field is derived from the serviceIDref attribute of the Schedule element that refers to this + * programme. + * Flag indicating whether the programme is blocked due to parental control settings or conditional access + * restrictions. + * The blocked and locked properties work together to provide a tri-state flag describing the status of a + * programme. This can best be described by the following table: + * ------------------------------------------------------------------------------------------------------- + * Description | blocked | locked + * ------------------------------------------------------------------------------ ----------- ------------ + * No parental control applies. | false | false + * ------------------------------------------------------------------------------ ----------- ------------ + * Item is above the parental rating threshold (or manually blocked); no PIN has | true | true + * been entered to view it and so the item cannot currently be viewed. | | + * ------------------------------------------------------------------------------ ----------- ------------ + * Item is above the parental rating threshold (or manually blocked); the PIN has| true | false + * been entered and so the item can be viewed. | | + * ------------------------------------------------------------------------------ ----------- ------------ + * Invalid combination – OITFs SHALL NOT support this combination | false | true + * ------------------------------------------------------------------------------------------------------- + * + * Visibility Type: readonly Boolean + */ this.blocked = null; - this.longName = null; - this.longDescription = null; - this.channelID = null; - this.totalEpisodes = null; - this.is3D = null; - this.programmeIDType = null; - this.IMI = null; - this.parentalRatings = null; - this.groupCRIDs = null; + + /* + * Description: + * Flag indicating the type of show (live, first run, rerun, etc,). + * The value of this property is determined by the child elements of the programme’s BroadcastEvent or + * ScheduleEvent element from the Program Location Table. Values are determined as follows: + * programme. + * Flag indicating whether the programme is blocked due to parental control settings or conditional access + * restrictions. + * The blocked and locked properties work together to provide a tri-state flag describing the status of a + * programme. This can best be described by the following table: + * ---------------------------------------------------------------------------------- + * Value | Description + * ---------------------------------------------------------------------------------- + * 1 | The programme is live; indicated by the presence of a Live element with + * | a value attribute set to true. + * ---------------------------------------------------------------------------------- + * 2 | The programme is a first-run show; indicated by the presence of a + * | FirstShowing element with a value attribute set to true. + * ---------------------------------------------------------------------------------- + * 3 | The programme is a rerun; indicated by the presence of a Repeat + * | element with a value attribute set to true. + * ---------------------------------------------------------------------------------- + * + * If none of the above conditions are met, the default value of this field SHALL be 2. + * + * Visibility Type: readonly Boolean + */ this.showType = null; + + /* + * Description: + * Flag indicating whether subtitles or closed-caption information is available. + * This flag SHALL be true if one or more BCG CaptionLanguage elements are present in this programme’s + * description, false otherwise. + * + * Type: Boolean + */ this.subtitles = null; + + /* + * Description: + * Flag indicating whether the programme has high-definition video. + * This flag SHALL be true if a VerticalSize element is present in the programme’s description and has a + * value greater than 576, false otherwise. + * + * Type: Boolean + */ this.isHD = null; + + /* + * Description: + * Bitfield indicating the type of audio that is available for the programme. + * The value of this field is determined by the NumOfChannels elements in a programme’s A/V attributes. + * Values are determined as follows: + * + * ------------------------------------------------------------------------------------------------------- + * Value | Description + * ------------------------------------------------------------------------------------------------------- + * 1 | A mono audio stream is available (at least one AvAttributes.AudioAttributes element is present + * | which has a child NumOfChannels element whose value is 1). + * ------------------------------------------------------------------------------------------------------- + * 2 | A mono audio stream is available (at least one AvAttributes.AudioAttributes element is present + * | which has a child NumOfChannels element whose value is 2). + * ------------------------------------------------------------------------------------------------------- + * 4 | A mono audio stream is available (at least one AvAttributes.AudioAttributes element is present + * | which has a child NumOfChannels element whose value is 4). + * ------------------------------------------------------------------------------------------------------- + * For programmes with multiple audio streams, these values may be ORed together. + */ this.audioType = null; + + /* + * Description: + * Flag indicating whether more than one audio language is available for the programme. + * This flag SHALL be true if more than one BCG Language element is present in the programme’s + * description, false otherwise. + * + * Visibility Type: Boolean + */ this.isMultilingual = null; + + /* + * Description: + * A collection of genres that describe this programme. + * The value of this field is the concatenation of the values of any Name elements that are children of Genre + * elements in the programme’s description. + * + * Type: StringCollection + */ this.genre = null; + + /* + * Description: + * Flag indicating whether the Programme has a recording associated with it (either scheduled, in progress, or + * completed). + * + * Type: readonly Boolean + */ this.hasRecording = null; + + /* + * Description: + * Supported audio languages, indicated by their ISO.639-2 language codes as defined in [ISO 639-2]. + * + * Type: StringCollection + */ this.audioLanguages = null; + + /* + * Description: + * Supported subtitle languages, indicated by their ISO.639-2 language codes as defined in [ISO 639-2]. + * + * Visibility Type: readonly StringCollection + */ this.subtitleLanguages = null; + + /* + * Description: + * Flag indicating whether the current state of the parental control system prevents the programme from being + * viewed (e.g. a correct parental control PIN has not been entered to allow the programme to be viewed). + * + * Visibility Type: readonly Boolean + */ this.locked = null; + + /* + * Description: + * If available, this property represents the recording associated with this programme (either scheduled, in- + * progress or completed). Has value undefined if this programme has no scheduled recording associated with + * it. + * + * Visibility Type: readonly ScheduledRecording + */ this.recording = null; - }, - + + oipf.utils.initProperties.call(this, initObject); + } + /* - * Description: + * Description: * Get the value of the field referred to by fieldId that is contained in the metadata for this * programme. If the field does not exist, this method SHALL return undefined . * - * Arguments: + * Arguments: * - fieldId: The name of the field whose value SHALL be retrieved. * * Return: String */ - getField: function(fieldId) { - - }, - + getField(fieldId) { + + } + /* - * Description: + * Description: * Get the contents of the descriptor specified by descriptorTag from the DVB SI EIT * programme's descriptor loop. If more than one descriptor with the specified tag is available for * the given programme, the contents of all matching descriptors SHALL be returned in the @@ -394,7 +368,7 @@ * via MetadataSearch events targeted at the application/oipfSearchManager object * used to retrieve the programme metadata. * - * Arguments: + * Arguments: * - descriptorTag: The descriptor tag as specified by [EN 300 468]. * * - descriptorTag: An optional argument giving the descriptor tag extension as @@ -407,9 +381,8 @@ * * Return: StringCollection */ - getSIDescriptors: function(descriptorTag, descriptorTagExtension, privateDataSpecifier) { - - + getSIDescriptors(descriptorTag, descriptorTagExtension, privateDataSpecifier) { + } -}); \ No newline at end of file +} Modified: oipf/lib/js/impl/model/Query.js =================================================================== --- oipf/lib/js/impl/model/Query.js 2015-06-09 15:39:44 UTC (rev 1668) +++ oipf/lib/js/impl/model/Query.js 2015-06-09 15:42:18 UTC (rev 1669) @@ -1,33 +1,25 @@ /* * The Query class represents a metadata query that the user wants to carry out. * This may be a simple search, or a complex search involving Boolean logic. - * Queries are immutable; an operation on a query SHALL return - * a new Query object, allowing applications to continue referring to + * Queries are immutable; an operation on a query SHALL return + * a new Query object, allowing applications to continue referring to * the original query. */ -var Query = Class.extend({ - - _inverse: { - 0: 1, - 1: 0, - 2: 4, - 3: 5, - 4: 2, - 5: 3, - 6: 1 - }, - - _type: null, - - _field: null, - - _comparison: null, - - _value: null, - - init: function(field, comparison, value, count) { +class Query { + + constructor(field, comparison, value, count) { + this._inverse = { + 0: 1, + 1: 0, + 2: 4, + 3: 5, + 4: 2, + 5: 3, + 6: 1 + }; + if (field == "startTime" && value == null) { - this._type = "current"; + this._type = "current"; } else { this._type = "undifferent"; } @@ -39,40 +31,34 @@ if (count) { this._count = count; } - }, - - and: function(query) { - + } + + and(query) { var queryClone = this._cloneKeys(this); queryClone._and && queryClone._and.push(query); - + return queryClone; - }, - - or: function(query) { - + } + + or(query) { var queryClone = this._cloneKeys(this); queryClone._or && queryClone._or.push(query); - + return queryClone; - }, - - _cloneKeys: function(query) { - + } + + _cloneKeys(query) { var keys = Object.keys(query); var newQuery = new Query(); for (var i = 0, l = keys.length; i < l; i++) { newQuery[keys[i]] = query[keys[i]]; } - + return newQuery; - - }, - - not: function() { + } + + not() { var queryClone = this._cloneKeys(this); - queryClone._comparison = this._inverse[queryClone._comparison]; + queryClone._comparison = this._inverse[queryClone._comparison]; } - - -}); \ No newline at end of file +} Modified: oipf/lib/js/impl/model/Recording.js =================================================================== --- oipf/lib/js/impl/model/Recording.js 2015-06-09 15:39:44 UTC (rev 1668) +++ oipf/lib/js/impl/model/Recording.js 2015-06-09 15:42:18 UTC (rev 1669) @@ -1,75 +1,71 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ +class Recording extends ScheduledRecording { -var Recording = ScheduledRecording.extend({ - - uri: null, - id: null, - doNotDelete: null, - saveDays: null, - saveEpisodes: null, - blocked: null, - showType: null, - subtitles: null, - /* - * Decsription: - * - * Visibilty Type: readonly StringCollection - */ - subtitleLanguages: null, - isHD: null, - is3D: null, - audioType: null, - isMultilingual: null, - - /* - * Decsription: - * - * Visibilty Type: readonly StringCollection - */ - audioLanguages: null, - - /* - * Decsription: - * - * Visibilty Type: readonly StringCollection - */ - genres: null, - recordingStartTime: null, - recordingDuration: null, - - /* - * Decsription: - * - * Visibilty Type: readonly BookmarkCollection - */ - bookmarks: null, - locked: null, - - /* - * FIXME: - * Yannis - 28/04/2015 - Initialize its own properties matching(not the inherited) + * FIXME: + * Yannis - 28/04/2015 - Initialize its own properties matching(not the inherited) * programme field contained by its inherited property channel */ - init: function(associatedScheduledRecording) { + constructor(associatedScheduledRecording) { + super(associatedScheduledRecording); + + this.uri = null; + this.id = null; + this.doNotDelete = null; + this.saveDays = null; + this.saveEpisodes = null; + this.blocked = null; + this.showType = null; + this.subtitles = null; + + /* + * Decsription: + * + * Visibilty Type: readonly StringCollection + */ + this.subtitleLanguages = null; + this.isHD = null; + this.is3D = null; + this.audioType = null; + this.isMultilingual = null; + + /* + * Decsription: + * + * Visibilty Type: readonly StringCollection + */ + this.audioLanguages = null; + + /* + * Decsription: + * + * Visibilty Type: readonly StringCollection + */ + this.genres = null; + this.recordingStartTime = null; + this.recordingDuration = null; + + /* + * Decsription: + * + * Visibilty Type: readonly BookmarkCollection + */ + this.bookmarks = null; + this.locked = null; + this.isManual = true; - associatedScheduledRecording && + associatedScheduledRecording && oipf.utils.initProperties.call(this, associatedScheduledRecording); - + this.id = createUUID(); - }, - - _setRecordingStartTime: function(recordingStartTime) { - this.recordingStartTime= recordingStartTime; - }, - - _setRecordingEndTime: function(recordingEndTime) { + } + + _setRecordingStartTime(recordingStartTime) { + this.recordingStartTime = recordingStartTime; + } + + _setRecordingEndTime(recordingEndTime) { this.recordingEndTime = recordingEndTime; } - -}); +} + Modified: oipf/lib/js/impl/model/ScheduledRecording.js =================================================================== --- oipf/lib/js/impl/model/ScheduledRecording.js 2015-06-09 15:39:44 UTC (rev 1668) +++ oipf/lib/js/impl/model/ScheduledRecording.js 2015-06-09 15:42:18 UTC (rev 1669) @@ -1,241 +1,238 @@ -/* +/* * The ScheduledRecording object represents a scheduled programme in the system, - * i.e. a recording that is scheduled but which has not yet started. - * For group recordings (e.g. recording an entire series), + * i.e. a recording that is scheduled but which has not yet started. + * For group recordings (e.g. recording an entire series), * a ScheduledRecording object is also used to represent a “parent” recording * that enables management of the group recording without representing any of - * the actual recordings in the group. + * the actual recordings in the group. * The values of the properties of a ScheduledRecording (except for - * startPadding and endPadding ) are provided when the object is created - * using one of the record() methods in section 7.10.1, for example by + * startPadding and endPadding ) are provided when the object is created + * using one of the record() methods in section 7.10.1, for example by * using a corresponding Programme object as argument for the record() method, - * and can not be changed for this scheduled recording object + * and can not be changed for this scheduled recording object * (except for startPadding and endPadding). */ +class ScheduledRecording { -var ScheduledRecording = Class.extend({ + constructor(...parameters) { + /* + * This specification does not define values for these constants. + * Implementations may use any values as long as the value of + * each constant is unique. + */ + this.RECORDING_SCHEDULED = 0; + this.RECORDING_REC_STARTED = 1; + this.RECORDING_REC_COMPLETED = 2; + this.RECORDING_REC_PARTIALLY_COMPLETED = 3; + this.RECORDING_ERROR = 4; + this.ERROR_REC_RESOURCE_LIMITATION = 1712; + this.ERROR_INSUFFICIENT_STORAGE = 918; + this.ERROR_REC_UNKNOWN = 21; - /* - * This specification does not define values for these constants. - * Implementations may use any values as long as the value of - * each constant is unique. - */ - RECORDING_SCHEDULED: 0, - RECORDING_REC_STARTED: 1, - RECORDING_REC_COMPLETED: 2, - RECORDING_REC_PARTIALLY_COMPLETED: 3, - RECORDING_ERROR: 4, - ERROR_REC_RESOURCE_LIMITATION: 1712, - ERROR_INSUFFICIENT_STORAGE: 918, - ERROR_REC_UNKNOWN: 21, - - ID_TVA_GROUP_CRID: 2, - - /* - * Description: - * The state of the recording. Valid values are: - * RECORDING_REC_STARTED - * RECORDING_REC_COMPLETED - * RECORDING_REC_PARTIALLY_COMPLETED - * RECORDING_SCHEDULED - * RECORDING_ERROR - * - * Visibility Type: readonly Integer - */ - state: null, - - /* - * Description: - * If the state of the recording has changed due to an error, - * this field contains an error code detailing the type of error. - * This is only valid if the value of the state argument is RECORDING_ERROR - * or RECORDING_REC_PARTIALLY_COMPLETED otherwise - * this property SHALL be null . Valid values are: - * ERROR_REC_RESOURCE_LIMITATION - * ERROR_INSUFFICIENT_STORAGE - * ERROR_REC_UNKNOWN - * - * Visibility Type: readonly Integer - */ - error: null, - - scheduleID: null, - customID: null, - startPadding: null, - endPadding: null, - - /* - * Description: - * Bitfield indicating which days of the week the recording SHOULD - * be repeated. Values are as follows: - * ------------------------------------------------------------------------ - * Day | Bitfield Value - * ------------- ---------------------------------------------------------- - * Sunday | Indicates there are no analogue video outputs - * ------------- ---------------------------------------------------------- - * Monday | Indicates platform support for the NTSC TV standard. - * ------------- ---------------------------------------------------------- - * Tuesday | Indicates platform support for the PAL-BGH TV standard. - * ------------- ---------------------------------------------------------- - * Wednesday | Indicates platform support for the SECAM TV standard. - * ------------- ---------------------------------------------------------- - * Thursday | Indicates platform support for the PAL-M TV standard. - * ------------- ---------------------------------------------------------- - * Friday | Indicates platform support for the PAL-N TV standard. - * ------------------------------------------------------------------------ - * Saturday | Indicates platform support for the PAL-N TV standard. - * ------------------------------------------------------------------------ - * - * Visibility Type: readonly Integer - * - * FIXME: Yannis - 27/04/2015 - Express this properties as a bitfield. - */ - repeatDays: null, - - /* - * Description: - * The short name of the programme, e.g. 'Star Trek: DS9'. - * - * Type: String - */ - name: null, + this.ID_TVA_GROUP_CRID = 2; - /* - * Description: - * The long name of the programme, e.g. 'Star Trek: Deep Space Nine'. - * If the long name is not available, this property will be undefined. - * - * Type: String - */ - longName: null, + /* + * Description: + * The state of the recording. Valid values are: + * RECORDING_REC_STARTED + * RECORDING_REC_COMPLETED + * RECORDING_REC_PARTIALLY_COMPLETED + * RECORDING_SCHEDULED + * RECORDING_ERROR + * + * Visibility Type: readonly Integer + */ + this.state = null; - /* - * Description: - * The description of the programme, e.g. an episode synopsis. If no description is available, this property will be undefined. - * - * Type: String - */ - description: null, + /* + * Description: + * If the state of the recording has changed due to an error, + * this field contains an error code detailing the type of error. + * This is only valid if the value of the state argument is RECORDING_ERROR + * or RECORDING_REC_PARTIALLY_COMPLETED otherwise + * this property SHALL be null . Valid values are: + * ERROR_REC_RESOURCE_LIMITATION + * ERROR_INSUFFICIENT_STORAGE + * ERROR_REC_UNKNOWN + * + * Visibility Type: readonly Integer + */ + this.error = null; - /* - * Description: - * The long description of the programme. If no description is available, this property will be undefined. - * - * Type: String - */ - longDescription: null, - - /* - * Description: - * The long description of the programme. If no description is available, this property will be undefined. - * - * Visibility Type: readonly Integer - */ - startTime: null, + this.scheduleID = null; + this.customID = null; + this.startPadding = null; + this.endPadding = null; - /* - * Description: - * The duration of the programme (in seconds). - * - * Visibility Type: readonly Integer - */ - duration: null, - - /* - * Description: - * Reference to the broadcast channel where the scheduled programme - * is available. - * - * Visibility Type: reaonly Channel - */ - channel: null, - - /* - * Description: - * true if the recording was scheduled using - * oipfRecordingScheduler.recordAt() or using a terminal-specific approach - * that does not use guide data to determine what to record, false otherwise. - * If false , then any fields whose name matches a field in the Programme - * object contains details from the programme guide on the programme - * that has been recorded. If true , only the channel , startTime and - * duration properties are required to be valid. - * - * Visibility Type: readonly Boolean - */ - isManual: null, - - /* - * Description: - * The episode number for the programme if it is part of a series. This property is undefined when the - * programme is not part of a series or the information is not available. - * - * Visibility Type: readonly Integer - */ - episode: null, + /* + * Description: + * Bitfield indicating which days of the week the recording SHOULD + * be repeated. Values are as follows: + * ------------------------------------------------------------------------ + * Day | Bitfield Value + * ------------- ---------------------------------------------------------- + * Sunday | Indicates there are no analogue video outputs + * ------------- ---------------------------------------------------------- + * Monday | Indicates platform support for the NTSC TV standard. + * ------------- ---------------------------------------------------------- + * Tuesday | Indicates platform support for the PAL-BGH TV standard. + * ------------- ---------------------------------------------------------- + * Wednesday | Indicates platform support for the SECAM TV standard. + * ------------- ---------------------------------------------------------- + * Thursday | Indicates platform support for the PAL-M TV standard. + * ------------- ---------------------------------------------------------- + * Friday | Indicates platform support for the PAL-N TV standard. + * ------------------------------------------------------------------------ + * Saturday | Indicates platform support for the PAL-N TV standard. + * ------------------------------------------------------------------------ + * + * Visibility Type: readonly Integer + * + * FIXME: Yannis - 27/04/2015 - Express this properties as a bitfield. + */ + this.repeatDays = null; - /* - * Description: - * If the programme is part of a series, the total number of episodes in the series. This property is undefined - * when the programme is not part of a series or the information is not available. - * - * Visibility Type: readonly Integer - */ - totalEpisodes: null, + /* + * Description: + * The short name of the programme, e.g. 'Star Trek: DS9'. + * + * Type: String + */ + this.name = null; - /* - * Description: - * The unique identifier of the programme or series, e.g., - * a TV-Anytime CRID (Content Reference Identifier). - * - * Visibility Type: readonly Integer - */ - programmeID: null, + /* + * Description: + * The long name of the programme, e.g. 'Star Trek: Deep Space Nine'. + * If the long name is not available, this property will be undefined. + * + * Type: String + */ + this.longName = null; - /* - * Description: - * The type of identification used to reference the programme, - * as indicated by one of the ID_* constants - * defined above. - * - * Visibility Type: readonly Integer - */ - programmeIDType: null, - - /* - * Description: - * A collection of parental rating values for the programme for zero or more - * parental rating schemes supported by the OITF. The value of this property - * is typically provided by a corresponding “ Programme ” object that is - * used to schedule the recording and can not be changed for this scheduled - * recording object. If no parental rating information is available for this - * scheduled recording, this property is a ParentalRatingCollection - * object (as defined in section 7.9.5) with length 0. - * Note that if the parentalRating property contains a certain - * parental rating (e.g. PG-13) and the broadcastchannel associated with - * this scheduled recording has metadata that says that the content is - * rated PG-16,then the conflict resolution is implementation dependent. - * Note that this property was formerly called “parentalRating” - * (singular not plural). - * - * Visibility Type: readonly ParentalRatingCollection - */ - parentalRatings: null, - - /* - * Description: - * Application-specific information for this recording. - * This value is information that the DAE application can set in order - * to retain additional information on this scheduled recording. It is not - * changed by the OITF. The OITF SHALL support values up to and including - * 16 K Bytes in size. Strings longer than this MAY get truncated. - * - * Type: String - */ - customMetadata: null, - - init: function() { - var parameters = arguments; - + /* + * Description: + * The description of the programme, e.g. an episode synopsis. If no description is available, this property will be undefined. + * + * Type: String + */ + this.description = null; + + /* + * Description: + * The long description of the programme. If no description is available, this property will be undefined. + * + * Type: String + */ + this.longDescription = null; + + /* + * Description: + * The long description of the programme. If no description is available, this property will be undefined. + * + * Visibility Type: readonly Integer + */ + this.startTime = null; + + /* + * Description: + * The duration of the programme (in seconds). + * + * Visibility Type: readonly Integer + */ + this.duration = null; + + /* + * Description: + * Reference to the broadcast channel where the scheduled programme + * is available. + * + * Visibility Type: reaonly Channel + */ + this.channel = null; + + /* + * Description: + * true if the recording was scheduled using + * oipfRecordingScheduler.recordAt() or using a terminal-specific approach + * that does not use guide data to determine what to record, false otherwise. + * If false , then any fields whose name matches a field in the Programme + * object contains details from the programme guide on the programme + * that has been recorded. If true , only the channel , startTime and + * duration properties are required to be valid. + * + * Visibility Type: readonly Boolean + */ + this.isManual = null; + + /* + * Description: + * The episode number for the programme if it is part of a series. This property is undefined when the + * programme is not part of a series or the information is not available. + * + * Visibility Type: readonly Integer + */ + this.episode = null; + + /* + * Description: + * If the programme is part of a series, the total number of episodes in the series. This property is undefined + * when the programme is not part of a series or the information is not available. + * + * Visibility Type: readonly Integer + */ + this.totalEpisodes = null; + + /* + * Description: + * The unique identifier of the programme or series, e.g., + * a TV-Anytime CRID (Content Reference Identifier). + * + * Visibility Type: readonly Integer + */ + this.programmeID = null; + + /* + * Description: + * The type of identification used to reference the programme, + * as indicated by one of the ID_* constants + * defined above. + * + * Visibility Type: readonly Integer + */ + this.programmeIDType = null; + + /* + * Description: + * A collection of parental rating values for the programme for zero or more + * parental rating schemes supported by the OITF. The value of this property + * is typically provided by a corresponding “ Programme ” object that is + * used to schedule the recording and can not be changed for this scheduled + * recording object. If no parental rating information is available for this + * scheduled recording, this property is a ParentalRatingCollection + * object (as defined in section 7.9.5) with length 0. + * Note that if the parentalRating property contains a certain + * parental rating (e.g. PG-13) and the broadcastchannel associated with + * this scheduled recording has metadata that says that the content is + * rated PG-16,then the conflict resolution is implementation dependent. + * Note that this property was formerly called “parentalRating” + * (singular not plural). + * + * Visibility Type: readonly ParentalRatingCollection + */ + this.parentalRatings = null; + + /* + * Description: + * Application-specific information for this recording. + * This value is information that the DAE application can set in order + * to retain additional information on this scheduled recording. It is not + * changed by the OITF. The OITF SHALL support values up to and including + * 16 K Bytes in size. Strings longer than this MAY get truncated. + * + * Type: String + */ + this.customMetadata = null; + this.state = this.RECORDING_SCHEDULED; this.scheduleID = createUUID(); if (parameters.length == 1) { @@ -243,23 +240,23 @@ } else { this._initFromFields.apply(this, parameters); } - }, - - _initFromProgramme: function(programme) { + } + + _initFromProgramme(programme) { console.log("Method _initFromProgramme called."); - var keys = Object.keys(programme); - + var keys = Object.keys(programme); + if (programme.programmeIDType == this.ID_TVA_GROUP_CRID) { - + } else { - for(var i = 0, l = keys.length; i < l; i++) { + for (var i = 0, l = keys.length; i < l; i++) { this[keys[i]] = programme[keys[i]]; } this.isManual = false; } - }, - - _initFromFields: function(startTime, duration, repeatDays, channelID) { + } + + _initFromFields(startTime, duration, repeatDays, channelID) { console.log("Method _initFromFields called"); this.startTime = startTime; this.duration = duration; @@ -267,22 +264,22 @@ this.isManual = true; this.programmeID = undefined; this.programmeIDType = undefined; - }, - - _setDuration: function(duration) { + } + + _setDuration(duration) { this.duration = duration; - }, - - _setStartTime: function(startTime) { + } + + _setStartTime(startTime) { this.startTime = startTime; - }, - - _setRepeatDays: function(repeatDays) { + } + + _setRepeatDays(repeatDays) { this.repeatDays = repeatDays; - }, - - _setState: function(state) { + } + + _setState(state) { this.state = state; } -}); +} Modified: oipf/lib/js/impl/model/ScheduledRecordingCollection.js =================================================================== --- oipf/lib/js/impl/model/ScheduledRecordingCollection.js 2015-06-09 15:39:44 UTC (rev 1668) +++ oipf/lib/js/impl/model/ScheduledRecordingCollection.js 2015-06-09 15:42:18 UTC (rev 1669) @@ -1,15 +1,7 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ +class ScheduledRecordingCollection extends Collection{ -var ScheduledRecordingCollection = Collection.extend({ - - init: function() { - this.super.init.apply(this, arguments); + constructor(...args) { + super(...args); } - -}); - +}