Created
September 12, 2014 02:41
-
-
Save ameliaikeda/184c87fb945b36b66d0c to your computer and use it in GitHub Desktop.
For being such a messy library, this is actually quite clean...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use GetId3\Write\Id3v2 as TagWriter; | |
trait TagTrait { | |
public function writeTags(Track $song = null) { | |
if (is_null($song)) $song = $this; | |
$writer = new TagWriter; | |
$writer->majorversion = 4; // write ID3v2.4 tags | |
$writer->filename = $song->file_path; | |
$writer->tag_data = [ | |
"title" => $song->title, | |
"artist" => $song->artist, | |
"album" => $song->album, | |
"internet_radio_station_name" => "R/a/dio <https://r-a-d.io>", | |
"internet_radio_station_owner" => "R/a/dio <[email protected]>", | |
"tracknumber" => $song->id, | |
"comment" => $song->tags, | |
]; | |
return $writer->WriteID3v2(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment