feat(torrents): rewrite upload page, ready for music and other type torrents

This commit is contained in:
OldHawk
2017-07-25 13:30:53 +08:00
parent 196c81ece6
commit 9b0b2a45bd
5 changed files with 121 additions and 101 deletions

View File

@@ -18,7 +18,7 @@ module.exports = {
admin: 'admin@chd.im',
base_url: 'http://chd.im:3000',
client_black_list_url: 'http://chd.im:3000/client_black_list',
private_torrent_cms: true
private_torrent_cms: false
},
sign: {
open_signin: true,

View File

@@ -299,8 +299,8 @@
TORRENTS_UPLOAD_FAILED: 'Failed to upload file',
TORRENTS_NO_FILE_SELECTED: 'No file selected',
SELECT_RESOURCE_TYPE: '1. Please select the resource type',
SELECT_TORRENT_FILE: '2. Please select the torrent file',
SELECT_RESOURCE_TYPE: '2. Please select the resource type',
SELECT_TORRENT_FILE: '1. Please select the torrent file',
SELECT_FILE: 'Select file',
DO_UPLOAD: 'Upload',
ENTER_TMDB_ID: '3. Please enter theMovieDB id',
@@ -310,7 +310,7 @@
TMDB_ID_ERROR: 'TMDB ID is error! Get info failed',
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...',
TMDB_IS_LOADING: 'Loading the resource 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',

View File

@@ -299,8 +299,8 @@
TORRENTS_UPLOAD_FAILED: '文件上传失败',
TORRENTS_NO_FILE_SELECTED: '请选择种子文件后再做尝试',
SELECT_RESOURCE_TYPE: '1. 请选择上传资源类型',
SELECT_TORRENT_FILE: '2. 请选择种子文件',
SELECT_RESOURCE_TYPE: '2. 请选择上传资源类型',
SELECT_TORRENT_FILE: '1. 请选择种子文件',
SELECT_FILE: '选择文件',
DO_UPLOAD: '上传',
ENTER_TMDB_ID: '3. 请输入TMDB_ID',

View File

@@ -19,13 +19,7 @@
vm.lang = getStorageLangService.getLang();
vm.user = Authentication.user;
vm.progress = 0;
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 = '';
@@ -102,7 +96,9 @@
*/
vm.onTMDBIDKeyDown = function (evt) {
if (evt.keyCode === 13) {
vm.getInfo(vm.tmdb_id);
$timeout(function () {
angular.element('#btnGetTMDBInfo').triggerHandler('click');
}, 0);
}
};
@@ -114,52 +110,22 @@
$event.target.select();
};
/**
* getIncludeInfoTemplate
* @returns {*}
*/
vm.getIncludeInfoTemplate = function () {
switch (vm.selectedType) {
case 'tvserial':
return 'tvinfo.html';
case 'music':
return 'musicinfo.html';
case 'other':
return 'otherinfo.html';
default:
return 'movieinfo.html';
}
};
/**
* onTorrentTypeChanged
*/
vm.onTorrentTypeChanged = function () {
vm.tmdb_isloading = false;
vm.tmdb_info_ok = undefined;
vm.inputedEpisodesError = undefined;
vm.inputedEpisodesOK = false;
vm.tmdb_isloading = false;
vm.movieinfo = undefined;
vm.tvinfo = undefined;
vm.tmdb_id = undefined;
};
/**
* getInfo
* @param tmdbid
*/
vm.getInfo = function (tmdbid) {
switch (vm.selectedType) {
case 'tvserial':
vm.getTVInfo(tmdbid);
break;
case 'music':
break;
case 'other':
break;
default:
vm.getMovieInfo(tmdbid);
}
vm.showVideoNfo = false;
vm.showAgreeAndSubmit = false;
};
/**
@@ -176,13 +142,15 @@
}
vm.tmdb_isloading = true;
vm.tmdb_info_ok = undefined;
TorrentsService.getTMDBMovieInfo({
tmdbid: tmdbid,
language: getStorageLangService.getLang()
}, function (res) {
vm.tmdb_info_ok = true;
vm.tmdb_isloading = false;
vm.inputedEpisodesOK = true;
vm.showVideoNfo = true;
vm.showAgreeAndSubmit = true;
Notification.success({
message: '<i class="glyphicon glyphicon-ok"></i> ' + $translate.instant('TMDB_ID_OK')
});
@@ -215,6 +183,7 @@
}
vm.tmdb_isloading = true;
vm.tmdb_info_ok = undefined;
TorrentsService.getTMDBTVInfo({
tmdbid: tmdbid,
language: getStorageLangService.getLang()
@@ -254,6 +223,8 @@
} else {
vm.inputedEpisodesError = false;
vm.inputedEpisodesOK = true;
vm.showVideoNfo = true;
vm.showAgreeAndSubmit = true;
}
};

View File

@@ -3,27 +3,13 @@
<div class="row">
<div class="col-md-11 col-md-offset-1 col-sm-11 col-sm-offset-1 col-xs-12">
<h4 translate="UPLOAD_RULES"></h4>
<!--<ol>-->
<!--<li ng-repeat="r in vm.rule_items" translate="UPLOAD_RULES_CONTENT.{{r}}"-->
<!--translate-values='{ url: vm.announceConfig.url, admin: vm.announceConfig.admin}' style="line-height: 1.6;"></li>-->
<!--</ol>-->
<div marked src="'/modules/torrents/client/templates/upload-rules-'+vm.lang+'.md'" compile="true" style="line-height: 1.6;">
</div>
</div>
</div>
</div>
<div class="row margin-bottom-40">
<div class="col-xs-12">
<legend class="small-legend" translate="SELECT_RESOURCE_TYPE"></legend>
<div class="col-xs-12 col-sm-6 col-md-4">
<select class="form-control" ng-model="vm.selectedType" ng-change="vm.onTorrentTypeChanged();">
<option ng-repeat="t in vm.torrentType.value" value="{{t.value}}">{{'MENU_TORRENTS_SUB.'+t.name | translate}}</option>
</select>
</div>
</div>
</div>
<div class="row margin-bottom-40">
<div class="col-xs-12">
<legend class="small-legend" translate="SELECT_TORRENT_FILE"></legend>
@@ -53,44 +39,22 @@
<label class="text-danger control-label" translate="TORRENTS_UPLOAD_FAILED"></label>
</div>
</div>
</div>
<div ng-show="vm.successfully == true" class="row margin-bottom-40">
<div class="col-md-12 col-sm-12 col-xs-12">
<legend class="small-legend" translate="ENTER_TMDB_ID"></legend>
<div class="col-lg-3 col-md-4 col-sm-5 col-xs-6">
<div class="input-group">
<input type="text" class="form-control" ng-ac ng-model="vm.tmdb_id"
id="tmdbid"
ng-change="vm.tmdb_info_ok = undefined"
ng-disabled="vm.tmdb_info_ok"
ng-focus="vm.onTextClick($event)"
ng-keydown="vm.onTMDBIDKeyDown($event);"
placeholder="{{ 'TMDB_ID' | translate}}" autofocus>
<div class="input-group-btn">
<button class="btn btn-primary" ng-click="vm.getInfo(vm.tmdb_id)"
ng-disabled="vm.tmdb_info_ok">{{ 'LOAD_TMDB_INFO' | translate}}
</button>
</div>
</div>
</div>
<div ng-show="vm.tmdb_info_ok == true" class="col-lg-9 col-md-8 col-sm-7 col-xs-6" style="margin-top: 7px">
<label class="text-success control-label" translate="TMDB_ID_OK"></label>
</div>
<div ng-show="vm.tmdb_info_ok == false" class="col-lg-9 col-md-8 col-sm-7 col-xs-6" style="margin-top: 7px">
<label class="text-danger control-label" translate="TMDB_ID_ERROR"></label>
</div>
<div ng-show="vm.tmdb_isloading" class="col-lg-9 col-md-8 col-sm-7 col-xs-6" style="margin-top: 7px">
<label class="text-danger control-label" translate="TMDB_IS_LOADING"></label>
<div class="row margin-bottom-40" ng-show="vm.successfully == true">
<div class="col-xs-12">
<legend class="small-legend" translate="SELECT_RESOURCE_TYPE"></legend>
<div class="col-xs-12 col-sm-6 col-md-4">
<select class="form-control" ng-model="vm.selectedType" ng-change="vm.onTorrentTypeChanged();">
<option ng-repeat="t in vm.torrentType.value" value="{{t.value}}">{{'MENU_TORRENTS_SUB.'+t.name | translate}}</option>
</select>
</div>
</div>
</div>
<div ng-if="vm.tmdb_info_ok == true" ng-include="vm.getIncludeInfoTemplate();"></div>
<div ng-if="vm.selectedType" ng-include="vm.selectedType"></div>
<div class="row margin-bottom-40" ng-show="vm.tmdb_info_ok == true && vm.inputedEpisodesOK == true">
<div class="row margin-bottom-40" ng-show="vm.showVideoNfo">
<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 +63,7 @@
</div>
</div>
<div class="row margin-bottom-40 margin-top-50" ng-show="vm.tmdb_info_ok == true && vm.inputedEpisodesOK == true">
<div class="row margin-bottom-40 margin-top-50" ng-show="vm.showAgreeAndSubmit">
<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">
@@ -126,8 +90,40 @@
ng-template movieinfo.html
**********************************************************************
-->
<script type="text/ng-template" id="movieinfo.html">
<div>
<script type="text/ng-template" id="movie">
<div class="row margin-bottom-40">
<div class="col-md-12 col-sm-12 col-xs-12">
<legend class="small-legend" translate="ENTER_TMDB_ID"></legend>
<div class="col-lg-3 col-md-4 col-sm-5 col-xs-6">
<div class="input-group">
<input type="text" class="form-control" ng-ac ng-model="vm.tmdb_id"
id="tmdbid"
ng-change="vm.tmdb_info_ok = undefined"
ng-disabled="vm.tmdb_info_ok"
ng-focus="vm.onTextClick($event)"
ng-keydown="vm.onTMDBIDKeyDown($event);"
placeholder="{{ 'TMDB_ID' | translate}}" autofocus>
<div class="input-group-btn">
<button id="btnGetTMDBInfo" class="btn btn-primary" ng-click="vm.getMovieInfo(vm.tmdb_id)"
ng-disabled="vm.tmdb_info_ok">{{ 'LOAD_TMDB_INFO' | translate}}
</button>
</div>
</div>
</div>
<div ng-show="vm.tmdb_info_ok == true" class="col-lg-9 col-md-8 col-sm-7 col-xs-6" style="margin-top: 7px">
<label class="text-success control-label" translate="TMDB_ID_OK"></label>
</div>
<div ng-show="vm.tmdb_info_ok == false" class="col-lg-9 col-md-8 col-sm-7 col-xs-6" style="margin-top: 7px">
<label class="text-danger control-label" translate="TMDB_ID_ERROR"></label>
</div>
<div ng-show="vm.tmdb_isloading" class="col-lg-9 col-md-8 col-sm-7 col-xs-6" style="margin-top: 7px">
<label class="text-danger control-label" translate="TMDB_IS_LOADING"></label>
</div>
</div>
</div>
<div ng-show="vm.tmdb_info_ok == true">
<div class="row margin-bottom-40">
<div class="col-md-12 col-sm-12 col-xs-12">
<legend class="small-legend" translate="TMDB_RESOURCE_INFO"></legend>
@@ -246,8 +242,39 @@
ng-template tvinfo.html
**********************************************************************
-->
<script type="text/ng-template" id="tvinfo.html">
<div>
<script type="text/ng-template" id="tvserial">
<div class="row margin-bottom-40">
<div class="col-md-12 col-sm-12 col-xs-12">
<legend class="small-legend" translate="ENTER_TMDB_ID"></legend>
<div class="col-lg-3 col-md-4 col-sm-5 col-xs-6">
<div class="input-group">
<input type="text" class="form-control" ng-ac ng-model="vm.tmdb_id"
id="tmdbid"
ng-change="vm.tmdb_info_ok = undefined"
ng-disabled="vm.tmdb_info_ok"
ng-focus="vm.onTextClick($event)"
ng-keydown="vm.onTMDBIDKeyDown($event);"
placeholder="{{ 'TMDB_ID' | translate}}" autofocus>
<div class="input-group-btn">
<button id="btnGetTMDBInfo" class="btn btn-primary" ng-click="vm.getTVInfo(vm.tmdb_id)"
ng-disabled="vm.tmdb_info_ok">{{ 'LOAD_TMDB_INFO' | translate}}
</button>
</div>
</div>
</div>
<div ng-show="vm.tmdb_info_ok == true" class="col-lg-9 col-md-8 col-sm-7 col-xs-6" style="margin-top: 7px">
<label class="text-success control-label" translate="TMDB_ID_OK"></label>
</div>
<div ng-show="vm.tmdb_info_ok == false" class="col-lg-9 col-md-8 col-sm-7 col-xs-6" style="margin-top: 7px">
<label class="text-danger control-label" translate="TMDB_ID_ERROR"></label>
</div>
<div ng-show="vm.tmdb_isloading" class="col-lg-9 col-md-8 col-sm-7 col-xs-6" style="margin-top: 7px">
<label class="text-danger control-label" translate="TMDB_IS_LOADING"></label>
</div>
</div>
</div>
<div ng-show="vm.tmdb_info_ok == true">
<div class="row margin-bottom-40">
<div class="col-md-12 col-sm-12 col-xs-12">
<legend class="small-legend" translate="TMDB_RESOURCE_INFO"></legend>
@@ -347,7 +374,9 @@
<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="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">
@@ -398,4 +427,24 @@
</div>
</div>
</script>
<!--
**********************************************************************
ng-template music.html
**********************************************************************
-->
<script type="text/ng-template" id="music">
<div>
</div>
</script>
<!--
**********************************************************************
ng-template other.html
**********************************************************************
-->
<script type="text/ng-template" id="other">
<div>
</div>
</script>
</section>