Compare commits

...

6 Commits

Author SHA1 Message Date
Vincent Riquer
4e2bb8aab9 README: update test collection 2025-05-02 03:19:44 +02:00
ScriptFanix
e960b18462 getInfos::guess skeleton 2025-04-30 02:53:48 +02:00
Vincent Riquer
7ff9923113 Setup 2025-04-30 02:46:15 +02:00
Vincent Riquer
a0cb1bae1b Switch to an array 2025-04-30 02:46:15 +02:00
Vincent Riquer
1a75cd4764 documentation 2025-04-30 02:46:15 +02:00
Vincent Riquer
298f6f1c60 Tag guessing config 2025-04-30 02:46:15 +02:00
8 changed files with 154 additions and 7 deletions

View File

@ -20,13 +20,13 @@ in the same format, it will want a constant sample-rate and bitrate. You can
have AtOM do that!
Here's what I have for my tests:
| Directory | Format | Sample rate | Bitrate | Channels | FAT32 compat. | ASCII | Size |
| --------- | ------ | ----------- | ------- | -------- | ------------- | ----- | ---- |
| 0-Full | Mixed | Mixed | Mixed | Mixed | No | No | 508G |
| 1-High | Opus | Same | 128 | Same | Yes | No | 101G |
| 2-Medium | Opus | Same | 64 | Same | Yes | No | 59G |
| 3-Small | Opus | Same | 32 | Same | Yes | No | 30G |
| 4-MP3 | MP3 | 44100 | 128 | 2 | Yes | Yes | 114G |
| Directory | Format | Sample rate | Bitrate | Channels | Normalize | FAT32 compat. | ASCII | Size |
| --------- | ------ | ----------- | --------- | -------- | --------- | ------------- | ----- | ---- |
| 0-Full | Mixed | Mixed | Mixed | Mixed | No | No | No | 508G |
| 1-High | Vorbis | Original | Quality 5 | Same | No | Yes | No | 136G |
| 2-Medium | Opus | Original | 64 | Same | No | Yes | No | 58G |
| 3-Small | Opus | Original | 32 | Same | No | Yes | No | 30G |
| 4-MP3 | MP3 | 44100 | 128 | 2 | No | Yes | Yes | 113G |

View File

@ -47,6 +47,20 @@ Sections:
Default: /var/lib/mpd/music
* skip <directory>: String. Files in <directory> will be ignored. Note that
<directory> can be any expression accepted by find.
* tag-guessing <expression>: String. Filenaming scheme to allow for guessing
tags from filenames and directories. The placeholders are the same as thosefor rename below:
%{album},
%{albumartist},
%{artist},
%{disc},
%{genre},
%{releasecountry},
%{title},
%{track},
%{year}.
* tag-guessing-trigger <tag>: String. Specify multiple times for multiple
tags.
If <tag> cannot be fetched by tag readers, guessing will be attempted.
[<some arbitrary string>]
Each section not named 'general' or 'source' will define a new destination.

View File

@ -49,6 +49,33 @@ skip /last
skip /lastfm
skip /zzz-atrier
# Tag guessing expresssion. Uses same values as "rename" below. This is used to
# guess tags from filenames and paths. This is useful for files with no tags but
# can lead to issues if a strict naming scheme is not used.
# Tag guessing disabled if unset (default).
# %{album},
# %{albumartist},
# %{artist},
# %{disc} (1 digit),
# %{genre},
# %{releasecountry} (2 letter code),
# %{title},
# %{track} (2 digits),
# %{year}.
#tag-guessing %{genre}/%{albumartist}/%{year}-%{album}-%{releasecountry}/%{disc}%{track}--%{artist}-%{title}
# Guess tags on missing infos:
#tag-guessing-trigger artist
#tag-guessing-trigger albumartist
#tag-guessing-trigger album
#tag-guessing-trigger releasecountry
#tag-guessing-trigger disc
#tag-guessing-trigger title
#tag-guessing-trigger track
#tag-guessing-trigger year
#tag-guessing-trigger genre
[Vorbis]
# Each section not named 'general' or 'source' will define a new destination.

View File

@ -7,5 +7,11 @@ getConfigSource() {
'skip')
skippeddirectories+=( "$value" )
;;
'tag-guessing')
tagguessing="$value"
;;
'tag-guessing-trigger')
tagguessingtriggers+=( "$value" )
;;
esac
}

View File

@ -21,6 +21,16 @@ printConfig() {
printed=1
done
unset printed
echo " |Tag guessing expression|$tagguessing"
for trigger in "${tagguessingtriggers[@]}"
do
(( printed )) \
&& echo -n ' | |' \
|| echo -n ' |Tag guessing triggers|'
echo "$trigger"
printed=1
done
for destination in ${destinations[@]}
do
cat <<-EOF

View File

@ -51,6 +51,32 @@ path $sourcepath
cat <<-EOCfg
# Tag guessing expresssion. Uses same values as "rename" below. This is used to
# guess tags from filenames and paths. This is useful for files with no tags but
# can lead to issues if a strict naming scheme is not used.
# Tag guessing disabled if unset (default).
# %{album},
# %{albumartist},
# %{artist},
# %{disc} (1 digit),
# %{genre},
# %{releasecountry} (2 letter code),
# %{title},
# %{track} (2 digits),
# %{year}.
#tag-guessing %{genre}/%{albumartist}/%{year}-%{album}-%{releasecountry}/%{disc}%{track}--%{artist}-%{title}
tag-guessing $tagguessing
# Guess tags on missing infos:
#tag-guessing-trigger artist
#tag-guessing-trigger albumartist
EOCfg
for trigger in "${tagguessingtriggers[@]}"
do
echo $'tag-guessing-trigger\t'"$trigger"
done
EOCfg
for destination in "${destinations[@]}"
do

View File

@ -55,4 +55,58 @@ setupSource() {
done
unset count
cd - >/dev/null
cat <<-EODesc
Tag guessing pattern:
This is a pattern that will be used to guess the tag names of files
that do not have any tags. The pattern is a string with the following
variables:
%{album} - The album name
%{albumartist} - The album artist name
%{artist} - The artist name
%{disc} - The disc number - 1 digit
%{genre} - The genre name
%{releasecountry} - The country of the release - 2 letter code
%{title} - The title of the track
%{track} - The track number - 2 digits
%{year} - The year or date of the album
EODesc
read \
-e \
-i"${tagguessing} \
-p'Pattern: ' \
tagguessing
cat <<-EODesc
Tag guessing trigger(s):
Tags whose absence will trigger tag guessing.
album - The album name
albumartist - The album artist name
artist - The artist name
disc - The disc number
genre - The genre name
releasecountry - The country of the release
title - The title of the track
track - The track number
year - The year or date of the album
EODesc
count=${#tagguessingtriggers[@]}
for (( i=0 ; 1 ; i++ ))
do
read \
-e \
${tagguessingtriggers[i]+-i"${tagguessingtriggers[i]}"}\
-p'Tag guessing trigger: ' \
value
if [ -n "$value" ]
then
tagguessingtriggers[i]="$value"
elif (( i < count ))
then
unset tagguessingtriggers[i]
else
break
fi
done
unset count
}

10
lib/tags/getInfos::guess Normal file
View File

@ -0,0 +1,10 @@
#!/usr/bin/env bash
getInfosGuess_version='guess-1'
tagreaders+=( "$getInfosGuess_version" )
getInfos::Guess() {
tagreader="$getInfosGuess_version"
local \
infos \
: #FIXME
}