VideoItem.ets 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*
  2. * Copyright (c) 2023 Huawei Device Co., Ltd.
  3. * Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at
  6. *
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. *
  9. * Unless required by applicable law or agreed to in writing, software
  10. * distributed under the License is distributed on an "AS IS" BASIS,
  11. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. * See the License for the specific language governing permissions and
  13. * limitations under the License.
  14. */
  15. import { FileUtil, StrUtil } from '@pura/harmony-utils';
  16. import { CommonConstants } from '../common/constants/CommonConstants';
  17. @Observed
  18. export class VideoItem {
  19. id: string;
  20. name: string;//视频和音频文件名称,音频如果是音乐取歌曲名称值
  21. filePath: string
  22. type:number
  23. videoSize:number;
  24. cTime:string;//创建时间
  25. parentPath:string;
  26. isFav:number;
  27. size?:string;
  28. pixelMapPath?: string;
  29. artist?: string;
  30. album?: string;
  31. fileName?: string;//音乐文件的真实文件名称
  32. lastPlayed?:Date;
  33. duration?:string//时长
  34. mimeType?:string//类型
  35. sampleRate?:string//音频的采样率单位为Hz
  36. trackCount?:string//轨道数量
  37. lastPlayedStr?:string;//最后播放时间
  38. playCount?:number//播放次数
  39. lyricContent?:string//歌词内容
  40. md5Str?:string//直接用来保存音质的判断
  41. extra_json?:string
  42. pyStr?:string//中文歌曲名称拼音的首字母
  43. bit_rate?:string//比特率
  44. probe_score?:number//评分
  45. year?:string//年份
  46. nb_streams?:number//流数量
  47. nb_programs?:number//节目数量
  48. genre?:string//风格
  49. track?:string//音轨号
  50. bits_per_raw_sample?:string//位深
  51. channels?:string//声道数
  52. channel_layout?:string//声道布局:stereo为标准立体声(左+右)
  53. start_time?:string//起始时间:
  54. ALBUMARTIST?:string//专辑艺术家
  55. COMPOSER?:string//作曲家
  56. LYRICIST?:string//作词家
  57. COMMENT?:string//注释
  58. disc?:string//碟号
  59. webdav_account_id?: string// WebDAV账号ID,用于获取认证信息
  60. remote_rel_path?: string // 远程相对路径(去掉协议+host+端口),便于重构URL
  61. navArtistId?: string;
  62. navAlbumId?: string;
  63. baiduFsId?: string // 百度网盘 fs_id
  64. constructor(name: string, id: string, filePath: string, type:number,videoSize:number,cTime: string,
  65. size?: string,pixelMapPath?: string,artist?: string,album?: string,fileName?: string, lastPlayed?:Date) {
  66. this.name = name;
  67. this.id = id;
  68. this.filePath = filePath;
  69. this.type = type;
  70. this.videoSize = videoSize;
  71. this.cTime = cTime;
  72. if(StrUtil.isNotEmpty(this.filePath)&&this.type===CommonConstants.TYPE_LOCAL){
  73. try {
  74. this.parentPath = FileUtil.getParentPath(this.filePath);
  75. }catch (e) {
  76. this.parentPath=''
  77. }
  78. }else{
  79. this.parentPath = ''
  80. }
  81. this.isFav = 0;
  82. this.size = size;
  83. this.pixelMapPath = pixelMapPath;
  84. this.artist = artist;
  85. this.album = album;
  86. this.fileName = fileName;
  87. this.lastPlayed = lastPlayed;
  88. this.playCount = 0
  89. this.md5Str = ''
  90. this.extra_json = ''
  91. this.pyStr = ''
  92. }
  93. }