From 598987d2d75f558688b1ffb4cede2d19dc0252ad Mon Sep 17 00:00:00 2001 From: OldHawk Date: Tue, 3 Oct 2017 00:24:49 +0800 Subject: [PATCH] feat(torrents): show topOne music info at home page --- .../controllers/home.client.controller.js | 71 ++++++++++++++++++- modules/core/client/less/mt.less | 20 +++++- .../core/client/views/home.client.view.html | 51 +++++++++++++ .../torrent-get-info.client.service.js | 20 +++--- .../views/admin/admin-list.client.view.html | 2 +- .../views/list-torrents.client.view.html | 4 +- .../views/view-torrent.client.view.html | 4 +- .../admin/user-leeching.client.view.html | 2 +- .../views/admin/user-seeding.client.view.html | 2 +- .../views/admin/user-uplist.client.view.html | 2 +- .../views/admin/user-warning.client.view.html | 2 +- .../views/status/downloading.client.view.html | 2 +- .../views/status/seeding.client.view.html | 2 +- .../views/status/uploaded.client.view.html | 2 +- .../views/status/warning.client.view.html | 2 +- 15 files changed, 159 insertions(+), 29 deletions(-) diff --git a/modules/core/client/controllers/home.client.controller.js b/modules/core/client/controllers/home.client.controller.js index d0316a4d..d5322477 100644 --- a/modules/core/client/controllers/home.client.controller.js +++ b/modules/core/client/controllers/home.client.controller.js @@ -6,10 +6,12 @@ .controller('HomeController', HomeController); HomeController.$inject = ['$scope', '$state', '$translate', 'Authentication', 'TorrentsService', 'Notification', 'MeanTorrentConfig', - 'getStorageLangService', 'DownloadService', '$timeout', 'localStorageService', 'ScrapeService', 'TorrentGetInfoServices']; + 'getStorageLangService', 'DownloadService', '$timeout', 'localStorageService', 'ScrapeService', 'TorrentGetInfoServices', 'DebugConsoleService', + 'marked']; function HomeController($scope, $state, $translate, Authentication, TorrentsService, Notification, MeanTorrentConfig, getStorageLangService, - DownloadService, $timeout, localStorageService, ScrapeService, TGI) { + DownloadService, $timeout, localStorageService, ScrapeService, TGI, mtDebug, + marked) { var vm = this; vm.TGI = TGI; vm.tmdbConfig = MeanTorrentConfig.meanTorrentConfig.tmdbConfig; @@ -64,6 +66,15 @@ } }; + /** + * initTopOneMusicInfo + */ + vm.initTopOneMusicInfo = function () { + if (vm.musicTopOne.resource_detail_info.cover) { + $('.music-backdrop').css('backgroundImage', 'url(/modules/torrents/client/uploads/cover/' + vm.musicTopOne.resource_detail_info.cover + ')'); + } + }; + /** * getTorrentTypeEnabled */ @@ -166,7 +177,7 @@ } }); - vm.moviesInfo = TorrentsService.get({ + vm.tvsInfo = TorrentsService.get({ torrent_status: 'reviewed', torrent_type: 'tvserial', newest: true, @@ -182,6 +193,47 @@ }); }; + /** + * getMusicTopInfo + */ + vm.getMusicTopInfo = function () { + vm.musicInfo = TorrentsService.get({ + torrent_status: 'reviewed', + torrent_type: 'music', + limit: 9 + }, function (items) { + if (items.rows.length > 0) { + mtDebug.info(items); + + 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: 14 + }, function (items) { + if (items.rows.length > 0) { + vm.musicNewList = items.rows; + + if (!vm.announce.privateTorrentCmsMode && vm.scrapeConfig.onTorrentInHome) { + ScrapeService.scrapeTorrent(vm.musicNewList); + } + } + }); + }; + /** * openTorrentInfo * @param id @@ -210,5 +262,18 @@ }); }); }; + + /** + * getOverviewMarkedContent + * @param t + * @returns {*} + */ + vm.getOverviewMarkedContent = function (c) { + if (c) { + return marked(c, {sanitize: true}); + } else { + return ''; + } + }; } }()); diff --git a/modules/core/client/less/mt.less b/modules/core/client/less/mt.less index b4b0dc04..da9c9f8c 100644 --- a/modules/core/client/less/mt.less +++ b/modules/core/client/less/mt.less @@ -63,8 +63,8 @@ body { color: #fff; opacity: 0.15; position: absolute; - right: 10px; - top: -20px; + right: 20px; + top: -10px; font-size: 100px; font-weight: bold; } @@ -141,7 +141,7 @@ body { } } } - .music-overview { + .music-detail { p { > img { max-width: 100% !important; @@ -150,6 +150,20 @@ body { } } } + .music-overview { + max-height: 400px; + overflow: auto; + padding-right: 5px; + &::-webkit-scrollbar { + width: 5px; + } + &::-webkit-scrollbar-track { + background-color: #000; + } + &::-webkit-scrollbar-thumb { + background-color: #555; + } + } } } diff --git a/modules/core/client/views/home.client.view.html b/modules/core/client/views/home.client.view.html index 3b103661..41fdf223 100644 --- a/modules/core/client/views/home.client.view.html +++ b/modules/core/client/views/home.client.view.html @@ -423,6 +423,57 @@ +
+
+
+
{{'MENU_TORRENTS_SUB.MUSIC' | translate}}
+
+
+
+ {{vm.TGI.getTorrentTitle(vm.musicTopOne)}} + +
+ +
+
+
+
+
{{ 'TMDB_FIELDS.TITLE' | translate}}:
+
{{vm.TGI.getTorrentTitle(vm.musicTopOne)}}
+ +
{{ 'TMDB_FIELDS.SUB_TITLE' | translate}}:
+
{{vm.musicTopOne.resource_detail_info.subtitle}}
+ +
{{ 'TMDB_FIELDS.ARTIST' | translate}}:
+
{{vm.musicTopOne.resource_detail_info.artist}}
+ +
{{ 'TMDB_FIELDS.VOTE_AVERAGE' | translate}}:
+
+ + + {{vm.TGI.getVoteTitle(vm.musicTopOne)}} + {{vm.musicTopOne.resource_detail_info.vote_average}} / {{vm.musicTopOne.resource_detail_info.vote_count}} {{ 'TMDB_FIELDS.VOTE_UNIT' | translate}} + +
+ +
{{ 'TMDB_FIELDS.OVERVIEW' | translate}}:
+
+
+
+
+
+
+
+
+
+
+
+