feat(TVseries): show seasons and episodes info in home/list/detail page

This commit is contained in:
OldHawk
2017-05-24 17:26:09 +08:00
parent 72ce0ee393
commit e7fe9fa090
10 changed files with 163 additions and 17 deletions

View File

@@ -246,6 +246,7 @@
TMDB_ID_REQUIRED: 'Please enter TMDB ID',
TMDB_RESOURCE_INFO: '4. The resource info from TMDB',
TMDB_IS_LOADING: 'Loading the movie info, please wait...',
SELECT_SE: '4.1. Please select number of seasons and input number of episodes',
SELECT_TAGS: '5. Please select any tags for the resources',
ENTER_VIDEO_NFO: '6. Please enter video NFO',
TORRENTS_SUBMIT_UPLOAD: '7. Agree the rules and submit your resources',
@@ -370,9 +371,11 @@
NETWORK: 'Network',
NUMBER_OF_SEASONS: 'total seasons',
NUMBER_OF_EPISODES: 'total episodes',
EPISODES_SEASONS: 'episodes/seasons',
TOTAL_SE: 'total S.E',
THIS_SE: 'this S.E',
UNIT_EPISODES: 'episodes',
UNIT_SEASONS: 'seasons'
UNIT_SEASONS: 'seasons',
EPISODES_INPUT_TIP: 'tip: Only accepts numbers 0-9 and characters minus, for example9 is 9th episode, 1-30 is first to thirty episode, like 001 12 01-30 12-45 45-127 etc.'
},
/////////////////////////resources tag fields///////////////////////////////////

View File

@@ -246,6 +246,7 @@
TMDB_ID_REQUIRED: '请输入 TMDB ID',
TMDB_RESOURCE_INFO: '4. TMDB 资源信息',
TMDB_IS_LOADING: '正在检索视频信息,请稍候...',
SELECT_SE: '4.1. 请选择电视剧季数并输入本资源为本剧第几集',
SELECT_TAGS: '5. 请为资源选择合适的标签',
ENTER_VIDEO_NFO: '6. 请输入视频NFO信息',
TORRENTS_SUBMIT_UPLOAD: '7. 同意上传协议,并提交',
@@ -370,9 +371,11 @@
NETWORK: '网络',
NUMBER_OF_SEASONS: '总季数',
NUMBER_OF_EPISODES: '总集数',
EPISODES_SEASONS: '总集/季数',
TOTAL_SE: '总集',
THIS_SE: '本资源季集',
UNIT_EPISODES: '集',
UNIT_SEASONS: '季'
UNIT_SEASONS: '季',
EPISODES_INPUT_TIP: '提示输入只接受0-9的数字以及减号字符如 9 表示第9集1-30 表示1到30集集合像 001 12 01-30 12-45 45-127 等.'
},
/////////////////////////resources tag fields///////////////////////////////////

View File

@@ -0,0 +1,18 @@
(function () {
'use strict';
angular.module('core')
.filter('mtRange', mtRange);
function mtRange() {
return function (input, total) {
total = parseInt(total, 10);
for (var i = 0; i < total; i++) {
input.push(i);
}
return input;
};
}
}());

View File

@@ -2,6 +2,10 @@
margin-top: 2px;
}
.margin-top-5 {
margin-top: 5px;
}
.margin-top-10 {
margin-top: 10px;
}

View File

@@ -75,6 +75,9 @@ body {
.network-item {
color: #ccc;
}
.se-info {
color: @mt-base-color;
}
.img-circle {
&:hover {
/* csslint ignore:start */
@@ -171,6 +174,9 @@ body {
.release-date {
color: #ccc;
}
.se-info {
color: #ccc;
}
}
.torrent-user-info {
@@ -321,6 +327,20 @@ body {
color: #0366d6;
}
}
.se-info {
right: 5px;
}
}
.se-info {
background-color: #eee;
padding: 0 5px;
border-radius: 3px;
border: solid 1px #aaa;
position: absolute;
right: 15px;
color: #555;
margin-top: 2px;
font-size: 10px;
}
}
@@ -557,6 +577,10 @@ body {
}
}
.episodes_input_tip {
color: #aaa;
}
.nav {
padding-left: 15px;
}

View File

@@ -255,12 +255,17 @@
<dt class="h-line">{{ 'TMDB_FIELDS.LAST_AIR_DATE' | translate}}</dt>
<dd class="h-line">{{vm.TVTopOne.resource_detail_info.last_air_date}}</dd>
<dt class="h-line">{{ 'TMDB_FIELDS.EPISODES_SEASONS' | translate}}</dt>
<dt class="h-line">{{ 'TMDB_FIELDS.TOTAL_SE' | translate}}</dt>
<dd class="h-line">
{{vm.TVTopOne.resource_detail_info.number_of_episodes}} {{ 'TMDB_FIELDS.UNIT_EPISODES' | translate}} /
{{vm.TVTopOne.resource_detail_info.number_of_seasons}} {{ 'TMDB_FIELDS.UNIT_SEASONS' | translate}}
</dd>
<dt class="h-line">{{ 'TMDB_FIELDS.THIS_SE' | translate}}</dt>
<dd class="h-line">
<span class="se-info">S{{vm.TVTopOne.torrent_seasons}}E{{vm.TVTopOne.torrent_episodes}}</span>
</dd>
<dt class="h-line">{{ 'TMDB_FIELDS.VOTE_AVERAGE' | translate}}</dt>
<dd class="h-line">
<span ng-show="vm.TVTopOne">
@@ -328,7 +333,7 @@
<div class="torrent-tmdb-info">
<ul class="list-unstyled">
<li>
<span class="release-date">{{item.resource_detail_info.last_air_date | date: 'yyyy'}}</span>
<span class="se-info">S{{item.torrent_seasons}}E{{item.torrent_episodes}}</span>
<span title="{{ 'TITLE_ALT.IMDB_VOTES' | translate}}"
class="pull-right torrent-votes"><kbd>IMDB</kbd> {{item.resource_detail_info.vote_average}}</span>
</li>
@@ -383,12 +388,14 @@
<div class="newest-info">
<div class="text-long">
{{$index + 1}}. {{nt.resource_detail_info.name}}
<span class="se-info">S{{nt.torrent_seasons}}E{{nt.torrent_episodes}}</span>
</div>
</div>
</div>
<div class="newest-item-small text-long">
{{$index + 1}}. {{nt.resource_detail_info.name}}
<span class="se-info">S{{nt.torrent_seasons}}E{{nt.torrent_episodes}}</span>
</div>
</td>
</tr>

View File

@@ -22,7 +22,10 @@
vm.selectedType = 'movie';
vm.successfully = undefined;
vm.tmdb_info_ok = undefined;
vm.selectedSeasons = undefined;
vm.torrentInfo = null;
vm.inputedEpisodesError = undefined;
vm.inputedEpisodesOK = false;
vm.tags = [];
vm.videoNfo = '';
@@ -133,6 +136,8 @@
*/
vm.onTorrentTypeChanged = function () {
vm.tmdb_info_ok = undefined;
vm.inputedEpisodesError = undefined;
vm.inputedEpisodesOK = false;
vm.tmdb_isloading = false;
vm.movieinfo = undefined;
vm.tvinfo = undefined;
@@ -177,6 +182,7 @@
}, function (res) {
vm.tmdb_info_ok = true;
vm.tmdb_isloading = false;
vm.inputedEpisodesOK = true;
Notification.success({
message: '<i class="glyphicon glyphicon-ok"></i> ' + $translate.instant('TMDB_ID_OK')
});
@@ -221,6 +227,9 @@
console.log(res);
vm.tvinfo = res;
if (parseInt(vm.tvinfo.number_of_seasons, 10) > 0) {
vm.selectedSeasons = '1';
}
}, function (err) {
vm.tmdb_info_ok = false;
vm.tmdb_isloading = false;
@@ -231,6 +240,23 @@
});
};
/**
* tvContinue
* @param isValid
* @returns {boolean}
*/
vm.tvContinue = function (isValid) {
if (!isValid) {
$scope.$broadcast('show-errors-check-validity', 'vm.episodesForm');
vm.inputedEpisodesError = true;
return false;
}else{
vm.inputedEpisodesError = false;
vm.inputedEpisodesOK = true;
}
};
/**
* create
*/
@@ -300,6 +326,8 @@
info_hash: vm.torrentInfo.info_hash,
torrent_filename: vm.torrentInfo.filename,
torrent_type: 'tvseries',
torrent_seasons: vm.selectedSeasons,
torrent_episodes: vm.inputedEpisodes,
torrent_tags: t,
torrent_nfo: vm.videoNfo,
torrent_announce: vm.torrentInfo.announce,

View File

@@ -90,7 +90,7 @@
<div ng-if="vm.tmdb_info_ok == true" ng-include="vm.getIncludeInfoTemplate();"></div>
<div class="row margin-bottom-40" ng-show="vm.tmdb_info_ok == true">
<div class="row margin-bottom-40" ng-show="vm.tmdb_info_ok == true && vm.inputedEpisodesOK == true">
<div class="col-md-12 col-sm-12 col-xs-12">
<legend class="small-legend" translate="ENTER_VIDEO_NFO"></legend>
<div class="col-xs-12">
@@ -99,7 +99,7 @@
</div>
</div>
<div class="row margin-bottom-40" ng-show="vm.tmdb_info_ok == true" style="margin-top: 60px;">
<div class="row margin-bottom-40 margin-top-50" ng-show="vm.tmdb_info_ok == true && vm.inputedEpisodesOK == true">
<div class="col-md-12 col-sm-12 col-xs-12">
<legend class="small-legend" translate="TORRENTS_SUBMIT_UPLOAD"></legend>
<div class="col-sm-6 col-sm-offset-3 text-center">
@@ -290,10 +290,10 @@
<dd class="h-line">{{vm.tvinfo.last_air_date}}</dd>
<dt class="h-line">{{ 'TMDB_FIELDS.NUMBER_OF_SEASONS' | translate}}</dt>
<dd class="h-line">{{vm.torrentLocalInfo.resource_detail_info.number_of_seasons}} {{ 'TMDB_FIELDS.UNIT_SEASONS' | translate}}</dd>
<dd class="h-line">{{vm.tvinfo.number_of_seasons}} {{ 'TMDB_FIELDS.UNIT_SEASONS' | translate}}</dd>
<dt class="h-line">{{ 'TMDB_FIELDS.NUMBER_OF_EPISODES' | translate}}</dt>
<dd class="h-line">{{vm.torrentLocalInfo.resource_detail_info.number_of_episodes}} {{ 'TMDB_FIELDS.UNIT_EPISODES' | translate}}</dd>
<dd class="h-line">{{vm.tvinfo.number_of_episodes}} {{ 'TMDB_FIELDS.UNIT_EPISODES' | translate}}</dd>
<dt class="h-line">{{ 'TMDB_FIELDS.VOTE_AVERAGE' | translate}}</dt>
<dd class="h-line">{{vm.tvinfo.vote_average}} / {{vm.tvinfo.vote_count}} {{ 'TMDB_FIELDS.VOTE_UNIT' | translate}}</dd>
@@ -320,7 +320,48 @@
</div>
</div>
<div class="row margin-bottom-40">
<div class="row margin-bottom-20">
<div class="col-md-12 col-sm-12 col-xs-12">
<legend class="small-legend" translate="SELECT_SE"></legend>
<dl class="dl-horizontal">
<dt class="h-line">{{ 'TMDB_FIELDS.UNIT_SEASONS' | translate}}</dt>
<dd class="h-line">
<div class="col-sm-4 col-md-3">
<select class="form-control" ng-model="vm.selectedSeasons">
<option ng-repeat="n in [] | mtRange:vm.tvinfo.number_of_seasons" value="{{n+1}}">{{n+1}}</option>
</select>
</div>
</dd>
<div class="margin-top-5">
<form name="vm.episodesForm" ng-submit="vm.tvContinue(vm.episodesForm.$valid)" novalidate>
<dt class="h-line">{{ 'TMDB_FIELDS.UNIT_EPISODES' | translate}}</dt>
<dd class="h-line">
<div class="form-group" show-errors>
<div class="col-sm-4 col-md-3">
<input class="form-control" id="inputedEpisodes" name="inputedEpisodes"
ng-pattern="/(^[0-9]{1,4}$)|(^[0-9]{1,2}[\-]{1}[0-9]{1,4}$)/"
ng-model="vm.inputedEpisodes" ng-disabled="vm.inputedEpisodesOK" required>
</div>
<div class="col-sm-4 col-md-3">
<button type="submit" class="btn btn-primary">continue</button>
</div>
<div class="col-xs-12" ng-messages="vm.episodesForm.inputedEpisodes.$error" role="alert">
<p class="help-block error-text" ng-message="required">{{'TMDB_FIELDS.EPISODES_INPUT_TIP' | translate}}</p>
<p class="help-block error-text" ng-message="pattern">{{'TMDB_FIELDS.EPISODES_INPUT_TIP' | translate}}</p>
</div>
<div class="col-xs-12" ng-hide="vm.inputedEpisodesError">
<p class="episodes_input_tip">{{ 'TMDB_FIELDS.EPISODES_INPUT_TIP' | translate}}</p>
</div>
</div>
</dd>
</form>
</div>
</dl>
</div>
</div>
<div class="row margin-bottom-40" ng-show="vm.inputedEpisodesOK">
<div class="col-md-12 col-sm-12 col-xs-12">
<legend class="small-legend" translate="SELECT_TAGS"></legend>
<dl class="dl-horizontal">

View File

@@ -97,13 +97,18 @@
</div>
<div ng-show="vm.torrentLocalInfo.resource_detail_info.number_of_seasons">
<dt class="h-line">{{ 'TMDB_FIELDS.NUMBER_OF_SEASONS' | translate}}</dt>
<dd class="h-line">{{vm.torrentLocalInfo.resource_detail_info.number_of_seasons}} {{ 'TMDB_FIELDS.UNIT_SEASONS' | translate}}</dd>
</div>
<dt class="h-line">{{ 'TMDB_FIELDS.TOTAL_SE' | translate}}</dt>
<dd class="h-line">
{{vm.torrentLocalInfo.resource_detail_info.number_of_episodes}} {{ 'TMDB_FIELDS.UNIT_EPISODES' | translate}} /
{{vm.torrentLocalInfo.resource_detail_info.number_of_seasons}} {{ 'TMDB_FIELDS.UNIT_SEASONS' | translate}}
</dd>
<div ng-show="vm.torrentLocalInfo.resource_detail_info.number_of_episodes">
<dt class="h-line">{{ 'TMDB_FIELDS.NUMBER_OF_EPISODES' | translate}}</dt>
<dd class="h-line">{{vm.torrentLocalInfo.resource_detail_info.number_of_episodes}} {{ 'TMDB_FIELDS.UNIT_EPISODES' | translate}}</dd>
<div ng-show="vm.torrentLocalInfo.resource_detail_info.number_of_seasons">
<dt class="h-line">{{ 'TMDB_FIELDS.THIS_SE' | translate}}</dt>
<dd class="h-line">
<span class="se-info">S{{vm.torrentLocalInfo.torrent_seasons}}E{{vm.torrentLocalInfo.torrent_episodes}}</span>
</dd>
</div>
</div>
<div ng-hide="!vm.torrentLocalInfo.resource_detail_info.runtime || vm.torrentLocalInfo.resource_detail_info.runtime == 0">
@@ -322,6 +327,11 @@
<dt class="h-line">{{ 'TRANCKER_URL' | translate}}</dt>
<dd class="h-line">{{vm.torrentLocalInfo.torrent_announce}}</dd>
<dt class="h-line">{{ 'TMDB_FIELDS.THIS_SE' | translate}}</dt>
<dd class="h-line">
<span class="se-info">S{{vm.torrentLocalInfo.torrent_seasons}}E{{vm.torrentLocalInfo.torrent_episodes}}</span>
</dd>
<dt class="h-line">{{ 'VIDEO_SIZE' | translate}}</dt>
<dd class="h-line">{{vm.torrentLocalInfo.torrent_size | bytes:2}}</dd>

View File

@@ -75,6 +75,14 @@ var TorrentSchema = new Schema({
default: '',
trim: true
},
torrent_seasons: {
type: Number,
default: 0
},
torrent_episodes: {
type: String,
default: '0'
},
torrent_size: {
type: Number,
default: 0