mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-28 17:01:16 +00:00
Removed unused scripts and files
This commit is contained in:
@@ -1,34 +0,0 @@
|
||||
03.09.2013 --> Updates to namefixer.
|
||||
02.09.2013 --> Updates to namefixer.php and prehash.php
|
||||
27.08.2013 --> Reverted some changes to namecleaner
|
||||
26.08.2013 --> Fixed typo in monitor.php and updated removeCrapreleases.php.
|
||||
23.08.2013 --> Updated namecleaner
|
||||
19.08.2013 --> Updated namecleaner and namefixer.
|
||||
13.08.2013 --> Added predb dump with more than 5 million releases for prehash table. Run commands from clean_duplicates_predb.txt first and then from import_predb.txt. PreDB data can be downloaded
|
||||
--> from https://mega.co.nz/#!xggDlBSC!ZDMDPVzbFY_MrzkWqX2EIFgIX8dV0vBkyQ_RF4SAb1A
|
||||
12.08.2013 --> Updates to namecleaning, namefixer and prehash. Reverted behaviour of tmux monitor to old one, fix for postprocessing panes.
|
||||
--> Removed folders and files from hash_matching folder that are not used anymore.
|
||||
09.08.2013 --> Updated monitor and namecleaner
|
||||
07.08.2013 --> Updates to namecleaner, changed displayed info in postprocessing panes due to changes to in latest update of nn+
|
||||
|
||||
06.08.2013 --> Updated namecleaner, changed removecrap timer to 2 hours by default and it is run every 40 seconds, added custom updateCategories.php to test folder - updates categories in last 6 hours, not the whole db.
|
||||
--> Updated tmux packages to 1.8-4 built on 02.08.2013, install using 'sudo dpkg -i tmux_1.8-4.deb'
|
||||
05.08.2013-1 --> Added removeCrapReleases.php to test folder. You can run it manualy, type php removeCrapReleases.php to see all the options.
|
||||
--> Script runs in true full mode from tmux. If you don't want that, disable it in your defaults.sh and run it manualy.
|
||||
05.08.2012 --> Updated namecleaner.php, removed aflys init.php and added new create_prehash_table.sql.
|
||||
--> Added prehash sql files to import manualy predb data for prehash table. Do not do it unless you want to mess with prehash table,
|
||||
--> as it needs removal of primary key and removal of id column before you can import those. And you need to add those back later (id and primary key).
|
||||
24.07.2013 --> Updated monitor.php to show prehash database status.If no hash matching, name fixing scripts are enabled, this information
|
||||
--> will not be shown.
|
||||
--> Added another prehash table update.
|
||||
23.07.2013.1 --> Switched to hash_decrypt.php from testing folder, changes to nn+ db and core files are mandatory for new scripts to work.
|
||||
23.07.2013 --> Adapted fixReleaseName script from nZEDb to scan nfo's and releasenames and fix them as much as they can be fixed. Removed pre.corrupt net script (pre.php) as it is useless now.
|
||||
--> Added test folder with "files to copy" folder. In that folder are located core newznab files, but if you want to use fixReleaseNames script you have to copy them to their respective folders.
|
||||
--> Be aware that any future update to nn+ could render these scripts unusable.Use them at your own risk.
|
||||
--> There is a bug in init.php. I will fix it later, as original aflys init.php can be used to create prehash table, after that you can use prehash*.sql to update it.
|
||||
20.07.2013 --> fixed bug in prehash, you will need to run this query: update prehash set title = replace (title, ' - omgwtfnzbs.org', '');
|
||||
19.07.2013 --> Removed nzbx_ws_hashdecrypt.php as it is no longer working.
|
||||
Added standalone hash_decrypt.php as a replacement.
|
||||
You need do run this sql "ALTER TABLE `releases` ADD `dehashstatus` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `haspreview`;" on newznab database if you want to run this.
|
||||
|
||||
|
||||
@@ -1,153 +0,0 @@
|
||||
<?php
|
||||
require_once(dirname(__FILE__)."/../bin/config.php");
|
||||
require_once(WWW_DIR."/lib/framework/db.php");
|
||||
require_once(WWW_DIR."/lib/site.php");
|
||||
require_once("functions.php");
|
||||
|
||||
class ReleaseComments
|
||||
{
|
||||
// Returns the row associated to the id of a comment.
|
||||
public function getCommentById($id)
|
||||
{
|
||||
$db = new DB();
|
||||
return $db->queryOneRow(sprintf("SELECT * FROM releasecomment WHERE ID = %d", $id));
|
||||
}
|
||||
|
||||
public function getComments($id)
|
||||
{
|
||||
$db = new DB();
|
||||
return $db->query(sprintf("SELECT releasecomment.* FROM releasecomment WHERE releaseID = %d", $id));
|
||||
}
|
||||
|
||||
public function getCommentCount()
|
||||
{
|
||||
$db = new DB();
|
||||
$res = $db->queryOneRow(sprintf("SELECT COUNT(ID) AS num FROM releasecomment"));
|
||||
return $res["num"];
|
||||
}
|
||||
|
||||
// For deleting a single comment on the site.
|
||||
public function deleteComment($id)
|
||||
{
|
||||
$db = new DB();
|
||||
$res = $this->getCommentById($id);
|
||||
if ($res)
|
||||
{
|
||||
$db->exec(sprintf("DELETE FROM releasecomment WHERE ID = %d", $id));
|
||||
$this->updateReleaseCommentCount($res["releaseID"]);
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteCommentsForRelease($id)
|
||||
{
|
||||
$db = new DB();
|
||||
$db->exec(sprintf("DELETE FROM releasecomment WHERE releaseID = %d", $id));
|
||||
$this->updateReleaseCommentCount($id);
|
||||
}
|
||||
|
||||
public function deleteCommentsForUser($id)
|
||||
{
|
||||
|
||||
$numcomments = $this->getCommentCountForUser($id);
|
||||
if ($numcomments > 0)
|
||||
{
|
||||
$comments = $this->getCommentsForUserRange($id, 0, $numcomments);
|
||||
foreach ($comments as $comment)
|
||||
{
|
||||
$this->deleteComment($comment["ID"]);
|
||||
$this->updateReleaseCommentCount($comment["releaseID"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function addComment($id, $text, $userid, $host)
|
||||
{
|
||||
$db = new DB();
|
||||
|
||||
$site = new Sites();
|
||||
$s = $site->get();
|
||||
if ($s->storeuserips != "1")
|
||||
$host = "";
|
||||
|
||||
$username = $db->queryOneRow(sprintf('SELECT username FROM users WHERE ID = %d', $userid));
|
||||
$username = ($username === false ? 'ANON' : $username['username']);
|
||||
|
||||
$comid = $db->queryInsert(
|
||||
sprintf("
|
||||
INSERT INTO releasecomment (releaseID, text, userID, createddate, host, username)
|
||||
VALUES (%d, %s, %d, NOW(), %s, %s)",
|
||||
$id,
|
||||
$db->escapeString($text),
|
||||
$userid,
|
||||
$db->escapeString($host),
|
||||
$db->escapeString($username)
|
||||
)
|
||||
);
|
||||
$this->updateReleaseCommentCount($id);
|
||||
return $comid;
|
||||
}
|
||||
|
||||
public function getCommentsRange($start, $num)
|
||||
{
|
||||
$db = new DB();
|
||||
return $db->query(
|
||||
sprintf("
|
||||
SELECT releasecomment.*, releases.guid
|
||||
FROM releasecomment
|
||||
LEFT JOIN releases on releases.ID = releasecomment.releaseID
|
||||
ORDER BY releasecomment.createddate DESC %s",
|
||||
($start === false ? '' : " LIMIT " . $num . " OFFSET " . $start)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Updates the amount of comments for the rlease.
|
||||
public function updateReleaseCommentCount($relid)
|
||||
{
|
||||
$db = new DB();
|
||||
$db->exec(
|
||||
sprintf("
|
||||
UPDATE releases
|
||||
SET comments = (SELECT COUNT(ID) from releasecomment WHERE releasecomment.releaseID = %d)
|
||||
WHERE releases.ID = %d",
|
||||
$relid,
|
||||
$relid
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function getCommentCountForUser($uid)
|
||||
{
|
||||
$db = new DB();
|
||||
$res = $db->queryOneRow(
|
||||
sprintf("
|
||||
SELECT COUNT(ID) AS num
|
||||
FROM releasecomment
|
||||
WHERE userID = %d",
|
||||
$uid
|
||||
)
|
||||
);
|
||||
return $res["num"];
|
||||
}
|
||||
|
||||
public function getCommentsForUserRange($uid, $start, $num)
|
||||
{
|
||||
$db = new DB();
|
||||
|
||||
if ($start === false)
|
||||
$limit = "";
|
||||
else
|
||||
$limit = " LIMIT ".$num." OFFSET ".$start;
|
||||
|
||||
return $db->query(
|
||||
sprintf("
|
||||
SELECT releasecomment.*
|
||||
FROM releasecomment
|
||||
WHERE userID = %d
|
||||
ORDER BY releasecomment.createddate DESC %s",
|
||||
$uid,
|
||||
$limit
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,99 +0,0 @@
|
||||
<?php
|
||||
require_once(dirname(__FILE__) . "/../bin/config.php");
|
||||
require_once(WWW_DIR . "/lib/framework/db.php");
|
||||
require_once("ColorCLI.php");
|
||||
require_once("consoletools.php");
|
||||
require_once("Enzebe.php");
|
||||
require_once("functions.php");
|
||||
|
||||
// This script updates all releases with the guid from the nzb file. Adapted from nZEDb for newznab
|
||||
|
||||
$c = new ColorCLI();
|
||||
if (isset($argv[1])) {
|
||||
$del = false;
|
||||
if (isset($argv[2])) {
|
||||
$del = $argv[2];
|
||||
}
|
||||
create_guids($argv[1], $del);
|
||||
} else {
|
||||
exit($c->error("\nThis script updates all releases with the guid (md5 hash of the first message-id) from the nzb file.\n\n"
|
||||
. "php $argv[0] true ...: To create missing nzb_guids.\n"
|
||||
. "php $argv[0] true delete ...: To create missing nzb_guids and delete invalid nzbs and releases.\n"));
|
||||
}
|
||||
|
||||
function create_guids($live, $delete = false)
|
||||
{
|
||||
$db = new DB();
|
||||
$consoletools = new ConsoleTools();
|
||||
$timestart = TIME();
|
||||
$relcount = $deleted = 0;
|
||||
$c = new ColorCLI();
|
||||
|
||||
if ($live == "true") {
|
||||
$relrecs = $db->queryDirect(sprintf("SELECT ID, guid FROM releases WHERE nzbstatus = 1 AND nzb_guid IS NULL ORDER BY ID DESC"));
|
||||
} else if ($live == "limited") {
|
||||
$relrecs = $db->queryDirect(sprintf("SELECT ID, guid FROM releases WHERE nzbstatus = 1 AND nzb_guid IS NULL ORDER BY ID DESC LIMIT 10000"));
|
||||
}
|
||||
$total = $relrecs->rowCount();
|
||||
if ($total > 0) {
|
||||
echo $c->header("Creating nzb_guids for " . number_format($total) . " releases.");
|
||||
$functions = new Functions();
|
||||
$nzb = new Enzebe();
|
||||
$reccnt = 0;
|
||||
foreach ($relrecs as $relrec) {
|
||||
$reccnt++;
|
||||
$nzbpath = $nzb->NZBPath($relrec['guid']);
|
||||
if ($nzbpath !== false) {
|
||||
$nzbpath = 'compress.zlib://' . $nzbpath;
|
||||
$nzbfile = @simplexml_load_file($nzbpath);
|
||||
if (!$nzbfile) {
|
||||
if (isset($delete) && $delete == 'delete') {
|
||||
//echo "\n".$nzb->NZBPath($relrec['guid'])." is not a valid xml, deleting release.\n";
|
||||
$functions->fastDelete($relrec['ID'], $relrec['guid']);
|
||||
$deleted++;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
$binary_names = array();
|
||||
foreach ($nzbfile->file as $file) {
|
||||
$binary_names[] = $file["subject"];
|
||||
}
|
||||
if (count($binary_names) == 0) {
|
||||
if (isset($delete) && $delete == 'delete') {
|
||||
//echo "\n".$nzb->NZBPath($relrec['guid'])." has no binaries, deleting release.\n";
|
||||
$functions->fastDelete($relrec['ID'], $relrec['guid']);
|
||||
$deleted++;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
asort($binary_names);
|
||||
$segment = "";
|
||||
foreach ($nzbfile->file as $file) {
|
||||
if ($file["subject"] == $binary_names[0]) {
|
||||
$segment = $file->segments->segment;
|
||||
$nzb_guid = md5($segment);
|
||||
|
||||
$db->exec("UPDATE releases set nzb_guid = " . $db->escapestring($nzb_guid) . " WHERE ID = " . $relrec["ID"]);
|
||||
$relcount++;
|
||||
$consoletools->overWritePrimary("Created: [" . $deleted . "] " . $consoletools->percentString($reccnt, $total) . " Time:" . $consoletools->convertTimer(TIME() - $timestart));
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (isset($delete) && $delete == 'delete') {
|
||||
//echo $c->primary($nzb->NZBPath($relrec['guid']) . " does not have an nzb, deleting.");
|
||||
$functions->fastDelete($relrec['ID'], $relrec['guid']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($relcount > 0) {
|
||||
echo "\n";
|
||||
}
|
||||
echo $c->header("Updated " . $relcount . " release(s). This script ran for " . $consoletools->convertTime(TIME() - $timestart));
|
||||
} else {
|
||||
echo $c->info('Query time: ' . $consoletools->convertTime(TIME() - $timestart));
|
||||
exit($c->info("No releases are missing the guid."));
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,65 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# Written by convict
|
||||
import sys, os, shutil
|
||||
import platform, subprocess, re, os, json, urllib2
|
||||
|
||||
def runGit(args):
|
||||
git_locations = ['git']
|
||||
run_dir = os.getcwd()
|
||||
|
||||
if platform.system().lower() == 'darwin':
|
||||
git_locations.append('/usr/local/git/bin/git')
|
||||
|
||||
output = err = None
|
||||
for cur_git in git_locations:
|
||||
cmd = cur_git + ' ' + args
|
||||
try:
|
||||
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True, cwd=run_dir)
|
||||
output, err = p.communicate()
|
||||
except OSError:
|
||||
print 'Command "%s" did not work. Could not find git.' % cmd
|
||||
continue
|
||||
|
||||
if 'not found' in output or 'not recognized as an internal or external command' in output:
|
||||
print 'Unable to find git with command "%s"' % cmd
|
||||
output = None
|
||||
elif 'fatal:' in output or err:
|
||||
print 'Git returned bad info. Are you sure this is a git installation?'
|
||||
output = None
|
||||
elif output:
|
||||
break
|
||||
return (output, err)
|
||||
|
||||
def gitCurrentVersion():
|
||||
output, err = runGit('rev-parse HEAD')
|
||||
|
||||
if not output:
|
||||
print 'Could not find latest installed version with git.'
|
||||
return None
|
||||
|
||||
current_commit = output.strip()
|
||||
|
||||
if not re.match('^[a-z0-9]+$', current_commit):
|
||||
print 'Git output does not look like a hash, not using it.'
|
||||
return None
|
||||
|
||||
return current_commit
|
||||
|
||||
def latestCommit():
|
||||
url = 'https://api.github.com/repos/DariusIII/newznab-tmux/commits/master'
|
||||
result = urllib2.urlopen(url).read()
|
||||
git = json.JSONDecoder().decode(result)
|
||||
return git['sha']
|
||||
|
||||
def commitsBehind():
|
||||
url = 'https://api.github.com/repos/DariusIII/newznab-tmux/compare/%s...%s' % (gitCurrentVersion(), latestCommit())
|
||||
try:
|
||||
result = urllib2.urlopen(url).read()
|
||||
except urllib2.HTTPError:
|
||||
return None
|
||||
git = json.JSONDecoder().decode(result)
|
||||
return git['total_commits']
|
||||
|
||||
if __name__ == '__main__':
|
||||
print 'You are %s commits behind.' % commitsBehind()
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
require(dirname(__FILE__) . "/../bin/config.php");
|
||||
require_once(WWW_DIR . "/lib/framework/db.php");
|
||||
|
||||
$db = new DB;
|
||||
|
||||
|
||||
$rel = $db->query("update groups set backfill_target=0, first_record=0, first_record_postdate=null, last_record=0, last_record_postdate=null, last_updated=null");
|
||||
printf("Reseting all groups completed.\n");
|
||||
|
||||
$arr = array("parts", "partrepair", "binaries");
|
||||
foreach ($arr as &$value) {
|
||||
$rel = $db->query("truncate table $value");
|
||||
printf("Truncating $value completed.\n");
|
||||
}
|
||||
unset($value);
|
||||
|
||||
//get variables from config.sh and defaults.sh
|
||||
$path = dirname(__FILE__);
|
||||
$varnames = shell_exec("cat " . $path . "/../config.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'");
|
||||
$varnames .= shell_exec("cat " . $path . "/../defaults.sh | grep ^export | cut -d \= -f1 | awk '{print $2;}'");
|
||||
$vardata = shell_exec("cat " . $path . "/../config.sh | grep ^export | cut -d \\\" -f2 | awk '{print $1;}'");
|
||||
$vardata .= shell_exec("cat " . $path . "/../defaults.sh | grep ^export | cut -d \\\" -f2 | awk '{print $1;}'");
|
||||
$varnames = explode("\n", $varnames);
|
||||
$vardata = explode("\n", $vardata);
|
||||
$array = array_combine($varnames, $vardata);
|
||||
unset($array['']);
|
||||
|
||||
$TESTING = "{$array['NEWZPATH']}{$array['TESTING_PATH']}";
|
||||
passthru("cd $TESTING && php spotnab.php -r");
|
||||
@@ -1,13 +0,0 @@
|
||||
<?php
|
||||
require(dirname(__FILE__) . "/../bin/config.php");
|
||||
require_once(WWW_DIR . "/lib/framework/db.php");
|
||||
|
||||
$db = new DB;
|
||||
|
||||
$arr = array("parts", "partrepair", "binaries");
|
||||
|
||||
foreach ($arr as &$value) {
|
||||
$rel = $db->query("truncate table $value");
|
||||
printf("Truncating $value completed.\n");
|
||||
}
|
||||
unset($value);
|
||||
Reference in New Issue
Block a user