Return the genre ID3 field from an mp3 file.

@return string
189262
public function getGenre()
    {
        if ($this->genre === null) {
            $match = [];
            preg_match(self::$REGEX_GENRE, $this->output, $match);
            $this->genre = array_key_exists(2, $match) ? trim($match[2]) : '';
        }

        return $this->genre;
    }
785897
public function getIndexDefinition()
    {
        return array(
            'filename' => new Search\FieldType\StringField(),
            'alternative_text' => new Search\FieldType\StringField(),
            'file_size' => new Search\FieldType\IntegerField(),
            'mime_type' => new Search\FieldType\StringField(),
        );
    }
1262596
public function getMetaData(): string
    {
        $uri = substr($this->getUri(), strlen(self::PREFIX));

        return Helper::createMetaDataXml(Helper::TRACK_HASH . "{$uri}", "-1", [
            "dc:title"      =>  "",
            "upnp:class"    =>  "object.item.audioItem.musicTrack",
        ], static::$region);
    }
581184
public function getId()
    {
        return sprintf(
          '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
          mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff),
          mt_rand(0, 0x0fff) | 0x4000,
          mt_rand(0, 0x3fff) | 0x8000,
          mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff)
        );
    }
532793
public function getMimeType(){
		if( function_exists( 'finfo_open' ) ){
			$magicFile	= ini_get( 'mime_magic.magicfile' );
//			$magicFile	= str_replace( "\\", "/", $magicFile );
//			$magicFile	= preg_replace( "@\.mime$@", "", $magicFile );
			$fileInfo	= finfo_open( FILEINFO_MIME_TYPE, $magicFile );
			$mimeType	= finfo_file( $fileInfo, realpath( $this->pathName ) );
			finfo_close( $fileInfo );
			return $mimeType;
		}
		else if( substr( PHP_OS, 0, 3 ) != "WIN" ){
			$command	= 'file -b --mime-type '.escapeshellarg( $this->pathName );
			return trim( exec( $command ) );
		}
		else if( function_exists( 'mime_content_type' ) ){
			if( $mimeType = mime_content_type( $this->pathName ) )
				return $mimeType;
		}
		throw new RuntimeException( 'PHP extension Fileinfo is missing' );
	}
1132868
public function getFldTypeForClass()
    {
        $type = 'TYPE_STRING';
        switch ($this->getFldType()) {
            case FFCST::TYPE_INTEGER:
                $type = 'TYPE_INTEGER';
                break;
            case FFCST::TYPE_BIGINT:
                $type = 'TYPE_BIGINT';
                break;
            case FFCST::TYPE_DATETIME:
                $type = 'TYPE_DATETIME';
                break;
            case FFCST::TYPE_MD5:
                $type = 'TYPE_MD5';
                break;
            case FFCST::TYPE_STRING:
                $type = 'TYPE_STRING';
                break;
            case FFCST::TYPE_BOOLEAN:
                $type = 'TYPE_BOOLEAN';
                break;
            case FFCST::TYPE_BLOB:
                $type = 'TYPE_BLOB';
                break;
        }
        return $type;
    }
127188
function toMusicXML() {
        $out = '';
        $n   = 0;
        foreach ($this->notes as $note) {
            if (count($this->notes) > 1 && $n > 0) {
                $note->setProperty('chord', true);
            }

            $out .= $note->toMusicXML();
            $n++;
        }

        return $out;
    }
798582
public function parseSimpleType() {
		if (is_callable('elgg_get_file_simple_type')) {
			return elgg_get_file_simple_type($this->detectMimeType());
		}

		$mime_type = $this->detectMimeType();

		switch ($mime_type) {
			case "application/msword":
			case "application/vnd.openxmlformats-officedocument.wordprocessingml.document":
			case "application/pdf":
				return "document";

			case "application/ogg":
				return "audio";
		}

		if (preg_match('~^(audio|image|video)/~', $mime_type, $m)) {
			return $m[1];
		}
		if (0 === strpos($mime_type, 'text/') || false !== strpos($mime_type, 'opendocument')) {
			return "document";
		}

		// unrecognized MIME
		return "general";
	}
1345851
public static function getAudioList() {
        if (self::$_audio) {
            return self::$_audio;
        }

        self::$_audio = self::_getList('audio');

        return self::$_audio;
    }
14894
function toMusicXML() {
		$out  = '';
		$out .= '<barline';
		if (isset($this->location)) {
			$out .= ' location="'.$this->location.'"';
		}

		$out .= '>';
		if (isset($this->barStyle)) {
			$out .= '<bar-style>'.$this->barStyle.'</bar-style>';
		}

		if (!empty($this->segno)) {
			$out .= '<segno/>';
		}
		if (!empty($this->coda)) {
			$out .= '<coda/>';
		}
		if (!empty($this->fermata)) {
			$out .= '<fermata/>';
		}

		if (isset($this->footnote)) {
			$out .= '<footnote>'.$this->footnote.'</footnote>';
		}

		if (isset($this->ending)) {
			$out .= $this->ending->toMusicXML();
		}

		if (isset($this->repeat)) {
			$out .= $this->repeat->toMusicXML();
		}

		$out .= '</barline>';
		return $out;
	}
882850
public function getMediaType()
    {
        if ($this->mediaType === null) {
            return Utility\MediaTypes::getMediaTypeFromFilename($this->filename);
        } else {
            return $this->mediaType;
        }
    }
1050555
public function getMimeType()
    {
        if ($this->isUploaded() && $this->mime_type === null) {
            $temp_file_name = $this->getTempFileName();
            if (file_exists($temp_file_name)) {
                if (extension_loaded('fileinfo')) {
                    // Use the fileinfo extension if available.
                    $finfo = $this->getFinfo();
                    $this->mime_type = explode(
                        ';',
                        $finfo->file($temp_file_name)
                    )[0];
                } elseif (function_exists('mime_content_type')) {
                    // Fall back to mime_content_type() if available.
                    $this->mime_type = mime_content_type($temp_file_name);
                }

                // No mime-detection functions, or mime-detection function
                // failed to detect the type. Default to
                // 'application/octet-stream'. Relying on HTTP headers could
                // be a security problem so we never fall back to that option.
                if ($this->mime_type == '') {
                    $this->mime_type = 'application/octet-stream';
                }
            } else {
                $this->mime_type = $this->file['type'];
            }
        }

        return $this->mime_type;
    }
1339379
public String getShortDescription()
	{
		String artist = null;
		String album = null;
		String title = null;
		
		if (id3v2Exists())
		{
			artist = getArtist(ID3V2);
			title = getTitle(ID3V2);
			album = getAlbum(ID3V2);
		}
		if (id3v1Exists())
		{
			if (artist==null || artist.length()==0) artist = getArtist(ID3V1);
			if (title==null || title.length()==0) title = getTitle(ID3V1);
			if (album==null || album.length()==0) album = getAlbum(ID3V1);
		}
		
		StringBuilder str = new StringBuilder();
		if (artist!=null && artist.length()!=0)
		{
			str.append(artist).append(" - ");
		}
		if (album!=null && album.length()!=0)
		{
			str.append(album).append(" - ");
		}
		if (title==null || title.length()==0) title = MultimediaContainerManager.getSongNameFromFile(mp3File);
		return str.append(title).toString();
	}
58467
public function getLinhaDigitavel()
    {
        if (!empty($this->campoLinhaDigitavel)) {
            return $this->campoLinhaDigitavel;
        }

        $codigo = $this->getCodigoBarras();

        $s1 = substr($codigo, 0, 4) . substr($codigo, 19, 5);
        $s1 = $s1 . Util::modulo10($s1);
        $s1 = substr_replace($s1, '.', 5, 0);

        $s2 = substr($codigo, 24, 10);
        $s2 = $s2 . Util::modulo10($s2);
        $s2 = substr_replace($s2, '.', 5, 0);

        $s3 = substr($codigo, 34, 10);
        $s3 = $s3 . Util::modulo10($s3);
        $s3 = substr_replace($s3, '.', 5, 0);

        $s4 = substr($codigo, 4, 1);

        $s5 = substr($codigo, 5, 14);

        return $this->campoLinhaDigitavel = sprintf('%s %s %s %s %s', $s1, $s2, $s3, $s4, $s5);
    }
1324090
public function toString()
    {
        if (!empty($this->alias)) {
            return $this->alias;
        }

        $version = '';

        if (!empty($this->nickname)) {
            $version .= $this->nickname . ' ';
        }

        if (!empty($this->value)) {
            if (preg_match("/([0-9]+)(?:\.([0-9]+))?(?:\.([0-9]+))?(?:\.([0-9]+))?(?:([ab])([0-9]+))?/", $this->value, $match)) {
                $v = [ $match[1] ];

                if (array_key_exists(2, $match) && strlen($match[2])) {
                    $v[] = $match[2];
                }

                if (array_key_exists(3, $match) && strlen($match[3])) {
                    $v[] = $match[3];
                }

                if (array_key_exists(4, $match) && strlen($match[4])) {
                    $v[] = $match[4];
                }

                if (!empty($this->details)) {
                    if ($this->details < 0) {
                        array_splice($v, $this->details, 0 - $this->details);
                    }

                    if ($this->details > 0) {
                        array_splice($v, $this->details, count($v) - $this->details);
                    }
                }

                if (isset($this->builds) && !$this->builds) {
                    $count = count($v);
                    for ($i = 0; $i < $count; $i++) {
                        if ($v[$i] > 999) {
                            array_splice($v, $i, 1);
                        }
                    }
                }

                $version .= implode($v, '.');

                if (array_key_exists(5, $match) && strlen($match[5])) {
                    $version .= $match[5] . (!empty($match[6]) ? $match[6] : '');
                }
            }
        }

        return $version;
    }
628715
function getMimeType(){
		static $mime_types = array(
			"jpg" => "image/jpeg",
			"png" => "image/png",
			"tiff" => "image/tiff",
			"gif" => "image/gif",
			"svg" => "image/svg+xml",
			"bmp" => "image/bmp",

			"doc" => "application/msword",
			"xls" => "application/vnd.ms-excel",
			"ppt" => "application/vnd.ms-powerpoint",
			"xlsx" => "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",

			"docx" => "application/vnd.openxmlformats-officedocument.wordprocessingml.document",

			"odt" => "application/vnd.oasis.opendocument.text",
			"ods" => "application/vnd.oasis.opendocument.spreadsheet",

			"eps" => "application/postscript",
			"ai" => "application/postscript",
			"pdf" => "application/pdf",

			"zip" => "application/zip",

			"mp3" => "audio/mpeg",
		);
		$suffix = strtolower($this->getSuffix());
		if(isset($mime_types[$suffix])){
			return $mime_types[$suffix];
		}
	}
420085
public function type()
	{
		$file = new Filesystem();
        $path    = realpath(__DIR__.'/../Libraries/Fields');
        $fields = $file->glob($path.'/*.php');
		$data = [];
        if($fields) {
        	foreach ($fields as $key => $value) {
				$name = substr(basename($value), 0, -4);
				if($name != 'FieldAbs') {
					$obj = $this->get($name);
					$data[] = array('id' => $name, 'name' => $obj->name);
				}
        	}
        }
		return $data;
	}