YaMusicDownload : Implement.
This commit is contained in:
parent
5f8d6907f2
commit
0ccbd5c756
|
@ -27,7 +27,7 @@
|
|||
# Manual: https://danth.github.io/stylix
|
||||
stylix.url = "github:danth/stylix";
|
||||
|
||||
# I use this for a single container called jobber.
|
||||
# I use this for a single container called jobber. WARN: Do not update.
|
||||
# You likely won't need this one, so just skip it for now.
|
||||
poetry2nixJobber.url = "github:nix-community/poetry2nix/304f8235fb0729fd48567af34fcd1b58d18f9b95";
|
||||
nixpkgsJobber.url = "github:nixos/nixpkgs/051f920625ab5aabe37c920346e3e69d7d34400e";
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
download = [ "/storage/hot/download" ];
|
||||
manga = [ "/storage/cold_1/media/manga" "/storage/cold_2/media/manga" ];
|
||||
movie = [ "/storage/cold_1/media/movie" "/storage/cold_2/media/movie" ];
|
||||
music = [ "/storage/cold_2/media/music" ];
|
||||
music = [ "/storage/cold_2/media/music" "/storage/hot/media/music" ];
|
||||
paper = [ "/storage/hot/media/paper" ];
|
||||
porn = [ "/storage/cold_2/media/porn" ];
|
||||
photo = [ "/storage/hot/container/cloud/data/data/cakee/files/media/photo" "/storage/cold_1/backup/tmp/photo" ];
|
||||
|
|
42
host/home/YaMusicDownload.nix
Normal file
42
host/home/YaMusicDownload.nix
Normal file
|
@ -0,0 +1,42 @@
|
|||
{ pkgs, util, lib, ... }: let
|
||||
storage = "/storage/hot/media/music";
|
||||
package = import ./yamusicdownload { inherit pkgs; };
|
||||
pattern = "#album-artist/#year_#album/#number_#title";
|
||||
in {
|
||||
systemd.user = {
|
||||
services.yamusicdownload = let
|
||||
script = pkgs.writeText "YaMusicDownloadScript" (util.trimTabs ''
|
||||
[[ $UID = 0 ]] && exit 0
|
||||
|
||||
function notify_silent() {
|
||||
curl -X POST -H 'Content-Type: Application/json' -d "{\"chat_id\":\"155897358\",\"text\":\"$1\",\"disable_notification\":\"true\"}" https://api.telegram.org/bot2046849441:AAHQpjRK4xpL8tEUyN4JTSDUUze4J0wSIy4/sendMessage &> /dev/null
|
||||
}
|
||||
|
||||
cd ${storage}
|
||||
|
||||
${package}/bin/yandex-music-downloader --browser "firefox" --hq --add-lyrics --embed-cover --skip-existing --stick-to-artist --only-music --path-pattern "${pattern}" --url https://music.yandex.ru/users/cakee.ru/playlists/3 && notify_silent "Music download complete." || notify_silent "Failed to download music!"
|
||||
'');
|
||||
in util.mkStaticSystemdService {
|
||||
enable = true;
|
||||
description = "Yandex Music Download.";
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
ExecStart = "-${lib.getExe pkgs.bashInteractive} ${script}";
|
||||
Restart = "on-failure";
|
||||
};
|
||||
path = with pkgs; [
|
||||
python313
|
||||
firefox-esr
|
||||
];
|
||||
};
|
||||
|
||||
timers.yamusicdownload = {
|
||||
timerConfig = {
|
||||
OnCalendar = "daily";
|
||||
Persistent = true;
|
||||
Unit = "yamusicdownload.service";
|
||||
};
|
||||
wantedBy = [ "timers.target" ];
|
||||
};
|
||||
};
|
||||
}
|
|
@ -5,6 +5,7 @@
|
|||
./Filesystem.nix
|
||||
./Network.nix
|
||||
./Photoprocess.nix
|
||||
./YaMusicDownload.nix
|
||||
];
|
||||
|
||||
user.voronind.enable = true;
|
||||
|
|
20
host/home/yamusicdownload/default.nix
Normal file
20
host/home/yamusicdownload/default.nix
Normal file
|
@ -0,0 +1,20 @@
|
|||
{ pkgs, ... }: with pkgs.python3Packages; buildPythonPackage {
|
||||
version = "1.0.0";
|
||||
pname = "yandex-music-downloader";
|
||||
format = "pyproject";
|
||||
|
||||
propagatedBuildInputs = [
|
||||
setuptools
|
||||
setuptools-git
|
||||
requests
|
||||
eyed3
|
||||
browser-cookie3
|
||||
];
|
||||
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "llistochek";
|
||||
repo = "yandex-music-downloader";
|
||||
rev = "184d1d1aeb056d6b90df03437b2edde88661b19d";
|
||||
hash = "sha256-7ll1sMTE/fosgTRtaF6vHBsnDNiqxjFXaRG21JV7wo4=";
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue