Skip to content

Commit

Permalink
[AMR-94] feat: add release year rpc variable
Browse files Browse the repository at this point in the history
  • Loading branch information
N0chteil committed Aug 22, 2023
1 parent ee4c892 commit 08605b2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/utils/replaceVariables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class replaceVariables {
// e.g. "%title% - %album%" => "-"
const separator =
config
.split(/%title%|%album%|%artist%|%version%/g)
.split(/%title%|%album%|%artist%|%year%|%version%/g)
.find((e) => e.length > 0)
?.trim()
?.replace(/[a-zA-Z0-9 ]/g, "") ?? "-";
Expand All @@ -43,6 +43,10 @@ export class replaceVariables {
/%artist%/g,
this.currentTrack.artist ? "_ARTIST_IS_AV_" : "_ARTIST_NOT_AV_"
)
.replace(
/%year%/g,
this.currentTrack.releaseYear ? "_YEAR_IS_AV_" : "_YEAR_NOT_AV_"
)
.replace(
/%version%/g,
app.getVersion() ? "_VERSION_IS_AV_" : "_VERSION_NOT_AV_"
Expand Down Expand Up @@ -90,6 +94,8 @@ export class replaceVariables {
return this.currentTrack.album;
case "artist":
return this.currentTrack.artist;
case "year":
return this.currentTrack.releaseYear?.toString();
case "version":
return app.isPackaged ? app.getVersion() : "Development";
default:
Expand Down

0 comments on commit 08605b2

Please sign in to comment.