From 48ee36713d009cc60db8ee2bad6a13a883c2e30c Mon Sep 17 00:00:00 2001 From: coolneng Date: Sun, 4 Sep 2022 08:06:02 +0200 Subject: [PATCH] Use HEAD of Mopidy somafm soundcloud and youtube --- .gitattributes | 1 + modules/audio.nix | 43 ++++++++++++++++++++++++++++++++++----- secrets/soundcloud_token | Bin 0 -> 56 bytes 3 files changed, 39 insertions(+), 5 deletions(-) create mode 100644 .gitattributes create mode 100644 secrets/soundcloud_token diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..d65a898 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +secrets/soundcloud_token filter=git-crypt diff=git-crypt diff --git a/modules/audio.nix b/modules/audio.nix index a2b9322..6e530ce 100644 --- a/modules/audio.nix +++ b/modules/audio.nix @@ -2,12 +2,38 @@ with pkgs; -# HACK Replace youtube-dl with yt-dlp in mopidy-youtube let + # HACK Replace youtube-dl with yt-dlp in mopidy-youtube mopidy-youtube-yt_dlp = mopidy-youtube.overrideAttrs (old: rec { + src = python3Packages.fetchPypi { + version = "3.6"; + pname = "Mopidy-YouTube"; + sha256 = "sha256-92tJpCu0S79Z1yYaQUnNMxN1rD+8Wr0rtt4GVnldZ9A="; + }; + propagatedBuildInputs = old.propagatedBuildInputs ++ [ python3.pkgs.yt-dlp ]; }); + latest-mopidy-somafm = mopidy-somafm.overrideAttrs (old: rec { + src = python3Packages.fetchPypi { + version = "2.0.2"; + pname = "Mopidy-SomaFM"; + sha256 = "DC0emxkoWfjGHih2C8nINBFByf521Xf+3Ks4JRxNPLM="; + }; + }); + soundcloud_token = builtins.readFile ../secrets/soundcloud_token; + latest-mopidy-soundcloud = mopidy-soundcloud.overrideAttrs (old: rec { + src = fetchFromGitHub { + owner = "mopidy"; + repo = "mopidy-soundcloud"; + rev = "fc766b0bf17feb4fc989029b92a315a10ff453ee"; + sha256 = "sha256-LftBbfs5KqqkhFQVZRh/AQKQQ+18x8RapRU1mTB7FD8="; + }; + + propagatedBuildInputs = old.propagatedBuildInputs + ++ [ python3.pkgs.beautifulsoup4 ]; + }); + in { # Configure pipewire as sound server services.pipewire = { @@ -32,13 +58,16 @@ in { # Set up Mopidy services.mopidy = { enable = true; - extensionPackages = - [ mopidy-mpd mopidy-youtube-yt_dlp mopidy-somafm mopidy-local ]; + extensionPackages = [ + mopidy-mpd + mopidy-local + mopidy-youtube-yt_dlp + latest-mopidy-somafm + latest-mopidy-soundcloud + ]; configuration = '' [audio] - mixer_volume = output = pulsesink server=127.0.0.1 - visualizer = [local] media_dir = /home/coolneng/Music @@ -72,6 +101,10 @@ in { [somafm] encoding = aac quality = highest + + [soundcloud] + auth_token = ${soundcloud_token} + explore_songs = 100 ''; }; } diff --git a/secrets/soundcloud_token b/secrets/soundcloud_token new file mode 100644 index 0000000000000000000000000000000000000000..df524f2c1893e2b9a73b03d06c993aed408274e1 GIT binary patch literal 56 zcmV-80LT9TM@dveQdv+`07-Pl5oI;GeZ7`y_4y8yphF!8Ws+A|-0-@}pKn5FSON(4 OPOlg=c