feat(torrents): list music torrents

This commit is contained in:
OldHawk
2017-09-29 17:55:50 +08:00
parent 8b254310fc
commit 4ba82dffde
9 changed files with 138 additions and 274 deletions

View File

@@ -243,7 +243,6 @@ module.exports = {
* @position: position of submenu item(ordered index)
* @state: angular state of torrent type, this state value used in module route config
* @url: window location url of type
* @viewTemplateUrl: view templateUrl value of state
* @pageTitle: the page title string, used by translate
* @uploadTemplateID: view templateID in upload torrent page, when selected type is changed, then include the template by this id,
* all the template html is in file: modules/torrents/client/views/uploads-torrents.client.view.html
@@ -265,7 +264,6 @@ module.exports = {
position: 1,
state: 'torrents.movie',
url: '/movie',
viewTemplateUrl: '/modules/torrents/client/views/list-movie.client.view.html',
pageTitle: 'MOVIE_LIST',
uploadTemplateID: 'movie'
},
@@ -278,7 +276,6 @@ module.exports = {
position: 2,
state: 'torrents.tvserial',
url: '/tv',
viewTemplateUrl: '/modules/torrents/client/views/list-tv.client.view.html',
pageTitle: 'TV_LIST',
uploadTemplateID: 'tvserial'
},
@@ -291,7 +288,6 @@ module.exports = {
position: 3,
state: 'torrents.music',
url: '/music',
viewTemplateUrl: '/modules/torrents/client/views/list-music.client.view.html',
pageTitle: 'MUSIC_LIST',
uploadTemplateID: 'music'
},
@@ -304,7 +300,6 @@ module.exports = {
position: 4,
state: 'torrents.variety',
url: '/variety',
viewTemplateUrl: '/modules/torrents/client/views/list-variety.client.view.html',
pageTitle: 'VARIETY_LIST',
uploadTemplateID: 'variety'
},
@@ -317,7 +312,6 @@ module.exports = {
position: 4,
state: 'torrents.software',
url: '/software',
viewTemplateUrl: '/modules/torrents/client/views/list-software.client.view.html',
pageTitle: 'SOFTWARE_LIST',
uploadTemplateID: 'default'
},
@@ -330,7 +324,6 @@ module.exports = {
position: 4,
state: 'torrents.ebook',
url: '/ebook',
viewTemplateUrl: '/modules/torrents/client/views/list-ebook.client.view.html',
pageTitle: 'EBOOK_LIST',
uploadTemplateID: 'default'
},
@@ -343,7 +336,6 @@ module.exports = {
position: 5,
state: 'torrents.other',
url: '/other',
viewTemplateUrl: '/modules/torrents/client/views/list-other.client.view.html',
pageTitle: 'OTHER_LIST',
uploadTemplateID: 'default'
}

View File

@@ -23,6 +23,7 @@
cir1.css('border', 'solid 2px #515151');
cir1.css('background-color', '#ddd');
cir1.css('padding', '1px');
cir1.attr('title', attrs.alt);
var cir2 = angular.element('<div></div>');
cir2.css('border-radius', '50%');
@@ -30,7 +31,7 @@
cir2.css('background-size', '100% 100%');
cir2.css('height', '100%');
cir2.css('width', '100%');
cir2.css('padding', '22px');
cir2.css('padding', '36%');
var cir3 = angular.element('<div></div>');
cir3.css('border-radius', '50%');

View File

@@ -154,6 +154,27 @@ body {
margin-bottom: 0;
}
}
.music {
margin: 35px 0;
overflow: hidden;
opacity: 0.8;
&:hover {
opacity: 1;
}
&::before {
content: ' ';
padding-top: 100%; /* vertical value as 100% equals width */
float: left;
}
div {
overflow: hidden;
&::before {
content: ' ';
padding-top: 100%; /* vertical value as 100% equals width */
float: left;
}
}
}
}
.torrent-votes {

View File

@@ -34,7 +34,7 @@
$stateProvider
.state(cfg.state, {
url: cfg.url,
templateUrl: cfg.viewTemplateUrl,
templateUrl: '/modules/torrents/client/views/list-torrents.client.view.html',
data: {
pageTitle: 'PAGETITLE.' + cfg.pageTitle,
torrentType: cfg.value

View File

@@ -503,7 +503,7 @@
vm.getTorrentListImage = function (item) {
var result = null;
switch (vm.selectedType) {
switch (item.torrent_type) {
case 'movie':
case 'tvserial':
result = vm.tmdbConfig.posterListBaseUrl + item.resource_detail_info.poster_path;
@@ -523,7 +523,7 @@
vm.getTorrentTitle = function (item) {
var result = null;
switch (vm.selectedType) {
switch (item.torrent_type) {
case 'movie':
result = item.resource_detail_info.original_title;
break;
@@ -545,7 +545,7 @@
vm.getTorrentOriginalTitle = function (item) {
var result = null;
switch (vm.selectedType) {
switch (item.torrent_type) {
case 'movie':
if (item.resource_detail_info.original_title !== item.resource_detail_info.title) {
result = item.resource_detail_info.title;

View File

@@ -19,6 +19,7 @@
vm.resourcesTags = MeanTorrentConfig.meanTorrentConfig.resourcesTags;
vm.torrentSalesType = MeanTorrentConfig.meanTorrentConfig.torrentSalesType;
vm.itemsPerPageConfig = MeanTorrentConfig.meanTorrentConfig.itemsPerPage;
vm.voteTitleConfig = MeanTorrentConfig.meanTorrentConfig.voteTitle;
vm.searchTags = [];
vm.searchKey = '';
@@ -90,6 +91,7 @@
torrent_status: 'reviewed',
torrent_type: vm.torrentType
}, function (items) {
mtDebug.info(items);
vm.listTopInfo = items.rows;
if (!vm.announce.privateTorrentCmsMode && vm.scrapeConfig.onTorrentInList) {
@@ -324,5 +326,99 @@
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

@@ -52,7 +52,7 @@
</div>
</dd>
<dt class="h-line">{{ 'CA_TORRENT_HNR' | translate}}:</dt>
<dt class="h-line">{{ 'CA_TORRENT_VIP' | translate}}:</dt>
<dd class="h-line">
<div class="checkbox checkbox-vip">
<label>

View File

@@ -6,9 +6,9 @@
<div data-ng-if="$index != 0 && $index % 6 == 0" class="clearfix visible-md-block visible-lg-block"></div>
<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 ng-src="{{vm.tmdbConfig.posterImgBaseUrl}}{{item.resource_detail_info.poster_path}}"
alt="{{item.resource_detail_info.title || item.resource_detail_info.name}}"
class="img-responsive">
<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)}}">
<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>IMDB</kbd> {{item.resource_detail_info.vote_average}}</span>
class="pull-right torrent-votes"><kbd>{{vm.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>{{item.resource_detail_info.title || item.resource_detail_info.name}}</strong>
<strong>{{vm.getTorrentTitle(item)}}</strong>
</li>
</ul>
</div>
@@ -138,7 +138,7 @@
<thead>
<tr>
<th>{{ 'TABLE_FIELDS.INFO' | translate}}</th>
<th class="text-center">{{ 'TABLE_FIELDS.VOTES' | translate}}</th>
<th>{{ 'TABLE_FIELDS.VOTES' | translate}}</th>
<th class="text-center">{{ 'TABLE_FIELDS.LIFETIME' | translate}}</th>
<th class="text-center">{{ 'TABLE_FIELDS.SIZE' | translate}}</th>
<th>
@@ -154,10 +154,11 @@
<td class="col-md-7 td-text-overflow">
<div class="media">
<div class="media-left">
<img class="media-object" ng-src="{{vm.tmdbConfig.posterListBaseUrl}}{{item.resource_detail_info.poster_path}}"
<img class="media-object" ng-class="{'music': item.torrent_type=='music'}" music-disk="{{item.torrent_type=='music'}}"
ng-src="{{vm.getTorrentListImage(item)}}"
alt="...">
<div class="layer-download">
<div class="layer-download" ng-class="{'music': item.torrent_type=='music'}">
<i class="fa fa-arrow-circle-o-down fa-3x" aria-hidden="true"
title="{{ 'TITLE_ALT.DOWNLOAD_TORRENT' | translate}}"
ng-click="vm.downloadTorrent(item._id); $event.stopPropagation();"
@@ -166,15 +167,16 @@
</div>
</div>
<div class="media-body">
<h5 class="media-heading">
{{item.resource_detail_info.original_title}}
<span ng-show="item.resource_detail_info.original_title!=item.resource_detail_info.title"> / {{item.resource_detail_info.title}}</span>
<h5 class="media-heading">{{vm.getTorrentTitle(item)}}
<span ng-show="vm.getTorrentOriginalTitle(item)"> / {{vm.getTorrentOriginalTitle(item)}}</span>
<span class="upload-by" ng-show="item.user.displayName"></span>
</h5>
<div class="list-all-genres">
<span class="genres-item" ng-repeat="t in item.resource_detail_info.genres">{{t.name}}</span>
</div>
<div class="torrent-filename text-long">{{item.resource_detail_info.subtitle}}</div>
<div class="torrent-filename text-long">{{item.torrent_filename | filename}}</div>
<div class="list-all-tags">
@@ -210,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>IMDB</kbd> {{item.resource_detail_info.vote_average | number : 1}}</span>
class="torrent-votes"><kbd>{{vm.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

@@ -1,248 +0,0 @@
<section class="container padding-top-10" ng-controller="TorrentsController as vm" ng-init="vm.getResourceTopInfo();vm.torrentBuildPager();">
<div class="row" style="padding: 0 10px;">
<div ng-repeat="item in vm.listTopInfo">
<div data-ng-if="$index != 0 && $index % 2 == 0" class="clearfix visible-xs-block"></div>
<div data-ng-if="$index != 0 && $index % 3 == 0" class="clearfix visible-sm-block"></div>
<div data-ng-if="$index != 0 && $index % 6 == 0" class="clearfix visible-md-block visible-lg-block"></div>
<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 ng-src="{{vm.tmdbConfig.posterImgBaseUrl}}{{item.resource_detail_info.poster_path}}"
alt="{{item.resource_detail_info.title || item.resource_detail_info.name}}"
class="img-responsive">
<div class="torrent-user-info">
<table>
<tr>
<td class="text-left">
<span class="glyphicon glyphicon-arrow-up torrent-up"></span>
<span>{{item.torrent_seeds}}</span>
</td>
<td class="text-center">
<span class="glyphicon glyphicon-arrow-down torrent-down"></span>
<span>{{item.torrent_leechers}}</span>
</td>
<td class="text-right">
<span class="glyphicon glyphicon-ok torrent-finished"></span>
<span>{{item.torrent_finished}}</span>
</td>
</tr>
</table>
</div>
<div class="torrent-tmdb-info">
<ul class="list-unstyled">
<li>
<span class="se-info">S{{item.torrent_seasons}}E{{item.torrent_episodes}}</span>
<span title="{{ 'TITLE_ALT.IMDB_VOTES' | translate}}"
class="pull-right torrent-votes"><kbd>IMDB</kbd> {{item.resource_detail_info.vote_average}}</span>
</li>
</ul>
</div>
<div class="caption">
<ul class="list-unstyled">
<li class="text-long">
<strong>{{item.resource_detail_info.title || item.resource_detail_info.name}}</strong>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading text-center">
<h3 class="panel-title" translate="TAGS_SEARCH"></h3>
</div>
<div class="panel-body">
<div class="col-md-10 col-md-offset-1">
<dl class="dl-horizontal">
<dt class="h-line">{{ 'CA_KEYWORD' | translate}}:</dt>
<dd class="h-line">
<div class="row" style="">
<div class="col-sm-7">
<input type="text" class="form-control" ng-model="vm.searchKey"
ng-keydown="vm.onKeysKeyDown($event);"
placeholder="{{ 'PH_KEYWORD' | translate}}">
</div>
<div class="col-sm-5">
<span class="label label-tag text-uppercase incline-block-valign"
title="{{ 'TITLE_ALT.MORE_TAGS' | translate}}"
ng-click="vm.onMoreTagsClicked();">
<i class="glyphicon glyphicon-chevron-down" id="more-tags-icon"></i> {{ 'MORE_TAGS' | translate}}
</span>
<span class="label label-tag text-uppercase incline-block-valign"
title="{{ 'TITLE_ALT.RESET_TAGS' | translate}}"
ng-click="vm.clearAllCondition();">
<i class="glyphicon glyphicon-repeat"></i> {{ 'CA_RESET' | translate}}
</span>
</div>
</div>
</dd>
<dt class="h-line">{{ 'CA_TORRENT_HNR' | translate}}:</dt>
<dd class="h-line">
<div class="checkbox checkbox-hnr">
<label>
<input type="checkbox" ng-model="vm.filterHnR" ng-change="vm.onHnRChanged();"> {{ 'CA_TORRENT_HNR' | translate}}
</label>
</div>
</dd>
<div class="more-tags panel-collapsed" style="display: none;">
<div ng-repeat="item in vm.resourcesTags.radio | filter:vm.torrentType">
<dt class="h-line">{{ 'RESOURCESTAGS.'+item.name+'.SELF' | translate}}:</dt>
<dd class="h-line">
<div class="btn-group btn-group-xs" role="group">
<button ng-repeat="sitem in item.value" id="tag_{{sitem.name}}"
class="btn btn-xs btn-default btn-tag" value="{{sitem.name}}"
ng-click="vm.onRadioTagClicked($event, sitem.name)">
{{ 'RESOURCESTAGS.' + item.name + '.' + sitem.name | translate}}
</button>
</span>
</div>
</dd>
</div>
<div ng-repeat="item in vm.resourcesTags.checkbox | filter:vm.torrentType">
<dt class="h-line">{{ 'RESOURCESTAGS.'+item.name+'.SELF' | translate}}:</dt>
<dd class="h-line">
<div class="btn-group btn-group-xs" role="group">
<button ng-repeat="sitem in item.value" id="tag_{{sitem.name}}"
class="btn btn-xs btn-default btn-tag" value="{{sitem.name}}"
ng-click="vm.onCheckboxTagClicked($event, sitem.name)"
toggle-class="btn-success" base-class="btn-default" onclick="this.blur();">
{{ 'RESOURCESTAGS.' + item.name + '.' + sitem.name | translate}}
</button>
</div>
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="torrent-list" id="top_of_torrent_list">
<div class="pagination-div-top">
<ul uib-pagination boundary-links="true" max-size="8" items-per-page="vm.torrentItemsPerPage" total-items="vm.torrentFilterLength"
ng-model="vm.torrentCurrentPage" ng-change="vm.torrentPageChanged()"
first-text="{{ 'PAGE_TEXT_FIRST' | translate}}" previous-text="{{ 'PAGE_TEXT_PREVIOUS' | translate}}"
next-text="{{ 'PAGE_TEXT_NEXT' | translate}}" last-text="{{ 'PAGE_TEXT_LAST' | translate}}">
</ul>
</div>
<div class="table-responsive">
<table class="table table-hover tb-v-middle">
<thead>
<tr>
<th>{{ 'TABLE_FIELDS.INFO' | translate}}</th>
<th class="text-center">{{ 'TABLE_FIELDS.VOTES' | translate}}</th>
<th class="text-center">{{ 'TABLE_FIELDS.LIFETIME' | translate}}</th>
<th class="text-center">{{ 'TABLE_FIELDS.SIZE' | translate}}</th>
<th>
<abbr title="{{ 'TABLE_FIELDS.ABBR_SEEDS_LEECHERS_FINISHED' | translate}}" class="initialism">
{{ 'TABLE_FIELDS.SEEDS_LEECHERS_FINISHED' | translate}}
</abbr>
</th>
<th class="text-center">{{ 'TABLE_FIELDS.PUBLISHER' | translate}}</th>
</tr>
</thead>
<tbody>
<tr class="torrent-list-info" ng-repeat="item in vm.torrentPagedItems" ng-click="vm.openTorrentInfo(item._id);">
<td class="col-md-7 td-text-overflow">
<div class="media">
<div class="media-left">
<img class="media-object" ng-src="{{vm.tmdbConfig.posterListBaseUrl}}{{item.resource_detail_info.poster_path}}"
alt="...">
<div class="layer-download">
<i class="fa fa-arrow-circle-o-down fa-3x" aria-hidden="true"
title="{{ 'TITLE_ALT.DOWNLOAD_TORRENT' | translate}}"
ng-click="vm.downloadTorrent(item._id); $event.stopPropagation();"
ng-class="{'fa-arrow-circle-down': vm.hover}"
ng-mouseover="vm.hover = true;" ng-mouseleave="vm.hover = false;"></i>
</div>
</div>
<div class="media-body">
<h5 class="media-heading">
{{item.resource_detail_info.original_name}}
<span ng-show="item.resource_detail_info.original_name!=item.resource_detail_info.name"> / {{item.resource_detail_info.name}}</span>
</h5>
<div class="list-all-genres">
<span class="genres-item" ng-repeat="t in item.resource_detail_info.genres">{{t.name}}</span>
</div>
<div class="torrent-filename text-long">{{item.torrent_filename | filename}}</div>
<div class="list-all-tags">
<span class="label label-rlevel label-info"
ng-show="item.torrent_recommended != 'none'"
ng-click="$event.stopPropagation();">
{{ 'TORRENT_RECOMMEND_LEVEL_ITEM.' + item.torrent_recommended.toUpperCase() | translate}}
</span>
<span class="label label-sale" ng-if="item.isSaling"
title="{{vm.getSaleTypeDesc(item);}} | {{ 'SALE_EXPIRES_TIME' | translate}}: {{item.torrent_sale_expires | date: 'MM-dd HH:mm'}}"
ng-click="$event.stopPropagation();"
ng-class="{'label-default': !item.isSaling, 'label-success': item.isSaling}">
{{item.torrent_sale_status}} {{item.torrent_sale_expires | unlife}}
</span>
<span class="label label-se-info"
ng-click="$event.stopPropagation();">S{{item.torrent_seasons}}E{{item.torrent_episodes}}</span>
<span class="label label-hnr-info" ng-if="item.torrent_hnr"
ng-click="vm.onHnRClicked(); $event.stopPropagation();">H&R</span>
<span ng-repeat="t in item.torrent_tags">
<span class="label label-tag" ng-class="{'used': vm.searchTags.indexOf(t) !== -1}"
ng-click="vm.onTagClicked(t); $event.stopPropagation();">
{{ 'RESOURCESTAGS.' + vm.getTagTitle(t) + '.' + t | translate}}
</span>
</span>
</div>
</div>
</div>
</td>
<td class="col-md-1 td-v-middle td-imdb">
<span title="{{ 'TITLE_ALT.IMDB_VOTES' | translate}}"
class="torrent-votes"><kbd>IMDB</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>
<td class="col-md-1 td-v-middle list-user-info td-user-info">
<p class="no-margin-p" title="{{ 'TITLE_ALT.SEEDS' | translate}}">
<span class="glyphicon glyphicon-arrow-up torrent-up"></span>
{{item.torrent_seeds}}
</p>
<p class="no-margin-p" title="{{ 'TITLE_ALT.LEECHERS' | translate}}">
<span class="glyphicon glyphicon-arrow-down torrent-down"></span>
{{item.torrent_leechers}}
</p>
<p class="no-margin-p" title="{{ 'TITLE_ALT.FINISHED' | translate}}">
<span class="glyphicon glyphicon-ok torrent-finished"></span>
{{item.torrent_finished}}
</p>
</td>
<td class="col-md-1 td-v-middle text-center td-uploader">
<span user-info="item.user" info-name></span>
<!--<span vip-flag="item.user"></span>-->
<span message-to="item.user" to-class="message-to-icon"></span>
</td>
</tr>
</tbody>
</table>
</div>
<div class="pagination-div-bottom">
<ul uib-pagination boundary-links="true" max-size="8" items-per-page="vm.torrentItemsPerPage" total-items="vm.torrentFilterLength"
ng-model="vm.torrentCurrentPage" ng-change="vm.torrentPageChanged()"
first-text="{{ 'PAGE_TEXT_FIRST' | translate}}" previous-text="{{ 'PAGE_TEXT_PREVIOUS' | translate}}"
next-text="{{ 'PAGE_TEXT_NEXT' | translate}}" last-text="{{ 'PAGE_TEXT_LAST' | translate}}">
</ul>
</div>
</div>
</section>