1
0

hosts/storage-2: optimize music scraper

This commit is contained in:
clerie 2023-01-18 20:40:45 +01:00
parent 820a05b266
commit 5bb88492c2

View File

@ -25,11 +25,13 @@ let
Group = "data-mixcloud";
Restart="on-failure";
};
wants = [ "youtube-dl-prepare.service" ];
after = [ "youtube-dl-prepare.service" ];
path = [ pkgs.youtube-dl ];
script = ''
mkdir -p /data/mixcloud/${source}/
cd /data/mixcloud/${source}/
youtube-dl --ignore-errors --playlist-random --newline ${url}
youtube-dl --ignore-errors --playlist-random --newline -x --audio-format mp3 ${url}
'';
startAt = "*-*-* 05:05:00";
}
@ -67,6 +69,17 @@ in {
};
users.groups.data-mixcloud = {};
systemd.services = (mapAttrs' generateYoutubedlMixcloudUnits mixcloudSources);
systemd.services = {
"youtube-dl-prepare" = {
serviceConfig = {
Type = "oneshot";
RemainAfterExit = "true";
};
script = ''
mkdir -p /data/mixcloud
chown -R data-mixcloud:data-mixcloud /data/mixcloud
'';
};
} // (mapAttrs' generateYoutubedlMixcloudUnits mixcloudSources);
systemd.timers = (mapAttrs' generateYoutubedlMixcloudTimers mixcloudSources);
}