PHP code example of cwhite92 / scene-release-parser-php

1. Go to this page and download the library: Download cwhite92/scene-release-parser-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

cwhite92 / scene-release-parser-php example snippets


use thcolin\SceneReleaseParser\Release;

// Optionals arguments
$strict = true; // if no tags found, it will throw an exception
$defaults = []; // defaults values for : language, resolution and year

$Release = new Release("Mr.Robot.S01E05.PROPER.VOSTFR.720p.WEB-DL.DD5.1.H264-ARK01", $strict, $defaults);

// TYPE
echo($Release -> getType()); // tvshow (::TVSHOW)

// TITLE
echo($Release -> getTitle()); // Mr Robot

// LANGUAGE
echo($Release -> getLanguage()); // VOSTFR

// YEAR
echo($Release -> getYear()); // null (no tag in the release name)
echo($Release -> guessYear()); // 2015 (year of the system)
echo($Release -> guess() -> getYear()); // 2015 (year of the system)

// RESOLUTION
echo($Release -> getResolution()); // 720p

// SOURCE
echo($Release -> getSource()); // WEB

// DUB
echo($Release -> getDub()); // null (no tag in the release name)

// ENCODING
echo($Release -> getEncoding()); // h264

// GROUP
echo($Release -> getGroup()); // ARK01

// FLAGS
print_r($Release -> getFlags()); // [PROPER, DD5.1]

// SCORE
echo($Release -> getScore()); // 7 (bigger is better, max : 7)

// ONLY TVSHOW
echo($Release -> getSeason()); // 1
echo($Release -> getEpisode()); // 5

use thcolin\SceneReleaseParser\Release;

$Release = new Release("Bataille a Seattle BDRip", false, [
  'language' => 'FRENCH' // default to Release::LANGUAGE_DEFAULT (VO)
]);

// LANGUAGE
echo($Release -> getLanguage()); // null
echo($Release -> guessLanguage()); // FRENCH

// RESOLUTION
echo($Release -> getResolution()); // null
echo($Release -> guessResolution()); // SD

// YEAR
echo($Release -> getYear()); // null
echo($Release -> guessYear()); // 2017 (current year)

// Will set guessed values to the Release
$Release -> guess();

// LANGUAGE
echo($Release -> getLanguage()); // FRENCH

// RESOLUTION
echo($Release -> getResolution()); // SD

// YEAR
echo($Release -> getYear()); // 2017 (current year)

use thcolin\SceneReleaseParser\Release;

// Mhor\MediaInfo::setConfig arguments (default to empty)
$mediainfo = [
  // Optional, just for example
  'command' => '/usr/local/bin/mediainfo'
];

$Release = Release::analyze('/home/downloads/Bataille a Seattle BDRip.avi', $mediainfo);

// RELEASE
echo($Release -> getRelease(Release::GENERATED_RELEASE)): // Bataille.A.Seattle.FRENCH.720p.BDRip.x264-NOTEAM

// RESOLUTION
echo($Release -> getResolution()); // 720p

// ENCODING
echo($Release -> getEncoding()); // x264

// LANGUAGE
echo($Release -> getLanguage()); // FRENCH