aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenry Webster <hwebs@hwebs.info>2026-07-25 19:21:28 -0500
committerHenry Webster <hwebs@hwebs.info>2026-07-25 19:21:28 -0500
commitcd7be9534f86c46d28d478bf8fa22e6423d474f1 (patch)
tree0f656c471cb6c56e49cba686d31d354e29c58b6c
parente41b922e83f2c090578e6ab8d3cee7f1c5b957b7 (diff)
change name to discidurl
-rw-r--r--README.md4
-rw-r--r--flake.nix14
-rw-r--r--pdiscidurl.c65
3 files changed, 9 insertions, 74 deletions
diff --git a/README.md b/README.md
index 6402eb5..301161f 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# pdiscidurl
+# discidurl
This program prints the `discid` submission URL to `STDOUT`. _That's it_.
@@ -7,5 +7,5 @@ It's a trimmed down version of [libdiscid/examples/discid.c](https://github.com/
When paired with something like `xdg-open`, the submission page of the current disc opens in the preferred browser:
``` sh
-pdiscidurl | xargs -r xdg-open
+discidurl | xargs -r xdg-open
```
diff --git a/flake.nix b/flake.nix
index 403a9d5..27b949e 100644
--- a/flake.nix
+++ b/flake.nix
@@ -1,5 +1,5 @@
{
- description = "pdiscidurl - print the MusicBrainz submission URL for a disc";
+ description = "discidurl - output the MusicBrainz submission URL for a disc";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
@@ -10,7 +10,7 @@
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f nixpkgs.legacyPackages.${system});
- pdiscidurl =
+ discidurl =
{
lib,
stdenv,
@@ -18,7 +18,7 @@
libdiscid,
}:
stdenv.mkDerivation {
- pname = "pdiscidurl";
+ pname = "discidurl";
version = "0-unstable-${self.shortRev or self.dirtyShortRev or "dirty"}";
src = ./.;
@@ -29,7 +29,7 @@
makeFlags = [ "PREFIX=$(out)" ];
meta = {
- mainProgram = "pdiscidurl";
+ mainProgram = "discidurl";
license = lib.licenses.lgpl21Plus;
# TODO: test if I ever need on another platform
platforms = lib.platforms.linux;
@@ -38,16 +38,16 @@
in
{
packages = forAllSystems (pkgs: {
- default = pkgs.callPackage pdiscidurl { };
+ default = pkgs.callPackage discidurl { };
});
overlays.default = final: prev: {
- pdiscidurl = final.callPackage pdiscidurl { };
+ discidurl = final.callPackage discidurl { };
};
devShells = forAllSystems (pkgs: {
default = pkgs.mkShell {
- inputsFrom = [ (pkgs.callPackage pdiscidurl { }) ];
+ inputsFrom = [ (pkgs.callPackage discidurl { }) ];
};
});
};
diff --git a/pdiscidurl.c b/pdiscidurl.c
deleted file mode 100644
index 24425a0..0000000
--- a/pdiscidurl.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/* --------------------------------------------------------------------------
-
- MusicBrainz -- The Internet music metadatabase
-
- Copyright (C) 2026 Henry J. Webster
- Copyright (C) 2013 Johannes Dewender, Laurent Monin
- Copyright (C) 2006 Matthias Friedrich
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, see
- <https://www.gnu.org/licenses/>.
-
---------------------------------------------------------------------------- */
-#ifdef _MSC_VER
-#define _CRT_SECURE_NO_WARNINGS
-#if (_MSC_VER < 1900)
-#define snprintf _snprintf
-#endif
-#endif
-
-#include <discid/discid.h>
-#include <stdio.h>
-
-#ifndef DISCID_HAVE_SPARSE_READ
-#define discid_read_sparse(disc, dev, i) discid_read(disc, dev)
-#endif
-
-int main(int argc, char *argv[]) {
- char *device = NULL;
- DiscId *disc;
-
- disc = discid_new();
-
- /* If we have an argument, use it as the device name */
- if (argc > 1) {
- device = argv[1];
- } else {
- /* this will use discid_get_default_device() internally */
- device = NULL;
- }
-
- if (discid_read_sparse(disc, device, 0) == 0) {
- fprintf(stderr, "Error: %s\n", discid_get_error_msg(disc));
- discid_free(disc);
- return 1;
- }
-
- printf("%s\n", discid_get_submission_url(disc));
-
- discid_free(disc);
-
- return 0;
-}
-
-/* EOF */