mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-03-18 01:50:37 +01:00
feat(torrents): Optimized torrent list data
This commit is contained in:
44
config/lib/populateStrings.js
Normal file
44
config/lib/populateStrings.js
Normal file
@@ -0,0 +1,44 @@
|
||||
module.exports.populate_torrent_string =
|
||||
' -info_hash' +
|
||||
' -last_scrape' +
|
||||
' -torrent_announce' +
|
||||
' -torrent_nfo' +
|
||||
' -torrent_media_info' +
|
||||
' -_other_torrents' +
|
||||
' -_ratings' +
|
||||
' -_replies' +
|
||||
' -_subtitles' +
|
||||
' -_thumbs' +
|
||||
' -_all_files' +
|
||||
' -resource_detail_info.adult' +
|
||||
' -resource_detail_info.budget' +
|
||||
' -resource_detail_info.genres' +
|
||||
' -resource_detail_info.homepage' +
|
||||
' -resource_detail_info.imdb_id' +
|
||||
' -resource_detail_info.original_language' +
|
||||
' -resource_detail_info.popularity' +
|
||||
' -resource_detail_info.production_companies' +
|
||||
' -resource_detail_info.production_countries' +
|
||||
' -resource_detail_info.revenue' +
|
||||
' -resource_detail_info.spoken_languages' +
|
||||
' -resource_detail_info.status' +
|
||||
' -resource_detail_info.tagline' +
|
||||
' -resource_detail_info.credits' +
|
||||
' -resource_detail_info.overview' +
|
||||
' -resource_detail_info.images' +
|
||||
' -resource_detail_info.alternative_titles' +
|
||||
' -resource_detail_info.release_dates' +
|
||||
' -resource_detail_info.belongs_to_collection' +
|
||||
|
||||
' -resource_detail_info.created_by' +
|
||||
' -resource_detail_info.episode_run_time' +
|
||||
' -resource_detail_info.first_air_date' +
|
||||
' -resource_detail_info.last_air_date' +
|
||||
' -resource_detail_info.in_production' +
|
||||
' -resource_detail_info.languages' +
|
||||
' -resource_detail_info.networks' +
|
||||
' -resource_detail_info.number_of_episodes' +
|
||||
' -resource_detail_info.number_of_seasons' +
|
||||
' -resource_detail_info.origin_country' +
|
||||
' -resource_detail_info.seasons' +
|
||||
' -resource_detail_info.type';
|
||||
@@ -33,6 +33,7 @@
|
||||
albumId: $state.params.albumId
|
||||
}, function (data) {
|
||||
vm.album = data;
|
||||
mtDebug.info(data);
|
||||
vm.buildPager();
|
||||
$('.backdrop').css('backgroundImage', 'url("' + vm.getAlbumBackdropImage(vm.album) + '")');
|
||||
});
|
||||
|
||||
@@ -10,6 +10,7 @@ var path = require('path'),
|
||||
Maker = mongoose.model('Maker'),
|
||||
Album = mongoose.model('Album'),
|
||||
async = require('async'),
|
||||
populateStrings = require(path.resolve('./config/lib/populateStrings')),
|
||||
traceLogCreate = require(path.resolve('./config/lib/tracelog')).create;
|
||||
|
||||
var traceConfig = config.meanTorrentConfig.trace;
|
||||
@@ -229,7 +230,7 @@ exports.list = function (req, res) {
|
||||
var findQuery = function (callback) {
|
||||
Album.find(condition)
|
||||
.sort(sort_str)
|
||||
.populate('torrents')
|
||||
.populate('torrents', populateStrings.populate_torrent_string)
|
||||
.exec(function (err, albums) {
|
||||
if (err) {
|
||||
callback(err, null);
|
||||
@@ -262,6 +263,7 @@ exports.albumByID = function (req, res, next, id) {
|
||||
.populate('user', 'username displayName profileImageURL isVip score uploaded downloaded')
|
||||
.populate({
|
||||
path: 'torrents',
|
||||
select: populateStrings.populate_torrent_string,
|
||||
populate: [{
|
||||
path: 'user',
|
||||
select: 'username displayName profileImageURL isVip score uploaded downloaded'
|
||||
|
||||
@@ -15,6 +15,7 @@ var path = require('path'),
|
||||
async = require('async'),
|
||||
tmdb = require('moviedb')(config.meanTorrentConfig.tmdbConfig.key),
|
||||
traceLogCreate = require(path.resolve('./config/lib/tracelog')).create,
|
||||
populateStrings = require(path.resolve('./config/lib/populateStrings')),
|
||||
scoreUpdate = require(path.resolve('./config/lib/score')).update;
|
||||
|
||||
var traceConfig = config.meanTorrentConfig.trace;
|
||||
@@ -280,7 +281,7 @@ exports.list = function (req, res) {
|
||||
Collection.find(condition)
|
||||
.sort('-recommend_level -ordered_at -created_at')
|
||||
.populate('user', 'username displayName profileImageURL isVip score uploaded downloaded')
|
||||
.populate('torrents')
|
||||
.populate('torrents', populateStrings.populate_torrent_string)
|
||||
.skip(skip)
|
||||
.limit(limit)
|
||||
.exec(function (err, colls) {
|
||||
@@ -315,6 +316,7 @@ exports.collectionByID = function (req, res, next, id) {
|
||||
.populate('user', 'username displayName profileImageURL isVip score uploaded downloaded')
|
||||
.populate({
|
||||
path: 'torrents',
|
||||
select: populateStrings.populate_torrent_string,
|
||||
populate: [{
|
||||
path: 'user',
|
||||
select: 'username displayName profileImageURL isVip score uploaded downloaded'
|
||||
|
||||
@@ -11,6 +11,7 @@ var path = require('path'),
|
||||
async = require('async'),
|
||||
moment = require('moment'),
|
||||
traceLogCreate = require(path.resolve('./config/lib/tracelog')).create,
|
||||
populateStrings = require(path.resolve('./config/lib/populateStrings')),
|
||||
scoreUpdate = require(path.resolve('./config/lib/score')).update;
|
||||
|
||||
var traceConfig = config.meanTorrentConfig.trace;
|
||||
@@ -305,6 +306,7 @@ exports.requestByID = function (req, res, next, id) {
|
||||
.populate('user', 'username displayName profileImageURL isVip score uploaded downloaded')
|
||||
.populate({
|
||||
path: 'torrents',
|
||||
select: populateStrings.populate_torrent_string,
|
||||
populate: [{
|
||||
path: 'user',
|
||||
select: 'username displayName profileImageURL isVip score uploaded downloaded'
|
||||
|
||||
@@ -13,7 +13,8 @@ var path = require('path'),
|
||||
Torrent = mongoose.model('Torrent'),
|
||||
async = require('async'),
|
||||
validator = require('validator'),
|
||||
tmdb = require('moviedb')(config.meanTorrentConfig.tmdbConfig.key);
|
||||
tmdb = require('moviedb')(config.meanTorrentConfig.tmdbConfig.key),
|
||||
populateStrings = require(path.resolve('./config/lib/populateStrings'));
|
||||
|
||||
const PEERSTATE_SEEDER = 'seeder';
|
||||
const PEERSTATE_LEECHER = 'leecher';
|
||||
@@ -33,6 +34,7 @@ exports.getMySeeding = function (req, res) {
|
||||
}).sort('-peer_uploaded')
|
||||
.populate({
|
||||
path: 'torrent',
|
||||
select: populateStrings.populate_torrent_string,
|
||||
populate: [
|
||||
{path: 'user', select: 'displayName profileImageURL'},
|
||||
{path: 'maker', select: 'name'}
|
||||
@@ -62,6 +64,7 @@ exports.getMyDownloading = function (req, res) {
|
||||
}).sort('-peer_downloaded')
|
||||
.populate({
|
||||
path: 'torrent',
|
||||
select: populateStrings.populate_torrent_string,
|
||||
populate: [
|
||||
{path: 'user', select: 'displayName profileImageURL'},
|
||||
{path: 'maker', select: 'name'}
|
||||
@@ -89,6 +92,7 @@ exports.getMyWarning = function (req, res) {
|
||||
hnr_warning: true
|
||||
}).populate({
|
||||
path: 'torrent',
|
||||
select: populateStrings.populate_torrent_string,
|
||||
populate: [
|
||||
{path: 'user', select: 'displayName profileImageURL'},
|
||||
{path: 'maker', select: 'name'}
|
||||
|
||||
@@ -17,7 +17,8 @@ var path = require('path'),
|
||||
ScoreLog = mongoose.model('ScoreLog'),
|
||||
scoreUpdate = require(path.resolve('./config/lib/score')).update,
|
||||
errorHandler = require(path.resolve('./modules/core/server/controllers/errors.server.controller')),
|
||||
traceLogCreate = require(path.resolve('./config/lib/tracelog')).create;
|
||||
traceLogCreate = require(path.resolve('./config/lib/tracelog')).create,
|
||||
populateStrings = require(path.resolve('./config/lib/populateStrings'));
|
||||
|
||||
const PEERSTATE_SEEDER = 'seeder';
|
||||
const PEERSTATE_LEECHER = 'leecher';
|
||||
@@ -554,6 +555,7 @@ exports.getUserSeeding = function (req, res) {
|
||||
}).sort('-peer_uploaded')
|
||||
.populate({
|
||||
path: 'torrent',
|
||||
select: populateStrings.populate_torrent_string,
|
||||
populate: [
|
||||
{path: 'user', select: 'displayName profileImageURL'},
|
||||
{path: 'maker', select: 'name'}
|
||||
@@ -583,6 +585,7 @@ exports.getUserLeeching = function (req, res) {
|
||||
}).sort('-peer_downloaded')
|
||||
.populate({
|
||||
path: 'torrent',
|
||||
select: populateStrings.populate_torrent_string,
|
||||
populate: [
|
||||
{path: 'user', select: 'displayName profileImageURL'},
|
||||
{path: 'maker', select: 'name'}
|
||||
@@ -610,6 +613,7 @@ exports.getUserWarning = function (req, res) {
|
||||
hnr_warning: true
|
||||
}).populate({
|
||||
path: 'torrent',
|
||||
select: populateStrings.populate_torrent_string,
|
||||
populate: [
|
||||
{path: 'user', select: 'displayName profileImageURL'},
|
||||
{path: 'maker', select: 'name'}
|
||||
|
||||
Reference in New Issue
Block a user