summaryrefslogtreecommitdiffstats
path: root/5pkgs/nsrenamer
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2020-08-18 23:26:51 +0200
committermakefu <github@syntax-fehler.de>2020-08-18 23:26:51 +0200
commit80a277213556af2847d0e64723b1cb079d59416a (patch)
tree68a4a12e86927dc816c275ca5c9c7cf57d2c4ce4 /5pkgs/nsrenamer
parent3d3cc898858cec05f7f02bd108b5259e12a51dac (diff)
ma pkgs.nsrenamer: new naming scheme
Diffstat (limited to '5pkgs/nsrenamer')
-rw-r--r--5pkgs/nsrenamer/default.nix2
-rwxr-xr-x5pkgs/nsrenamer/nsrenamer.sh20
2 files changed, 11 insertions, 11 deletions
diff --git a/5pkgs/nsrenamer/default.nix b/5pkgs/nsrenamer/default.nix
index 9dbd3ad4f..16b9a4f20 100644
--- a/5pkgs/nsrenamer/default.nix
+++ b/5pkgs/nsrenamer/default.nix
@@ -1,3 +1,3 @@
{ pkgs,... }:
# TODO: dependencies: coreutils, nx_game_info,
-pkgs.writeScriptBin "nsrenamer" ./nsrenamer.sh
+pkgs.writeScriptBin "nsrenamer" (builtins.readFile ./nsrenamer.sh)
diff --git a/5pkgs/nsrenamer/nsrenamer.sh b/5pkgs/nsrenamer/nsrenamer.sh
index 3d60d1ae9..16aec3113 100755
--- a/5pkgs/nsrenamer/nsrenamer.sh
+++ b/5pkgs/nsrenamer/nsrenamer.sh
@@ -4,29 +4,29 @@ indir=$(dirname "$1")
inname=$(basename "$1")
out=$(nxgameinfo_cli "$1")
ext=${1##*.}
-id=$(awk -F: '/├ Title ID:/{print $2}' <<<$out |xargs)
-baseid=$(awk -F: '/Base Title ID:/{print $2}' <<<$out |xargs)
-version=$(awk -F: '/├ Display Version:/{print $2}' <<<$out |xargs)
-name=$(awk -F: '/Title Name/{print $2}' <<<$out |xargs)
-type=$(awk -F: '/Type:/{print $2}' <<<$out | xargs)
+id=$(awk -F: '/├ Title ID:/{print $2}' <<<"$out" |xargs)
+baseid=$(awk -F: '/Base Title ID:/{print $2}' <<<"$out" |xargs)
+version=$(awk -F: '/├ Version:/{print $2}' <<<"$out" |xargs)
+name=$(awk -F: '/Title Name/{print $2}' <<<"$out" | sed "s/[:']//g" | xargs )
+type=$(awk -F: '/Type:/{print $2}' <<<"$out" | xargs)
! test -n "$id" && echo "Title ID cannot be empty!" && exit 1
! test -n "$type" && echo "type cannot be empty!" && exit 1
if test "$type" == Base;then
! test -n "$name" && echo "Title Name cannot be empty!" && exit 1
- NAME="[$id] $name Base Game.$ext"
+ NAME="$name [$id][v$version].$ext"
elif test "$type" == Update;then
! test -n "$name" && echo "Title Name cannot be empty!" && exit 1
! test -n "$version" && echo "Version cannot be empty!" && exit 1
- NAME="[$id] $name Update $version.$ext"
+ NAME="$name [UPD][$id][v$version].$ext"
elif test "$type" == DLC;then
- dlcname=$(jq -r --arg id "$id" '.[$id].name' < ~/.switch/titles.US.en.json)
+ dlcname=$(jq -r --arg id "$id" '.[$id].name' < ~/.switch/titles.US.en.json | sed "s/[:']//g")
if test -n "$dlcname" ;then
- NAME="[$id] $dlcname DLC.$ext"
+ NAME="$dlcname [DLC][$id][v$version].$ext"
else
! test -n "$name" && echo "dlcname cannot be found in titles.US.en.json and $name is empty!" && exit 1
- NAME="[$id] $name DLC.$ext"
+ NAME="$dlcname [DLC][$id][v$version].$ext"
fi
else
echo "unknown type '$type'"
[cgit] Unable to lock slot /tmp/cgit/b4000000.lock: No such file or directory (2)