diff --git a/modules/torrents/client/config/torrents.client.menus.js b/modules/torrents/client/config/torrents.client.menus.js
index e7b02da7..6b421b40 100644
--- a/modules/torrents/client/config/torrents.client.menus.js
+++ b/modules/torrents/client/config/torrents.client.menus.js
@@ -18,22 +18,22 @@
// Add the dropdown list item
menuService.addSubMenuItem('topbar', 'torrents', {
- title: 'MENU_TORRENTS_SUB.SUB_MOVIE',
+ title: 'MENU_TORRENTS_SUB.MOVIE',
state: 'torrents.movie',
roles: ['*']
});
menuService.addSubMenuItem('topbar', 'torrents', {
- title: 'MENU_TORRENTS_SUB.SUB_MTV',
- state: 'torrents.mtv',
+ title: 'MENU_TORRENTS_SUB.TVSERIES',
+ state: 'torrents.tvseries',
roles: ['*']
});
menuService.addSubMenuItem('topbar', 'torrents', {
- title: 'MENU_TORRENTS_SUB.SUB_MUSIC',
+ title: 'MENU_TORRENTS_SUB.MUSIC',
state: 'torrents.music',
roles: ['*']
});
menuService.addSubMenuItem('topbar', 'torrents', {
- title: 'MENU_TORRENTS_SUB.SUB_OTHER',
+ title: 'MENU_TORRENTS_SUB.OTHER',
state: 'torrents.other',
roles: ['*']
});
diff --git a/modules/torrents/client/controllers/admin/admin-list.client.controller.js b/modules/torrents/client/controllers/admin/admin-list.client.controller.js
index 2bcec81a..59dc11c5 100644
--- a/modules/torrents/client/controllers/admin/admin-list.client.controller.js
+++ b/modules/torrents/client/controllers/admin/admin-list.client.controller.js
@@ -18,7 +18,9 @@
vm.resourcesTags = MeanTorrentConfig.meanTorrentConfig.resourcesTags;
vm.torrentSalesType = MeanTorrentConfig.meanTorrentConfig.torrentSalesType;
vm.torrentRLevels = MeanTorrentConfig.meanTorrentConfig.torrentRecommendLevel;
+ vm.torrentType = MeanTorrentConfig.meanTorrentConfig.torrentType;
+ vm.selectedType = 'movie';
vm.searchTags = [];
vm.searchKey = '';
vm.releaseYear = undefined;
@@ -43,12 +45,20 @@
vm.torrentFigureOutItemsToDisplay();
};
+ /**
+ * onTorrentTypeChanged
+ */
+ vm.onTorrentTypeChanged = function () {
+ vm.searchTags = [];
+ vm.torrentBuildPager();
+ };
+
/**
* commentFigureOutItemsToDisplay
* @param callback
*/
vm.torrentFigureOutItemsToDisplay = function (callback) {
- vm.getMoviePageInfo(vm.torrentCurrentPage, function (items) {
+ vm.getTorrentPageInfo(vm.torrentCurrentPage, function (items) {
vm.torrentFilterLength = items.total;
vm.torrentPagedItems = items.rows;
@@ -163,17 +173,17 @@
};
/**
- * getMoviePageInfo
+ * getTorrentPageInfo
* @param p: page number
*/
- vm.getMoviePageInfo = function (p, callback) {
+ vm.getTorrentPageInfo = function (p, callback) {
TorrentsService.get({
skip: (p - 1) * vm.torrentItemsPerPage,
limit: vm.torrentItemsPerPage,
keys: vm.searchKey.trim(),
torrent_status: vm.torrentStatus,
torrent_rlevel: vm.torrentRLevel,
- torrent_type: 'movie',
+ torrent_type: vm.selectedType,
torrent_release: vm.releaseYear,
torrent_tags: vm.searchTags
}, function (items) {
@@ -200,7 +210,24 @@
vm.getTagTitle = function (tag) {
var tmp = tag;
var find = false;
- angular.forEach(vm.resourcesTags.movie.radio, function (item) {
+ var r = undefined;
+
+ switch (vm.selectedType) {
+ case 'tvseries':
+ r = vm.resourcesTags.tv;
+ break;
+ case 'music':
+ r = vm.resourcesTags.music;
+ break;
+ case 'other':
+ r = vm.resourcesTags.other;
+ break;
+ default:
+ r = vm.resourcesTags.movie;
+ }
+
+
+ angular.forEach(r.radio, function (item) {
angular.forEach(item.value, function (sitem) {
if (sitem.name === tag) {
tmp = item.name;
@@ -210,7 +237,7 @@
});
if (!find) {
- angular.forEach(vm.resourcesTags.movie.checkbox, function (item) {
+ angular.forEach(r.checkbox, function (item) {
angular.forEach(item.value, function (sitem) {
if (sitem.name === tag) {
tmp = item.name;
diff --git a/modules/torrents/client/controllers/uploads.client.controller.js b/modules/torrents/client/controllers/uploads.client.controller.js
index 633a2913..5221154d 100644
--- a/modules/torrents/client/controllers/uploads.client.controller.js
+++ b/modules/torrents/client/controllers/uploads.client.controller.js
@@ -15,19 +15,17 @@
vm.tmdbConfig = MeanTorrentConfig.meanTorrentConfig.tmdbConfig;
vm.imdbConfig = MeanTorrentConfig.meanTorrentConfig.imdbConfig;
vm.resourcesTags = MeanTorrentConfig.meanTorrentConfig.resourcesTags;
- vm.rule_items = [];
+ vm.torrentType = MeanTorrentConfig.meanTorrentConfig.torrentType;
+ vm.lang = getStorageLangService.getLang();
vm.user = Authentication.user;
vm.progress = 0;
+ vm.selectedType = 'movie';
vm.successfully = undefined;
vm.tmdb_info_ok = undefined;
vm.torrentInfo = null;
vm.tags = [];
vm.videoNfo = '';
- for (var i = 0; i < $translate.instant('UPLOAD_RULES_COUNT'); i++) {
- vm.rule_items[i] = i;
- }
-
// If user is not signed in then redirect back home
if (!Authentication.user) {
$state.go('authentication.signin');
@@ -113,12 +111,57 @@
$event.target.select();
};
+ /**
+ * getIncludeInfoTemplate
+ * @returns {*}
+ */
+ vm.getIncludeInfoTemplate = function () {
+ switch (vm.selectedType) {
+ case 'tvseries':
+ return 'tvinfo.html';
+ case 'music':
+ return 'musicinfo.html';
+ case 'other':
+ return 'otherinfo.html';
+ default:
+ return 'movieinfo.html';
+ }
+ };
+
+ /**
+ * onTorrentTypeChanged
+ */
+ vm.onTorrentTypeChanged = function () {
+ vm.tmdb_info_ok = undefined;
+ vm.tmdb_isloading = false;
+ vm.movieinfo = undefined;
+ vm.tvinfo = undefined;
+ vm.tmdb_id = undefined;
+ };
+
/**
* getInfo
* @param tmdbid
*/
vm.getInfo = function (tmdbid) {
- console.log(tmdbid);
+ switch (vm.selectedType) {
+ case 'tvseries':
+ vm.getTVInfo(tmdbid);
+ break;
+ case 'music':
+ break;
+ case 'other':
+ break;
+ default:
+ vm.getMovieInfo(tmdbid);
+ }
+ };
+
+ /**
+ * getMovieInfo
+ * @param tmdbid
+ */
+ vm.getMovieInfo = function (tmdbid) {
if (tmdbid === null || tmdbid === undefined) {
Notification.info({
message: '
' + $translate.instant('TMDB_ID_REQUIRED')
@@ -128,7 +171,7 @@
}
vm.tmdb_isloading = true;
- TorrentsService.getTMDBInfo({
+ TorrentsService.getTMDBMovieInfo({
tmdbid: tmdbid,
language: getStorageLangService.getLang()
}, function (res) {
@@ -152,75 +195,69 @@
});
};
+ /**
+ * getTVInfo
+ * @param tmdbid
+ */
+ vm.getTVInfo = function (tmdbid) {
+ if (tmdbid === null || tmdbid === undefined) {
+ Notification.info({
+ message: '
' + $translate.instant('TMDB_ID_REQUIRED')
+ });
+ angular.element('#tmdbid').focus();
+ return;
+ }
+
+ vm.tmdb_isloading = true;
+ TorrentsService.getTMDBTVInfo({
+ tmdbid: tmdbid,
+ language: getStorageLangService.getLang()
+ }, function (res) {
+ vm.tmdb_info_ok = true;
+ vm.tmdb_isloading = false;
+ Notification.success({
+ message: '
' + $translate.instant('TMDB_ID_OK')
+ });
+
+ console.log(res);
+ vm.tvinfo = res;
+ }, function (err) {
+ vm.tmdb_info_ok = false;
+ vm.tmdb_isloading = false;
+ Notification.error({
+ message: '
' + $translate.instant('TMDB_ID_ERROR')
+ });
+ angular.element('#tmdbid').focus();
+ });
+ };
+
/**
* create
*/
vm.create = function () {
- //var d = new Date(vm.movieinfo.release_date);
- var l = 0;
-
//console.log(vm.torrentInfo);
- if (vm.torrentInfo.length !== undefined) {
- l = vm.torrentInfo.length;
- } else if (vm.torrentInfo.info.length !== undefined) {
- l = vm.torrentInfo.info.length;
- } else {
- angular.forEach(vm.torrentInfo.info.files, function (item) {
- l = l + item.length;
- });
+ switch (vm.selectedType) {
+ case 'tvseries':
+ vm.createTVTorrent();
+ break;
+ case 'music':
+ vm.createMusicTorrent();
+ break;
+ case 'other':
+ vm.createOtherTorrent();
+ break;
+ default:
+ vm.createMovieTorrent();
}
+ };
- var t = [];
- angular.forEach(vm.resourcesTags.movie.radio, function (item) {
- if (vm.tags['tag_' + item.name]) {
- t.push(vm.tags['tag_' + item.name]);
- }
- });
- angular.forEach(vm.resourcesTags.movie.checkbox, function (item) {
- angular.forEach(item.value, function (sitem) {
- if (vm.tags['tag_' + item.name + '_' + sitem.name]) {
- t.push(sitem.name);
- }
- });
- });
-
- //var g = [];
- //angular.forEach(vm.movieinfo.genres, function (item) {
- // g.push(item.name);
- //});
- //
- //var com = [];
- //angular.forEach(vm.movieinfo.production_companies, function (item) {
- // com.push(item.name);
- //});
- //
- //var country = [];
- //angular.forEach(vm.movieinfo.production_countries, function (item) {
- // country.push(item.iso_3166_1);
- //});
- //
- //var casts = [];
- //var i = 0;
- //angular.forEach(vm.movieinfo.credits.cast, function (item) {
- // if (i < 6) {
- // var c = {
- // name: item.name,
- // character: item.character,
- // profile_path: item.profile_path
- // };
- // casts.push(c);
- // i++;
- // }
- //});
- //
- //var dir = undefined;
- //angular.forEach(vm.movieinfo.credits.crew, function (item) {
- // if (item.job === 'Director') {
- // dir = item.name;
- // }
- //});
-
+ /**
+ * createMovieTorrent
+ */
+ vm.createMovieTorrent = function () {
+ var l = vm.getTorrentSize();
+ var t = vm.getResourceTag();
var torrent = new TorrentsService({
info_hash: vm.torrentInfo.info_hash,
@@ -252,6 +289,101 @@
}
};
+ /**
+ * createTvTorrent
+ */
+ vm.createTVTorrent = function () {
+ var l = vm.getTorrentSize();
+ var t = vm.getResourceTag();
+
+ var torrent = new TorrentsService({
+ info_hash: vm.torrentInfo.info_hash,
+ torrent_filename: vm.torrentInfo.filename,
+ torrent_type: 'tvseries',
+ torrent_tags: t,
+ torrent_nfo: vm.videoNfo,
+ torrent_announce: vm.torrentInfo.announce,
+ torrent_size: l,
+
+ resource_detail_info: vm.tvinfo
+ });
+
+ torrent.$save(function (response) {
+ successCallback(response);
+ }, function (errorResponse) {
+ errorCallback(errorResponse);
+ });
+
+ function successCallback(res) {
+ $state.reload('torrents.uploads');
+ document.body.scrollTop = document.documentElement.scrollTop = 0;
+ Notification.success({message: '
Torrent created successfully!'});
+ }
+
+ function errorCallback(res) {
+ vm.error_msg = res.data.message;
+ Notification.error({message: res.data.message, title: '
Torrent created error!'});
+ }
+ };
+
+ /**
+ * getTorrentSize
+ * @returns {number}
+ */
+ vm.getTorrentSize = function () {
+ var l = 0;
+
+ if (vm.torrentInfo.length !== undefined) {
+ l = vm.torrentInfo.length;
+ } else if (vm.torrentInfo.info.length !== undefined) {
+ l = vm.torrentInfo.info.length;
+ } else {
+ angular.forEach(vm.torrentInfo.info.files, function (item) {
+ l = l + item.length;
+ });
+ }
+
+ return l;
+ };
+
+ /**
+ * getResourceTag
+ * @returns {Array}
+ */
+ vm.getResourceTag = function () {
+ var t = [];
+ var r = undefined;
+
+ switch (vm.selectedType) {
+ case 'tvseries':
+ r = vm.resourcesTags.tv;
+ break;
+ case 'music':
+ r = vm.resourcesTags.music;
+ break;
+ case 'other':
+ r = vm.resourcesTags.other;
+ break;
+ default:
+ r = vm.resourcesTags.movie;
+ }
+
+ angular.forEach(r.radio, function (item) {
+ if (vm.tags['tag_' + item.name]) {
+ t.push(vm.tags['tag_' + item.name]);
+ }
+ });
+ angular.forEach(r.checkbox, function (item) {
+ angular.forEach(item.value, function (sitem) {
+ if (vm.tags['tag_' + item.name + '_' + sitem.name]) {
+ t.push(sitem.name);
+ }
+ });
+ });
+
+ return t;
+ };
+
/**
* cancel
*/
diff --git a/modules/torrents/client/services/torrents.client.service.js b/modules/torrents/client/services/torrents.client.service.js
index 2e52e169..0d6916f1 100644
--- a/modules/torrents/client/services/torrents.client.service.js
+++ b/modules/torrents/client/services/torrents.client.service.js
@@ -15,7 +15,7 @@
update: {
method: 'PUT'
},
- getTMDBInfo: {
+ getTMDBMovieInfo: {
method: 'GET',
url: '/api/movieinfo/:tmdbid/:language',
params: {
@@ -23,6 +23,14 @@
language: '@language'
}
},
+ getTMDBTVInfo: {
+ method: 'GET',
+ url: '/api/tvinfo/:tmdbid/:language',
+ params: {
+ tmdbid: '@tmdbid',
+ language: '@language'
+ }
+ },
setSaleType: {
method: 'PUT',
url: '/api/torrents/:torrentId/set/saletype/:saleType',
diff --git a/modules/torrents/client/templates/upload-rules-en.md b/modules/torrents/client/templates/upload-rules-en.md
new file mode 100644
index 00000000..43de80b8
--- /dev/null
+++ b/modules/torrents/client/templates/upload-rules-en.md
@@ -0,0 +1,6 @@
+1. The torrent file tracker URL must be: __{{vm.announce.url}}__.
+1. If you selected resource type with `Movie` or `TVSeries`, the torrent TMDB_ID must be `TheMovieDB` resources ID, you can [find the ID
+ from here]({{vm.tmdbConfig.tmdb_home}}), then the resources detail info can be autoload, if everything looks good, hit submit.
+1. Select one or more tags that match the resources, which will play a significant role in your search results.
+1. After the submission of documents, may be approved by the management, the rules do not meet the seeds will be deleted directly.
+1. For additional assistance, please contact our administrator: [{{vm.announce.admin}}](mailto:{{vm.announce.admin}}).
\ No newline at end of file
diff --git a/modules/torrents/client/templates/upload-rules-zh.md b/modules/torrents/client/templates/upload-rules-zh.md
new file mode 100644
index 00000000..379f4d85
--- /dev/null
+++ b/modules/torrents/client/templates/upload-rules-zh.md
@@ -0,0 +1,6 @@
+1. 种子文件的Tracker地址必须为:__{{vm.announce.url}}__.
+1. 如果你选择的资源类型为`电影`或`电视剧`,种子文件的 TMDB_ID 必须是 `TheMovieDB` 相对应的资源ID号,
+您可以[从这里找到ID号]({{vm.tmdbConfig.tmdb_home}}). 资源的详细信息,系统会自动载入,如无误可直接提交.
+1. 请为资源选择匹配的一个或多个标签,它会在您的搜索结果中发挥重大作用.
+1. 种子文件提交后,可能会由后台管理人员进行审批,不符合规则的种子会被直接删除.
+1. 如需其它帮助,请与我们的管理员联系:[{{vm.announce.admin}}](mailto:{{vm.announce.admin}}).
\ No newline at end of file
diff --git a/modules/torrents/client/views/admin/admin-list.client.view.html b/modules/torrents/client/views/admin/admin-list.client.view.html
index f48eae70..0adea0a5 100644
--- a/modules/torrents/client/views/admin/admin-list.client.view.html
+++ b/modules/torrents/client/views/admin/admin-list.client.view.html
@@ -6,9 +6,21 @@
+ - {{'CA_RESOURCE_TYPE' | translate}}
+ -
+
+
+
+
+
+
+
- {{ 'CA_KEYWORD' | translate}}:
-
-