fiddling around with id3

master
Josha von Gizycki 2 years ago
parent e1f5495bd2
commit 354a03b34a

File diff suppressed because it is too large Load Diff

@ -30,3 +30,5 @@ APP_SECRET=10807aa920111cc994ed503360f5cfa3
# DATABASE_URL="mysql://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=5.7"
DATABASE_URL="postgresql://symfony:ChangeMe@127.0.0.1:5432/app?serverVersion=13&charset=utf8"
###< doctrine/doctrine-bundle ###
DATABASE_URL="sqlite:///%kernel.project_dir%/var/app.db"

2
.gitignore vendored

@ -18,3 +18,5 @@
/phpunit.xml
.phpunit.result.cache
###< phpunit/phpunit ###
.idea

@ -4,14 +4,14 @@
use App\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
if (!is_file(dirname(__DIR__).'/vendor/autoload_runtime.php')) {
if (!is_file(dirname(__DIR__) . '/vendor/autoload_runtime.php')) {
throw new LogicException('Symfony Runtime is missing. Try running "composer require symfony/runtime".');
}
require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
require_once dirname(__DIR__) . '/vendor/autoload_runtime.php';
return function (array $context) {
$kernel = new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
$kernel = new Kernel($context['APP_ENV'], (bool)$context['APP_DEBUG']);
return new Application($kernel);
};

@ -5,15 +5,15 @@ if (!ini_get('date.timezone')) {
ini_set('date.timezone', 'UTC');
}
if (is_file(dirname(__DIR__).'/vendor/phpunit/phpunit/phpunit')) {
define('PHPUNIT_COMPOSER_INSTALL', dirname(__DIR__).'/vendor/autoload.php');
if (is_file(dirname(__DIR__) . '/vendor/phpunit/phpunit/phpunit')) {
define('PHPUNIT_COMPOSER_INSTALL', dirname(__DIR__) . '/vendor/autoload.php');
require PHPUNIT_COMPOSER_INSTALL;
PHPUnit\TextUI\Command::main();
} else {
if (!is_file(dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php')) {
if (!is_file(dirname(__DIR__) . '/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php')) {
echo "Unable to find the `simple-phpunit.php` script in `vendor/symfony/phpunit-bridge/bin/`.\n";
exit(1);
}
require dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php';
require dirname(__DIR__) . '/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php';
}

@ -4,7 +4,7 @@
"minimum-stability": "stable",
"prefer-stable": true,
"require": {
"php": ">=7.2.5",
"php": ">=8",
"ext-ctype": "*",
"ext-iconv": "*",
"composer/package-versions-deprecated": "1.11.99.4",
@ -12,9 +12,10 @@
"doctrine/doctrine-bundle": "^2.5",
"doctrine/doctrine-migrations-bundle": "^3.2",
"doctrine/orm": "^2.10",
"lambdish/phunctional": "^2.1",
"phpdocumentor/reflection-docblock": "^5.3",
"phpstan/phpdoc-parser": "^1.2",
"sensio/framework-extra-bundle": "^6.1",
"sensio/framework-extra-bundle": "^6.2",
"symfony/asset": "5.4.*",
"symfony/console": "5.4.*",
"symfony/dotenv": "5.4.*",
@ -26,7 +27,7 @@
"symfony/intl": "5.4.*",
"symfony/mailer": "5.4.*",
"symfony/mime": "5.4.*",
"symfony/monolog-bundle": "^3.1",
"symfony/monolog-bundle": "^3.7",
"symfony/notifier": "5.4.*",
"symfony/process": "5.4.*",
"symfony/property-access": "5.4.*",
@ -42,7 +43,8 @@
"symfony/web-link": "5.4.*",
"symfony/yaml": "5.4.*",
"twig/extra-bundle": "^2.12|^3.0",
"twig/twig": "^2.12|^3.0"
"twig/twig": "^2.12|^3.0",
"wapmorgan/mp3info": "^0.0.7"
},
"require-dev": {
"phpunit/phpunit": "^9.5",

271
composer.lock generated

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "076125f938e4eae50bc5a7eb0e35fcc9",
"content-hash": "8f3ee861127a5ff042bdbf2be1a1f61c",
"packages": [
{
"name": "composer/package-versions-deprecated",
@ -1203,16 +1203,16 @@
},
{
"name": "doctrine/orm",
"version": "2.10.3",
"version": "2.10.4",
"source": {
"type": "git",
"url": "https://github.com/doctrine/orm.git",
"reference": "7b242753466508e1dd10f67c1baee95785f845c1"
"reference": "cccb2e2fdfed2969afb3d65c5ea82bafdefbe1a7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/orm/zipball/7b242753466508e1dd10f67c1baee95785f845c1",
"reference": "7b242753466508e1dd10f67c1baee95785f845c1",
"url": "https://api.github.com/repos/doctrine/orm/zipball/cccb2e2fdfed2969afb3d65c5ea82bafdefbe1a7",
"reference": "cccb2e2fdfed2969afb3d65c5ea82bafdefbe1a7",
"shasum": ""
},
"require": {
@ -1244,10 +1244,10 @@
"phpbench/phpbench": "^0.16.10 || ^1.0",
"phpstan/phpstan": "1.2.0",
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.4",
"squizlabs/php_codesniffer": "3.6.1",
"squizlabs/php_codesniffer": "3.6.2",
"symfony/cache": "^4.4 || ^5.2",
"symfony/yaml": "^3.4 || ^4.0 || ^5.0 || ^6.0",
"vimeo/psalm": "4.13.1"
"vimeo/psalm": "4.15.0"
},
"suggest": {
"symfony/cache": "Provides cache support for Setup Tool with doctrine/cache 2.0",
@ -1296,9 +1296,9 @@
],
"support": {
"issues": "https://github.com/doctrine/orm/issues",
"source": "https://github.com/doctrine/orm/tree/2.10.3"
"source": "https://github.com/doctrine/orm/tree/2.10.4"
},
"time": "2021-12-03T12:27:05+00:00"
"time": "2021-12-20T21:23:47+00:00"
},
{
"name": "doctrine/persistence",
@ -1589,18 +1589,74 @@
],
"time": "2021-05-22T16:11:15+00:00"
},
{
"name": "lambdish/phunctional",
"version": "v2.1.0",
"source": {
"type": "git",
"url": "https://github.com/Lambdish/phunctional.git",
"reference": "ed3482e7da134d886789abb33c6df22a5d2f271c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Lambdish/phunctional/zipball/ed3482e7da134d886789abb33c6df22a5d2f271c",
"reference": "ed3482e7da134d886789abb33c6df22a5d2f271c",
"shasum": ""
},
"require": {
"php": ">=7.2"
},
"require-dev": {
"phpstan/phpstan": "^0.11.16",
"phpunit/phpunit": "^8.4"
},
"type": "library",
"autoload": {
"files": [
"src/_bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Eloi Poch"
},
{
"name": "Jorge Ávila"
},
{
"name": "Rafa Gómez"
}
],
"description": "λ PHP functional library",
"keywords": [
"functional",
"generator",
"lambda",
"library",
"php"
],
"support": {
"issues": "https://github.com/Lambdish/phunctional/issues",
"source": "https://github.com/Lambdish/phunctional/tree/v2.1.0"
},
"time": "2020-09-18T07:22:08+00:00"
},
{
"name": "laminas/laminas-code",
"version": "4.5.0",
"version": "4.5.1",
"source": {
"type": "git",
"url": "https://github.com/laminas/laminas-code.git",
"reference": "c99ef8e5629c33bfaa3a8f1df773e916af564cd6"
"reference": "6fd96d4d913571a2cd056a27b123fa28cb90ac4e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laminas/laminas-code/zipball/c99ef8e5629c33bfaa3a8f1df773e916af564cd6",
"reference": "c99ef8e5629c33bfaa3a8f1df773e916af564cd6",
"url": "https://api.github.com/repos/laminas/laminas-code/zipball/6fd96d4d913571a2cd056a27b123fa28cb90ac4e",
"reference": "6fd96d4d913571a2cd056a27b123fa28cb90ac4e",
"shasum": ""
},
"require": {
@ -1653,7 +1709,7 @@
"type": "community_bridge"
}
],
"time": "2021-12-07T06:00:32+00:00"
"time": "2021-12-19T18:06:55+00:00"
},
{
"name": "monolog/monolog",
@ -1965,20 +2021,20 @@
},
{
"name": "psr/cache",
"version": "1.0.1",
"version": "2.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/cache.git",
"reference": "d11b50ad223250cf17b86e38383413f5a6764bf8"
"reference": "213f9dbc5b9bfbc4f8db86d2838dc968752ce13b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8",
"reference": "d11b50ad223250cf17b86e38383413f5a6764bf8",
"url": "https://api.github.com/repos/php-fig/cache/zipball/213f9dbc5b9bfbc4f8db86d2838dc968752ce13b",
"reference": "213f9dbc5b9bfbc4f8db86d2838dc968752ce13b",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
"php": ">=8.0.0"
},
"type": "library",
"extra": {
@ -1998,7 +2054,7 @@
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common interface for caching libraries",
@ -2008,9 +2064,9 @@
"psr-6"
],
"support": {
"source": "https://github.com/php-fig/cache/tree/master"
"source": "https://github.com/php-fig/cache/tree/2.0.0"
},
"time": "2016-08-06T20:24:11+00:00"
"time": "2021-02-03T23:23:37+00:00"
},
{
"name": "psr/container",
@ -2112,20 +2168,20 @@
},
{
"name": "psr/link",
"version": "1.0.0",
"version": "1.1.1",
"source": {
"type": "git",
"url": "https://github.com/php-fig/link.git",
"reference": "eea8e8662d5cd3ae4517c9b864493f59fca95562"
"reference": "846c25f58a1f02b93a00f2404e3626b6bf9b7807"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/link/zipball/eea8e8662d5cd3ae4517c9b864493f59fca95562",
"reference": "eea8e8662d5cd3ae4517c9b864493f59fca95562",
"url": "https://api.github.com/repos/php-fig/link/zipball/846c25f58a1f02b93a00f2404e3626b6bf9b7807",
"reference": "846c25f58a1f02b93a00f2404e3626b6bf9b7807",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
"php": ">=8.0.0"
},
"type": "library",
"extra": {
@ -2149,6 +2205,7 @@
}
],
"description": "Common interfaces for HTTP links",
"homepage": "https://github.com/php-fig/link",
"keywords": [
"http",
"http-link",
@ -2158,36 +2215,36 @@
"rest"
],
"support": {
"source": "https://github.com/php-fig/link/tree/master"
"source": "https://github.com/php-fig/link/tree/1.1.1"
},
"time": "2016-10-28T16:06:13+00:00"
"time": "2021-03-11T22:59:13+00:00"
},
{
"name": "psr/log",
"version": "1.1.4",
"version": "2.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/log.git",
"reference": "d49695b909c3b7628b6289db5479a1c204601f11"
"reference": "ef29f6d262798707a9edd554e2b82517ef3a9376"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11",
"reference": "d49695b909c3b7628b6289db5479a1c204601f11",
"url": "https://api.github.com/repos/php-fig/log/zipball/ef29f6d262798707a9edd554e2b82517ef3a9376",
"reference": "ef29f6d262798707a9edd554e2b82517ef3a9376",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
"php": ">=8.0.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.1.x-dev"
"dev-master": "2.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Log\\": "Psr/Log/"
"Psr\\Log\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
@ -2208,22 +2265,22 @@
"psr-3"
],
"support": {
"source": "https://github.com/php-fig/log/tree/1.1.4"
"source": "https://github.com/php-fig/log/tree/2.0.0"
},
"time": "2021-05-03T11:20:27+00:00"
"time": "2021-07-14T16:41:46+00:00"
},
{
"name": "sensio/framework-extra-bundle",
"version": "v6.2.2",
"version": "v6.2.3",
"source": {
"type": "git",
"url": "https://github.com/sensiolabs/SensioFrameworkExtraBundle.git",
"reference": "8be174975f05cb9a91860308b8b306213689b736"
"reference": "eeab0bbe6ac94a600a7da7aac020646dcd739484"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sensiolabs/SensioFrameworkExtraBundle/zipball/8be174975f05cb9a91860308b8b306213689b736",
"reference": "8be174975f05cb9a91860308b8b306213689b736",
"url": "https://api.github.com/repos/sensiolabs/SensioFrameworkExtraBundle/zipball/eeab0bbe6ac94a600a7da7aac020646dcd739484",
"reference": "eeab0bbe6ac94a600a7da7aac020646dcd739484",
"shasum": ""
},
"require": {
@ -2286,9 +2343,9 @@
],
"support": {
"issues": "https://github.com/sensiolabs/SensioFrameworkExtraBundle/issues",
"source": "https://github.com/sensiolabs/SensioFrameworkExtraBundle/tree/v6.2.2"
"source": "https://github.com/sensiolabs/SensioFrameworkExtraBundle/tree/v6.2.3"
},
"time": "2021-12-17T02:08:16+00:00"
"time": "2021-12-17T14:36:53+00:00"
},
{
"name": "symfony/asset",
@ -2809,25 +2866,25 @@
},
{
"name": "symfony/deprecation-contracts",
"version": "v2.5.0",
"version": "v3.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/deprecation-contracts.git",
"reference": "6f981ee24cf69ee7ce9736146d1c57c2780598a8"
"reference": "c726b64c1ccfe2896cb7df2e1331c357ad1c8ced"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/6f981ee24cf69ee7ce9736146d1c57c2780598a8",
"reference": "6f981ee24cf69ee7ce9736146d1c57c2780598a8",
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/c726b64c1ccfe2896cb7df2e1331c357ad1c8ced",
"reference": "c726b64c1ccfe2896cb7df2e1331c357ad1c8ced",
"shasum": ""
},
"require": {
"php": ">=7.1"
"php": ">=8.0.2"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "2.5-dev"
"dev-main": "3.0-dev"
},
"thanks": {
"name": "symfony/contracts",
@ -2856,7 +2913,7 @@
"description": "A generic function and convention to trigger deprecation notices",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.0"
"source": "https://github.com/symfony/deprecation-contracts/tree/v3.0.0"
},
"funding": [
{
@ -2872,7 +2929,7 @@
"type": "tidelift"
}
],
"time": "2021-07-12T14:48:14+00:00"
"time": "2021-11-01T23:48:49+00:00"
},
{
"name": "symfony/doctrine-bridge",
@ -3221,20 +3278,20 @@
},
{
"name": "symfony/event-dispatcher-contracts",
"version": "v2.5.0",
"version": "v3.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/event-dispatcher-contracts.git",
"reference": "66bea3b09be61613cd3b4043a65a8ec48cfa6d2a"
"reference": "aa5422287b75594b90ee9cd807caf8f0df491385"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/66bea3b09be61613cd3b4043a65a8ec48cfa6d2a",
"reference": "66bea3b09be61613cd3b4043a65a8ec48cfa6d2a",
"url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/aa5422287b75594b90ee9cd807caf8f0df491385",
"reference": "aa5422287b75594b90ee9cd807caf8f0df491385",
"shasum": ""
},
"require": {
"php": ">=7.2.5",
"php": ">=8.0.2",
"psr/event-dispatcher": "^1"
},
"suggest": {
@ -3243,7 +3300,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "2.5-dev"
"dev-main": "3.0-dev"
},
"thanks": {
"name": "symfony/contracts",
@ -3280,7 +3337,7 @@
"standards"
],
"support": {
"source": "https://github.com/symfony/event-dispatcher-contracts/tree/v2.5.0"
"source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.0.0"
},
"funding": [
{
@ -3296,7 +3353,7 @@
"type": "tidelift"
}
],
"time": "2021-07-12T14:48:14+00:00"
"time": "2021-07-15T12:33:35+00:00"
},
{
"name": "symfony/expression-language",
@ -3490,28 +3547,28 @@
},
{
"name": "symfony/flex",
"version": "v1.17.6",
"version": "v2.0.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/flex.git",
"reference": "7a79135e1dc66b30042b4d968ecba0908f9374bc"
"reference": "3dbfa5c4e3308fd9def9a2006a20fa0c272a30a2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/flex/zipball/7a79135e1dc66b30042b4d968ecba0908f9374bc",
"reference": "7a79135e1dc66b30042b4d968ecba0908f9374bc",
"url": "https://api.github.com/repos/symfony/flex/zipball/3dbfa5c4e3308fd9def9a2006a20fa0c272a30a2",
"reference": "3dbfa5c4e3308fd9def9a2006a20fa0c272a30a2",
"shasum": ""
},
"require": {
"composer-plugin-api": "^1.0|^2.0",
"php": ">=7.1"
"composer-plugin-api": "^2.1",
"php": ">=8.0"
},
"require-dev": {
"composer/composer": "^1.0.2|^2.0",
"symfony/dotenv": "^4.4|^5.0|^6.0",
"symfony/filesystem": "^4.4|^5.0|^6.0",
"symfony/phpunit-bridge": "^4.4.12|^5.0|^6.0",
"symfony/process": "^4.4|^5.0|^6.0"
"composer/composer": "^2.1",
"symfony/dotenv": "^5.4|^6.0",
"symfony/filesystem": "^5.4|^6.0",
"symfony/phpunit-bridge": "^5.4|^6.0",
"symfony/process": "^5.4|^6.0"
},
"type": "composer-plugin",
"extra": {
@ -3535,7 +3592,7 @@
"description": "Composer plugin for Symfony",
"support": {
"issues": "https://github.com/symfony/flex/issues",
"source": "https://github.com/symfony/flex/tree/v1.17.6"
"source": "https://github.com/symfony/flex/tree/v2.0.1"
},
"funding": [
{
@ -3551,7 +3608,7 @@
"type": "tidelift"
}
],
"time": "2021-11-29T15:39:37+00:00"
"time": "2021-11-29T15:40:20+00:00"
},
{
"name": "symfony/form",
@ -6460,22 +6517,21 @@
},
{
"name": "symfony/service-contracts",
"version": "v2.5.0",
"version": "v2.4.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/service-contracts.git",
"reference": "1ab11b933cd6bc5464b08e81e2c5b07dec58b0fc"
"reference": "d664541b99d6fb0247ec5ff32e87238582236204"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/service-contracts/zipball/1ab11b933cd6bc5464b08e81e2c5b07dec58b0fc",
"reference": "1ab11b933cd6bc5464b08e81e2c5b07dec58b0fc",
"url": "https://api.github.com/repos/symfony/service-contracts/zipball/d664541b99d6fb0247ec5ff32e87238582236204",
"reference": "d664541b99d6fb0247ec5ff32e87238582236204",
"shasum": ""
},
"require": {
"php": ">=7.2.5",
"psr/container": "^1.1",
"symfony/deprecation-contracts": "^2.1"
"psr/container": "^1.1"
},
"conflict": {
"ext-psr": "<1.1|>=2"
@ -6486,7 +6542,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "2.5-dev"
"dev-main": "2.4-dev"
},
"thanks": {
"name": "symfony/contracts",
@ -6523,7 +6579,7 @@
"standards"
],
"support": {
"source": "https://github.com/symfony/service-contracts/tree/v2.5.0"
"source": "https://github.com/symfony/service-contracts/tree/v2.4.1"
},
"funding": [
{
@ -6539,7 +6595,7 @@
"type": "tidelift"
}
],
"time": "2021-11-04T16:48:04+00:00"
"time": "2021-11-04T16:37:19+00:00"
},
{
"name": "symfony/stopwatch",
@ -7664,6 +7720,55 @@
],
"time": "2021-11-25T13:46:55+00:00"
},
{
"name": "wapmorgan/mp3info",
"version": "0.0.7",
"source": {
"type": "git",
"url": "https://github.com/wapmorgan/Mp3Info.git",
"reference": "b53a5e936851921dc2b88238b39a5bcc0ace4866"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/wapmorgan/Mp3Info/zipball/b53a5e936851921dc2b88238b39a5bcc0ace4866",
"reference": "b53a5e936851921dc2b88238b39a5bcc0ace4866",
"shasum": ""
},
"require": {
"ext-mbstring": "*",
"php": ">=5.4.0"
},
"require-dev": {
"wapmorgan/terminal-info": "dev-master"
},
"bin": [
"bin/mp3scan"
],
"type": "library",
"autoload": {
"psr-4": {
"wapmorgan\\Mp3Info\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-3.0"
],
"description": "The fastest php library to extract mp3 tags & meta information.",
"keywords": [
"audio",
"id3",
"id3v1",
"id3v2",
"mp3",
"mpeg"
],
"support": {
"issues": "https://github.com/wapmorgan/Mp3Info/issues",
"source": "https://github.com/wapmorgan/Mp3Info/tree/0.0.7"
},
"time": "2021-08-12T00:38:40+00:00"
},
{
"name": "webmozart/assert",
"version": "1.10.0",
@ -10001,7 +10106,7 @@
"prefer-stable": true,
"prefer-lowest": false,
"platform": {
"php": ">=7.2.5",
"php": ">=8",
"ext-ctype": "*",
"ext-iconv": "*"
},

@ -12,7 +12,7 @@ doctrine:
mappings:
App:
is_bundle: false
type: annotation
type: attribute
dir: '%kernel.project_dir%/src/Entity'
prefix: 'App\Entity'
alias: App

@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20211217152806 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE song (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, path VARCHAR(2048) NOT NULL, artist VARCHAR(2048) DEFAULT NULL, album VARCHAR(2048) DEFAULT NULL, name VARCHAR(2048) DEFAULT NULL, filehash VARCHAR(2048) NOT NULL, release_year INTEGER DEFAULT NULL)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE song');
}
}

@ -0,0 +1,17 @@
<?php
namespace App\Adapter;
use SplFileInfo;
class ScannedSong
{
public string $path;
public SplFileInfo $file;
public string $artist;
public string $album;
public string $title;
public float $duration;
}

@ -0,0 +1,60 @@
<?php
namespace App\Adapter;
use FilesystemIterator;
use RecursiveDirectoryIterator;
use RecursiveIteratorIterator;
use SplFileInfo;
use wapmorgan\Mp3Info\Mp3Info;
use function Lambdish\Phunctional\filter;
use function Lambdish\Phunctional\map;
use function Lambdish\Phunctional\pipe;
class SongScanner
{
private string $rootDir;
public function __construct(string $rootDir) {
$this->rootDir = $rootDir;
}
/**
* @return ScannedSong[]
*/
public function scanFunctional(): array {
$it = new RecursiveDirectoryIterator(
$this->rootDir,
FilesystemIterator::FOLLOW_SYMLINKS | FilesystemIterator::SKIP_DOTS
);
$pipe = pipe([$this, 'isMp3'], [$this, 'toScannedFile']);
return $pipe(new RecursiveIteratorIterator($it));
}
public static function isMp3(iterable $files): iterable {
return filter(function (SplFileInfo $file, string $_): bool {
echo $_ . "\n";
return $file->isFile() && strtolower($file->getExtension()) === 'mp3';
}, $files);
}
public static function toScannedFile(iterable $files): iterable {
return map(
function (SplFileInfo $file, string $path): ScannedSong {
$song = new ScannedSong();
$song->file = $file;
$song->path = $path;
$id3 = new Mp3Info($path, true);
$song->artist = $id3->tags['artist'] ?: '';
$song->album = $id3->tags['album'] ?: '';
$song->title = $id3->tags['song'] ?: '';
$song->duration = $id3->duration ?: 0;
return $song;
}, $files);
}
}

@ -0,0 +1,20 @@
<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class Home extends AbstractController
{
#[Route(path: '/home')]
public function home(): Response {
return $this->render(
'home.html.twig',
[]
);
}
}

@ -0,0 +1,97 @@
<?php
namespace App\Entity;
use App\Repository\SongRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: SongRepository::class)]
class Song
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private int $id;
#[ORM\Column(type: 'string', length: 2048)]
private string $path;
#[ORM\Column(type: 'string', length: 2048, nullable: true)]
private ?string $artist;
#[ORM\Column(type: 'string', length: 2048, nullable: true)]
private ?string $album;
#[ORM\Column(type: 'string', length: 2048, nullable: true)]
private ?string $name;
#[ORM\Column(type: 'string', length: 2048)]
private string $filehash;
#[ORM\Column(type: 'integer', nullable: true)]
private int $releaseYear;
public function getId(): ?int {
return $this->id;
}
public function getPath(): ?string {
return $this->path;
}
public function setPath(string $path): self {
$this->path = $path;
return $this;
}
public function getArtist(): ?string {
return $this->artist;
}
public function setArtist(?string $artist): self {
$this->artist = $artist;
return $this;
}
public function getAlbum(): ?string {
return $this->album;
}
public function setAlbum(?string $album): self {
$this->album = $album;
return $this;
}
public function getName(): ?string {
return $this->name;
}
public function setName(?string $name): self {
$this->name = $name;
return $this;
}
public function getFilehash(): ?string {
return $this->filehash;
}
public function setFilehash(string $filehash): self {
$this->filehash = $filehash;
return $this;
}
public function getReleaseYear(): ?int {
return $this->releaseYear;
}
public function setReleaseYear(?int $releaseYear): self {
$this->releaseYear = $releaseYear;
return $this;
}
}

@ -0,0 +1,49 @@
<?php
namespace App\Repository;
use App\Entity\Song;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @method Song|null find($id, $lockMode = null, $lockVersion = null)
* @method Song|null findOneBy(array $criteria, array $orderBy = null)
* @method Song[] findAll()
* @method Song[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class SongRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry) {
parent::__construct($registry, Song::class);
}
// /**
// * @return Song[] Returns an array of Song objects
// */
/*
public function findByExampleField($value)
{
return $this->createQueryBuilder('s')
->andWhere('s.exampleField = :val')
->setParameter('val', $value)
->orderBy('s.id', 'ASC')
->setMaxResults(10)
->getQuery()
->getResult()
;
}
*/
/*
public function findOneBySomeField($value): ?Song
{
return $this->createQueryBuilder('s')
->andWhere('s.exampleField = :val')
->setParameter('val', $value)
->getQuery()
->getOneOrNullResult()
;
}
*/
}

@ -88,6 +88,12 @@
"friendsofphp/proxy-manager-lts": {
"version": "v1.0.5"
},
"james-heinrich/getid3": {
"version": "v1.9.21"
},
"lambdish/phunctional": {
"version": "v2.1.0"
},
"laminas/laminas-code": {
"version": "4.5.0"
},
@ -592,6 +598,9 @@
"twig/twig": {
"version": "v3.3.4"
},
"wapmorgan/mp3info": {
"version": "0.0.7"
},
"webmozart/assert": {
"version": "1.10.0"
}

@ -0,0 +1,16 @@
<?php
namespace App\Tests\Adapter;
use App\Adapter\SongScanner;
use PHPUnit\Framework\TestCase;
class SongScannerTest extends TestCase
{
function testDefaultBehaviourFunctional() {
$scanner = new SongScanner(__DIR__);
$songs = $scanner->scanFunctional();
var_dump($songs);
}
}
Loading…
Cancel
Save