feat(home): optimization home torrent list

This commit is contained in:
OldHawk
2017-11-21 17:18:58 +08:00
parent 901e2b5985
commit 6fd75eae90
2 changed files with 369 additions and 10 deletions

View File

@@ -263,6 +263,365 @@
});
};
/**
* getMovieTopInfo
*/
vm.getMovieTopInfo = function () {
vm.moviesInfo = TorrentsService.get({
torrent_status: 'reviewed',
torrent_type: 'movie',
limit: 9
}, function (items) {
if (items.rows.length > 0) {
vm.movieTopOne = items.rows[0];
items.rows.splice(0, 1);
vm.movieTopList = items.rows;
vm.initTopOneMovieInfo();
if (!vm.announce.privateTorrentCmsMode && vm.scrapeConfig.onTorrentInHome) {
ScrapeService.scrapeTorrent(vm.movieTopOne);
ScrapeService.scrapeTorrent(vm.movieTopList);
}
}
}, function (err) {
Notification.error({
message: '<i class="glyphicon glyphicon-remove"></i> ' + $translate.instant('TOP_MOVIE_INFO_ERROR')
});
});
vm.moviesInfo = TorrentsService.get({
torrent_status: 'reviewed',
torrent_type: 'movie',
newest: true,
limit: 14
}, function (items) {
if (items.rows.length > 0) {
vm.movieNewList = items.rows;
if (!vm.announce.privateTorrentCmsMode && vm.scrapeConfig.onTorrentInHome) {
ScrapeService.scrapeTorrent(vm.movieNewList);
}
}
}, function (err) {
Notification.error({
message: '<i class="glyphicon glyphicon-remove"></i> ' + $translate.instant('TOP_MOVIE_INFO_ERROR')
});
});
};
/**
* getTVTopInfo
*/
vm.getTVTopInfo = function () {
vm.tvsInfo = TorrentsService.get({
torrent_status: 'reviewed',
torrent_type: 'tvserial',
limit: 9
}, function (items) {
if (items.rows.length > 0) {
vm.TVTopOne = items.rows[0];
items.rows.splice(0, 1);
vm.TVTopList = items.rows;
vm.initTopOneTVInfo();
if (!vm.announce.privateTorrentCmsMode && vm.scrapeConfig.onTorrentInHome) {
ScrapeService.scrapeTorrent(vm.TVTopOne);
ScrapeService.scrapeTorrent(vm.TVTopList);
}
}
});
vm.tvsInfo = TorrentsService.get({
torrent_status: 'reviewed',
torrent_type: 'tvserial',
newest: true,
limit: 14
}, function (items) {
if (items.rows.length > 0) {
vm.TVNewList = items.rows;
if (!vm.announce.privateTorrentCmsMode && vm.scrapeConfig.onTorrentInHome) {
ScrapeService.scrapeTorrent(vm.TVNewList);
}
}
});
};
/**
* getMusicTopInfo
*/
vm.getMusicTopInfo = function () {
vm.musicInfo = TorrentsService.get({
torrent_status: 'reviewed',
torrent_type: 'music',
limit: 9
}, function (items) {
if (items.rows.length > 0) {
vm.musicTopOne = items.rows[0];
items.rows.splice(0, 1);
vm.musicTopList = items.rows;
vm.initTopOneMusicInfo();
if (!vm.announce.privateTorrentCmsMode && vm.scrapeConfig.onTorrentInHome) {
ScrapeService.scrapeTorrent(vm.musicTopOne);
ScrapeService.scrapeTorrent(vm.musicTopList);
}
}
});
vm.musicInfo = TorrentsService.get({
torrent_status: 'reviewed',
torrent_type: 'music',
newest: true,
limit: 13
}, function (items) {
if (items.rows.length > 0) {
vm.musicNewList = items.rows;
if (!vm.announce.privateTorrentCmsMode && vm.scrapeConfig.onTorrentInHome) {
ScrapeService.scrapeTorrent(vm.musicNewList);
}
}
});
};
/**
* getSportsTopInfo
*/
vm.getSportsTopInfo = function () {
vm.sportsInfo = TorrentsService.get({
torrent_status: 'reviewed',
torrent_type: 'sports',
limit: 9
}, function (items) {
if (items.rows.length > 0) {
vm.sportsTopOne = items.rows[0];
items.rows.splice(0, 1);
vm.sportsTopList = items.rows;
vm.initTopOneSportsInfo();
if (!vm.announce.privateTorrentCmsMode && vm.scrapeConfig.onTorrentInHome) {
ScrapeService.scrapeTorrent(vm.sportsTopOne);
ScrapeService.scrapeTorrent(vm.sportsTopList);
}
}
});
vm.sportsInfo = TorrentsService.get({
torrent_status: 'reviewed',
torrent_type: 'sports',
newest: true,
limit: 14
}, function (items) {
if (items.rows.length > 0) {
vm.sportsNewList = items.rows;
if (!vm.announce.privateTorrentCmsMode && vm.scrapeConfig.onTorrentInHome) {
ScrapeService.scrapeTorrent(vm.sportsNewList);
}
}
});
};
/**
* getVarietyTopInfo
*/
vm.getVarietyTopInfo = function () {
vm.varietyInfo = TorrentsService.get({
torrent_status: 'reviewed',
torrent_type: 'variety',
limit: 9
}, function (items) {
if (items.rows.length > 0) {
vm.varietyTopOne = items.rows[0];
items.rows.splice(0, 1);
vm.varietyTopList = items.rows;
vm.initTopOneVarietyInfo();
if (!vm.announce.privateTorrentCmsMode && vm.scrapeConfig.onTorrentInHome) {
ScrapeService.scrapeTorrent(vm.varietyTopOne);
ScrapeService.scrapeTorrent(vm.varietyTopList);
}
}
});
vm.varietyInfo = TorrentsService.get({
torrent_status: 'reviewed',
torrent_type: 'variety',
newest: true,
limit: 14
}, function (items) {
if (items.rows.length > 0) {
vm.varietyNewList = items.rows;
if (!vm.announce.privateTorrentCmsMode && vm.scrapeConfig.onTorrentInHome) {
ScrapeService.scrapeTorrent(vm.varietyNewList);
}
}
});
};
/**
* getPictureTopInfo
*/
vm.getPictureTopInfo = function () {
vm.pictureInfo = TorrentsService.get({
torrent_status: 'reviewed',
torrent_type: 'picture',
limit: 9
}, function (items) {
if (items.rows.length > 0) {
vm.pictureTopOne = items.rows[0];
items.rows.splice(0, 1);
vm.pictureTopList = items.rows;
vm.initTopOnePictureInfo();
if (!vm.announce.privateTorrentCmsMode && vm.scrapeConfig.onTorrentInHome) {
ScrapeService.scrapeTorrent(vm.pictureTopOne);
ScrapeService.scrapeTorrent(vm.pictureTopList);
}
}
});
vm.pictureInfo = TorrentsService.get({
torrent_status: 'reviewed',
torrent_type: 'picture',
newest: true,
limit: 14
}, function (items) {
if (items.rows.length > 0) {
vm.pictureNewList = items.rows;
if (!vm.announce.privateTorrentCmsMode && vm.scrapeConfig.onTorrentInHome) {
ScrapeService.scrapeTorrent(vm.pictureNewList);
}
}
});
};
/**
* getGameTopInfo
*/
vm.getGameTopInfo = function () {
vm.gameInfo = TorrentsService.get({
torrent_status: 'reviewed',
torrent_type: 'game',
limit: 9
}, function (items) {
if (items.rows.length > 0) {
vm.gameTopOne = items.rows[0];
items.rows.splice(0, 1);
vm.gameTopList = items.rows;
vm.initTopOneGameInfo();
if (!vm.announce.privateTorrentCmsMode && vm.scrapeConfig.onTorrentInHome) {
ScrapeService.scrapeTorrent(vm.gameTopOne);
ScrapeService.scrapeTorrent(vm.gameTopList);
}
}
});
vm.gameInfo = TorrentsService.get({
torrent_status: 'reviewed',
torrent_type: 'game',
newest: true,
limit: 14
}, function (items) {
if (items.rows.length > 0) {
vm.gameNewList = items.rows;
if (!vm.announce.privateTorrentCmsMode && vm.scrapeConfig.onTorrentInHome) {
ScrapeService.scrapeTorrent(vm.gameNewList);
}
}
});
};
/**
* getSoftwareTopInfo
*/
vm.getSoftwareTopInfo = function () {
vm.softwareInfo = TorrentsService.get({
torrent_status: 'reviewed',
torrent_type: 'software',
limit: 9
}, function (items) {
if (items.rows.length > 0) {
vm.softwareTopOne = items.rows[0];
items.rows.splice(0, 1);
vm.softwareTopList = items.rows;
vm.initTopOneSoftwareInfo();
if (!vm.announce.privateTorrentCmsMode && vm.scrapeConfig.onTorrentInHome) {
ScrapeService.scrapeTorrent(vm.softwareTopOne);
ScrapeService.scrapeTorrent(vm.softwareTopList);
}
}
});
vm.softwareInfo = TorrentsService.get({
torrent_status: 'reviewed',
torrent_type: 'software',
newest: true,
limit: 14
}, function (items) {
if (items.rows.length > 0) {
vm.softwareNewList = items.rows;
if (!vm.announce.privateTorrentCmsMode && vm.scrapeConfig.onTorrentInHome) {
ScrapeService.scrapeTorrent(vm.softwareNewList);
}
}
});
};
/**
* getEbookTopInfo
*/
vm.getEbookTopInfo = function () {
vm.ebookInfo = TorrentsService.get({
torrent_status: 'reviewed',
torrent_type: 'ebook',
limit: 9
}, function (items) {
if (items.rows.length > 0) {
vm.ebookTopOne = items.rows[0];
items.rows.splice(0, 1);
vm.ebookTopList = items.rows;
vm.initTopOneEbookInfo();
if (!vm.announce.privateTorrentCmsMode && vm.scrapeConfig.onTorrentInHome) {
ScrapeService.scrapeTorrent(vm.ebookTopOne);
ScrapeService.scrapeTorrent(vm.ebookTopList);
}
}
});
vm.ebookInfo = TorrentsService.get({
torrent_status: 'reviewed',
torrent_type: 'ebook',
newest: true,
limit: 14
}, function (items) {
if (items.rows.length > 0) {
vm.ebookNewList = items.rows;
if (!vm.announce.privateTorrentCmsMode && vm.scrapeConfig.onTorrentInHome) {
ScrapeService.scrapeTorrent(vm.ebookNewList);
}
}
});
};
/**
* getOverviewMarkedContent
* @param t

View File

@@ -1,8 +1,8 @@
<section ng-controller="HomeController as vm" ng-init="vm.getWarningInfo(); vm.getHomeTorrentList();">
<section ng-controller="HomeController as vm" ng-init="vm.getWarningInfo();">
<!-- **********************************************************************
movie top list
*********************************************************************** -->
<div ng-if="vm.getTorrentTypeEnabled('movie')">
<div ng-if="vm.getTorrentTypeEnabled('movie')" ng-init="vm.getMovieTopInfo();">
<div class="backdrop movie-backdrop" ng-show="vm.movieTopOne">
<div class="filter">
<div class="type-flag">{{'MENU_TORRENTS_SUB.MOVIE' | translate}}</div>
@@ -221,7 +221,7 @@
<!-- **********************************************************************
tvserial top list
*********************************************************************** -->
<div ng-if="vm.getTorrentTypeEnabled('tvserial')">
<div ng-if="vm.getTorrentTypeEnabled('tvserial')" ng-init="vm.getTVTopInfo();">
<div class="backdrop tv-backdrop" ng-show="vm.TVTopOne">
<div class="filter">
<div class="type-flag">{{'MENU_TORRENTS_SUB.TVSERIAL' | translate}}</div>
@@ -449,7 +449,7 @@
<!-- **********************************************************************
music top list
*********************************************************************** -->
<div ng-if="vm.getTorrentTypeEnabled('music')">
<div ng-if="vm.getTorrentTypeEnabled('music')" ng-init="vm.getMusicTopInfo();">
<div class="backdrop music-backdrop" ng-show="vm.musicTopOne">
<div class="filter">
<div class="type-flag">{{'MENU_TORRENTS_SUB.MUSIC' | translate}}</div>
@@ -629,7 +629,7 @@
<!-- **********************************************************************
sports top list
*********************************************************************** -->
<div ng-if="vm.getTorrentTypeEnabled('sports')">
<div ng-if="vm.getTorrentTypeEnabled('sports')" ng-init="vm.getSportsTopInfo();">
<div class="backdrop sports-backdrop" ng-show="vm.sportsTopOne">
<div class="filter">
<div class="type-flag">{{'MENU_TORRENTS_SUB.SPORTS' | translate}}</div>
@@ -801,7 +801,7 @@
<!-- **********************************************************************
variety top list
*********************************************************************** -->
<div ng-if="vm.getTorrentTypeEnabled('variety')">
<div ng-if="vm.getTorrentTypeEnabled('variety')" ng-init="vm.getVarietyTopInfo();">
<div class="backdrop variety-backdrop" ng-show="vm.varietyTopOne">
<div class="filter">
<div class="type-flag">{{'MENU_TORRENTS_SUB.VARIETY' | translate}}</div>
@@ -973,7 +973,7 @@
<!-- **********************************************************************
picture top list
*********************************************************************** -->
<div ng-if="vm.getTorrentTypeEnabled('picture')">
<div ng-if="vm.getTorrentTypeEnabled('picture')" ng-init="vm.getPictureTopInfo();">
<div class="backdrop picture-backdrop" ng-show="vm.pictureTopOne">
<div class="filter">
<div class="type-flag">{{'MENU_TORRENTS_SUB.PICTURE' | translate}}</div>
@@ -1145,7 +1145,7 @@
<!-- **********************************************************************
game top list
*********************************************************************** -->
<div ng-if="vm.getTorrentTypeEnabled('game')">
<div ng-if="vm.getTorrentTypeEnabled('game')" ng-init="vm.getGameTopInfo();">
<div class="backdrop game-backdrop" ng-show="vm.gameTopOne">
<div class="filter">
<div class="type-flag">{{'MENU_TORRENTS_SUB.GAME' | translate}}</div>
@@ -1317,7 +1317,7 @@
<!-- **********************************************************************
software top list
*********************************************************************** -->
<div ng-if="vm.getTorrentTypeEnabled('software')">
<div ng-if="vm.getTorrentTypeEnabled('software')" ng-init="vm.getSoftwareTopInfo();">
<div class="backdrop software-backdrop" ng-show="vm.softwareTopOne">
<div class="filter">
<div class="type-flag">{{'MENU_TORRENTS_SUB.SOFTWARE' | translate}}</div>
@@ -1489,7 +1489,7 @@
<!-- **********************************************************************
ebook top list
*********************************************************************** -->
<div ng-if="vm.getTorrentTypeEnabled('ebook')">
<div ng-if="vm.getTorrentTypeEnabled('ebook')" ng-init="vm.getEbookTopInfo();">
<div class="backdrop ebook-backdrop" ng-show="vm.ebookTopOne">
<div class="filter">
<div class="type-flag">{{'MENU_TORRENTS_SUB.EBOOK' | translate}}</div>