Skip to content

Commit

Permalink
Update relationship
Browse files Browse the repository at this point in the history
  • Loading branch information
DariusIII committed Jan 1, 2025
1 parent f4c067c commit 34bf090
Show file tree
Hide file tree
Showing 48 changed files with 206 additions and 200 deletions.
6 changes: 3 additions & 3 deletions Blacklight/Books.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function getBookInfo($id)

public function getBookInfoByName(string $title): ?Model
{
//only used to get a count of words
// only used to get a count of words
$searchWords = '';
$title = preg_replace(['/( - | -|\(.+\)|\(|\))/', '/[^\w ]+/'], [' ', ''], $title);
$title = trim(trim(preg_replace('/\s\s+/i', ' ', $title)));
Expand Down Expand Up @@ -350,10 +350,10 @@ public function parseTitle($release_name, $releaseID, $releasetype)
$a = preg_replace('/\d{1,2} \d{1,2} \d{2,4}|(19|20)\d\d|anybody got .+?[a-z]\? |[ ._-](Novel|TIA)([ ._-]|$)|([ \.])HQ([-\. ])|[\(\)\.\-_ ](AVI|AZW3?|DOC|EPUB|LIT|MOBI|NFO|RETAIL|(si)?PDF|RTF|TXT)[\)\]\.\-_ ](?![a-z0-9])|compleet|DAGSTiDNiNGEN|DiRFiX|\+ extra|r?e ?Books?([\.\-_ ]English|ers)?|azw3?|ePu([bp])s?|html|mobi|^NEW[\.\-_ ]|PDF([\.\-_ ]English)?|Please post more|Post description|Proper|Repack(fix)?|[\.\-_ ](Chinese|English|French|German|Italian|Retail|Scan|Swedish)|^R4 |Repost|Skytwohigh|TIA!+|TruePDF|V413HAV|(would someone )?please (re)?post.+? "|with the authors name right/i', '', $release_name);
$b = preg_replace('/^(As Req |conversion |eq |Das neue Abenteuer \d+|Fixed version( ignore previous post)?|Full |Per Req As Found|(\s+)?R4 |REQ |revised |version |\d+(\s+)?$)|(COMPLETE|INTERNAL|RELOADED| (AZW3|eB|docx|ENG?|exe|FR|Fix|gnv64|MU|NIV|R\d\s+\d{1,2} \d{1,2}|R\d|Req|TTL|UC|v(\s+)?\d))(\s+)?$/i', '', $a);

//remove book series from title as this gets more matches on amazon
// remove book series from title as this gets more matches on amazon
$c = preg_replace('/ - \[.+\]|\[.+\]/', '', $b);

//remove any brackets left behind
// remove any brackets left behind
$d = preg_replace('/(\(\)|\[\])/', '', $c);
$releasename = trim(preg_replace('/\s\s+/i', ' ', $d));

Expand Down
2 changes: 1 addition & 1 deletion Blacklight/Categorize.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public function isTV(): bool
public function isOtherTV(): bool
{
if (preg_match('/[._ -]S\d{1,3}.+(EP\d{1,3}|Extras|SUBPACK)[._ -]|News/i', $this->releaseName)
//special case for "Have.I.Got.News.For.You" tv show
// special case for "Have.I.Got.News.For.You" tv show
&& ! preg_match('/[._ -]Got[._ -]News[._ -]For[._ -]You/i', $this->releaseName)
) {
$this->tmpCat = Category::TV_OTHER;
Expand Down
2 changes: 1 addition & 1 deletion Blacklight/CollectionsCleaning.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ protected function generic(): array
*/
protected function musicSubject(): bool|string
{
//Broderick_Smith-Unknown_Country-2009-404 "00-broderick_smith-unknown_country-2009.sfv" yEnc
// Broderick_Smith-Unknown_Country-2009-404 "00-broderick_smith-unknown_country-2009.sfv" yEnc
if (preg_match('/^(\w{10,}-[a-zA-Z0-9]+ ")\d\d-.+?" yEnc$/', $this->subject, $hit)) {
return $hit[1];
}
Expand Down
14 changes: 7 additions & 7 deletions Blacklight/Console.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public function getConsoleInfo($id)
*/
public function getConsoleInfoByName(string $title, string $platform)
{
//only used to get a count of words
// only used to get a count of words
$searchWords = '';

$title = preg_replace('/( - | -|\(.+\)|\(|\))/', ' ', $title);
Expand Down Expand Up @@ -330,7 +330,7 @@ protected function _matchConToGameInfo(array $gameInfo = [], array $con = []): b
// This actual compares the two strings and outputs a percentage value.
$titlepercent = $platformpercent = '';

//Remove import tags from console title for match
// Remove import tags from console title for match
$con['title'] = trim(preg_replace('/([\[|\(]).{2,} import([\]|\)])$/i', '', $con['title']));

similar_text(strtolower($gameInfo['title']), strtolower($con['title']), $titlepercent);
Expand Down Expand Up @@ -427,8 +427,8 @@ protected function _matchGenre($amaz): array
$genreName = '';

if (isset($amaz->BrowseNodes)) {
//had issues getting this out of the browsenodes obj
//workaround is to get the xml and load that into its own obj
// had issues getting this out of the browsenodes obj
// workaround is to get the xml and load that into its own obj
$amazGenresXml = $amaz->BrowseNodes->asXml();
$amazGenresObj = simplexml_load_string($amazGenresXml);
$amazGenres = $amazGenresObj->xpath('//Name');
Expand Down Expand Up @@ -805,9 +805,9 @@ public function parseTitle($releaseName)
// Replace dots, underscores, or brackets with spaces.
$result['title'] = str_replace(['.', '_', '%20', '[', ']'], ' ', $title);
$result['title'] = str_replace([' RF ', '.RF.', '-RF-', '_RF_'], ' ', $result['title']);
//Remove format tags from release title for match
// Remove format tags from release title for match
$result['title'] = trim(preg_replace('/PAL|MULTI(\d)?|NTSC-?J?|\(JAPAN\)/i', '', $result['title']));
//Remove disc tags from release title for match
// Remove disc tags from release title for match
$result['title'] = trim(preg_replace('/Dis[ck] \d.*$/i', '', $result['title']));

// Needed to add code to handle DLC Properly.
Expand Down Expand Up @@ -930,7 +930,7 @@ public function matchBrowseNode($nodeName)
{
$str = '';

//music nodes above mp3 download nodes
// music nodes above mp3 download nodes
switch ($nodeName) {
case 'Action_shooter':
case 'Action_Games':
Expand Down
2 changes: 1 addition & 1 deletion Blacklight/ElasticSearchSiteSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ protected function search(array $search, bool $fullResults = false): array

// Execute a Scroll request and repeat
$results = Elasticsearch::scroll([
'scroll_id' => $scroll_id, //...using our previously obtained _scroll_id
'scroll_id' => $scroll_id, // ...using our previously obtained _scroll_id
'scroll' => '30s', // and the same timeout window
]
);
Expand Down
4 changes: 2 additions & 2 deletions Blacklight/Games.php
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ public function update($id, $title, $asin, $url, $publisher, $releaseDate, $esrb
*/
public function updateGamesInfo($gameInfo): bool
{
//wait 10 seconds before proceeding (steam api limit)
// wait 10 seconds before proceeding (steam api limit)
sleep(10);
$gen = new Genres(['Settings' => null]);
$ri = new ReleaseImage;
Expand Down Expand Up @@ -769,7 +769,7 @@ public function matchGenreName($gameGenre): bool|string
{
$str = '';

//Game genres
// Game genres
switch ($gameGenre) {
case 'Action':
case 'Adventure':
Expand Down
2 changes: 1 addition & 1 deletion Blacklight/IRCClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ public function login(string $nickName, string $userName, string $realName, $pas
return false;
}
}
//ERROR :Closing Link: kevin123[100.100.100.100] (This server is full.)
// ERROR :Closing Link: kevin123[100.100.100.100] (This server is full.)
} elseif (preg_match('/^ERROR\s*:/', $this->_buffer)) {
echo $this->_buffer.PHP_EOL;

Expand Down
4 changes: 2 additions & 2 deletions Blacklight/Movie.php
Original file line number Diff line number Diff line change
Expand Up @@ -1059,7 +1059,7 @@ public function processMovieReleases(string $groupID = '', string $guidChar = ''
foreach ($res as $arr) {
// Try to get a name/year.
if (! $this->parseMovieSearchName($arr['searchname'])) {
//We didn't find a name, so set to all 0's so we don't parse again.
// We didn't find a name, so set to all 0's so we don't parse again.
Release::query()->where('id', $arr['id'])->update(['imdbid' => 0000000]);

continue;
Expand Down Expand Up @@ -1191,7 +1191,7 @@ public function processMovieReleases(string $groupID = '', string $guidChar = ''
*/
protected function localIMDBSearch()
{
//If we found a year, try looking in a 4 year range.
// If we found a year, try looking in a 4 year range.
$check = MovieInfo::query()
->where('title', 'like', '%'.$this->currentTitle.'%');

Expand Down
18 changes: 9 additions & 9 deletions Blacklight/Music.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public function getMusicInfo($id)
*/
public function getMusicInfoByName($artist, $album)
{
//only used to get a count of words
// only used to get a count of words
$searchwords = '';
$album = preg_replace('/( - | -|\(.+\)|\(|\))/', ' ', $album);
$album = preg_replace('/[^\w ]+/', '', $album);
Expand Down Expand Up @@ -507,7 +507,7 @@ public function matchBrowseNode($nodeId)
{
$str = '';

//music nodes above mp3 download nodes
// music nodes above mp3 download nodes
switch ($nodeId) {
case '163420':
$str = 'Music Video & Concerts';
Expand All @@ -528,9 +528,9 @@ public function matchBrowseNode($nodeId)
case '624899011':
$str = "Children's Music";
break;
case '173429': //christian
case '2231705011': //gospel
case '624905011': //christian & gospel
case '173429': // christian
case '2231705011': // gospel
case '624905011': // christian & gospel
$str = 'Christian & Gospel';
break;
case '67204':
Expand All @@ -545,8 +545,8 @@ public function matchBrowseNode($nodeId)
case '624976011':
$str = 'Country';
break;
case '7': //dance & electronic
case '624988011': //dance & dj
case '7': // dance & electronic
case '624988011': // dance & dj
$str = 'Dance & Electronic';
break;
case '32':
Expand All @@ -557,8 +557,8 @@ public function matchBrowseNode($nodeId)
case '625011011':
$str = 'Hard Rock & Metal';
break;
case '33': //world music
case '625021011': //international
case '33': // world music
case '625021011': // international
$str = 'World Music';
break;
case '34':
Expand Down
10 changes: 5 additions & 5 deletions Blacklight/NZB.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public function writeNzbForReleaseId(Release $release): bool
$XMLWriter->writeAttribute('type', 'name');
$XMLWriter->text($release->name);
$XMLWriter->endElement();
$XMLWriter->endElement(); //head
$XMLWriter->endElement(); // head

foreach ($collections as $collection) {
$binaries = Binary::whereCollectionsId($collection->id)->select(['id', 'name', 'totalparts'])->orderBy('name')->get();
Expand Down Expand Up @@ -151,7 +151,7 @@ public function writeNzbForReleaseId(Release $release): bool
} else {
return false;
}
$XMLWriter->endElement(); //groups
$XMLWriter->endElement(); // groups
$XMLWriter->startElement('segments');
foreach ($parts as $part) {
if ($nzb_guid === '') {
Expand All @@ -163,12 +163,12 @@ public function writeNzbForReleaseId(Release $release): bool
$XMLWriter->text($part->messageid);
$XMLWriter->endElement();
}
$XMLWriter->endElement(); //segments
$XMLWriter->endElement(); //file
$XMLWriter->endElement(); // segments
$XMLWriter->endElement(); // file
}
}
$XMLWriter->writeComment($this->_siteCommentString);
$XMLWriter->endElement(); //nzb
$XMLWriter->endElement(); // nzb
$XMLWriter->endDocument();
$path = ($this->buildNZBPath($release->guid, $this->nzbSplitLevel, true).$release->guid.'.nzb.gz');
$fp = gzopen($path, 'wb7');
Expand Down
4 changes: 2 additions & 2 deletions Blacklight/NameFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ protected function _getReleases($time, $cats, $query, int $limit = 0): \Illumina
} // 24 hours, all cats
if ($time === 1 && $cats === 2) {
$releases = Release::fromQuery($query.$this->timeall.$queryLimit);
} //other cats
} // other cats
if ($time === 2 && $cats === 1) {
$releases = Release::fromQuery($query.$this->fullother.$queryLimit);
} // all cats
Expand Down Expand Up @@ -1018,7 +1018,7 @@ public function matchPredbFT($pre, $echo, $nameStatus, $show): int
return $matching;
}

//Find release matches with fulltext and then identify exact matches with cleaned LIKE string
// Find release matches with fulltext and then identify exact matches with cleaned LIKE string
$res = Release::fromQuery(
sprintf(
'
Expand Down
2 changes: 1 addition & 1 deletion Blacklight/Nfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ public function processNfoFiles($nntp, string $groupID = '', string $guidChar =
Release::whereId($arr['id'])->update(['nfostatus' => self::NFO_FOUND]);
$ret++;
// Disable for now, we don't want to do full processing on nfo's.
/*$movie->doMovieUpdate($fetchedBinary, 'nfo', $arr['id'], $processImdb);*/
/* $movie->doMovieUpdate($fetchedBinary, 'nfo', $arr['id'], $processImdb); */

// If set scan for tv info.
// Disable for now, we don't want to do full processing on nfo's.
Expand Down
6 changes: 3 additions & 3 deletions Blacklight/PopulateAniDB.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ private function getAniDbAPI($aniDbId)
}
}

//start and end date come from AniDB API as date strings -- no manipulation needed
// start and end date come from AniDB API as date strings -- no manipulation needed
$AniDBAPIArray['startdate'] = $AniDBAPIXML->startdate ?? '0000-00-00';
$AniDBAPIArray['enddate'] = $AniDBAPIXML->enddate ?? '0000-00-00';

Expand Down Expand Up @@ -283,8 +283,8 @@ private function populateMainTable(): void

$animeTitles = new \SimpleXMLElement('compress.zlib://http://anidb.net/api/anime-titles.xml.gz', null, true);

//Even if the update process fails,
//we must mark the last update time or risk ban
// Even if the update process fails,
// we must mark the last update time or risk ban
$this->setLastUpdated();

if ($animeTitles) {
Expand Down
Loading

0 comments on commit 34bf090

Please sign in to comment.