From e7fe9fa0901a95efad04574fb1de91f9db8d835c Mon Sep 17 00:00:00 2001 From: OldHawk Date: Wed, 24 May 2017 17:26:09 +0800 Subject: [PATCH] feat(TVseries): show seasons and episodes info in home/list/detail page --- modules/core/client/app/trans-string-en.js | 7 ++- modules/core/client/app/trans-string-zh.js | 7 ++- .../client/filter/mt-range.client.filter.js | 18 +++++++ modules/core/client/less/margin.less | 4 ++ modules/core/client/less/mt.less | 24 +++++++++ .../core/client/views/home.client.view.html | 11 +++- .../controllers/uploads.client.controller.js | 28 ++++++++++ .../views/uploads-torrents.client.view.html | 51 +++++++++++++++++-- .../views/view-torrent.client.view.html | 22 +++++--- .../server/models/torrent.server.model.js | 8 +++ 10 files changed, 163 insertions(+), 17 deletions(-) create mode 100644 modules/core/client/filter/mt-range.client.filter.js diff --git a/modules/core/client/app/trans-string-en.js b/modules/core/client/app/trans-string-en.js index e1f8a085..cde8af78 100644 --- a/modules/core/client/app/trans-string-en.js +++ b/modules/core/client/app/trans-string-en.js @@ -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 example:9 is 9th episode, 1-30 is first to thirty episode, like 001 12 01-30 12-45 45-127 etc.' }, /////////////////////////resources tag fields/////////////////////////////////// diff --git a/modules/core/client/app/trans-string-zh.js b/modules/core/client/app/trans-string-zh.js index f92498dc..8623be2f 100644 --- a/modules/core/client/app/trans-string-zh.js +++ b/modules/core/client/app/trans-string-zh.js @@ -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/////////////////////////////////// diff --git a/modules/core/client/filter/mt-range.client.filter.js b/modules/core/client/filter/mt-range.client.filter.js new file mode 100644 index 00000000..808d36db --- /dev/null +++ b/modules/core/client/filter/mt-range.client.filter.js @@ -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; + }; + } +}()); diff --git a/modules/core/client/less/margin.less b/modules/core/client/less/margin.less index a052adb8..4c0a2347 100644 --- a/modules/core/client/less/margin.less +++ b/modules/core/client/less/margin.less @@ -2,6 +2,10 @@ margin-top: 2px; } +.margin-top-5 { + margin-top: 5px; +} + .margin-top-10 { margin-top: 10px; } diff --git a/modules/core/client/less/mt.less b/modules/core/client/less/mt.less index 6b7910d9..3204ed91 100644 --- a/modules/core/client/less/mt.less +++ b/modules/core/client/less/mt.less @@ -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; } diff --git a/modules/core/client/views/home.client.view.html b/modules/core/client/views/home.client.view.html index 0db5d235..4bda87de 100644 --- a/modules/core/client/views/home.client.view.html +++ b/modules/core/client/views/home.client.view.html @@ -255,12 +255,17 @@
{{ 'TMDB_FIELDS.LAST_AIR_DATE' | translate}}:
{{vm.TVTopOne.resource_detail_info.last_air_date}}
-
{{ 'TMDB_FIELDS.EPISODES_SEASONS' | translate}}:
+
{{ 'TMDB_FIELDS.TOTAL_SE' | translate}}:
{{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}}
+
{{ 'TMDB_FIELDS.THIS_SE' | translate}}:
+
+ S{{vm.TVTopOne.torrent_seasons}}E{{vm.TVTopOne.torrent_episodes}} +
+
{{ 'TMDB_FIELDS.VOTE_AVERAGE' | translate}}:
@@ -328,7 +333,7 @@
  • - {{item.resource_detail_info.last_air_date | date: 'yyyy'}} + S{{item.torrent_seasons}}E{{item.torrent_episodes}} IMDB {{item.resource_detail_info.vote_average}}
  • @@ -383,12 +388,14 @@
    {{$index + 1}}. {{nt.resource_detail_info.name}} + S{{nt.torrent_seasons}}E{{nt.torrent_episodes}}
{{$index + 1}}. {{nt.resource_detail_info.name}} + S{{nt.torrent_seasons}}E{{nt.torrent_episodes}}
diff --git a/modules/torrents/client/controllers/uploads.client.controller.js b/modules/torrents/client/controllers/uploads.client.controller.js index 5221154d..4260af05 100644 --- a/modules/torrents/client/controllers/uploads.client.controller.js +++ b/modules/torrents/client/controllers/uploads.client.controller.js @@ -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: ' ' + $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, diff --git a/modules/torrents/client/views/uploads-torrents.client.view.html b/modules/torrents/client/views/uploads-torrents.client.view.html index b45d8dc0..6e88e5bc 100644 --- a/modules/torrents/client/views/uploads-torrents.client.view.html +++ b/modules/torrents/client/views/uploads-torrents.client.view.html @@ -90,7 +90,7 @@
-
+
@@ -99,7 +99,7 @@
-
+
@@ -290,10 +290,10 @@
{{vm.tvinfo.last_air_date}}
{{ 'TMDB_FIELDS.NUMBER_OF_SEASONS' | translate}}:
-
{{vm.torrentLocalInfo.resource_detail_info.number_of_seasons}} {{ 'TMDB_FIELDS.UNIT_SEASONS' | translate}}
+
{{vm.tvinfo.number_of_seasons}} {{ 'TMDB_FIELDS.UNIT_SEASONS' | translate}}
{{ 'TMDB_FIELDS.NUMBER_OF_EPISODES' | translate}}:
-
{{vm.torrentLocalInfo.resource_detail_info.number_of_episodes}} {{ 'TMDB_FIELDS.UNIT_EPISODES' | translate}}
+
{{vm.tvinfo.number_of_episodes}} {{ 'TMDB_FIELDS.UNIT_EPISODES' | translate}}
{{ 'TMDB_FIELDS.VOTE_AVERAGE' | translate}}:
{{vm.tvinfo.vote_average}} / {{vm.tvinfo.vote_count}} {{ 'TMDB_FIELDS.VOTE_UNIT' | translate}}
@@ -320,7 +320,48 @@ -
+
+
+ +
+
{{ 'TMDB_FIELDS.UNIT_SEASONS' | translate}}:
+
+
+ +
+
+ +
+
+
{{ 'TMDB_FIELDS.UNIT_EPISODES' | translate}}:
+
+
+
+ +
+
+ +
+ +
+

{{ 'TMDB_FIELDS.EPISODES_INPUT_TIP' | translate}}

+
+
+
+
+
+
+
+
+ +
diff --git a/modules/torrents/client/views/view-torrent.client.view.html b/modules/torrents/client/views/view-torrent.client.view.html index 3c6183fe..8be111f7 100644 --- a/modules/torrents/client/views/view-torrent.client.view.html +++ b/modules/torrents/client/views/view-torrent.client.view.html @@ -97,13 +97,18 @@
-
{{ 'TMDB_FIELDS.NUMBER_OF_SEASONS' | translate}}:
-
{{vm.torrentLocalInfo.resource_detail_info.number_of_seasons}} {{ 'TMDB_FIELDS.UNIT_SEASONS' | translate}}
-
+
{{ 'TMDB_FIELDS.TOTAL_SE' | translate}}:
+
+ {{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}} +
-
-
{{ 'TMDB_FIELDS.NUMBER_OF_EPISODES' | translate}}:
-
{{vm.torrentLocalInfo.resource_detail_info.number_of_episodes}} {{ 'TMDB_FIELDS.UNIT_EPISODES' | translate}}
+
+
{{ 'TMDB_FIELDS.THIS_SE' | translate}}:
+
+ S{{vm.torrentLocalInfo.torrent_seasons}}E{{vm.torrentLocalInfo.torrent_episodes}} +
+
@@ -322,6 +327,11 @@
{{ 'TRANCKER_URL' | translate}}:
{{vm.torrentLocalInfo.torrent_announce}}
+
{{ 'TMDB_FIELDS.THIS_SE' | translate}}:
+
+ S{{vm.torrentLocalInfo.torrent_seasons}}E{{vm.torrentLocalInfo.torrent_episodes}} +
+
{{ 'VIDEO_SIZE' | translate}}:
{{vm.torrentLocalInfo.torrent_size | bytes:2}}
diff --git a/modules/torrents/server/models/torrent.server.model.js b/modules/torrents/server/models/torrent.server.model.js index 55f4be69..f693b3ee 100644 --- a/modules/torrents/server/models/torrent.server.model.js +++ b/modules/torrents/server/models/torrent.server.model.js @@ -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