diff --git a/README.md b/README.md index 5026cbd..462ab7d 100755 --- a/README.md +++ b/README.md @@ -23,5 +23,4 @@ - [ ] get things up and running on vps - optional, but kinda neat: - * [ ] establish password secured admin backend - * [ ] write id3 and flac tag extractor in php \ No newline at end of file + * [ ] establish password secured admin backend to manage content \ No newline at end of file diff --git a/app/tag_extractor.php b/app/tag_extractor.php index 784b287..479c8ce 100755 --- a/app/tag_extractor.php +++ b/app/tag_extractor.php @@ -2,10 +2,10 @@ function get_file_tags($input_file) { $input_type = mime_content_type($input_file); - // echo $input_type; + //echo $input_type; switch($input_type) { - case 'audio/mpeg': break; + case 'audio/mpeg': get_mp3_tags($input_file); break; case 'audio/flac': get_flac_tags($input_file); break; default: echo("Ey boss, that file type is NOT okay."); die(); break; } @@ -13,4 +13,17 @@ function get_file_tags($input_file) { function get_flac_tags($input_file) { echo(fread(fopen($input_file, 'r'), 4096)); -} \ No newline at end of file +} + +function get_mp3_tags($input_file) { + $fp = fopen($input_file, "r"); + + fseek($fp, -64, SEEK_END); + + $mdata = fgets($fp); + var_dump($mdata); + fclose($fp); +} + +// https://stackoverflow.com/questions/16653100/what-are-those-32-bits-near-the-start-of-a-flac-file +// https://github.com/mdesharnais/mediatheque/ \ No newline at end of file diff --git a/public/audio.php b/public/audio.php index 945cc22..bcf811d 100755 --- a/public/audio.php +++ b/public/audio.php @@ -32,9 +32,4 @@ else { get_audio($pdo); } - - // TODO: remove this part: TESTING ONLY! - include_once('../app/tag_extractor.php'); - get_file_tags('../public/resources/aud/chronostasis.mp3'); - get_file_tags('F:\MEGA Backup\musik\chronostasis\01 the enigmatic benefits of chronostasis - dan the melon lord.flac'); ?>