Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

v1 source realm

Package catalog is GnoRadio's catalog rules, release 1: artists, tracks, albums, playlists, likes, follows, tips, sup...

Overview

Package catalog is GnoRadio's catalog rules, release 1: artists, tracks, albums, playlists, likes, follows, tips, support, moderation and verification. Other GnoRadio realms (radio, tickets, home) read it through the value getters in read.gno; it imports none of them.

It keeps no state but its admin role. Every record lives in the data realm (gno.land/r/nym-alexiscolin000/gnoradio/data), in the "catalog/…" collections only the current catalog writer may change (db.gno). Promo budgets sit in data's vault, so a later release takes over the data and the coins without copying anything.

Four track origins share one catalog:

  • "artist": published by the artist's own wallet, tips enabled;
  • "curated": imported by the admin from CC0 / CC BY / CC BY-SA / CC BY-NC / CC BY-NC-SA sources;
  • "audius", "jamendo": pointers the admin imports. The record keeps only what the radio needs (platform id, genre, duration, licence); the app reads title, artist and cover live, since both platforms' API terms allow session caching only (attribution required).

Imported artists start unclaimed; once the admin assigns them to a wallet (AssignArtist) or the robot verifies a claim, their tracks receive tips.

Tips and support are forwarded in the same transaction: this realm ends every transaction holding no coins.

Constants 3

const version, denom, ugnot, OriginArtist, OriginCurated, OriginAudius, OriginJamendo, minTip, maxTip, maxSplits, maxSplitPct, earlyBadges, minDuration, maxDuration, maxPerArtist, maxAlbumTracks, maxListTracks, maxUserLists, maxFollows, maxUserReports, maxTitle, maxBio, maxCredits, maxReason, topSize, maxSupportPct

 1const (
 2	version = "1.0.0"
 3	denom   = "ugnot"
 4	ugnot   = 1_000_000
 5
 6	OriginArtist  = "artist"
 7	OriginCurated = "curated"
 8	OriginAudius  = "audius"
 9	OriginJamendo = "jamendo"
10
11	minTip         = 100_000           // 0.1 GNOT
12	maxTip         = 1_000_000 * ugnot // keeps share math far from overflow
13	maxSplits      = 4
14	maxSplitPct    = 90 // the artist always keeps at least 10%
15	earlyBadges    = 10
16	minDuration    = 10
17	maxDuration    = 1200
18	maxPerArtist   = 500 // tracks per artist
19	maxAlbumTracks = 40
20	maxListTracks  = 200
21	maxUserLists   = 50
22	maxFollows     = 1000
23	maxUserReports = 5   // open reports per reporter
24	maxTitle       = 64  // track, album and playlist titles, in characters
25	maxBio         = 280 // artist bio
26	maxCredits     = 160 // a track's credits and a curated import's attribution
27	maxReason      = 200 // report and moderation reasons
28	topSize        = 10
29	maxSupportPct  = 50
30)
source

const AudiusLicense

1const AudiusLicense = "Audius-OML"
source

AudiusLicense is the license id of tracks streamed from Audius.

const NumGenres

1const NumGenres = 20
source

NumGenres is the size of the fixed genre list; genre ids are 1..NumGenres.

Functions 112

func ActivityJSON

Action
1func ActivityJSON(limit int) string
source

ActivityJSON returns the activity feed, newest first (limit <= 64).

func AlbumsJSON

Action
1func AlbumsJSON(offset, limit int) string
source

AlbumsJSON returns visible albums with ids offset+1..offset+limit (at most 100).

func AllowHost

crossing Action
1func AllowHost(cur realm, host string, allowed bool)
source

AllowHost adds or removes an https host that audio and covers may use.

func ArtistBrief

Action
1func ArtistBrief(artistID int) (name string, verified, hidden, ok bool)
source

ArtistBrief returns what a link to an artist needs, without the bio or the id lists; ok is false for an unknown artist.

func ArtistByName

Action
1func ArtistByName(name string) int
source

ArtistByName looks a profile up by its (case-insensitive) name.

func ArtistByRef

Action
1func ArtistByRef(ref string) int
source

ArtistByRef looks a pointer artist up by its platform id ("audius-user:12").

func ArtistTrackPage

Action
1func ArtistTrackPage(artistID, offset, limit int) []int
source

ArtistTrackPage lists an artist's track ids in publishing order, paginated.

func ArtistVerified

Action
1func ArtistVerified(artistID int) bool
source

ArtistVerified reports whether an artist proved who they are (tips and paid tickets need it).

func ArtistsJSON

Action
1func ArtistsJSON(offset, limit int) string
source

ArtistsJSON returns visible artists with ids offset+1..offset+limit (at most 100).

func AssignArtist

crossing Action
1func AssignArtist(cur realm, artistID int, owner address)
source

AssignArtist hands an unclaimed artist to the wallet that proved it owns the profile (claim checked off-chain). Their tracks then receive tips.

func CancelClaim

crossing Action
1func CancelClaim(cur realm, artistID int)
source

CancelClaim drops a pending claim (e.g. the proof page was hijacked). Admin only.

func Claim

crossing Action
1func Claim(cur realm, artistID int, proof string, expires int64, sigHex string)
source

Claim starts the verification of artistID for the caller with the robot's certificate (ClaimMessage signed, hex). It replaces any pending claim for the artist and restarts the delay. The artist pays its gas.

func ClaimJSON

Action
1func ClaimJSON(artistID int) string
source

ClaimJSON is the verification state of an artist for the app: {"verified":b,"proof":"…","pending":b,"to":"…","pendingProof":"…","readyAt":n,"bot":"…"}.

func ClaimMessage

Action
1func ClaimMessage(artistID int, to address, proof string, expires int64) string
source

ClaimMessage is what the robot signs: the chain, the GnoRadio deployment (its data realm, so a staging deployment on the same chain cannot reuse a certificate), the profile, the wallet, where the proof was found and until when the certificate holds.

func CreateAlbum

crossing Action
1func CreateAlbum(cur realm, artistID int, title, cover, coverSHA string, year int, trackIDs string) int
source

CreateAlbum groups tracks of one artist. The artist (or the admin for an unclaimed artist) creates it; trackIDs is "12,13,14" in play order.

func CreateArtist

crossing Action
1func CreateArtist(cur realm, kind, name, bio, source string) int
source

CreateArtist adds an unclaimed artist. Admin only. A curated artist has a name and its page at the source (https), shown for attribution. An Audius or Jamendo artist is a pointer: no name or bio, and source is its platform id ("audius-user:<id>", "jamendo-artist:<id>"), which also keeps it unique; the app reads its name live from the platform.

func EditFor

crossing Action
1func EditFor(cur realm, caller address, trackID int, title string, genre int, duration, credits, audio, audioSHA, cover, coverSHA string)
source

EditFor fixes a track's details. Its artist only (the admin while the artist is unclaimed): caller is who signed.

func FinalizeClaim

crossing Action
1func FinalizeClaim(cur realm, artistID int)
source

FinalizeClaim applies a pending claim once claimDelay has passed. Anyone can call it, usually the artist from the app.

func Follow

crossing Action
1func Follow(cur realm, artistID int)
source

Follow and Unfollow an artist.

func FollowsPage

Action
1func FollowsPage(addr address, offset, limit int) []int
source

FollowsPage lists the artist ids a listener follows, paginated.

func FundPromo

crossing Action
1func FundPromo(cur realm)
source

FundPromo adds the attached ugnot to the caller's sponsored-pick budget in the vault. A new budget pays defaultPickPay per aired pick (SetPromoPay changes it). If the profile changed hands since the last funding, the previous funder gets their whole balance back first, reservations included, and the budget starts a new funding generation. The caller's budget must then hold at least one refund, or no pick could ever use it.

func GenrePage

Action
1func GenrePage(genre, offset, limit int) []int
source

GenrePage lists the track ids of a genre (hidden ones included), newest first.

func HiddenNote

Action
1func HiddenNote(kind string, id int) string
source

HiddenNote says why a track, album, artist or playlist is hidden, for its page: "Removed by moderation: <reason>", "Hidden by the artist.", or "".

func HideOwn

crossing Action
1func HideOwn(cur realm, kind string, id int, hidden bool)
source

HideOwn hides or shows again the caller's own track, album or artist profile ("artist", with the profile's id). The artist can show again only what they hid themselves: what the moderator hid stays hidden.

func HideSource

crossing Action
1func HideSource(cur realm, kind string, from, count int, reason string) int
source

HideSource hides every artist read from a platform ("audius" or "jamendo"), and so all their tracks, for a platform that ends GnoRadio's API access. It walks artist ids from `from`, count (1-50) at a time, and returns where to go on (0 once past the last artist). One artist opting out is a HideArtist. Admin only.

func HideTrack

crossing Action
1func HideTrack(cur realm, trackID int, hidden bool, reason string)
source

Hide or restore content. Admin only; hiding takes a public reason (4-200 characters) and restoring works on anything, whoever hid it. Hidden content stays on-chain (and on IPFS); it is no longer listed, played or tippable. Radio stations drop a hidden track on their next Refresh (radio.RefreshArtist for a whole artist).

func ImportFor

crossing Action
1func ImportFor(cur realm, by address, artistID int, title string, genre int, duration, license, credits, audio, audioSHA, cover, coverSHA, sourceURL, attribution string) int
source

ImportFor adds a curated (CC0 / CC BY / CC BY-SA / CC BY-NC / CC BY-NC-SA) track, or a pointer to an Audius or Jamendo track, to an unclaimed artist. by must be the admin. A pointer keeps only what the radio needs (audio "audius:<id>" or "jamendo:<id>", genre, duration, licence): title, credits, cover, source and attribution stay empty and the app reads them live from the platform, whose API terms allow session caching only.

func Info

Action
1func Info() string
source

Info is the catalog's summary for the app: counts, the admin and the realm that writes the catalog now ("current", this one unless retired).

func Like

crossing Action
1func Like(cur realm, trackID int)
source

Like records a public like. The first listeners to like a track earn its early-listener badge. (Saving a track privately is done in the app, free.)

func LikedPage

Action
1func LikedPage(addr address, offset, limit int) []int
source

LikedPage lists a listener's liked track ids, newest tracks first, paginated. Likes are keyed by track id, so this is the newest music the listener liked, not the order of their likes (that needs an index per like, which would add to every like's storage deposit).

func OfferAdmin

crossing Action
1func OfferAdmin(cur realm, to address)
source

OfferAdmin offers the admin role to an address (offering it to the admin cancels the offer); AcceptAdmin takes it. Each change is mirrored to the data realm, so the next release keeps the admin.

func PlayableTitle

Action
1func PlayableTitle(id int) string
source

PlayableTitle is a track's title, "" unless it is playable (TrackBrief).

func PlaylistBrief

Action
1func PlaylistBrief(id int) (owner address, title string, tracks int, hidden, ok bool)
source

PlaylistBrief returns a playlist's header without its track ids.

func PlaylistsJSON

Action
1func PlaylistsJSON(offset, limit int) string
source

PlaylistsJSON returns visible playlists with ids offset+1..offset+limit (at most 100).

func PromoClaim

crossing Action
1func PromoClaim(cur realm, trackID int, picker address, end, amount int64, gen int)
source

PromoClaim pays picker a reservation of funding generation gen once their sponsored pick ending at end has aired; the radio realm checks the slot. A lapsed or cancelled reservation (the budget was refunded since) pays nothing.

func PromoClaimable

Action
1func PromoClaimable(trackID int, end, amount int64, gen int) bool
source

PromoClaimable reports whether PromoClaim would pay a sponsored pick's refund: reserved for end in generation gen, neither lapsed nor cancelled.

func PromoJSON

Action
1func PromoJSON(artistID int) string
source

PromoJSON is an artist's sponsored-pick budget: {"artist","funder","balance","reserved","free","pay","perDay","today","funded","paid","picks","offer"}. The funder withdraws "free" with data.VaultWithdraw(acct) where acct is "catalog/" and the artist id on 8 digits.

func PromoOffer

Action
1func PromoOffer(artistID int) int64
source

PromoOffer is what a sponsored pick of the artist's tracks refunds right now (0: none). Picker-specific limits are checked when picking.

func PromoRelease

crossing Action
1func PromoRelease(cur realm, trackID int, picker address, end, amount, reserved int64, gen int)
source

PromoRelease returns a reservation to its budget: the slot was dropped or cut before it aired in full. A reservation of an earlier funding generation than gen's budget was refunded with it: nothing to release. A pick that never aired, reserved at reserved (unix; 0 when it partly aired), also gives back the daily counts it took, the artist's and picker's, if that was today. Radio realm only.

func PromoReserve

crossing Action
1func PromoReserve(cur realm, trackID int, picker address, end int64) (int64, int)
source

PromoReserve reserves the refund of a sponsored pick of trackID by picker whose slot ends at end. Only the radio realm may call it (radio.QueueSponsored); it panics with the reason when the pick cannot be sponsored. It returns the amount reserved and the budget's funding generation, which the radio passes back to PromoClaim, PromoClaimable and PromoRelease.

func ProofHost

Action
1func ProofHost(artistID int) string
source

ProofHost is where a verified artist's proof was found: a host they control, not proof of who they are, so show it next to the ✓. It is "" when the artist is not verified, or a moderator verified it (Verify, AssignArtist).

func PublishFor

crossing Action
1func PublishFor(cur realm, caller address, title string, genre int, duration, license, cmo, credits, audio, audioSHA, cover, coverSHA, splits, rights string) int
source

PublishFor adds a track by caller's own artist profile. duration is "m:ss"; cmo is "none" or "sacem-nc"; splits is optional, "g1...:30,g1...:15" in percent (the artist keeps at least 10%); rights must be "yes" (the caller accepts RightsTerms). audio and cover are ipfs://, ar:// or https:// links (an allowed host, with the file's sha256).

func PublishPlaylist

crossing Action
1func PublishPlaylist(cur realm, title, trackIDs string) int
source

PublishPlaylist makes a public playlist in one signature; trackIDs is "12,40,7". Private playlists live in the app and cost nothing.

func RadioTip

crossing Action
1func RadioTip(cur realm, trackID, supportPct int, tipper, picker, ref address, total int64) (toPicker, toRef int64)
source

RadioTip pays a tip the radio realm received for the listener tipper (radio.TipOnAir): the radio has already forwarded total ugnot to this realm and names the picker of the slot on air. Only the radio writer may call it. It returns what the picker and the referrer received.

func Ready

crossing Action
1func Ready(cur realm)
source

Ready tells the data realm that this release is on chain (see data.Propose). Anyone may call it.

func RegisterArtist

crossing Action
1func RegisterArtist(cur realm, name, bio string) int
source

RegisterArtist creates or updates the caller's artist profile. Names use Latin letters so look-alike names in other scripts cannot impersonate.

func ReleaseName

crossing Action
1func ReleaseName(cur realm, name string)
source

ReleaseName frees a reserved name no visible artist is using. Admin only.

func Render

1func Render(_ string) string
source

Render points gnoweb visitors to the GnoRadio site; a retired release says which realm took over.

func RenounceAdmin

crossing Action
1func RenounceAdmin(cur realm)
source

RenounceAdmin gives the admin role up for good, for this release and the next ones.

func Report

crossing Action
1func Report(cur realm, kind string, target int, reason string)
source

Report flags a track, album, artist or playlist for the moderators (e.g. "broken link", "not the real artist", "copyright").

func ReportPage

Action
1func ReportPage(offset, limit int) []int
source

ReportPage lists open report ids, newest first.

func ResetOwner

crossing Action
1func ResetOwner(cur realm, artistID int)
source

ResetOwner undoes a wrong claim on an imported profile (e.g. a hijacked proof page found too late): the profile is unclaimed again. Self-registered profiles keep their owner. Admin only.

func ResolveReport

crossing Action
1func ResolveReport(cur realm, id int)
source

ResolveReport closes a report once handled. Admin only.

func ResolveReports

crossing Action
1func ResolveReports(cur realm, from, count int)
source

ResolveReports closes the open reports with ids from..from+count-1 (count 1-50) in one transaction, e.g. a run of spam reports; ids already closed are skipped. There is no global cap on open reports, so spam never blocks an honest reporter: each wallet keeps at most 5 open. Admin only.

func SetBot

crossing Action
1func SetBot(cur realm, pubKeyHex string)
source

SetBot sets the robot's Ed25519 public key, hex ("" disables it). Every pending claim started with the previous key is voided: its artist claims again with a fresh certificate. Admin only.

func SetMonthlyGoal

crossing Action
1func SetMonthlyGoal(cur realm, ugnot int64)
source

SetMonthlyGoal sets the monthly support goal shown in the app (ugnot). Admin only.

func SetPromoPay

crossing Action
1func SetPromoPay(cur realm, ugnotPerPick int64, perDay int)
source

SetPromoPay sets what each aired sponsored pick of the caller's tracks refunds (10 000..500 000 ugnot, 0 pauses) and the daily limit (1 to 100, 0 = the default, 10).

func SetPromoShare

crossing Action
1func SetPromoShare(cur realm, pct int)
source

SetPromoShare sets the percent of each tip on the caller's tracks that goes to the picker and the referrer (0..20).

func SetTreasury

crossing Action
1func SetTreasury(cur realm, to address)
source

SetTreasury changes where GnoRadio's support goes; "" (the default) takes none. Admin only.

func SupportGnoRadio

crossing Action
1func SupportGnoRadio(cur realm)
source

SupportGnoRadio sends the attached ugnot to the GnoRadio treasury.

func Tip

crossing Action
1func Tip(cur realm, trackID int)
source

Tip forwards the attached ugnot to the track's artist and collaborators, split as declared at publish time, in this same transaction. Only verified artists receive tips (verify.gno). Verification proves control of a web host or an Audius account, not who the artist is: the proof host is public next to every ✓ (ProofHost), and the 72 h claim window (PendingClaims) is there to catch an impersonator before tips open.

func TipWithSupport

crossing Action
1func TipWithSupport(cur realm, trackID int, supportPct int)
source

TipWithSupport is Tip plus an optional contribution to GnoRadio: of the attached total T, the artist side receives T*100/(100+supportPct) (split as in Tip) and the rest goes to the GnoRadio treasury. supportPct is 0..50.

func TrackBrief

Action
1func TrackBrief(id int) (artistID, genre int, duration int64, playable_ bool)
source

TrackBrief is what the radio needs; playable is false for an unknown or hidden track, or one whose artist is hidden.

func TrackBriefFor

Action
1func TrackBriefFor(id int, addr address) (artistID, genre int, duration int64, playable_, own bool)
source

TrackBriefFor is TrackBrief and whether addr ("" for nobody) is the track's artist or one of its collaborators, from the same reads.

func TrackPage

Action
1func TrackPage(offset, limit int, newest bool) []int
source

TrackPage lists track ids, newest first when newest is true. Ids are dense (1..count), so these pages are arithmetic.

func TracksJSON

Action
1func TracksJSON(offset, limit int) string
source

TracksJSON pages through playable tracks (newest first), at most 100. Chunks and artist heads are read once per page.

func Unlike

crossing Action
1func Unlike(cur realm, trackID int)
source

Unlike takes a like back, and its early-listener badge with it.

func UpdatePlaylist

crossing Action
1func UpdatePlaylist(cur realm, playlistID int, title, trackIDs string)
source

UpdatePlaylist replaces a playlist's title and tracks. Owner only.

func UserJSON

Action
1func UserJSON(addr address) string
source

UserJSON returns a listener's public counters (likes are paged with LikesJSON).

func UserStats

Action
1func UserStats(addr address) (likes, follows int, tipped int64, lists []int)
source

UserStats returns a listener's public counters and playlists. The like count reads the listener's own like ranges, one page.

func Verify

crossing Action
1func Verify(cur realm, artistID int, verified bool)
source

Verify marks an artist whose identity was checked off-chain.

func Activities

Action
1func Activities(limit int) []Activity
source

Activities returns up to limit entries, newest first.

func PendingClaims

Action
1func PendingClaims(offset, limit int) (out []PendingClaim, total int)
source

PendingClaims lists up to limit (1-100) verifications pending with the current robot key, by artist id from offset, and how many claims are stored (stale ones included, so offset+limit < total means more). A claim stays public for 72 hours before it counts: this is where anyone watches them.

func GetTrack

Action
1func GetTrack(id int) (Track, bool)
source

GetTrack returns a copy of a track; ok is false if unknown. A pointer's empty title reads as its platform ("Audius track").

Types 10

type Activity

struct
1type Activity struct {
2	Kind   string // publish | like | follow | tip | support | playlist | album | claim
3	By     address
4	Track  int // track, playlist or album id depending on Kind
5	Artist int
6	Amount int64
7	At     int64
8}
source

Activity is one entry of the public activity feed.

type Album

struct
 1type Album struct {
 2	ID       int
 3	Artist   int
 4	Title    string
 5	Cover    string
 6	CoverSHA string
 7	Year     int
 8	Tracks   []int
 9	Created  int64
10	Hidden   bool
11}
source

type Artist

struct
 1type Artist struct {
 2	ID        int
 3	Owner     address // "" while unclaimed (curated / Audius / Jamendo)
 4	Kind      string  // artist | curated | audius | jamendo
 5	Name      string
 6	Bio       string
 7	Source    string // curated: source page; audius / jamendo: platform id (audius-user:<id>, jamendo-artist:<id>)
 8	Joined    int64
 9	Tips      int64
10	Followers int
11	Tracks    []int
12	Albums    []int
13	Verified  bool
14	Hidden    bool
15}
source

type PendingClaim

struct
1type PendingClaim struct {
2	Artist  int
3	To      address
4	Proof   string
5	ReadyAt int64
6}
source

PendingClaim is a verification on its way: the artist, the wallet it goes to, the proof link and when FinalizeClaim may apply it.

type Playlist

struct
1type Playlist struct {
2	ID      int
3	Owner   address
4	Title   string
5	Tracks  []int
6	Updated int64
7	Hidden  bool
8}
source

type Rank

struct
1type Rank struct {
2	Key   string
3	Value int64
4}
source

type ReportInfo

struct
1type ReportInfo struct {
2	ID     int
3	Kind   string // track | album | artist | playlist
4	Target string
5	Reason string
6	By     address
7	At     int64
8}
source

type Split

struct
1type Split struct {
2	To  address
3	Pct int64 // percent of each tip
4}
source

type Track

struct
 1type Track struct {
 2	ID          int
 3	Artist      int
 4	Origin      string
 5	Title       string
 6	Genre       int
 7	Duration    int64 // seconds
 8	License     string
 9	CMO         string // none | sacem-nc
10	Credits     string
11	Audio       string // ipfs://… ar://… audius:… jamendo:… https://…
12	AudioSHA    string // sha256 hex, required for https
13	Cover       string
14	CoverSHA    string
15	SourceURL   string
16	Attribution string
17	Splits      []Split
18	Album       int
19	Created     int64
20	Likes       int
21	Tips        int64
22	Supporters  int
23	Hidden      bool
24	Early       []address // first listeners to like it
25}
source

type User

struct
1type User struct {
2	Follows   string // sorted packed artist ids
3	Tipped    int64
4	Playlists []int
5	Reports   int // open reports filed by this user
6}
source

User is what a listener writes, so a follow only touches that listener's own record. Follows are a sorted packed list (9 bytes each); likes and the tipped tracks live apart, per range of 512 track ids.

Imports 15

Source Files 15