OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 var FilesMetadataBox = Polymer({ | 5 var FilesMetadataBox = Polymer({ |
6 is: 'files-metadata-box', | 6 is: 'files-metadata-box', |
7 | 7 |
8 properties: { | 8 properties: { |
9 // File media type, e.g. image, video. | 9 // File media type, e.g. image, video. |
10 type: String, | 10 type: String, |
(...skipping 25 matching lines...) Expand all Loading... |
36 }, | 36 }, |
37 mediaGenre: { | 37 mediaGenre: { |
38 type: String, | 38 type: String, |
39 observer: 'metadataUpdated_', | 39 observer: 'metadataUpdated_', |
40 }, | 40 }, |
41 mediaTitle: { | 41 mediaTitle: { |
42 type: String, | 42 type: String, |
43 observer: 'metadataUpdated_', | 43 observer: 'metadataUpdated_', |
44 }, | 44 }, |
45 mediaTrack: { | 45 mediaTrack: { |
46 type: Number, | 46 type: String, |
| 47 observer: 'metadataUpdated_', |
| 48 }, |
| 49 mediaYearRecorded: { |
| 50 type: String, |
47 observer: 'metadataUpdated_', | 51 observer: 'metadataUpdated_', |
48 }, | 52 }, |
49 /** | 53 /** |
50 * Exif information parsed by exif_parser.js or null if there is no | 54 * Exif information parsed by exif_parser.js or null if there is no |
51 * information. | 55 * information. |
52 * @type {?Object} | 56 * @type {?Object} |
53 */ | 57 */ |
54 ifd: { | 58 ifd: { |
55 type: Object, | 59 type: Object, |
56 observer: 'metadataUpdated_', | 60 observer: 'metadataUpdated_', |
(...skipping 16 matching lines...) Expand all Loading... |
73 this.mediaMimeType = ''; | 77 this.mediaMimeType = ''; |
74 this.filePath = ''; | 78 this.filePath = ''; |
75 | 79 |
76 this.imageWidth = 0; | 80 this.imageWidth = 0; |
77 this.imageHeight = 0; | 81 this.imageHeight = 0; |
78 this.mediaTitle = ''; | 82 this.mediaTitle = ''; |
79 this.mediaArtist = ''; | 83 this.mediaArtist = ''; |
80 this.mediaAlbum = ''; | 84 this.mediaAlbum = ''; |
81 this.mediaDuration = 0; | 85 this.mediaDuration = 0; |
82 this.mediaGenre = ''; | 86 this.mediaGenre = ''; |
83 this.mediaTrack = 0; | 87 this.mediaTrack = ''; |
| 88 this.mediaYearRecorded = ''; |
84 this.ifd = null; | 89 this.ifd = null; |
85 | 90 |
86 this.isSizeLoading = false; | 91 this.isSizeLoading = false; |
87 }, | 92 }, |
88 | 93 |
89 /** | 94 /** |
90 * @param {string} type | 95 * @param {string} type |
91 * @return {boolean} | 96 * @return {boolean} |
92 * | 97 * |
93 * @private | 98 * @private |
(...skipping 17 matching lines...) Expand all Loading... |
111 isAudio_: function(type) { return type === 'audio'; }, | 116 isAudio_: function(type) { return type === 'audio'; }, |
112 | 117 |
113 /** | 118 /** |
114 * Update private properties computed from metadata. | 119 * Update private properties computed from metadata. |
115 * @private | 120 * @private |
116 */ | 121 */ |
117 metadataUpdated_: function() { | 122 metadataUpdated_: function() { |
118 this.hasFileSpecificInfo_ = | 123 this.hasFileSpecificInfo_ = |
119 !!(this.imageWidth && this.imageHeight || this.mediaTitle || | 124 !!(this.imageWidth && this.imageHeight || this.mediaTitle || |
120 this.mediaArtist || this.mediaAlbum || this.mediaDuration || | 125 this.mediaArtist || this.mediaAlbum || this.mediaDuration || |
121 this.mediaGenre || this.mediaTrack || | 126 this.mediaGenre || this.mediaTrack || this.mediaYearRecorded || |
122 this.ifd); | 127 this.ifd); |
123 }, | 128 }, |
124 | 129 |
125 /** | 130 /** |
126 * Converts the duration into human friendly string. | 131 * Converts the duration into human friendly string. |
127 * @param {number} time the duration in seconds. | 132 * @param {number} time the duration in seconds. |
128 * @return {string} String representation of the given duration. | 133 * @return {string} String representation of the given duration. |
129 **/ | 134 **/ |
130 time2string_: function(time) { | 135 time2string_: function(time) { |
131 if (!time) | 136 if (!time) |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 | 240 |
236 var result = ''; | 241 var result = ''; |
237 for (var i = 0; i < values.length; i++) { | 242 for (var i = 0; i < values.length; i++) { |
238 if (values[i]) { | 243 if (values[i]) { |
239 result += (result ? ' ' : '') + values[i]; | 244 result += (result ? ' ' : '') + values[i]; |
240 } | 245 } |
241 } | 246 } |
242 return result; | 247 return result; |
243 }, | 248 }, |
244 }); | 249 }); |
OLD | NEW |