feat(torrents): new TorrentGetInfoServices to get field value of torrent

This commit is contained in:
OldHawk
2017-09-30 11:29:23 +08:00
parent 601d6c5245
commit 9515a0fc4f
18 changed files with 189 additions and 612 deletions

View File

@@ -6,20 +6,18 @@
.controller('TorrentsAdminController', TorrentsAdminController);
TorrentsAdminController.$inject = ['$scope', '$state', '$translate', '$timeout', 'Authentication', 'Notification', 'TorrentsService',
'MeanTorrentConfig', 'DownloadService', '$window', 'ModalConfirmService', 'NotifycationService', 'DebugConsoleService'];
'MeanTorrentConfig', 'DownloadService', '$window', 'ModalConfirmService', 'NotifycationService', 'DebugConsoleService', 'TorrentGetInfoServices'];
function TorrentsAdminController($scope, $state, $translate, $timeout, Authentication, Notification, TorrentsService, MeanTorrentConfig,
DownloadService, $window, ModalConfirmService, NotifycationService, mtDebug) {
DownloadService, $window, ModalConfirmService, NotifycationService, mtDebug, TGI) {
var vm = this;
vm.TGI = TGI;
vm.user = Authentication.user;
vm.announce = MeanTorrentConfig.meanTorrentConfig.announce;
vm.tmdbConfig = MeanTorrentConfig.meanTorrentConfig.tmdbConfig;
vm.imdbConfig = MeanTorrentConfig.meanTorrentConfig.imdbConfig;
vm.resourcesTags = MeanTorrentConfig.meanTorrentConfig.resourcesTags;
vm.torrentSalesType = MeanTorrentConfig.meanTorrentConfig.torrentSalesType;
vm.torrentRLevels = MeanTorrentConfig.meanTorrentConfig.torrentRecommendLevel;
vm.torrentType = MeanTorrentConfig.meanTorrentConfig.torrentType;
vm.voteTitleConfig = MeanTorrentConfig.meanTorrentConfig.voteTitle;
vm.selectedType = 'movie';
vm.searchTags = [];
@@ -494,79 +492,5 @@
});
});
};
/**
* getTorrentListImage
* @param item
* @returns {string}
*/
vm.getTorrentListImage = function (item) {
var result = null;
switch (item.torrent_type) {
case 'movie':
case 'tvserial':
result = vm.tmdbConfig.posterListBaseUrl + item.resource_detail_info.poster_path;
break;
case 'music':
result = '/modules/torrents/client/uploads/cover/' + item.resource_detail_info.cover;
break;
}
return result;
};
/**
* getTorrentTitle
* @param item
* @returns {string}
*/
vm.getTorrentTitle = function (item) {
var result = null;
switch (item.torrent_type) {
case 'movie':
result = item.resource_detail_info.original_title;
break;
case 'tvserial':
result = item.resource_detail_info.original_name;
break;
case 'music':
result = item.resource_detail_info.title;
break;
}
return result;
};
/**
* getTorrentOriginalTitle
* @param item
* @returns {string}
*/
vm.getTorrentOriginalTitle = function (item) {
var result = null;
switch (item.torrent_type) {
case 'movie':
if (item.resource_detail_info.original_title !== item.resource_detail_info.title) {
result = item.resource_detail_info.title;
}
break;
case 'tvserial':
if (item.resource_detail_info.original_name !== item.resource_detail_info.name) {
result = item.resource_detail_info.name;
}
break;
}
return result;
};
/**
* getVoteTitle
* @param item
* @returns {string}
*/
vm.getVoteTitle = function (item) {
return item.resource_detail_info.vote_average ? vm.voteTitleConfig.imdb : vm.voteTitleConfig.mt;
};
}
}());

View File

@@ -6,20 +6,18 @@
.controller('TorrentsController', TorrentsController);
TorrentsController.$inject = ['$scope', '$state', '$translate', '$timeout', 'Authentication', 'Notification', 'TorrentsService',
'MeanTorrentConfig', 'DownloadService', '$window', 'ScrapeService', 'DebugConsoleService'];
'MeanTorrentConfig', 'DownloadService', '$window', 'ScrapeService', 'DebugConsoleService', 'TorrentGetInfoServices'];
function TorrentsController($scope, $state, $translate, $timeout, Authentication, Notification, TorrentsService, MeanTorrentConfig,
DownloadService, $window, ScrapeService, mtDebug) {
DownloadService, $window, ScrapeService, mtDebug, TGI) {
var vm = this;
vm.TGI = TGI;
vm.user = Authentication.user;
vm.announce = MeanTorrentConfig.meanTorrentConfig.announce;
vm.scrapeConfig = MeanTorrentConfig.meanTorrentConfig.scrapeTorrentStatus;
vm.tmdbConfig = MeanTorrentConfig.meanTorrentConfig.tmdbConfig;
vm.imdbConfig = MeanTorrentConfig.meanTorrentConfig.imdbConfig;
vm.resourcesTags = MeanTorrentConfig.meanTorrentConfig.resourcesTags;
vm.torrentSalesType = MeanTorrentConfig.meanTorrentConfig.torrentSalesType;
vm.itemsPerPageConfig = MeanTorrentConfig.meanTorrentConfig.itemsPerPage;
vm.voteTitleConfig = MeanTorrentConfig.meanTorrentConfig.voteTitle;
vm.searchTags = [];
vm.searchKey = '';
@@ -326,99 +324,5 @@
var url = $state.href('torrents.view', {torrentId: id});
$window.open(url, '_blank');
};
/**
* getTorrentListImage
* @param item
* @returns {string}
*/
vm.getTorrentListImage = function (item) {
var result = null;
switch (item.torrent_type) {
case 'movie':
case 'tvserial':
result = vm.tmdbConfig.posterListBaseUrl + item.resource_detail_info.poster_path;
break;
case 'music':
result = '/modules/torrents/client/uploads/cover/' + item.resource_detail_info.cover;
break;
}
return result;
};
/**
* getTorrentListTopImage
* @param item
* @returns {string}
*/
vm.getTorrentListTopImage = function (item) {
var result = null;
switch (item.torrent_type) {
case 'movie':
case 'tvserial':
result = vm.tmdbConfig.posterImgBaseUrl + item.resource_detail_info.poster_path;
break;
case 'music':
result = '/modules/torrents/client/uploads/cover/' + item.resource_detail_info.cover;
break;
}
return result;
};
/**
* getTorrentTitle
* @param item
* @returns {string}
*/
vm.getTorrentTitle = function (item) {
var result = null;
switch (item.torrent_type) {
case 'movie':
result = item.resource_detail_info.original_title;
break;
case 'tvserial':
result = item.resource_detail_info.original_name;
break;
case 'music':
result = item.resource_detail_info.title;
break;
}
return result;
};
/**
* getTorrentOriginalTitle
* @param item
* @returns {string}
*/
vm.getTorrentOriginalTitle = function (item) {
var result = null;
switch (item.torrent_type) {
case 'movie':
if (item.resource_detail_info.original_title !== item.resource_detail_info.title) {
result = item.resource_detail_info.title;
}
break;
case 'tvserial':
if (item.resource_detail_info.original_name !== item.resource_detail_info.name) {
result = item.resource_detail_info.name;
}
break;
}
return result;
};
/**
* getVoteTitle
* @param item
* @returns {string}
*/
vm.getVoteTitle = function (item) {
return item.resource_detail_info.vote_average ? vm.voteTitleConfig.imdb : vm.voteTitleConfig.mt;
};
}
}());

View File

@@ -0,0 +1,122 @@
(function () {
'use strict';
// Authentication service for user variables
angular
.module('torrents.services')
.factory('TorrentGetInfoServices', TorrentGetInfoServices);
TorrentGetInfoServices.$inject = ['MeanTorrentConfig'];
function TorrentGetInfoServices(MeanTorrentConfig) {
var voteTitleConfig = MeanTorrentConfig.meanTorrentConfig.voteTitle;
var tmdbConfig = MeanTorrentConfig.meanTorrentConfig.tmdbConfig;
var service = {
getTorrentTitle: getTorrentTitle,
getTorrentOriginalTitle: getTorrentOriginalTitle,
getTorrentListImage: getTorrentListImage,
getTorrentListTopImage: getTorrentListTopImage,
getVoteTitle: getVoteTitle
};
return service;
/**
* getTorrentTitle
* @param item
* @returns {string}
*/
function getTorrentTitle(item) {
var result = null;
switch (item.torrent_type) {
case 'movie':
result = item.resource_detail_info.original_title;
break;
case 'tvserial':
result = item.resource_detail_info.original_name;
break;
case 'music':
result = item.resource_detail_info.title;
break;
}
return result;
}
/**
* getTorrentOriginalTitle
* @param item
* @returns {string}
*/
function getTorrentOriginalTitle(item) {
var result = null;
switch (item.torrent_type) {
case 'movie':
if (item.resource_detail_info.original_title !== item.resource_detail_info.title) {
result = item.resource_detail_info.title;
}
break;
case 'tvserial':
if (item.resource_detail_info.original_name !== item.resource_detail_info.name) {
result = item.resource_detail_info.name;
}
break;
}
return result;
}
/**
* getTorrentListImage
* @param item
* @returns {string}
*/
function getTorrentListImage(item) {
var result = null;
switch (item.torrent_type) {
case 'movie':
case 'tvserial':
result = tmdbConfig.posterListBaseUrl + item.resource_detail_info.poster_path;
break;
case 'music':
result = '/modules/torrents/client/uploads/cover/' + item.resource_detail_info.cover;
break;
}
return result;
}
/**
* getTorrentListTopImage
* @param item
* @returns {string}
*/
function getTorrentListTopImage(item) {
var result = null;
switch (item.torrent_type) {
case 'movie':
case 'tvserial':
result = tmdbConfig.posterImgBaseUrl + item.resource_detail_info.poster_path;
break;
case 'music':
result = '/modules/torrents/client/uploads/cover/' + item.resource_detail_info.cover;
break;
}
return result;
}
/**
* getVoteTitle
* @param item
* @returns {string}
*/
function getVoteTitle(item) {
return item.resource_detail_info.vote_average ? voteTitleConfig.imdb : voteTitleConfig.mt;
}
}
}());

View File

@@ -160,7 +160,7 @@
<div class="media">
<div class="media-left">
<img class="media-object" ng-class="{'music': vm.selectedType=='music'}" music-disk="{{vm.selectedType=='music'}}"
ng-src="{{vm.getTorrentListImage(item)}}"
ng-src="{{vm.TGI.getTorrentListImage(item)}}"
alt="...">
<div class="layer-download" ng-class="{'music': vm.selectedType=='music'}">
@@ -172,8 +172,8 @@
</div>
</div>
<div class="media-body">
<h5 class="media-heading">{{vm.getTorrentTitle(item)}}
<span ng-show="vm.getTorrentOriginalTitle(item)"> / {{vm.getTorrentOriginalTitle(item)}}</span>
<h5 class="media-heading">{{vm.TGI.getTorrentTitle(item)}}
<span ng-show="vm.TGI.getTorrentOriginalTitle(item)"> / {{vm.TGI.getTorrentOriginalTitle(item)}}</span>
<span class="upload-by" ng-show="item.user.displayName"> (By:
<span user-info="item.user" info-name></span> )</span>
</h5>
@@ -223,7 +223,7 @@
</td>
<td class="col-md-1 td-v-middle td-imdb">
<span title="{{ 'TITLE_ALT.IMDB_VOTES' | translate}}"
class="torrent-votes"><kbd>{{vm.getVoteTitle(item)}}</kbd> {{item.resource_detail_info.vote_average | number : 1}}</span>
class="torrent-votes"><kbd>{{vm.TGI.getVoteTitle(item)}}</kbd> {{item.resource_detail_info.vote_average | number : 1}}</span>
</td>
<td class="col-md-1 td-v-middle text-center td-life">{{item.createdat | life}}</td>
<td class="col-md-1 td-v-middle text-center td-size">{{item.torrent_size | bytes:2}}</td>

View File

@@ -7,8 +7,8 @@
<div class="col-xs-6 col-sm-4 col-md-2 col-small-padding">
<div class="thumbnail torrent-post-info" ng-click="vm.openTorrentInfo(item._id);">
<img class="img-responsive" ng-class="{'music': item.torrent_type=='music'}" music-disk="{{item.torrent_type=='music'}}"
ng-src="{{vm.getTorrentListTopImage(item)}}"
alt="{{vm.getTorrentTitle(item)}}">
ng-src="{{vm.TGI.getTorrentListTopImage(item)}}"
alt="{{vm.TGI.getTorrentTitle(item)}}">
<div class="torrent-user-info">
<table>
@@ -34,7 +34,7 @@
<li>
<span class="release-date">{{item.resource_detail_info.release_date}}</span>
<span title="{{ 'TITLE_ALT.IMDB_VOTES' | translate}}"
class="pull-right torrent-votes"><kbd>{{vm.getVoteTitle(item)}}</kbd> {{item.resource_detail_info.vote_average}}</span>
class="pull-right torrent-votes"><kbd>{{vm.TGI.getVoteTitle(item)}}</kbd> {{item.resource_detail_info.vote_average}}</span>
</li>
</ul>
</div>
@@ -42,7 +42,7 @@
<div class="caption">
<ul class="list-unstyled">
<li class="text-long">
<strong>{{vm.getTorrentTitle(item)}}</strong>
<strong>{{vm.TGI.getTorrentTitle(item)}}</strong>
</li>
</ul>
</div>
@@ -155,7 +155,7 @@
<div class="media">
<div class="media-left">
<img class="media-object" ng-class="{'music': item.torrent_type=='music'}" music-disk="{{item.torrent_type=='music'}}"
ng-src="{{vm.getTorrentListImage(item)}}"
ng-src="{{vm.TGI.getTorrentListImage(item)}}"
alt="...">
<div class="layer-download" ng-class="{'music': item.torrent_type=='music'}">
@@ -167,8 +167,8 @@
</div>
</div>
<div class="media-body">
<h5 class="media-heading">{{vm.getTorrentTitle(item)}}
<span ng-show="vm.getTorrentOriginalTitle(item)"> / {{vm.getTorrentOriginalTitle(item)}}</span>
<h5 class="media-heading">{{vm.TGI.getTorrentTitle(item)}}
<span ng-show="vm.TGI.getTorrentOriginalTitle(item)"> / {{vm.TGI.getTorrentOriginalTitle(item)}}</span>
<span class="upload-by" ng-show="item.user.displayName"></span>
</h5>
@@ -212,7 +212,7 @@
</td>
<td class="col-md-1 td-v-middle td-imdb">
<span title="{{ 'TITLE_ALT.IMDB_VOTES' | translate}}"
class="torrent-votes"><kbd>{{vm.getVoteTitle(item)}}</kbd> {{item.resource_detail_info.vote_average | number : 1}}</span>
class="torrent-votes"><kbd>{{vm.TGI.getVoteTitle(item)}}</kbd> {{item.resource_detail_info.vote_average | number : 1}}</span>
</td>
<td class="col-md-1 td-v-middle text-center td-life">{{item.createdat | life}}</td>
<td class="col-md-1 td-v-middle text-center td-size">{{item.torrent_size | bytes:2}}</td>

View File

@@ -7,19 +7,18 @@
UserController.$inject = ['$scope', '$state', '$window', 'Authentication', 'userResolve', 'Notification', 'NotifycationService', 'MeanTorrentConfig',
'AdminService', 'ScoreLevelService', 'PeersService', 'DownloadService', '$translate', 'TorrentsService', 'ModalConfirmService', 'CompleteService',
'DebugConsoleService'];
'DebugConsoleService', 'TorrentGetInfoServices'];
function UserController($scope, $state, $window, Authentication, user, Notification, NotifycationService, MeanTorrentConfig, AdminService,
ScoreLevelService, PeersService, DownloadService, $translate, TorrentsService, ModalConfirmService, CompleteService,
mtDebug) {
mtDebug, TGI) {
var vm = this;
vm.TGI = TGI;
vm.authentication = Authentication;
vm.user = user;
vm.selectedRole = vm.user.roles[0];
vm.userRolesConfig = MeanTorrentConfig.meanTorrentConfig.userRoles;
vm.resourcesTags = MeanTorrentConfig.meanTorrentConfig.resourcesTags;
vm.tmdbConfig = MeanTorrentConfig.meanTorrentConfig.tmdbConfig;
vm.hnrConfig = MeanTorrentConfig.meanTorrentConfig.hitAndRun;
vm.announce = MeanTorrentConfig.meanTorrentConfig.announce;
vm.remove = remove;
@@ -27,7 +26,6 @@
vm.messageTo = messageTo;
vm.isContextUserSelf = isContextUserSelf;
vm.scoreLevelData = ScoreLevelService.getScoreLevelJson(vm.user.score);
vm.voteTitleConfig = MeanTorrentConfig.meanTorrentConfig.voteTitle;
vm.searchTags = [];
@@ -423,79 +421,5 @@
});
};
/**
* getTorrentListImage
* @param item
* @returns {string}
*/
vm.getTorrentListImage = function (item) {
var result = null;
switch (item.torrent_type) {
case 'movie':
case 'tvserial':
result = vm.tmdbConfig.posterListBaseUrl + item.resource_detail_info.poster_path;
break;
case 'music':
result = '/modules/torrents/client/uploads/cover/' + item.resource_detail_info.cover;
break;
}
return result;
};
/**
* getTorrentTitle
* @param item
* @returns {string}
*/
vm.getTorrentTitle = function (item) {
var result = null;
switch (item.torrent_type) {
case 'movie':
result = item.resource_detail_info.original_title;
break;
case 'tvserial':
result = item.resource_detail_info.original_name;
break;
case 'music':
result = item.resource_detail_info.title;
break;
}
return result;
};
/**
* getTorrentOriginalTitle
* @param item
* @returns {string}
*/
vm.getTorrentOriginalTitle = function (item) {
var result = null;
switch (item.torrent_type) {
case 'movie':
if (item.resource_detail_info.original_title !== item.resource_detail_info.title) {
result = item.resource_detail_info.title;
}
break;
case 'tvserial':
if (item.resource_detail_info.original_name !== item.resource_detail_info.name) {
result = item.resource_detail_info.name;
}
break;
}
return result;
};
/**
* getVoteTitle
* @param item
* @returns {string}
*/
vm.getVoteTitle = function (item) {
return item.resource_detail_info.vote_average ? vm.voteTitleConfig.imdb : vm.voteTitleConfig.mt;
};
}
}());

View File

@@ -6,16 +6,16 @@
.controller('DownloadingController', DownloadingController);
DownloadingController.$inject = ['$scope', '$state', '$translate', '$timeout', 'Authentication', 'Notification', 'PeersService',
'MeanTorrentConfig', '$window', '$filter', 'DownloadService', 'DebugConsoleService'];
'MeanTorrentConfig', '$window', '$filter', 'DownloadService', 'DebugConsoleService', 'TorrentGetInfoServices'];
function DownloadingController($scope, $state, $translate, $timeout, Authentication, Notification, PeersService, MeanTorrentConfig,
$window, $filter, DownloadService, mtDebug) {
$window, $filter, DownloadService, mtDebug, TGI) {
var vm = this;
vm.TGI = TGI;
vm.user = Authentication.user;
vm.tmdbConfig = MeanTorrentConfig.meanTorrentConfig.tmdbConfig;
vm.resourcesTags = MeanTorrentConfig.meanTorrentConfig.resourcesTags;
vm.torrentSalesType = MeanTorrentConfig.meanTorrentConfig.torrentSalesType;
vm.voteTitleConfig = MeanTorrentConfig.meanTorrentConfig.voteTitle;
vm.searchTags = [];
@@ -147,79 +147,5 @@
var url = $state.href('torrents.view', {torrentId: id});
$window.open(url, '_blank');
};
/**
* getTorrentListImage
* @param item
* @returns {string}
*/
vm.getTorrentListImage = function (item) {
var result = null;
switch (item.torrent_type) {
case 'movie':
case 'tvserial':
result = vm.tmdbConfig.posterListBaseUrl + item.resource_detail_info.poster_path;
break;
case 'music':
result = '/modules/torrents/client/uploads/cover/' + item.resource_detail_info.cover;
break;
}
return result;
};
/**
* getTorrentTitle
* @param item
* @returns {string}
*/
vm.getTorrentTitle = function (item) {
var result = null;
switch (item.torrent_type) {
case 'movie':
result = item.resource_detail_info.original_title;
break;
case 'tvserial':
result = item.resource_detail_info.original_name;
break;
case 'music':
result = item.resource_detail_info.title;
break;
}
return result;
};
/**
* getTorrentOriginalTitle
* @param item
* @returns {string}
*/
vm.getTorrentOriginalTitle = function (item) {
var result = null;
switch (item.torrent_type) {
case 'movie':
if (item.resource_detail_info.original_title !== item.resource_detail_info.title) {
result = item.resource_detail_info.title;
}
break;
case 'tvserial':
if (item.resource_detail_info.original_name !== item.resource_detail_info.name) {
result = item.resource_detail_info.name;
}
break;
}
return result;
};
/**
* getVoteTitle
* @param item
* @returns {string}
*/
vm.getVoteTitle = function (item) {
return item.resource_detail_info.vote_average ? vm.voteTitleConfig.imdb : vm.voteTitleConfig.mt;
};
}
}());

View File

@@ -6,16 +6,15 @@
.controller('SeedingController', SeedingController);
SeedingController.$inject = ['$scope', '$state', '$translate', '$timeout', 'Authentication', 'Notification', 'PeersService',
'MeanTorrentConfig', '$window', '$filter', 'DownloadService', 'DebugConsoleService'];
'MeanTorrentConfig', '$window', '$filter', 'DownloadService', 'DebugConsoleService', 'TorrentGetInfoServices'];
function SeedingController($scope, $state, $translate, $timeout, Authentication, Notification, PeersService, MeanTorrentConfig,
$window, $filter, DownloadService, mtDebug) {
$window, $filter, DownloadService, mtDebug, TGI) {
var vm = this;
vm.TGI = TGI;
vm.user = Authentication.user;
vm.tmdbConfig = MeanTorrentConfig.meanTorrentConfig.tmdbConfig;
vm.resourcesTags = MeanTorrentConfig.meanTorrentConfig.resourcesTags;
vm.torrentSalesType = MeanTorrentConfig.meanTorrentConfig.torrentSalesType;
vm.voteTitleConfig = MeanTorrentConfig.meanTorrentConfig.voteTitle;
vm.searchTags = [];
@@ -147,79 +146,5 @@
var url = $state.href('torrents.view', {torrentId: id});
$window.open(url, '_blank');
};
/**
* getTorrentListImage
* @param item
* @returns {string}
*/
vm.getTorrentListImage = function (item) {
var result = null;
switch (item.torrent_type) {
case 'movie':
case 'tvserial':
result = vm.tmdbConfig.posterListBaseUrl + item.resource_detail_info.poster_path;
break;
case 'music':
result = '/modules/torrents/client/uploads/cover/' + item.resource_detail_info.cover;
break;
}
return result;
};
/**
* getTorrentTitle
* @param item
* @returns {string}
*/
vm.getTorrentTitle = function (item) {
var result = null;
switch (item.torrent_type) {
case 'movie':
result = item.resource_detail_info.original_title;
break;
case 'tvserial':
result = item.resource_detail_info.original_name;
break;
case 'music':
result = item.resource_detail_info.title;
break;
}
return result;
};
/**
* getTorrentOriginalTitle
* @param item
* @returns {string}
*/
vm.getTorrentOriginalTitle = function (item) {
var result = null;
switch (item.torrent_type) {
case 'movie':
if (item.resource_detail_info.original_title !== item.resource_detail_info.title) {
result = item.resource_detail_info.title;
}
break;
case 'tvserial':
if (item.resource_detail_info.original_name !== item.resource_detail_info.name) {
result = item.resource_detail_info.name;
}
break;
}
return result;
};
/**
* getVoteTitle
* @param item
* @returns {string}
*/
vm.getVoteTitle = function (item) {
return item.resource_detail_info.vote_average ? vm.voteTitleConfig.imdb : vm.voteTitleConfig.mt;
};
}
}());

View File

@@ -6,16 +6,15 @@
.controller('UploadedController', UploadedController);
UploadedController.$inject = ['$scope', '$state', '$translate', '$timeout', 'Authentication', 'Notification', 'TorrentsService',
'MeanTorrentConfig', '$window', '$filter', 'DownloadService', 'DebugConsoleService'];
'MeanTorrentConfig', '$window', '$filter', 'DownloadService', 'DebugConsoleService', 'TorrentGetInfoServices'];
function UploadedController($scope, $state, $translate, $timeout, Authentication, Notification, TorrentsService, MeanTorrentConfig,
$window, $filter, DownloadService, mtDebug) {
$window, $filter, DownloadService, mtDebug, TGI) {
var vm = this;
vm.TGI = TGI;
vm.user = Authentication.user;
vm.tmdbConfig = MeanTorrentConfig.meanTorrentConfig.tmdbConfig;
vm.resourcesTags = MeanTorrentConfig.meanTorrentConfig.resourcesTags;
vm.torrentSalesType = MeanTorrentConfig.meanTorrentConfig.torrentSalesType;
vm.voteTitleConfig = MeanTorrentConfig.meanTorrentConfig.voteTitle;
vm.searchTags = [];
@@ -147,79 +146,5 @@
var url = $state.href('torrents.view', {torrentId: id});
$window.open(url, '_blank');
};
/**
* getTorrentListImage
* @param item
* @returns {string}
*/
vm.getTorrentListImage = function (item) {
var result = null;
switch (item.torrent_type) {
case 'movie':
case 'tvserial':
result = vm.tmdbConfig.posterListBaseUrl + item.resource_detail_info.poster_path;
break;
case 'music':
result = '/modules/torrents/client/uploads/cover/' + item.resource_detail_info.cover;
break;
}
return result;
};
/**
* getTorrentTitle
* @param item
* @returns {string}
*/
vm.getTorrentTitle = function (item) {
var result = null;
switch (item.torrent_type) {
case 'movie':
result = item.resource_detail_info.original_title;
break;
case 'tvserial':
result = item.resource_detail_info.original_name;
break;
case 'music':
result = item.resource_detail_info.title;
break;
}
return result;
};
/**
* getTorrentOriginalTitle
* @param item
* @returns {string}
*/
vm.getTorrentOriginalTitle = function (item) {
var result = null;
switch (item.torrent_type) {
case 'movie':
if (item.resource_detail_info.original_title !== item.resource_detail_info.title) {
result = item.resource_detail_info.title;
}
break;
case 'tvserial':
if (item.resource_detail_info.original_name !== item.resource_detail_info.name) {
result = item.resource_detail_info.name;
}
break;
}
return result;
};
/**
* getVoteTitle
* @param item
* @returns {string}
*/
vm.getVoteTitle = function (item) {
return item.resource_detail_info.vote_average ? vm.voteTitleConfig.imdb : vm.voteTitleConfig.mt;
};
}
}());

View File

@@ -6,18 +6,19 @@
.controller('WarningController', WarningController);
WarningController.$inject = ['$rootScope', '$state', '$translate', '$timeout', 'Authentication', 'Notification', 'PeersService', 'CompleteService',
'MeanTorrentConfig', '$window', '$filter', 'DownloadService', 'NotifycationService', 'ModalConfirmService', 'getStorageLangService', 'DebugConsoleService'];
'MeanTorrentConfig', '$window', '$filter', 'DownloadService', 'NotifycationService', 'ModalConfirmService', 'getStorageLangService', 'DebugConsoleService',
'TorrentGetInfoServices'];
function WarningController($rootScope, $state, $translate, $timeout, Authentication, Notification, PeersService, CompleteService, MeanTorrentConfig,
$window, $filter, DownloadService, NotifycationService, ModalConfirmService, getStorageLangService, mtDebug) {
$window, $filter, DownloadService, NotifycationService, ModalConfirmService, getStorageLangService, mtDebug,
TGI) {
var vm = this;
vm.TGI = TGI;
vm.user = Authentication.user;
vm.tmdbConfig = MeanTorrentConfig.meanTorrentConfig.tmdbConfig;
vm.resourcesTags = MeanTorrentConfig.meanTorrentConfig.resourcesTags;
vm.torrentSalesType = MeanTorrentConfig.meanTorrentConfig.torrentSalesType;
vm.hnrConfig = MeanTorrentConfig.meanTorrentConfig.hitAndRun;
vm.lang = getStorageLangService.getLang();
vm.voteTitleConfig = MeanTorrentConfig.meanTorrentConfig.voteTitle;
vm.searchTags = [];
@@ -145,79 +146,5 @@
});
};
/**
* getTorrentListImage
* @param item
* @returns {string}
*/
vm.getTorrentListImage = function (item) {
var result = null;
switch (item.torrent_type) {
case 'movie':
case 'tvserial':
result = vm.tmdbConfig.posterListBaseUrl + item.resource_detail_info.poster_path;
break;
case 'music':
result = '/modules/torrents/client/uploads/cover/' + item.resource_detail_info.cover;
break;
}
return result;
};
/**
* getTorrentTitle
* @param item
* @returns {string}
*/
vm.getTorrentTitle = function (item) {
var result = null;
switch (item.torrent_type) {
case 'movie':
result = item.resource_detail_info.original_title;
break;
case 'tvserial':
result = item.resource_detail_info.original_name;
break;
case 'music':
result = item.resource_detail_info.title;
break;
}
return result;
};
/**
* getTorrentOriginalTitle
* @param item
* @returns {string}
*/
vm.getTorrentOriginalTitle = function (item) {
var result = null;
switch (item.torrent_type) {
case 'movie':
if (item.resource_detail_info.original_title !== item.resource_detail_info.title) {
result = item.resource_detail_info.title;
}
break;
case 'tvserial':
if (item.resource_detail_info.original_name !== item.resource_detail_info.name) {
result = item.resource_detail_info.name;
}
break;
}
return result;
};
/**
* getVoteTitle
* @param item
* @returns {string}
*/
vm.getVoteTitle = function (item) {
return item.resource_detail_info.vote_average ? vm.voteTitleConfig.imdb : vm.voteTitleConfig.mt;
};
}
}());

View File

@@ -35,7 +35,7 @@
<div class="media">
<div class="media-left">
<img class="media-object" ng-class="{'music': item.torrent.torrent_type=='music'}" music-disk="{{item.torrent.torrent_type=='music'}}"
ng-src="{{vm.getTorrentListImage(item.torrent)}}"
ng-src="{{vm.TGI.getTorrentListImage(item.torrent)}}"
alt="...">
<div class="layer-download" ng-class="{'music': item.torrent.torrent_type=='music'}">
@@ -47,8 +47,8 @@
</div>
</div>
<div class="media-body">
<h5 class="media-heading">{{vm.getTorrentTitle(item.torrent)}}
<span ng-show="vm.getTorrentOriginalTitle(item.torrent)"> / {{vm.getTorrentOriginalTitle(item.torrent)}}</span>
<h5 class="media-heading">{{vm.TGI.getTorrentTitle(item.torrent)}}
<span ng-show="vm.TGI.getTorrentOriginalTitle(item.torrent)"> / {{vm.TGI.getTorrentOriginalTitle(item.torrent)}}</span>
<span class="upload-by" ng-show="item.torrent.user.displayName"> (By:
<span user-info="item.torrent.user" info-name></span> )</span>
</h5>
@@ -105,7 +105,7 @@
</td>
<td class="col-md-1 td-v-middle td-imdb">
<span title="{{ 'TITLE_ALT.IMDB_VOTES' | translate}}"
class="torrent-votes"><kbd>{{vm.getVoteTitle(item.torrent)}}</kbd> {{item.torrent.resource_detail_info.vote_average | number : 1}}</span>
class="torrent-votes"><kbd>{{vm.TGI.getVoteTitle(item.torrent)}}</kbd> {{item.torrent.resource_detail_info.vote_average | number : 1}}</span>
</td>
<td class="col-md-1 td-v-middle text-center td-life">{{item.torrent.createdat | life}}</td>
<td class="col-md-1 td-v-middle text-center td-size">{{item.torrent.torrent_size | bytes:2}}</td>

View File

@@ -34,7 +34,7 @@
<div class="media">
<div class="media-left">
<img class="media-object" ng-class="{'music': item.torrent.torrent_type=='music'}" music-disk="{{item.torrent.torrent_type=='music'}}"
ng-src="{{vm.getTorrentListImage(item.torrent)}}"
ng-src="{{vm.TGI.getTorrentListImage(item.torrent)}}"
alt="...">
<div class="layer-download" ng-class="{'music': item.torrent.torrent_type=='music'}">
@@ -46,8 +46,8 @@
</div>
</div>
<div class="media-body">
<h5 class="media-heading">{{vm.getTorrentTitle(item.torrent)}}
<span ng-show="vm.getTorrentOriginalTitle(item.torrent)"> / {{vm.getTorrentOriginalTitle(item.torrent)}}</span>
<h5 class="media-heading">{{vm.TGI.getTorrentTitle(item.torrent)}}
<span ng-show="vm.TGI.getTorrentOriginalTitle(item.torrent)"> / {{vm.TGI.getTorrentOriginalTitle(item.torrent)}}</span>
<span class="upload-by" ng-show="item.torrent.user.displayName"> (By:
<span user-info="item.torrent.user" info-name></span> )</span>
</h5>
@@ -104,7 +104,7 @@
</td>
<td class="col-md-1 td-v-middle td-imdb">
<span title="{{ 'TITLE_ALT.IMDB_VOTES' | translate}}"
class="torrent-votes"><kbd>{{vm.getVoteTitle(item.torrent)}}</kbd> {{item.torrent.resource_detail_info.vote_average | number : 1}}</span>
class="torrent-votes"><kbd>{{vm.TGI.getVoteTitle(item.torrent)}}</kbd> {{item.torrent.resource_detail_info.vote_average | number : 1}}</span>
</td>
<td class="col-md-1 td-v-middle text-center td-life">{{item.torrent.createdat | life}}</td>
<td class="col-md-1 td-v-middle text-center td-size">{{item.torrent.torrent_size | bytes:2}}</td>

View File

@@ -30,7 +30,7 @@
<div class="media">
<div class="media-left">
<img class="media-object" ng-class="{'music': item.torrent_type=='music'}" music-disk="{{item.torrent_type=='music'}}"
ng-src="{{vm.getTorrentListImage(item)}}"
ng-src="{{vm.TGI.getTorrentListImage(item)}}"
alt="...">
<div class="layer-download" ng-class="{'music': item.torrent_type=='music'}">
@@ -42,8 +42,8 @@
</div>
</div>
<div class="media-body">
<h5 class="media-heading">{{vm.getTorrentTitle(item)}}
<span ng-show="vm.getTorrentOriginalTitle(item)"> / {{vm.getTorrentOriginalTitle(item)}}</span>
<h5 class="media-heading">{{vm.TGI.getTorrentTitle(item)}}
<span ng-show="vm.TGI.getTorrentOriginalTitle(item)"> / {{vm.TGI.getTorrentOriginalTitle(item)}}</span>
<span class="upload-by" ng-show="item.user.displayName"> (By:
<span user-info="item.user" info-name></span> )</span>
</h5>
@@ -100,7 +100,7 @@
</td>
<td class="col-md-1 td-v-middle td-imdb">
<span title="{{ 'TITLE_ALT.IMDB_VOTES' | translate}}"
class="torrent-votes"><kbd>{{vm.getVoteTitle(item)}}</kbd> {{item.resource_detail_info.vote_average | number : 1}}</span>
class="torrent-votes"><kbd>{{vm.TGI.getVoteTitle(item)}}</kbd> {{item.resource_detail_info.vote_average | number : 1}}</span>
</td>
<td class="col-md-1 td-v-middle text-center td-life">{{item.createdat | life}}</td>
<td class="col-md-1 td-v-middle text-center td-size">{{item.torrent_size | bytes:2}}</td>

View File

@@ -32,7 +32,7 @@
<div class="media">
<div class="media-left">
<img class="media-object" ng-class="{'music': item.torrent.torrent_type=='music'}" music-disk="{{item.torrent.torrent_type=='music'}}"
ng-src="{{vm.getTorrentListImage(item.torrent)}}"
ng-src="{{vm.TGI.getTorrentListImage(item.torrent)}}"
alt="...">
<div class="layer-download" ng-class="{'music': item.torrent.torrent_type=='music'}">
@@ -44,8 +44,8 @@
</div>
</div>
<div class="media-body">
<h5 class="media-heading">{{vm.getTorrentTitle(item.torrent)}}
<span ng-show="vm.getTorrentOriginalTitle(item.torrent)"> / {{vm.getTorrentOriginalTitle(item.torrent)}}</span>
<h5 class="media-heading">{{vm.TGI.getTorrentTitle(item.torrent)}}
<span ng-show="vm.TGI.getTorrentOriginalTitle(item.torrent)"> / {{vm.TGI.getTorrentOriginalTitle(item.torrent)}}</span>
<span class="upload-by" ng-show="item.torrent.user.displayName"> (By:
<span user-info="item.torrent.user" info-name></span> )</span>
</h5>
@@ -102,7 +102,7 @@
</td>
<td class="col-md-1 td-v-middle td-imdb">
<span title="{{ 'TITLE_ALT.IMDB_VOTES' | translate}}"
class="torrent-votes"><kbd>{{vm.getVoteTitle(item.torrent)}}</kbd> {{item.torrent.resource_detail_info.vote_average | number : 1}}</span>
class="torrent-votes"><kbd>{{vm.TGI.getVoteTitle(item.torrent)}}</kbd> {{item.torrent.resource_detail_info.vote_average | number : 1}}</span>
</td>
<td class="col-md-1 td-v-middle text-center td-life">{{item.torrent.createdat | life}}</td>
<td class="col-md-1 td-v-middle text-center td-size">{{item.torrent.torrent_size | bytes:2}}</td>

View File

@@ -50,7 +50,7 @@
<div class="media">
<div class="media-left">
<img class="media-object" ng-class="{'music': item.torrent.torrent_type=='music'}" music-disk="{{item.torrent.torrent_type=='music'}}"
ng-src="{{vm.getTorrentListImage(item.torrent)}}"
ng-src="{{vm.TGI.getTorrentListImage(item.torrent)}}"
alt="...">
<div class="layer-download" ng-class="{'music': item.torrent.torrent_type=='music'}">
@@ -62,8 +62,8 @@
</div>
</div>
<div class="media-body">
<h5 class="media-heading">{{vm.getTorrentTitle(item.torrent)}}
<span ng-show="vm.getTorrentOriginalTitle(item.torrent)"> / {{vm.getTorrentOriginalTitle(item.torrent)}}</span>
<h5 class="media-heading">{{vm.TGI.getTorrentTitle(item.torrent)}}
<span ng-show="vm.TGI.getTorrentOriginalTitle(item.torrent)"> / {{vm.TGI.getTorrentOriginalTitle(item.torrent)}}</span>
<span class="upload-by" ng-show="item.torrent.user.displayName"> (By:
<span user-info="item.torrent.user" info-name></span> )</span>
</h5>
@@ -120,7 +120,7 @@
</td>
<td class="col-md-1 td-v-middle td-imdb">
<span title="{{ 'TITLE_ALT.IMDB_VOTES' | translate}}"
class="torrent-votes"><kbd>{{vm.getVoteTitle(item.torrent)}}</kbd> {{item.torrent.resource_detail_info.vote_average | number : 1}}</span>
class="torrent-votes"><kbd>{{vm.TGI.getVoteTitle(item.torrent)}}</kbd> {{item.torrent.resource_detail_info.vote_average | number : 1}}</span>
</td>
<td class="col-md-1 td-v-middle text-center td-life">{{item.torrent.createdat | life}}</td>
<td class="col-md-1 td-v-middle text-center td-size">{{item.torrent.torrent_size | bytes:2}}</td>

View File

@@ -50,7 +50,7 @@
<div class="media">
<div class="media-left">
<img class="media-object" ng-class="{'music': item.torrent.torrent_type=='music'}" music-disk="{{item.torrent.torrent_type=='music'}}"
ng-src="{{vm.getTorrentListImage(item.torrent)}}"
ng-src="{{vm.TGI.getTorrentListImage(item.torrent)}}"
alt="...">
<div class="layer-download" ng-class="{'music': item.torrent.torrent_type=='music'}">
@@ -62,8 +62,8 @@
</div>
</div>
<div class="media-body">
<h5 class="media-heading">{{vm.getTorrentTitle(item.torrent)}}
<span ng-show="vm.getTorrentOriginalTitle(item.torrent)"> / {{vm.getTorrentOriginalTitle(item.torrent)}}</span>
<h5 class="media-heading">{{vm.TGI.getTorrentTitle(item.torrent)}}
<span ng-show="vm.TGI.getTorrentOriginalTitle(item.torrent)"> / {{vm.TGI.getTorrentOriginalTitle(item.torrent)}}</span>
<span class="upload-by" ng-show="item.torrent.user.displayName"> (By:
<span user-info="item.torrent.user" info-name></span> )</span>
</h5>
@@ -120,7 +120,7 @@
</td>
<td class="col-md-1 td-v-middle td-imdb">
<span title="{{ 'TITLE_ALT.IMDB_VOTES' | translate}}"
class="torrent-votes"><kbd>{{vm.getVoteTitle(item.torrent)}}</kbd> {{item.torrent.resource_detail_info.vote_average | number : 1}}</span>
class="torrent-votes"><kbd>{{vm.TGI.getVoteTitle(item.torrent)}}</kbd> {{item.torrent.resource_detail_info.vote_average | number : 1}}</span>
</td>
<td class="col-md-1 td-v-middle text-center td-life">{{item.torrent.createdat | life}}</td>
<td class="col-md-1 td-v-middle text-center td-size">{{item.torrent.torrent_size | bytes:2}}</td>

View File

@@ -47,7 +47,7 @@
<div class="media">
<div class="media-left">
<img class="media-object" ng-class="{'music': item.torrent_type=='music'}" music-disk="{{item.torrent_type=='music'}}"
ng-src="{{vm.getTorrentListImage(item)}}"
ng-src="{{vm.TGI.getTorrentListImage(item)}}"
alt="...">
<div class="layer-download" ng-class="{'music': item.torrent_type=='music'}">
@@ -59,8 +59,8 @@
</div>
</div>
<div class="media-body">
<h5 class="media-heading">{{vm.getTorrentTitle(item)}}
<span ng-show="vm.getTorrentOriginalTitle(item)"> / {{vm.getTorrentOriginalTitle(item)}}</span>
<h5 class="media-heading">{{vm.TGI.getTorrentTitle(item)}}
<span ng-show="vm.TGI.getTorrentOriginalTitle(item)"> / {{vm.TGI.getTorrentOriginalTitle(item)}}</span>
<span class="upload-by" ng-show="item.user.displayName"> (By:
<span user-info="item.user" info-name></span> )</span>
</h5>
@@ -117,7 +117,7 @@
</td>
<td class="col-md-1 td-v-middle td-imdb">
<span title="{{ 'TITLE_ALT.IMDB_VOTES' | translate}}"
class="torrent-votes"><kbd>{{vm.getVoteTitle(item)}}</kbd> {{item.resource_detail_info.vote_average | number : 1}}</span>
class="torrent-votes"><kbd>{{vm.TGI.getVoteTitle(item)}}</kbd> {{item.resource_detail_info.vote_average | number : 1}}</span>
</td>
<td class="col-md-1 td-v-middle text-center td-life">{{item.createdat | life}}</td>
<td class="col-md-1 td-v-middle text-center td-size">{{item.torrent_size | bytes:2}}</td>

View File

@@ -42,7 +42,7 @@
<div class="media">
<div class="media-left">
<img class="media-object" ng-class="{'music': item.torrent.torrent_type=='music'}" music-disk="{{item.torrent.torrent_type=='music'}}"
ng-src="{{vm.getTorrentListImage(item.torrent)}}"
ng-src="{{vm.TGI.getTorrentListImage(item.torrent)}}"
alt="...">
<div class="layer-download" ng-class="{'music': item.torrent.torrent_type=='music'}">
@@ -54,8 +54,8 @@
</div>
</div>
<div class="media-body">
<h5 class="media-heading">{{vm.getTorrentTitle(item.torrent)}}
<span ng-show="vm.getTorrentOriginalTitle(item.torrent)"> / {{vm.getTorrentOriginalTitle(item.torrent)}}</span>
<h5 class="media-heading">{{vm.TGI.getTorrentTitle(item.torrent)}}
<span ng-show="vm.TGI.getTorrentOriginalTitle(item.torrent)"> / {{vm.TGI.getTorrentOriginalTitle(item.torrent)}}</span>
<span class="upload-by" ng-show="item.torrent.user.displayName"> (By:
<span user-info="item.torrent.user" info-name></span> )</span>
</h5>
@@ -112,7 +112,7 @@
</td>
<td class="col-md-1 td-v-middle td-imdb">
<span title="{{ 'TITLE_ALT.IMDB_VOTES' | translate}}"
class="torrent-votes"><kbd>{{vm.getVoteTitle(item.torrent)}}</kbd> {{item.torrent.resource_detail_info.vote_average | number : 1}}</span>
class="torrent-votes"><kbd>{{vm.TGI.getVoteTitle(item.torrent)}}</kbd> {{item.torrent.resource_detail_info.vote_average | number : 1}}</span>
</td>
<td class="col-md-1 td-v-middle text-center td-life">{{item.torrent.createdat | life}}</td>
<td class="col-md-1 td-v-middle text-center td-size">{{item.torrent.torrent_size | bytes:2}}</td>