mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-27 07:17:59 +01:00
263ea48c5b
Shift automatically applies the Laravel coding style - which uses the PSR-2 coding style as a base with some minor additions. You may customize the adopted coding style by adding your own [PHP CS Fixer][1] `.php_cs` config file to your project root. Feel free to use [Shift's Laravel ruleset][2] to help you get started. [1]: https://github.com/FriendsOfPHP/PHP-CS-Fixer [2]: https://gist.github.com/laravel-shift/cab527923ed2a109dda047b97d53c200
62 lines
2.7 KiB
PHP
62 lines
2.7 KiB
PHP
<?php
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
/// getID3() by James Heinrich <info@getid3.org> //
|
|
// available at http://getid3.sourceforge.net //
|
|
// or http://www.getid3.org //
|
|
// also https://github.com/JamesHeinrich/getID3 //
|
|
/////////////////////////////////////////////////////////////////
|
|
// //
|
|
// /demo/demo.simple.write.php - part of getID3() //
|
|
// Sample script showing basic syntax for writing tags //
|
|
// See readme.txt for more details //
|
|
// ///
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
die('Due to a security issue, this demo has been disabled. It can be enabled by removing line '.__LINE__.' in '.$_SERVER['PHP_SELF']);
|
|
|
|
$TextEncoding = 'UTF-8';
|
|
|
|
require_once '../getid3/getid3.php';
|
|
// Initialize getID3 engine
|
|
$getID3 = new getID3;
|
|
$getID3->setOption(['encoding'=>$TextEncoding]);
|
|
|
|
require_once '../getid3/write.php';
|
|
// Initialize getID3 tag-writing module
|
|
$tagwriter = new getid3_writetags;
|
|
//$tagwriter->filename = '/path/to/file.mp3';
|
|
$tagwriter->filename = 'c:/file.mp3';
|
|
|
|
//$tagwriter->tagformats = array('id3v1', 'id3v2.3');
|
|
$tagwriter->tagformats = ['id3v2.3'];
|
|
|
|
// set various options (optional)
|
|
$tagwriter->overwrite_tags = true; // if true will erase existing tag data and write only passed data; if false will merge passed data with existing tag data (experimental)
|
|
$tagwriter->remove_other_tags = false; // if true removes other tag formats (e.g. ID3v1, ID3v2, APE, Lyrics3, etc) that may be present in the file and only write the specified tag format(s). If false leaves any unspecified tag formats as-is.
|
|
$tagwriter->tag_encoding = $TextEncoding;
|
|
$tagwriter->remove_other_tags = true;
|
|
|
|
// populate data array
|
|
$TagData = [
|
|
'title' => ['My Song'],
|
|
'artist' => ['The Artist'],
|
|
'album' => ['Greatest Hits'],
|
|
'year' => ['2004'],
|
|
'genre' => ['Rock'],
|
|
'comment' => ['excellent!'],
|
|
'track' => ['04/16'],
|
|
'popularimeter' => ['email'=>'user@example.net', 'rating'=>128, 'data'=>0],
|
|
'unique_file_identifier' => ['ownerid'=>'user@example.net', 'data'=>md5(time())],
|
|
];
|
|
$tagwriter->tag_data = $TagData;
|
|
|
|
// write tags
|
|
if ($tagwriter->WriteTags()) {
|
|
echo 'Successfully wrote tags<br>';
|
|
if (! empty($tagwriter->warnings)) {
|
|
echo 'There were some warnings:<br>'.implode('<br><br>', $tagwriter->warnings);
|
|
}
|
|
} else {
|
|
echo 'Failed to write tags!<br>'.implode('<br><br>', $tagwriter->errors);
|
|
}
|