feat(torrent): new torrent media info

This commit is contained in:
OldHawk
2018-05-19 22:34:02 +08:00
parent e9efa208f0
commit 3626e7ff47
7 changed files with 224 additions and 6 deletions

View File

@@ -1357,6 +1357,24 @@ module.exports = {
{command: './restart.sh', eid: 'restart', desc: 'COMMAND.RESTART'}
],
/**
* @mediaInfo
*
* mediaInfo settings
*
* @subtitle: subtitles of media info
* @flag: flag icon class, can find flag icon at '/public/lib/flag-icon-css/flags'
*/
mediaInfo: {
subtitles: {
flag: {
chs: {class: 'flag-icon-cn'},
cht: {class: 'flag-icon-tw'},
eng: {class: 'flag-icon-gb'}
}
}
},
/**
* @resourcesTags
*

View File

@@ -381,7 +381,11 @@
TORRENT_THUMBS_FAILED: 'Thumbs-up for torrent failed',
TORRENT_RATING_SUCCESSFULLY: 'Rating torrent successfully',
TORRENT_RATING_FAILED: 'Rating torrent failed',
EDIT_THIS_OVERVIEW: 'Edit this Overview',
EDIT_THIS_OVERVIEW: 'Edit this overview',
EDIT_THIS_MEDIA_INFO: 'Edit this media info',
SAVE_THIS_MEDIA_INFO: 'Save this media info',
EDIT_TORRENT_NFO_SUCCESSFULLY: 'Torrent media info edited successfully',
EDIT_TORRENT_NFO_FAILED: 'Torrent media info edited failed',
IMG_PAGE_INFO: 'Current: {{index}} / {{total}}',
ANNOUNCE_URL: 'Announce Url',
@@ -479,6 +483,8 @@
TORRENT_TOGGLE_VIP_FAILED: 'Torrent toggle VIP tag failed',
TORRENT_TOGGLE_TOP_SUCCESSFULLY: 'Torrent toggle TOP tag successfully',
TORRENT_TOGGLE_TOP_FAILED: 'Torrent toggle TOP tag failed',
TORRENT_TOGGLE_UNIQUE_SUCCESSFULLY: 'Torrent toggle Unique tag successfully',
TORRENT_TOGGLE_UNIQUE_FAILED: 'Torrent toggle Unique tag failed',
TORRENT_SETTAGS_SUCCESSFULLY: 'Torrent tags set successfully',
TORRENT_SETTAGS_ERROR: 'Torrent tags set failed',
@@ -1587,6 +1593,45 @@
}
},
MEDIAINFO: {
GENERAL: {
SELF: 'General Info',
FILESIZE: 'File Size',
RUNTIME: 'Runtime',
DURATION: 'Duration',
OVERALLBITRATE: 'Overall Bit Rate'
},
VIDEO: {
SELF: 'Video Info',
FORMAT: 'Format',
Duration: 'Duration',
BITRATE: 'Bit Rate',
WIDTH: 'Width',
HEIGHT: 'Height',
FRAMERATEMODE: 'Frame Rate Mode',
FRAMERATE: 'Frame Rate',
BITDEPTH: 'Bit Depth',
STREAMSIZE: 'Stream Size',
WRITINGLIBRARY: 'Writing Library',
RESOLUTION: 'Resolution',
CODEC: 'Video Codec'
},
AUDIO: {
SELF: 'Audio Info',
FORMAT: 'Format',
BITRATEMODE: 'Bit Rate Mode',
BITRATE: 'Bit Rate',
CHANNEL: 'Channel',
LANGUAGE: 'Language',
INFO: 'Audio Info',
CODEC: 'Codec'
},
TEXT: {
SELF: 'Subtitle Info',
LANGUAGE: 'Language'
}
},
//server returned string
SERVER: {
USER_IS_NOT_AUTHORIZED: 'User is not authorized',

View File

@@ -382,6 +382,10 @@
TORRENT_RATING_SUCCESSFULLY: '为种子投票成功',
TORRENT_RATING_FAILED: '为种子投票失败',
EDIT_THIS_OVERVIEW: '编辑详情介绍',
EDIT_THIS_MEDIA_INFO: '编辑媒体信息',
SAVE_THIS_MEDIA_INFO: '保存媒体信息',
EDIT_TORRENT_NFO_SUCCESSFULLY: '种子媒体信息编辑成功',
EDIT_TORRENT_NFO_FAILED: '种子媒体信息编辑失败',
IMG_PAGE_INFO: '当前页: {{index}} / {{total}}',
ANNOUNCE_URL: 'Tracker 地址',
@@ -1589,6 +1593,45 @@
}
},
MEDIAINFO: {
GENERAL: {
SELF: '资源通用信息',
FILESIZE: '资源总体积',
RUNTIME: '资源总时长',
DURATION: '资源总时长',
OVERALLBITRATE: '资源总码率'
},
VIDEO: {
SELF: '视频信息',
FORMAT: '格式',
Duration: '时长',
BITRATE: '码率',
WIDTH: '分辨率.宽',
HEIGHT: '分辨率.高',
FRAMERATEMODE: '帧率模式',
FRAMERATE: '帧率',
BITDEPTH: '位深',
STREAMSIZE: '体积',
WRITINGLIBRARY: '编码方式',
RESOLUTION: '分辨率',
CODEC: '编码'
},
AUDIO: {
SELF: '音频信息',
FORMAT: '格式',
BITRATEMODE: '码率模式',
BITRATE: '码率',
CHANNEL: '声道',
LANGUAGE: '音轨',
INFO: '音轨信息',
CODEC: '编码'
},
TEXT: {
SELF: '字幕信息',
LANGUAGE: '语言'
}
},
//server returned string
SERVER: {
USER_IS_NOT_AUTHORIZED: '用户身份验证未通过',

View File

@@ -1610,6 +1610,7 @@ body {
}
.all-files {
font-size: 12px;
json-tree {
json-node.expandable {
&::before {

View File

@@ -31,6 +31,9 @@
vm.scoreConfig = MeanTorrentConfig.meanTorrentConfig.score;
vm.inputLengthConfig = MeanTorrentConfig.meanTorrentConfig.inputLength;
vm.salesGlobalConfig = MeanTorrentConfig.meanTorrentConfig.torrentGlobalSales;
vm.mediaInfoConfig = MeanTorrentConfig.meanTorrentConfig.mediaInfo;
vm.mediaInfoEditMode = false;
vm.torrentTabs = [];
vm.searchTags = [];
@@ -1504,9 +1507,19 @@
_id: vm.torrentLocalInfo._id,
torrent_nfo: vm.torrentLocalInfo.torrent_nfo
}, function (res) {
console.log('updateTorrentNfo successfully');
console.log(res);
vm.torrentLocalInfo = res;
NotifycationService.showSuccessNotify('EDIT_TORRENT_NFO_SUCCESSFULLY');
vm.mediaInfoEditMode = false;
}, function (res) {
NotifycationService.showErrorNotify(res.data.message, 'EDIT_TORRENT_NFO_FAILED');
});
};
/**
* doEditMediaInfo
*/
vm.doEditMediaInfo = function () {
vm.mediaInfoEditMode = true;
};
}
}());

View File

@@ -217,6 +217,55 @@ pre.prettyprint {
}
}
.media-info-formated {
background-color: #fcfcfc;
border: solid 1px #f1f1f1;
border-radius: 4px;
padding: 10px 20px;
legend {
font-size: 13px;
font-weight: 400;
color: #7a7a7a;
margin-bottom: 6px;
}
.info-key {
width: 120px;
text-align: right;
color: #2a2a2a;
}
.info-value {
color: #7a7a7a;
font-size: 12px;
}
.flag-group {
font-family: monospace, 'Courier New';
padding: 4px 5px 2px 5px;
border: solid 1px #ccc;
display: inline-block;
margin-bottom: 3px;
margin-right: 5px;
.flag-icon {
font-size: 18px;
margin-right: 5px;
}
}
}
.dl-media-info {
margin-bottom: 10px;
dt {
color: #2a2a2a;
@media (min-width: @screen-sm-min) {
width: 120px;
}
}
dd {
@media (min-width: @screen-sm-min) {
margin-left: 140px;
}
}
}
/* csslint ignore:end */
//popup overlay----------------------------------------------

View File

@@ -675,10 +675,60 @@
</dd>
<dt class="h-line" ng-if="vm.torrentLocalInfo.torrent_nfo.length>0">{{ 'VIDEO_NFO' | translate}}</dt>
<dd class="h-line" ng-if="vm.torrentLocalInfo.torrent_nfo.length>0">
<div class="row">
<dd ng-if="vm.torrentLocalInfo.torrent_nfo.length>0">
<div class="row" ng-if="!vm.mediaInfoEditMode">
<div class="col-md-10">
<div class="media-info-formated">
<legend ng-repeat-start="(key, value) in vm.torrentLocalInfo.torrent_media_info track by $index">
{{'MEDIAINFO.'+key.toUpperCase()+'.SELF' | translate}}:
</legend>
<div class="info-value" ng-repeat-end>
<dl class="dl-horizontal dl-media-info">
<dt ng-repeat-start="(subKey, subValue) in value">
{{'MEDIAINFO.'+key.toUpperCase()+'.'+subKey.toUpperCase() | translate}}:
</dt>
<dd ng-repeat-end>
<div ng-if="subKey!='info' && subKey!='language'">
<div>{{subValue}}</div>
</div>
<div ng-if="subKey=='info'" ng-repeat="ifo in subValue track by $index">
<div>{{ifo}}</div>
</div>
<div ng-if="subKey=='language'">
<span ng-if="key=='audio'" ng-repeat="lang in subValue">
<div>{{lang}}</div>
</span>
<span ng-if="key=='text'" ng-repeat="lang in subValue">
<span class="flag-group">
<span class="flag-icon {{vm.mediaInfoConfig.subtitles.flag[lang].class}}"></span>{{lang}}
</span>
</span>
</div>
</dd>
</dl>
</div>
</div>
<div>
<button class="btn btn-xs btn-mt-o margin-top-15" mouse-enter-toggle-class="btn-success"
base-class="btn-mt-o-success"
ng-if="vm.isOwner(vm.torrentLocalInfo) || vm.user.isOper"
ng-click="vm.doEditMediaInfo()">
{{'EDIT_THIS_MEDIA_INFO' | translate}}
</button>
</div>
</div>
</div>
<div class="row" ng-if="vm.mediaInfoEditMode">
<div class="col-md-10">
<textarea class="form-control video-nfo margin-top-10" rows="15" ng-model="vm.torrentLocalInfo.torrent_nfo"></textarea>
<div>
<button class="btn btn-xs btn-mt-o margin-top-15" mouse-enter-toggle-class="btn-success"
base-class="btn-mt-o-success"
ng-if="vm.isOwner(vm.torrentLocalInfo) || vm.user.isOper"
ng-click="vm.updateTorrentNfo()">
{{'SAVE_THIS_MEDIA_INFO' | translate}}
</button>
</div>
</div>
</div>
</dd>
@@ -689,7 +739,6 @@
<button class="btn btn-success btn-width-100" ng-click="vm.DLS.downloadTorrent(vm.torrentLocalInfo._id)"
translate="DOWNLOAD_TORRENT"></button>
<span torrent-file-link-button="vm.torrentLocalInfo" torrent-user="vm.user" info-class="btn-default"></span>
<!--<button class="btn btn-default btn-width-100" ng-click="vm.updateTorrentNfo()">Update MediaInfo</button>-->
</div>
</dd>
</dl>