Skip to content

Commit

Permalink
Add failed count information to many of the pages as statistic info. …
Browse files Browse the repository at this point in the history
…Add changelog, contributing notes and license.
  • Loading branch information
DariusIII committed Sep 24, 2015
1 parent 1d2949c commit ff4afdc
Show file tree
Hide file tree
Showing 33 changed files with 196 additions and 68 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
2015-09-24 DariusIII
- Add failed downloads count to releases.
8 changes: 8 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
If you want to contribute to newznab-tmux project, you should follow couple of simple rules:

1. Your pull requests (PR) should be named as follows: branch-username-shortdescription (i.e. dev-dariusiii-fixedshit).

2. For dev regexless branch PR need to be done for dev-regexless branch, for dev into dev branch.

3. Pull requests will not be accepted for master branch. They will be rejected.

1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This project is licensed under GPLv2 license. Parts of the code have their own licenses and are in their respective folders.
2 changes: 1 addition & 1 deletion misc/testing/getConsole.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

use newznab\db\Settings;

$console = new Console(true);
$console = new Console(['Echo' => true, 'Settings' => $pdo]);

$db = new Settings();

Expand Down
1 change: 1 addition & 0 deletions newznab/controllers/Books.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ public function getBookRange($cat, $start, $num, $orderby, $excludedcats =[])
. "GROUP_CONCAT(r.totalpart ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_totalparts, "
. "GROUP_CONCAT(r.comments ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_comments, "
. "GROUP_CONCAT(r.grabs ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_grabs, "
. "GROUP_CONCAT(r.failed ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_failed,"
. "boo.*, r.bookinfoid, groups.name AS group_name, rn.id as nfoid FROM releases r "
. "LEFT OUTER JOIN groups ON groups.id = r.groupid "
. "LEFT OUTER JOIN releasenfo rn ON rn.releaseid = r.id "
Expand Down
1 change: 1 addition & 0 deletions newznab/controllers/Games.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ public function getGamesRange($cat, $start, $num, $orderby, $maxage = -1, $exclu
. "GROUP_CONCAT(r.totalpart ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_totalparts, "
. "GROUP_CONCAT(r.comments ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_comments, "
. "GROUP_CONCAT(r.grabs ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_grabs, "
. "GROUP_CONCAT(r.failed ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_failed,"
. "con.*, YEAR (con.releasedate) as year, r.gamesinfo_id, groups.name AS group_name,
rn.id as nfoid FROM releases r "
. "LEFT OUTER JOIN groups ON groups.id = r.groupid "
Expand Down
1 change: 1 addition & 0 deletions newznab/controllers/Konsole.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ public function getConsoleRange($cat, $start, $num, $orderby, $excludedcats =[])
. "GROUP_CONCAT(r.totalpart ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_totalparts, "
. "GROUP_CONCAT(r.comments ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_comments, "
. "GROUP_CONCAT(r.grabs ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_grabs, "
. "GROUP_CONCAT(r.failed ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_failed,"
. "con.*, r.consoleinfoid, groups.name AS group_name, rn.id as nfoid FROM releases r "
. "LEFT OUTER JOIN groups ON groups.id = r.groupid "
. "LEFT OUTER JOIN releasenfo rn ON rn.releaseid = r.id "
Expand Down
1 change: 1 addition & 0 deletions newznab/controllers/Movie.php
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ public function getMovieRange($cat, $start, $num, $orderBy, $maxAge = -1, $exclu
GROUP_CONCAT(r.totalpart ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_totalparts,
GROUP_CONCAT(r.comments ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_comments,
GROUP_CONCAT(r.grabs ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_grabs,
GROUP_CONCAT(r.failed ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_failed,
m.*, groups.name AS group_name, rn.id as nfoid FROM releases r
LEFT OUTER JOIN groups ON groups.id = r.groupid
LEFT OUTER JOIN releasenfo rn ON rn.releaseid = r.id
Expand Down
1 change: 1 addition & 0 deletions newznab/controllers/Musik.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ public function getMusicRange($cat, $start, $num, $orderby, $excludedcats = [])
. "GROUP_CONCAT(r.totalpart ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_totalparts, "
. "GROUP_CONCAT(r.comments ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_comments, "
. "GROUP_CONCAT(r.grabs ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_grabs, "
. "GROUP_CONCAT(r.failed ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_failed,"
. "m.*, r.musicinfoid, groups.name AS group_name, rn.id as nfoid FROM releases r "
. "LEFT OUTER JOIN groups ON groups.id = r.groupid "
. "LEFT OUTER JOIN releasenfo rn ON rn.releaseid = r.id "
Expand Down
12 changes: 12 additions & 0 deletions newznab/controllers/Releases.php
Original file line number Diff line number Diff line change
Expand Up @@ -1593,6 +1593,16 @@ public function updateGrab($guid)
}
}

/**
* @param string $guid
*/
public function updateFail($guid)
{
$this->pdo->queryExec(
sprintf('UPDATE releases SET failed = failed + 1 WHERE guid = %s', $this->pdo->escapeString($guid))
);
}

/**
* @return array
*/
Expand Down Expand Up @@ -1813,6 +1823,8 @@ public function getAlternate($guid, $searchname, $userid)
)
);

$this->updateFail($guid);

$alternate = $this->pdo->queryOneRow(sprintf('SELECT * FROM releases r
WHERE r.searchname %s
AND r.guid NOT IN (SELECT guid FROM dnzb_failures WHERE userid = %d)',
Expand Down
1 change: 1 addition & 0 deletions newznab/controllers/XXX.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ public function getXXXRange($cat, $start, $num, $orderBy, $maxAge = -1, $exclude
GROUP_CONCAT(r.totalpart ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_totalparts,
GROUP_CONCAT(r.comments ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_comments,
GROUP_CONCAT(r.grabs ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_grabs,
GROUP_CONCAT(r.failed ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_failed,
xxx.*, UNCOMPRESS(xxx.plot) AS plot, groups.name AS group_name, rn.id as nfoid FROM releases r
LEFT OUTER JOIN groups ON groups.id = r.groupid
LEFT OUTER JOIN releasenfo rn ON rn.releaseid = r.id
Expand Down
4 changes: 2 additions & 2 deletions www/admin/console-edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require_once './config.php';

$page = new AdminPage();
$console = new Console();
$console = new Console(['Settings' => $page->settings]);
$gen = new Genres();
$id = 0;

Expand Down Expand Up @@ -53,4 +53,4 @@
}

$page->content = $page->smarty->fetch('console-edit.tpl');
$page->render();
$page->render();
5 changes: 2 additions & 3 deletions www/admin/console-list.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
require_once './config.php';

$page = new AdminPage();

$con = new Console();
$con = new Console(['Settings' => $page->settings]);

$page->title = "Console List";

Expand All @@ -23,4 +22,4 @@
$page->smarty->assign('consolelist',$consolelist);

$page->content = $page->smarty->fetch('console-list.tpl');
$page->render();
$page->render();
6 changes: 2 additions & 4 deletions www/pages/consolemodal.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<?php

$console = new Console;

if (!$page->users->isLoggedIn())
$page->show403();

if (isset($_GET["id"]) && ctype_digit($_GET["id"]))
{
$console = new Console(['Settings' => $page->settings]);
$con = $console->getConsoleInfo($_GET['id']);
if (!$con)
$page->show404();
Expand All @@ -32,5 +31,4 @@
echo $page->content;
else
$page->render();
}

}
2 changes: 1 addition & 1 deletion www/pages/details.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@

$con = '';
if ($data['consoleinfoid'] != '') {
$c = new Console();
$c = new Konsole();
$con = $c->getConsoleInfo($data['consoleinfoid']);
}

Expand Down
12 changes: 9 additions & 3 deletions www/templates/charisma/views/frontend/books.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,20 @@
{assign var="mtotalparts" value=","|explode:$result.grp_release_totalparts}
{assign var="mcomments" value=","|explode:$result.grp_release_comments}
{assign var="mgrabs" value=","|explode:$result.grp_release_grabs}
{assign var="mfailed" value=","|explode:$result.grp_release_failed}
{assign var="mpass" value=","|explode:$result.grp_release_password}
{assign var="minnerfiles" value=","|explode:$result.grp_rarinnerfilecount}
{assign var="mhaspreview" value=","|explode:$result.grp_haspreview}
{foreach from=$msplits item=m}
<div class="panel panel-default">
<div class="panel-body">
<div class="row">
<div class="col-md-2">
<div class="col-md-2 small-gutter-left">
<a title="View details"
href="{$smarty.const.WWW_TOP}/details/{$mguid[$m@index]}/{$mname[$m@index]|escape:"htmlall"}">
<img src="{$smarty.const.WWW_TOP}/covers/book/{if $result.cover == 1}{$result.bookinfoid}.jpg{else}no-cover.jpg{/if}"
width="140" border="0"
alt="{$result.author|escape:"htmlall"} - {$result.title|escape:"htmlall"}"/>
alt="{$result.author|escape:"htmlall"} - {$result.title|escape:"htmlall"}"/>{if $mfailed[$m@index] > 0} <i class="fa fa-exclamation-circle" style="color: red" title="This release has failed to download for some users"></i>{/if}
</a>
{if isset($resulturl) && $result.url != ""}<a
class="label label-default" target="_blank"
Expand All @@ -105,8 +106,13 @@
<a class="label label-default"
href="{$smarty.const.WWW_TOP}/browse?g={$mgrp[$m@index]}"
title="Browse releases in {$mgrp[$m@index]|replace:"alt.binaries":"a.b"}">Group</a>
{if $mfailed[$m@index] > 0}
<span class="btn btn-hover btn-default btn-xs"><i class="fa fa-thumbs-o-down"></i><span
class="badge"> {$mfailed[$m@index]}
Failed Download{if $mfailed[$m@index] != 1}s{/if}</span>
{/if}
</div>
<div class="col-md-10">
<div class="col-md-10 small-gutter-left">
<h4><a title="View details"
href="{$smarty.const.WWW_TOP}/details/{$mguid[$m@index]}/{$mname[$m@index]|escape:"htmlall"}">{$result.author|escape:"htmlall"}
- {$result.title|escape:"htmlall"}</a></h4>
Expand Down
4 changes: 3 additions & 1 deletion www/templates/charisma/views/frontend/browse.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
value="{$result.guid}"/></td>
<td>
<a href="{$smarty.const.WWW_TOP}/details/{$result.guid}/{$result.searchname|escape:"htmlall"}"
class="title">{$result.searchname|escape:"htmlall"|replace:".":" "}</a>
class="title">{$result.searchname|escape:"htmlall"|replace:".":" "}</a>{if $result.failed > 0} <i class="fa fa-exclamation-circle" style="color: red" title="This release has failed to download for some users"></i>{/if}
<br/>
<span class="label label-default">{$result.grabs}
Grab{if $result.grabs != 1}s{/if}</span>
Expand All @@ -117,6 +117,8 @@
Aired {if $result.tvairdate|strtotime > $smarty.now}in future{else}{$result.tvairdate|daysago}{/if}</span>{/if}
{if $result.anidbid > 0}<span class="label label-default"><a
href="{$smarty.const.WWW_TOP}/anime/{$result.anidbid}">View Anime</a></span>{/if}
{if $result.failed > 0}<span class="label label-default">
<i class ="fa fa-thumbs-o-up"></i> {$result.grabs} Grabs / <i class ="fa fa-thumbs-o-down"></i> {$result.failed} Failed Downloads</span>{/if}
</td>
<td><span class="label label-default">{$result.category_name}</span>
</td>
Expand Down
11 changes: 8 additions & 3 deletions www/templates/charisma/views/frontend/console.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
{assign var="mtotalparts" value=","|explode:$result.grp_release_totalparts}
{assign var="mcomments" value=","|explode:$result.grp_release_comments}
{assign var="mgrabs" value=","|explode:$result.grp_release_grabs}
{assign var="mfailed" value=","|explode:$result.grp_release_failed}
{assign var="mpass" value=","|explode:$result.grp_release_password}
{assign var="minnerfiles" value=","|explode:$result.grp_rarinnerfilecount}
{assign var="mhaspreview" value=","|explode:$result.grp_haspreview}
Expand All @@ -104,12 +105,12 @@
<div class="panel panel-default">
<div class="panel-body">
<div class="row">
<div class="col-md-2">
<div class="col-md-2 small-gutter-left">
<a title="View details"
href="{$smarty.const.WWW_TOP}/details/{$mguid[$m@index]}/{$mname[$m@index]|escape:"htmlall"}">
<img src="{$smarty.const.WWW_TOP}/covers/console/{if $result.cover == 1}{$result.consoleinfoid}.jpg{else}no-cover.jpg{/if}"
width="140" border="0"
alt="{$result.title|escape:"htmlall"}"/>
alt="{$result.title|escape:"htmlall"}"/>{if $mfailed[$m@index] > 0} <i class="fa fa-exclamation-circle" style="color: red" title="This release has failed to download for some users"></i>{/if}
</a>
{if $result.url != ""}<a class="label label-default"
target="_blank"
Expand All @@ -124,8 +125,12 @@
<a class="label label-default"
href="{$smarty.const.WWW_TOP}/browse?g={$result.group_name}"
title="Browse releases in {$result.group_name|replace:"alt.binaries":"a.b"}">Group</a>
{if $mfailed[$m@index] > 0}
<span class="btn btn-default btn-xs" title="This release has failed to download for some users">
<i class ="fa fa-thumbs-o-up"></i> {$mgrabs[$m@index]} Grabs / <i class ="fa fa-thumbs-o-down"></i> {$mfailed[$m@index]} Failed Downloads</span>
{/if}
</div>
<div class="col-md-10">
<div class="col-md-10 small-gutter-left">
<h4><a title="View details"
href="{$smarty.const.WWW_TOP}/details/{$mguid[$m@index]}/{$mname[$m@index]|escape:"htmlall"}">{$result.title|escape:"htmlall"}</a>
</h4>
Expand Down
17 changes: 11 additions & 6 deletions www/templates/charisma/views/frontend/games.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
{assign var="mtotalparts" value=","|explode:$result.grp_release_totalparts}
{assign var="mcomments" value=","|explode:$result.grp_release_comments}
{assign var="mgrabs" value=","|explode:$result.grp_release_grabs}
{assign var="mfailed" value=","|explode:$result.grp_release_failed}
{assign var="mpass" value=","|explode:$result.grp_release_password}
{assign var="minnerfiles" value=","|explode:$result.grp_rarinnerfilecount}
{assign var="mhaspreview" value=","|explode:$result.grp_haspreview}
Expand All @@ -101,12 +102,12 @@
<div class="panel panel-default">
<div class="panel-body">
<div class="row">
<div class="col-md-2">
<div class="col-md-2 small-gutter-left">
<a title="View details"
href="{$smarty.const.WWW_TOP}/details/{$mguid[$m@index]}/{$mname[$m@index]|escape:"htmlall"}">
<img src="{$smarty.const.WWW_TOP}/covers/games/{if $result.cover == 1}{$result.gamesinfo_id}.jpg{else}no-cover.jpg{/if}"
width="140" border="0"
alt="{$result.title|escape:"htmlall"}"/>
alt="{$result.title|escape:"htmlall"}"/>{if $mfailed[$m@index] > 0} <i class="fa fa-exclamation-circle" style="color: red" title="This release has failed to download for some users"></i>{/if}
</a>
{if $result.classused == "gb"}<a class="label label-default"
target="_blank"
Expand Down Expand Up @@ -139,8 +140,12 @@
<a class="label label-default"
href="{$smarty.const.WWW_TOP}/browse?g={$result.group_name}"
title="Browse releases in {$result.group_name|replace:"alt.binaries":"a.b"}">Group</a>
{if $mfailed[$m@index] > 0}
<span class="btn btn-default btn-xs" title="This release has failed to download for some users">
<i class ="fa fa-thumbs-o-up"></i> {$mgrabs[$m@index]} Grabs / <i class ="fa fa-thumbs-o-down"></i> {$mfailed[$m@index]} Failed Downloads</span>
{/if}
</div>
<div class="col-md-10">
<div class="col-md-10 small-gutter-left">
<h4><a title="View details"
href="{$smarty.const.WWW_TOP}/details/{$mguid[$m@index]}/{$mname[$m@index]|escape:"htmlall"}">{$result.title|escape:"htmlall"}</a>
(<a class="title" title="{$result.year}"
Expand All @@ -150,9 +155,9 @@
<tr>
<td id="guid{$mguid[$m@index]}">
<label>
<input type="checkbox"
class="nzb_check"
value="{$mguid[$m@index]}" id="chksingle"/>
<input type="checkbox"
class="nzb_check"
value="{$mguid[$m@index]}" id="chksingle"/>
</label>
<span class="label label-default">{$msize[$m@index]|fsize_format:"MB"}</span>
<span class="label label-default">Posted {$mpostdate[$m@index]|timeago}
Expand Down
Loading

0 comments on commit ff4afdc

Please sign in to comment.