/**
     * Returns a merge operation's progress, as a rounded percentage
     *
     * @return int
     */
    public function progress()
    {
        try {
            $currentTargetSize = mmMkvManagerDiskHelper::bigFileSize( $this->targetFile );
        } catch( ezcBaseFileNotFoundException $e ) {
            return 0;
        }

        return round( $currentTargetSize / $this->targetFileSize * 100 );
    }
    public function __get( $property )
    {
    	$tvShowPath = ezcConfigurationManager::getInstance()->getSetting( 'tv', 'GeneralSettings', 'SourcePath' );
        switch( $property )
        {
            case 'hasSubtitleFile':
                $basedirAndFile = "{$tvShowPath}/{$this->showName}/{$this->fullname}";
                return ( file_exists( "$basedirAndFile.srt" ) || file_exists( "$basedirAndFile.ass" ) );
                break;

            case 'subtitleFile':
                $basedirAndFile = "{$tvShowPath}/{$this->showName}/{$this->fullname}";
                if ( file_exists( "$basedirAndFile.ass" ) )
                    return "$basedirAndFile.ass";
                elseif ( file_exists( "$basedirAndFile.srt" ) )
                {
                    return "$basedirAndFile.srt";
                }
                else
                {
                    throw new Exception("No subtitle found for $this->filename" );
                }
                break;

            case 'path':
                return "{$tvShowPath}/{$this->showName}/{$this->filename}";
                break;

            case 'downloadedFile':
                $db = ezcDbInstance::get( 'sickbeard' );

                // show ID
                $q = $db->createSelectQuery();
                $q->select( 'tvdb_id' )
                  ->from( 'tv_shows' )
                  ->where( $q->expr->eq( 'show_name', $q->bindValue( $this->showName ) ) );

                /**
                 * @var PDOStatement
                 */
                $stmt = $q->prepare();
                $stmt->execute();
                $showId = $stmt->fetchColumn();

                // downloaded file name
                $q = $db->createSelectQuery();
                $e = $q->expr;
                $q->select( 'resource' )
                  ->from( 'history' )
                  ->where( $e->lAnd(
                      $e->eq( 'action', $q->bindValue( 404 ) ),
                      $e->eq( 'showid', $q->bindValue( $showId) ),
                      $e->eq( 'season', $q->bindValue( $this->seasonNumber) ),
                      $e->eq( 'episode', $q->bindValue( $this->episodeNumber ) )
                  ) );
                $stmt = $q->prepare();
                $stmt->execute();
                return new TVEpisodeDownloadedFile( basename( $downloadedFile = $stmt->fetchColumn() ) );

            case 'fileSize':
                return mmMkvManagerDiskHelper::bigFileSize( $this->path );

            default:
                throw new ezcBasePropertyNotFoundException( $property );
        }
    }