JlSonic/JlSonic/types.jl

54 lines
1.2 KiB
Julia

import Random
import Dates
mutable struct User
name::String
password::String
email::String
# scrobbling::Bool
admin::Bool
settings::Bool
download::Bool
upload::Bool
cover::Bool
playlist::Bool
comment::Bool
# podcast::Bool
stream::Bool
# jukebox::Bool
share::Bool
end
mutable struct Playlist
uuid::String
name::String
comment::String
owner::String
public::Bool
# FIXME: replace with uuids only (and check they exists when importing)
songs::Vector{Song}
cover::String
allowed::Vector{String}
created::Dates.DateTime
end
function Playlist(owner::String
; uuid = string(UUIDs.uuid4()),
name = "New Playlist",
comment = "",
public = false,
songs = Song[],
cover = "",
allowed = String[],
creation = Dates.now())
Playlist(uuid,
name, comment, owner, public,
songs, cover,
allowed, creation)
end
function User(name::String)
User(name, Random.randstring(30),
string(name, "@", domain),
false, false, false, false, false, false, false, false, false)
end