tangled
alpha
login
or
join now
encode42.dev
/
nixos
0
fork
atom
Personal-use NixOS configuration
0
fork
atom
overview
issues
pulls
pipelines
Create function for artist and cover art downloading
encode42.dev
6 months ago
bfbc4d7f
f12b540e
+34
1 changed file
expand all
collapse all
unified
split
hosts
encryption
homes
encode42.nix
+34
hosts/encryption/homes/encode42.nix
···
5
5
...
6
6
}:
7
7
8
8
+
let
9
9
+
mkConvertFunction = outputName: ''
10
10
+
set downloadUrl $argv[1]
11
11
+
set fileName download.tmp
12
12
+
13
13
+
xh --download $downloadUrl --output $fileName
14
14
+
15
15
+
set isOpaque (magick identify -format '%[opaque]' $fileName)
16
16
+
set aspectRatio (magick $fileName -format "%[fx:w/h]" info:)
17
17
+
18
18
+
set -l arguments;
19
19
+
20
20
+
if test $isOpaque = "False"
21
21
+
echo "Will replace transparency with solid color!"
22
22
+
23
23
+
set -a arguments "-transparent white"
24
24
+
end
25
25
+
26
26
+
if test $aspectRatio != "1"
27
27
+
echo "Will adjust the image's cropping!"
28
28
+
29
29
+
set -a arguments "-gravity center -crop 1:1"
30
30
+
end
31
31
+
32
32
+
magick $fileName $arguments -quality 100% -verbose ${outputName}
33
33
+
34
34
+
rm -f $fileName
35
35
+
'';
36
36
+
in
8
37
{
9
38
imports = [
10
39
(flakeRoot + /homes/encode42/common)
···
25
54
26
55
(flakeRoot + /homes/shared/desktop/prismlauncher.nix)
27
56
];
57
57
+
58
58
+
programs.fish.functions = {
59
59
+
download_cover = mkConvertFunction "cover.jpg";
60
60
+
download_artist = mkConvertFunction "artist.jpg";
61
61
+
};
28
62
29
63
home.packages = with pkgs; [
30
64
ffmpeg