diff --git a/modules/announce/server/controllers/announces.server.controller.js b/modules/announce/server/controllers/announces.server.controller.js index 6579b197..370ab53d 100644 --- a/modules/announce/server/controllers/announces.server.controller.js +++ b/modules/announce/server/controllers/announces.server.controller.js @@ -1158,13 +1158,15 @@ exports.announce = function (req, res) { var udr = {}; var sale = req.torrent.torrent_sale_status; - var start = moment(globalSalesConfig.global.startAt, globalSalesConfig.global.timeFormats).utc().valueOf(); + var start = moment(globalSalesConfig.global.startAt, globalSalesConfig.global.timeFormats).valueOf(); var end = start + globalSalesConfig.global.expires; var now = Date.now(); isGlobalSaleValid = (now > start && now < end && globalSalesConfig.global.value) ? true : false; if (isGlobalSaleValid && globalSalesConfig.global.value) { sale = globalSalesConfig.global.value; + mtDebug.debugRed('isGlobalSaleValid = ' + isGlobalSaleValid, 'ANNOUNCE', true, req.passkeyuser); + mtDebug.debugRed('global sale value = ' + sale, 'ANNOUNCE', true, req.passkeyuser); } switch (sale) { diff --git a/modules/core/client/directives/torrent-list-item.client.directive.js b/modules/core/client/directives/torrent-list-item.client.directive.js index a1074e3d..4d32f9ea 100644 --- a/modules/core/client/directives/torrent-list-item.client.directive.js +++ b/modules/core/client/directives/torrent-list-item.client.directive.js @@ -6,9 +6,9 @@ function torrentListItem() { var TorrentsItemController = ['$scope', '$state', 'TorrentGetInfoServices', 'ResourcesTagsServices', '$timeout', 'DownloadService', 'MeanTorrentConfig', - 'TorrentsService', 'Authentication', 'NotifycationService', 'ModalConfirmService', '$translate', + 'TorrentsService', 'Authentication', 'NotifycationService', 'ModalConfirmService', '$translate', 'moment', function ($scope, $state, TorrentGetInfoServices, ResourcesTagsServices, $timeout, DownloadService, MeanTorrentConfig, TorrentsService, Authentication, - NotifycationService, ModalConfirmService, $translate) { + NotifycationService, ModalConfirmService, $translate, moment) { var vm = this; vm.user = Authentication.user; @@ -18,6 +18,7 @@ vm.DLS = DownloadService; vm.torrentSalesType = MeanTorrentConfig.meanTorrentConfig.torrentSalesType; vm.torrentRLevels = MeanTorrentConfig.meanTorrentConfig.torrentRecommendLevel; + vm.salesGlobalConfig = MeanTorrentConfig.meanTorrentConfig.torrentGlobalSales; /** * buildPager @@ -311,6 +312,22 @@ } }; + /** + * isGlobalSaleNow + * @returns {boolean} + */ + vm.isGlobalSaleNow = function () { + var start = moment(vm.salesGlobalConfig.global.startAt, vm.salesGlobalConfig.global.timeFormats).valueOf(); + var end = start + vm.salesGlobalConfig.global.expires; + var now = Date.now(); + + if (now > start && now < end && vm.salesGlobalConfig.global.value) { + return true; + } else { + return false; + } + }; + }]; return { 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 41199f33..7d389044 100644 --- a/modules/torrents/client/controllers/admin/admin-list.client.controller.js +++ b/modules/torrents/client/controllers/admin/admin-list.client.controller.js @@ -7,12 +7,12 @@ TorrentsAdminController.$inject = ['$scope', '$state', '$translate', '$timeout', 'Authentication', 'Notification', 'TorrentsService', 'MeanTorrentConfig', 'DownloadService', '$window', 'ModalConfirmService', 'NotifycationService', 'DebugConsoleService', 'TorrentGetInfoServices', - 'ResourcesTagsServices', 'localStorageService' + 'ResourcesTagsServices', 'localStorageService', 'moment' ]; function TorrentsAdminController($scope, $state, $translate, $timeout, Authentication, Notification, TorrentsService, MeanTorrentConfig, DownloadService, $window, ModalConfirmService, NotifycationService, mtDebug, TorrentGetInfoServices, - ResourcesTagsServices, localStorageService) { + ResourcesTagsServices, localStorageService, moment) { var vm = this; vm.DLS = DownloadService; vm.TGI = TorrentGetInfoServices; @@ -23,6 +23,7 @@ vm.torrentSalesType = MeanTorrentConfig.meanTorrentConfig.torrentSalesType; vm.torrentRLevels = MeanTorrentConfig.meanTorrentConfig.torrentRecommendLevel; vm.torrentTypeConfig = MeanTorrentConfig.meanTorrentConfig.torrentType; + vm.salesGlobalConfig = MeanTorrentConfig.meanTorrentConfig.torrentGlobalSales; vm.selectedType = localStorageService.get('admin_last_selected_type') || 'movie'; vm.filterVIP = isSelectedVipType(vm.selectedType); @@ -362,5 +363,21 @@ i.removeClass('glyphicon-chevron-down').addClass('glyphicon-chevron-up'); } }; + + /** + * isGlobalSaleNow + * @returns {boolean} + */ + vm.isGlobalSaleNow = function () { + var start = moment(vm.salesGlobalConfig.global.startAt, vm.salesGlobalConfig.global.timeFormats).valueOf(); + var end = start + vm.salesGlobalConfig.global.expires; + var now = Date.now(); + + if (now > start && now < end && vm.salesGlobalConfig.global.value) { + return true; + } else { + return false; + } + }; } }()); diff --git a/modules/torrents/client/controllers/torrent-info.client.controller.js b/modules/torrents/client/controllers/torrent-info.client.controller.js index 0c8cbd9d..0c910814 100644 --- a/modules/torrents/client/controllers/torrent-info.client.controller.js +++ b/modules/torrents/client/controllers/torrent-info.client.controller.js @@ -8,12 +8,12 @@ TorrentsInfoController.$inject = ['$scope', '$state', '$stateParams', '$translate', 'Authentication', 'Notification', 'TorrentsService', 'MeanTorrentConfig', 'DownloadService', '$sce', '$filter', 'CommentsService', 'ModalConfirmService', 'marked', 'Upload', '$timeout', 'SubtitlesService', 'getStorageLangService', 'NotifycationService', 'DebugConsoleService', 'TorrentGetInfoServices', - 'localStorageService', '$compile', 'SideOverlay', 'ResourcesTagsServices', 'CollectionsService']; + 'localStorageService', '$compile', 'SideOverlay', 'ResourcesTagsServices', 'CollectionsService', 'moment']; function TorrentsInfoController($scope, $state, $stateParams, $translate, Authentication, Notification, TorrentsService, MeanTorrentConfig, DownloadService, $sce, $filter, CommentsService, ModalConfirmService, marked, Upload, $timeout, SubtitlesService, getStorageLangService, NotifycationService, mtDebug, TorrentGetInfoServices, - localStorageService, $compile, SideOverlay, ResourcesTagsServices, CollectionsService) { + localStorageService, $compile, SideOverlay, ResourcesTagsServices, CollectionsService, moment) { var vm = this; vm.DLS = DownloadService; vm.TGI = TorrentGetInfoServices; @@ -30,6 +30,7 @@ vm.itemsPerPageConfig = MeanTorrentConfig.meanTorrentConfig.itemsPerPage; vm.scoreConfig = MeanTorrentConfig.meanTorrentConfig.score; vm.inputLengthConfig = MeanTorrentConfig.meanTorrentConfig.inputLength; + vm.salesGlobalConfig = MeanTorrentConfig.meanTorrentConfig.torrentGlobalSales; vm.torrentTabs = []; vm.searchTags = []; @@ -1396,5 +1397,21 @@ }); }; + /** + * isGlobalSaleNow + * @returns {boolean} + */ + vm.isGlobalSaleNow = function () { + var start = moment(vm.salesGlobalConfig.global.startAt, vm.salesGlobalConfig.global.timeFormats).valueOf(); + var end = start + vm.salesGlobalConfig.global.expires; + var now = Date.now(); + + if (now > start && now < end && vm.salesGlobalConfig.global.value) { + return true; + } else { + return false; + } + }; + } }()); diff --git a/modules/torrents/client/controllers/torrents.client.controller.js b/modules/torrents/client/controllers/torrents.client.controller.js index 9bf4caf9..28047b7d 100644 --- a/modules/torrents/client/controllers/torrents.client.controller.js +++ b/modules/torrents/client/controllers/torrents.client.controller.js @@ -6,10 +6,10 @@ .controller('TorrentsController', TorrentsController); TorrentsController.$inject = ['$scope', '$state', '$translate', '$timeout', 'Authentication', 'Notification', 'TorrentsService', 'getStorageLangService', - 'MeanTorrentConfig', 'DownloadService', '$window', 'DebugConsoleService', 'TorrentGetInfoServices', 'ResourcesTagsServices']; + 'MeanTorrentConfig', 'DownloadService', '$window', 'DebugConsoleService', 'TorrentGetInfoServices', 'ResourcesTagsServices', 'moment']; function TorrentsController($scope, $state, $translate, $timeout, Authentication, Notification, TorrentsService, getStorageLangService, MeanTorrentConfig, - DownloadService, $window, mtDebug, TorrentGetInfoServices, ResourcesTagsServices) { + DownloadService, $window, mtDebug, TorrentGetInfoServices, ResourcesTagsServices, moment) { var vm = this; vm.DLS = DownloadService; vm.TGI = TorrentGetInfoServices; @@ -22,6 +22,7 @@ vm.itemsPerPageConfig = MeanTorrentConfig.meanTorrentConfig.itemsPerPage; vm.appConfig = MeanTorrentConfig.meanTorrentConfig.app; vm.torrentTypeConfig = MeanTorrentConfig.meanTorrentConfig.torrentType; + vm.salesGlobalConfig = MeanTorrentConfig.meanTorrentConfig.torrentGlobalSales; vm.searchTags = []; vm.searchKey = $state.params.keys || ''; @@ -479,6 +480,22 @@ } }; + /** + * isGlobalSaleNow + * @returns {boolean} + */ + vm.isGlobalSaleNow = function () { + var start = moment(vm.salesGlobalConfig.global.startAt, vm.salesGlobalConfig.global.timeFormats).valueOf(); + var end = start + vm.salesGlobalConfig.global.expires; + var now = Date.now(); + + if (now > start && now < end && vm.salesGlobalConfig.global.value) { + return true; + } else { + return false; + } + }; + /** * onTorrentTypeChanged */ diff --git a/modules/torrents/client/services/torrent-get-info.client.service.js b/modules/torrents/client/services/torrent-get-info.client.service.js index 40fa058d..1cd6cf00 100644 --- a/modules/torrents/client/services/torrent-get-info.client.service.js +++ b/modules/torrents/client/services/torrent-get-info.client.service.js @@ -31,7 +31,8 @@ getTorrentOverview: getTorrentOverview, openTorrentDetailInfo: openTorrentDetailInfo, - getTorrentSaleTypeDesc: getTorrentSaleTypeDesc + getTorrentSaleTypeDesc: getTorrentSaleTypeDesc, + getTorrentSaleTypeDescByValue: getTorrentSaleTypeDescByValue }; return service; @@ -327,5 +328,19 @@ return desc; } + /** + * getTorrentSaleTypeDescByValue + */ + function getTorrentSaleTypeDescByValue(v) { + var desc = ''; + + angular.forEach(torrentSalesType.value, function (st) { + if (st.name === v) { + desc = st.desc; + } + }); + return desc; + } + } }()); diff --git a/modules/torrents/client/templates/torrent-item.client.view.html b/modules/torrents/client/templates/torrent-item.client.view.html index ccb994b3..11b3e900 100644 --- a/modules/torrents/client/templates/torrent-item.client.view.html +++ b/modules/torrents/client/templates/torrent-item.client.view.html @@ -60,12 +60,17 @@ {{ 'TORRENT_RECOMMEND_LEVEL_ITEM.' + item.torrent_recommended.toUpperCase() | translate}} - {{item.torrent_sale_status}} {{item.torrent_sale_expires | unlife}} + + G: {{vm.salesGlobalConfig.global.value}} + S{{item.torrent_seasons}}E{{item.torrent_episodes}} 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 3b935acc..5d138bd3 100644 --- a/modules/torrents/client/views/admin/admin-list.client.view.html +++ b/modules/torrents/client/views/admin/admin-list.client.view.html @@ -101,15 +101,17 @@ -
{{ 'CA_TORRENT_SALE_STATUS' | translate}}:
-
-
- -
-
+
+
{{ 'CA_TORRENT_SALE_STATUS' | translate}}:
+
+
+ +
+
+
{{ 'CA_TORRENT_VIP' | translate}}:
@@ -124,7 +126,8 @@
diff --git a/modules/torrents/client/views/list-torrents.client.view.html b/modules/torrents/client/views/list-torrents.client.view.html index 200b45f4..d5be715e 100644 --- a/modules/torrents/client/views/list-torrents.client.view.html +++ b/modules/torrents/client/views/list-torrents.client.view.html @@ -148,21 +148,24 @@ -
{{ 'CA_TORRENT_SALE_STATUS' | translate}}:
-
-
- -
-
+
+
{{ 'CA_TORRENT_SALE_STATUS' | translate}}:
+
+
+ +
+
+
{{ 'CA_TORRENT_TOP' | translate}}:
diff --git a/modules/torrents/client/views/search-torrents.client.view.html b/modules/torrents/client/views/search-torrents.client.view.html index af271cdf..0cdc2529 100644 --- a/modules/torrents/client/views/search-torrents.client.view.html +++ b/modules/torrents/client/views/search-torrents.client.view.html @@ -96,15 +96,17 @@ -
{{ 'CA_TORRENT_SALE_STATUS' | translate}}:
-
-
- -
-
+
+
{{ 'CA_TORRENT_SALE_STATUS' | translate}}:
+
+
+ +
+
+