Skip to content

Commit

Permalink
version 1.2.4
Browse files Browse the repository at this point in the history
~ Improved
	~ Sports parsing: MLB, NHL, Formula X, Indycar, Moto X
	~ Slovenian language
	~ Bluray source
	~ XXX type title parsing
	~ Ringtone flag
+ Added
	+ HR flag
	+ Vertical flag
	+ Test case
  • Loading branch information
pr0pz committed Aug 25, 2023
1 parent e458082 commit cb693e8
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 39 deletions.
70 changes: 55 additions & 15 deletions ReleaseParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
* @package ReleaseParser
* @author Wellington Estevo
* @version 1.2.3
* @version 1.2.4
*/

class ReleaseParser extends ReleasePatterns
Expand Down Expand Up @@ -1119,25 +1119,63 @@ private function parseTitle()

// XXX
case 'xxx':
$matches = [];

// Setup regex pattern
$regex_pattern = !empty( $this->get( 'date' ) ) ? self::REGEX_TITLE_XXX_DATE : self::REGEX_TITLE_XXX;
$regex_used = !empty( $this->get( 'date' ) ) ? 'REGEX_TITLE_XXX_DATE' : 'REGEX_TITLE_XXX';
// Some XXX releases with episode
if ( !empty( $this->get( 'episode' ) ) )
{
// Check for episode
$regex_pattern = self::REGEX_TITLE_TV;
$regex_used = 'REGEX_TITLE_TV';

// Search and replace pattern in regex pattern for better matching
$regex_pattern = $this->cleanupPattern( $this->release, $regex_pattern, [ 'flags', 'year', 'language', 'source', 'regex_date', 'regex_date_monthname' ] );
// Match title
\preg_match( $regex_pattern, $release_name_cleaned, $matches );

// Check for matches with regex title tv
if ( !empty( $matches ) )
{
$title = $matches[1];

// Match title
\preg_match( $regex_pattern, $release_name_cleaned, $matches );
// Build pattern and try to get episode title
// So search and replace needed data to match properly.
$regex_pattern = self::REGEX_TITLE_TV_EPISODE;
$regex_used .= ' + REGEX_TITLE_TV_EPISODE';

if ( !empty( $matches ) )
// Search and replace pattern in regex pattern for better matching
//$regex_pattern = $this->cleanupPattern( $this->release, $regex_pattern, [ 'flags', 'format', 'language', 'resolution', 'source' ] );
$release_name_cleaned = $this->cleanup( $release_name_cleaned, [ 'audio', 'flags', 'format', 'language', 'resolution', 'source' ] );

// Match episode title
\preg_match( $regex_pattern, $release_name_cleaned, $matches );

$title_extra = !empty( $matches[1] ) && $matches[1] !== '.' ? $matches[1] : '';

break;
}
}

// Default pattern
if ( empty( $title ) )
{
// 1st Match = Publisher, Website, etc.
$title = $matches[1];
// 2nd Match = Specific release name (movie/episode/model name, etc.)
$title_extra = !empty( $matches[2] ) ? $matches[2] : '';
// Setup regex pattern
$regex_pattern = !empty( $this->get( 'date' ) ) ? self::REGEX_TITLE_XXX_DATE : self::REGEX_TITLE_XXX;
$regex_used = !empty( $this->get( 'date' ) ) ? 'REGEX_TITLE_XXX_DATE' : 'REGEX_TITLE_XXX';

break;
// Search and replace pattern in regex pattern for better matching
$regex_pattern = $this->cleanupPattern( $this->release, $regex_pattern, [ 'flags', 'year', 'language', 'source', 'regex_date', 'regex_date_monthname' ] );

// Match title
\preg_match( $regex_pattern, $release_name_cleaned, $matches );

if ( !empty( $matches ) )
{
// 1st Match = Publisher, Website, etc.
$title = $matches[1];
// 2nd Match = Specific release name (movie/episode/model name, etc.)
$title_extra = !empty( $matches[2] ) ? $matches[2] : '';

break;
}
}

// Jump to default if no title found
Expand Down Expand Up @@ -1340,7 +1378,9 @@ private function parseAttribute( array $attribute, string $type = '' )
$attr_key === 'V2' ||
$attr_key === 'V3' ||
$attr_key === 'Cover' ||
$attr_key === 'Docu'
$attr_key === 'Docu' ||
$attr_key === 'HR' ||
$attr_key === 'Vertical'
)
{
$pattern = $this->cleanupPattern( $this->release, $pattern, [ 'flags', 'format', 'source', 'language', 'resolution' ] );
Expand Down
9 changes: 8 additions & 1 deletion ReleaseParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*
* @package ReleaseParser
* @author Wellington Estevo
* @version 1.2.3
* @version 1.2.4
*/

/**
Expand Down Expand Up @@ -438,6 +438,13 @@ function release_parser_test()
new ReleaseParser( 'NaughtyAmerica.com_17.10.12.Sloan.Harper.Sean.Lawless.Dirty.Wives.Club.XXX.IMAGESET-FuGLi', 'imgset' ),
'Publisher: NaughtyAmerica.com / Title: Sloan Harper Sean Lawless Dirty Wives Club / Group: FuGLi / Year: 2017 / Date: 12.10.2017 / Flags: Imageset, XXX / Type: XXX'
],
// XXX #2 - XXX with episode and special flags
[
new ReleaseParser( 'Lustery.E727.Leo.And.Madly.A.Happy.Ending.For.Him.XXX.VERTICAL.HRp.MP4-WRB', 'XXX' ),
'Publisher: Lustery / Title: Leo And Madly A Happy Ending For Him / Group: WRB / Episode: 727 / Flags: HR, Vertical, XXX / Format: MP4 / Type: XXX'
],



// MusicVideo
// MusicVideo #1 - Recorded on a live show with special date (like normal music live recording)
Expand Down
44 changes: 23 additions & 21 deletions ReleasePatterns.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* @package ReleaseParser
* @author Wellington Estevo
* @version 1.2.3
* @version 1.2.4
*/

class ReleasePatterns {
Expand Down Expand Up @@ -93,7 +93,7 @@ class ReleasePatterns {
// Sports
'Sports' => 'sport',
// XXX Sections
'XXX' => [ 'xxx', 'imgset' ],
'XXX' => [ 'xxx', 'imgset', 'imageset' ],
// Movie Sections
'Movie' => [ 'movie', '(?!tv).*26[45]', 'bluray', 'dvdr', 'xvid', 'divx' ],
];
Expand Down Expand Up @@ -192,8 +192,8 @@ class ReleasePatterns {
'MiniDisc' => [ 'md', 'minidisc' ], // Needs to be at the end, since some music releases has MD as source, but normally is MicDubbed for movies, so would wrongfully parse
// Misc Fallback
'CD' => [ '\d*cdr?\d*', 'cd[._-]?rom' ], // Other CD
'DVD' => '(Complete[._-])?\d*dvd[_-]?[r\d]?', // Just normal DVD
'Bluray' => [ 'blu[._-]?ray', '\d*bdr' ],
'DVD' => '(Complete.)?\d*dvd[_-]?[r\d]?', // Just normal DVD
'Bluray' => [ 'bl?u.?r[ae]y', '\d*bdr' ],
'RiP' => 'rip', // If no other rip matches
// Parse EP source last, it's part of the name if other source given
'EP' => 'EP',
Expand Down Expand Up @@ -221,12 +221,12 @@ class ReleasePatterns {
'CVD' => 'CVD',
'CVCD' => 'CVCD', // Compressed Video CD
'SVCD' => 'X?SVCD',
'VC1' => '(?:Bluray[._-])?VC[._-]?1',
'VC1' => '(?:Blu.?ray.)?VC.?1',
'WMV' => 'WMV',
'MDVDR' => 'MDVDR?',
'DVDR' => 'DVD[R\d]',
'MBluray' => '(Complete[._-])?MBLURAY',
'Bluray' => '(complete[._-]?)?bluray',
'MBluray' => '(Complete.?)?MBLURAY',
'Bluray' => '(complete.?)?bluray',
'MViD' => 'MViD',
// Ebook formats
'AZW' => 'AZW',
Expand All @@ -240,17 +240,17 @@ class ReleasePatterns {
'PDF' => 'PDF',
// Music formats
'DAISY' => 'DAISY', // Audiobook
'FLAC' => '(?:WEB[._-]?)?FLAC',
'FLAC' => '(?:WEB.?)?FLAC',
'KONTAKT' => 'KONTAKT',
'MP3' => 'MP3',
'WAV' => 'WAV',
'3GP' => '3gp',
// Software format
'ISO' => '(?:Bootable[._-])?ISO',
'ISO' => '(?:Bootable.)?ISO',
// Font format
'CrossPlatform' => 'Cross(?:Format|Platform)',
'OpenType' => 'Open[._-]?Type',
'TrueType' => 'True[._-]?Type',
'OpenType' => 'Open.?Type',
'TrueType' => 'True.?Type',
// Software/Game format
'Java Platform, Micro Edition' => 'j2me(?:v\d*)?',
'Java' => 'JAVA',
Expand Down Expand Up @@ -426,7 +426,7 @@ class ReleasePatterns {
'pt-BR' => [ 'Brazilian(?:.portuguese)?', 'BR' ],
'ro' => 'Romanian',
'ru' => [ 'Russian', 'RU' ],
'sk' => [ 'Slovak', 'SK', 'SLO', 'Slovenian' ],
'sk' => [ 'Slovak', 'SK', 'SLO', 'Slovenian', 'SI' ],
'sv' => [ 'Swedish', 'SW?E' ],
'sw' => 'Swahili',
'tg' => 'Tajik',
Expand Down Expand Up @@ -493,6 +493,7 @@ class ReleasePatterns {
'HLG' => 'HLG', // Hybrid log-gamma (like HDR)
'HOTFiX' => 'HOT.?FIX',
'HOU' => 'HOU',
'HR' => 'HRp?.(%flags%|%format%|%source%|%year%)', // High resolution
'HSBS' => 'HS(?:BS)?',
'Hybrid' => 'HYBRID',
'Imageset' => '(?:Full[._-]?)?(?:IMA?GE?|photo|foto).?SETS?',
Expand Down Expand Up @@ -538,7 +539,7 @@ class ReleasePatterns {
'RERiP' => 're.?rip',
'Restored' => 'RESTORED',
'Retail' => 'RETAIL',
'Ringtone' => 'rtone',
'Ringtone' => 'rtones?',
'Samplefix' => 'SAMPLE.?FIX',
'SDR' => 'SDR',
'Serial' => 'SERIAL(?!.Killer)?', // Software
Expand Down Expand Up @@ -569,9 +570,10 @@ class ReleasePatterns {
'Untouched' => 'UNTOUCHED',
'USK' => 'USK', // German rating system
'Update' => '(WITH.)?UPDATE',
'V1' => 'V1[._-](%format%|%language%|%source%|%resolution%)',
'V2' => 'V2[._-](%format%|%language%|%source%|%resolution%)',
'V3' => 'V3[._-](%format%|%language%|%source%|%resolution%)',
'V1' => 'V1.(%format%|%language%|%source%|%resolution%)',
'V2' => 'V2.(%format%|%language%|%source%|%resolution%)',
'V3' => 'V3.(%format%|%language%|%source%|%resolution%)',
'Vertical' => 'Vertical.(hrp?|xxx|%format%|%source%|%resolution%)',
'VKI' => 'VKI', // Variable Keyframe Intervals
'VR' => 'VR', // Virtual reality
'VR180' => 'VR180',
Expand Down Expand Up @@ -623,17 +625,17 @@ class ReleasePatterns {
'caf', // African
'afc.asian', // Asian
// Racing
'Formul[ae].?[1234E]',
'Formul[ae].?[1234E].\d{4}',
'F\d.\d{4}',
'Superleague.Formula',
'Nascar.(?:cup|truck|xfinity)',
'Indycar',
'Indycar\.(series|racing|\d{4})',
'Porsche.(Carrera|sprint)',
'DTM.(\d{2,4}|spa|lauszitzring|gp\d+|\d+.lauf)',
'wrc.(?:fia|\d{4})', // Rallye
'Supercars.championship',
'W.series.\d{4}',
'Moto.?(GP|[123])',
'Moto.?(GP|\d).\d{4}',
// Cycling
'Cycling.(?:volta|giro|tour|strade|paris|criterium|liege|fleche|amstel|la.vuelta)', // International
'giro.d.italia', // Italy
Expand All @@ -657,9 +659,9 @@ class ReleasePatterns {
'wwe.(?:nxt|friday|this|main|monday|wrestlemania)',
'aew.(?:collision|dynamite|dark)',
// Hockey
'NHL',
'NHL\.(?:\d{4}|stanley.cup|playoffs)',
// Baseball
'MLB',
'MLB.(?:\d{4}|spring|world.series|pre.?season|playoffs|ws|alcs)',
// Boxing
'boxing.\d{4}.\d{2}.\d{2}',
// Sumo
Expand Down
14 changes: 14 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
version 1.2.4 ( updated 25.08.2023 )
~ Improved
~ Sports parsing: MLB, NHL, Formula X, Indycar, Moto X
~ Slovenian language
~ Bluray source
~ XXX type title parsing
~ Ringtone flag
+ Added
+ HR flag
+ Vertical flag
+ Test case

***

version 1.2.3 ( updated 24.08.2023 )
~ Improved
~ Screener matching
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "propz/release-parser",
"version": "1.2.3",
"version": "1.2.4",
"description": "A library for parsing scene release names into human readable data.",
"keywords": [
"parser",
Expand All @@ -16,7 +16,7 @@
],
"homepage": "https://github.com/pr0pz/scene-release-parser-php#readme",
"readme": "README.md",
"time": "2023-08-24",
"time": "2023-08-25",
"license": "MIT",
"autoload": {
"classmap": [
Expand Down

0 comments on commit cb693e8

Please sign in to comment.