Ejemplo n.º 1
0
    /**
     * Merge interface for movies
     * @param string $this->Folder The name of the movie folder
     */
    public function doMovieMerge()
    {
        $moviesPath = ezcConfigurationManager::getInstance()->getSetting( 'movies', 'GeneralSettings', 'SourcePath' );
        $result = new ezcMvcResult;
        $result->variables['page_title'] = "{$this->Folder} :: Movies :: MKV Manager";
        $result->variables['movie'] = $this->Folder;

        $generator = new MKVMergeCommandGenerator();

        // video file, mandatory
        $videoFiles = glob( "{$moviesPath}/{$this->Folder}/{$this->Folder}.{mkv,avi}", GLOB_BRACE );
        if ( !count( $videoFiles ) )
        {
            throw new InvalidArgumentException( "No files found matching pattern {$moviesPath}/{$this->Folder}/{$this->Folder}.{mkv,avi}" );
        }
        $videoFiles = $videoFiles[0];
        $generator->addInputFile( new MKVMergeMediaInputFile( $videoFiles ) );

        // subtitle file(s), optional
        $subtitlesFiles = glob( "{$moviesPath}/{$this->Folder}/{$this->Folder}*.{srt,avi}", GLOB_BRACE );
        if ( count( $subtitlesFiles ) )
        {
        }
        foreach( $subtitlesFiles as $subtitlesFile )
        {
            $generator->addInputFile( new MKVMergeSubtitleInputFile( $subtitlesFile, 'und' ) );
        }

        $tracks = array();
        foreach ( $generator->trackSets as $trackSet )
        {
            foreach ( $trackSet as $track )
            {
                $tracks[] = $track;
            }
        }

        // output file
        $generator->setOutputFile( "/media/storage/VIMES/Movies/{$this->Folder}/{$this->Folder}.mkv" );

        $result->variables['tracks'] = $tracks;
        $result->variables['command'] = $generator->getCommandString();

        $result->variables += mmApp::doMovies();
        return $result;
    }
    public function testGenerateRealTVMKV()
    {
        self::markTestSkipped();

        $mkvFile = '/home/download/downloads/complete/TV/Sorted/Californication/Californication - 4x09 - Another Perfect Day.mkv';
        $assFile = '/home/download/downloads/complete/TV/Sorted/Californication/Californication - 4x09 - Another Perfect Day.ass';

        $generator = new MKVMergeCommandGenerator();

        foreach( $generator->addInputFile( new MKVMergeMediaInputFile( $mkvFile ) ) as $commandTrack )
        {
            $commandTrack->language = 'eng';
        }

        foreach( $generator->addInputFile( new MKVMergeMediaInputFile( $assFile ) ) as $commandTrack )
        {
            $commandTrack->language = 'fre';
        }

        $generator->setOutputFile( '/media/storage/CARROT/TV Shows/Californication/Californication - 4x09 - Another Perfect Day.mkv' );
        $command = $generator->getCommandString();

        // echo $command;
    }