From e651da03cc1a42020b29cec850f0f8a2209b8f76 Mon Sep 17 00:00:00 2001 From: matthew Date: Sun, 2 Jun 2019 13:27:24 -0500 Subject: [PATCH] Changed path tag handling to merge path tags with filename tags Added 0-9 to the filename tag regexp so that extensions like mp4 will be picked up as well. --- core/util.php | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/core/util.php b/core/util.php index 63e4f725..63cdac07 100644 --- a/core/util.php +++ b/core/util.php @@ -281,14 +281,20 @@ function manual_include(string $fname): ?string function path_to_tags(string $path): string { $matches = []; - if (preg_match("/\d+ - (.*)\.([a-zA-Z]+)/", basename($path), $matches)) { + $tags = ""; + if(preg_match("/\d+ - (.*)\.([a-zA-Z0-9]+)/", basename($path), $matches)) { $tags = $matches[1]; - } else { - $tags = dirname($path); - $tags = str_replace("/", " ", $tags); - $tags = str_replace("__", " ", $tags); - $tags = trim($tags); - } + } + + $dir_tags = dirname($path); + $dir_tags = str_replace("/", " ", $dir_tags); + $dir_tags = str_replace("__", " ", $dir_tags); + $dir_tags = trim($dir_tags); + if ($dir_tags != "") { + $tags = trim($tags)." ".trim($dir_tags); + } + $tags = trim ( $tags ); + return $tags; }