Skip to content

Instantly share code, notes, and snippets.

@OstlerDev
Last active August 29, 2015 14:23
Show Gist options
  • Save OstlerDev/afa32b9b2bfc8ab1e2d4 to your computer and use it in GitHub Desktop.
Save OstlerDev/afa32b9b2bfc8ab1e2d4 to your computer and use it in GitHub Desktop.
Get Strike Parser
<?php
$titles = [
'MyTV.Show.S09E01.HDTV.XviD',
'Game of Thrones S05E04 WEBRip XviD-FUM[ettv]',
'Breaking Bad S01E07 FINAL FRENCH DVDRip XviD-JMT',
'Breaking Bad S01E02 720p x265 HEVC - UTR'];
foreach($titles as $title){
$pattern = "/S(\d+)E(\d+)\.(.+)/";
preg_match($pattern, str_replace(' ', '.', $title), $matches);
$qualities = ['HDTV', '720p', '1080p'];
$epqual = 'HDTV';
foreach($qualities as $quality){
if (stripos($matches[3], $quality) !== false) $epqual = $quality;
}
print_r('Season ' . $matches[1] . ' Episode ' . $matches[2] . ' Quality ' . $epqual . "\r\n");
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment