Documentation ¶
Index ¶
- Constants
- Variables
- func CountTracks(ctx context.Context, userID int) (int64, error)
- func CountTracks2(ctx context.Context, userID int) (int64, error)
- func CreateTables(ctx context.Context) error
- func DeletePlaylist(ctx context.Context, userID int, id int) error
- func DeleteStar(ctx context.Context, userID int, ssid string) error
- func DeleteTrack(ctx context.Context, userID int, trackID string) error
- func GetALLTracks(ctx context.Context) dynamo.Iter
- func GetStars(ctx context.Context, userID int) (map[SSID]Star, error)
- func HashPassword(password string) ([]byte, error)
- func IncTotalPlays(ctx context.Context, secs int) error
- func Init(region, prefix, endpoint string, debug bool)
- func MassUpdateTracks(ctx context.Context, userID int, trackIDs []string, ...) error
- func NextID(ctx context.Context, class string) (n int, err error)
- func RecreateDump(ctx context.Context, userID int, at time.Time) error
- func RefreshDump(ctx context.Context, userID int, at time.Time, updates []Track, ...) error
- func SetStar(ctx context.Context, userID int, ssid SSID, date time.Time) error
- type DisplayOptions
- type Dump
- type Event
- type EventKind
- type File
- func (f File) Create(ctx context.Context) error
- func (f File) Delete(ctx context.Context) error
- func (f *File) Finish(ctx context.Context, contentType string, size int64) error
- func (f File) Glyph() string
- func (f File) Path() string
- func (f *File) SetQueued(ctx context.Context, at time.Time) error
- func (f *File) SetStarted(ctx context.Context, at time.Time) error
- func (f *File) SetTrackID(tID string) error
- func (f File) Status() string
- type MusicLinkOpt
- type Picture
- type Plan
- type PlanKind
- type PlanStatus
- type Playlist
- type RegPhase
- type SSID
- type SSIDKind
- type Session
- type Star
- type Timegarb
- type Track
- func (t Track) AlbumCode() string
- func (t Track) AlbumEqual(other Track) bool
- func (t Track) AlbumSSID() SSID
- func (t Track) AnyArtist() string
- func (t *Track) ApplyInfo(info TrackInfo)
- func (t Track) ArtistEqual(other Track) bool
- func (t Track) ArtistSSID() SSID
- func (t Track) Bitrate() int
- func (t *Track) Create(ctx context.Context) error
- func (Track) CreateTable(create *dynamo.CreateTable)
- func (t *Track) Delete(ctx context.Context) error
- func (t Track) Env() map[string]interface{}
- func (t Track) Ext() string
- func (t Track) FileURL() string
- func (t *Track) IncPlays(ctx context.Context) error
- func (t Track) LastModOrDate() time.Time
- func (t Track) MIMEType() string
- func (t Track) MatchesSSID(ssid SSID) bool
- func (t *Track) RefreshSortID(ctx context.Context) error
- func (t *Track) Save(ctx context.Context) error
- func (t *Track) SetDuration(ctx context.Context, secs int) error
- func (t *Track) SetResume(ctx context.Context, secs float64, modTime time.Time) error
- func (t Track) SortKey() string
- func (t Track) StorageKey() string
- func (t Track) TrackSSID() SSID
- func (t Track) VirtualPath() string
- type TrackInfo
- type TrackSelOpt
- type Tracks
- func GetTracks(ctx context.Context, userID int) (Tracks, error)
- func GetTracksBatch(ctx context.Context, userID int, trackIDs []string) (Tracks, error)
- func GetTracksInfo(ctx context.Context, userID int) (Tracks, error)
- func GetTracksPartial(ctx context.Context, userID int, limit int64, startFrom dynamo.PagingKey) (Tracks, dynamo.PagingKey, error)
- func GetTracksPartialSorted(ctx context.Context, userID int, limit int64, startFrom dynamo.PagingKey) (Tracks, dynamo.PagingKey, error)
- type User
- func AddUsage(ctx context.Context, id int, usage int64, trackCt int) (User, error)
- func GetAllUsers(ctx context.Context) ([]User, error)
- func GetUser(ctx context.Context, id int) (User, error)
- func GetUserByCustomerID(ctx context.Context, id string) (User, error)
- func GetUserByEmail(ctx context.Context, email string) (User, error)
- func (u User) Active() bool
- func (u User) CalcQuota() int64
- func (u *User) Create(ctx context.Context) error
- func (u *User) DeletePaymentInfo(ctx context.Context) error
- func (u User) Expired() bool
- func (u User) GetDump() (Dump, error)
- func (u User) GetTracks(ctx context.Context) (Tracks, error)
- func (u User) Grandfathered() bool
- func (u User) SaveDump(ctx context.Context, d Dump) error
- func (u *User) SetB2Token(ctx context.Context, token string, expire time.Time) error
- func (u *User) SetCustomerID(ctx context.Context, id string) error
- func (u *User) SetDisplayOpt(ctx context.Context, disp DisplayOptions) error
- func (u *User) SetEmail(ctx context.Context, email string) error
- func (u *User) SetPassword(ctx context.Context, pw []byte) error
- func (u *User) SetPlan(ctx context.Context, kind PlanKind, status PlanStatus, expires time.Time, ...) error
- func (u *User) SetRandomRecovery(ctx context.Context) error
- func (u *User) SetTheme(ctx context.Context, theme string) error
- func (u *User) SetTracks(ctx context.Context, count int) error
- func (u User) StorageFull() bool
- func (u User) TimeRemaining() time.Duration
- func (u User) Trialing() bool
- func (u *User) UpdateLastDump(ctx context.Context, at time.Time) error
- func (u *User) UpdateLastMod(ctx context.Context) error
- func (u User) UsageDesc() string
- func (u User) ValidPassword(password string) bool
Constants ¶
View Source
const ( UnknownArtist = "Unknown Artist" UnknownAlbum = "Unknown Album" UnknownTitle = "Untitled" )
View Source
const CurrentPhase = RegPhaseEarlyAccess
Variables ¶
View Source
var ErrNotFound = dynamo.ErrNotFound
View Source
var MusicFolder = SSID{Kind: SSIDFolder, ID: "1"}
View Source
var TrialDuration = 14 * time.Hour * 24
Functions ¶
func CreateTables ¶
func HashPassword ¶
func MassUpdateTracks ¶
func RefreshDump ¶
Types ¶
type DisplayOptions ¶
type DisplayOptions struct { Stretch bool MusicLink MusicLinkOpt TrackSelect TrackSelOpt }
type File ¶
type File struct { ID string `dynamo:",hash" index:"UserID-ID-index,range"` UserID int `index:"UserID-ID-index,hash"` Size int64 Type string Name string Ext string Time time.Time LocalMod int64 Queued time.Time Started time.Time Finished time.Time Ready bool Deleted bool TrackID string }
func (*File) SetTrackID ¶
type MusicLinkOpt ¶
type MusicLinkOpt string
const ( MusicLinkDefault MusicLinkOpt = "" MusicLinkAlbums MusicLinkOpt = "albums" )
func (MusicLinkOpt) String ¶
func (mlo MusicLinkOpt) String() string
type Picture ¶
func (Picture) StorageKey ¶
type PlanStatus ¶
type PlanStatus string
const ( PlanStatusActive PlanStatus = "active" PlanStatusTrialing PlanStatus = "trialing" PlanStatusIncomplete PlanStatus = "incomplete" PlanStatusIncompleteExpired PlanStatus = "incomplete_expired" PlanStatusPastDue PlanStatus = "past_due" PlanStatusCanceled PlanStatus = "canceled" PlanStatusUnpaid PlanStatus = "unpaid" )
func (PlanStatus) Active ¶
func (ps PlanStatus) Active() bool
type Playlist ¶
type Session ¶
type Session struct { Token string `dynamo:",hash"` UserID int Expires time.Time `dynamo:",unixtime"` IP string }
func CreateSession ¶
type Track ¶
type Track struct { UserID int `dynamo:",hash" index:"UserID-SortID-index,hash" index:"UserID-Date-index,hash"` ID string `dynamo:",range"` SortID string `index:"UserID-SortID-index,range" badgerhold:"index"` Date time.Time `index:"UserID-Date-index,range"` // proper case: Info TrackInfo // should be lowercase: Title string Artist string Album string AlbumArtist string Composer string Genre string Comment string Number int Total int Disc int Discs int Year int Picture Picture `dynamo:",omitempty"` Tags []string `dynamo:",set"` // user-defined tags Filename string Filetype string UploadID string Size int Duration int // seconds TagFormat string Metadata map[string]interface{} // IDv3 tags LastMod time.Time LocalMod int64 // lastMod from client at upload time Dirty bool Plays int LastPlayed time.Time Resume float64 // seconds ResumeMod time.Time `dynamo:",omitempty"` Deleted bool // view only Starred time.Time `dynamo:"-"` DL string `dynamo:"-" json:",omitempty"` }
func (Track) AlbumEqual ¶
func (Track) ArtistEqual ¶
func (Track) ArtistSSID ¶
func (Track) CreateTable ¶
func (Track) CreateTable(create *dynamo.CreateTable)
func (Track) LastModOrDate ¶
func (Track) MatchesSSID ¶
func (Track) StorageKey ¶
func (Track) VirtualPath ¶
VirtualPath returns an ideal path as synchronized to a filesystem
type TrackInfo ¶
type TrackSelOpt ¶
type TrackSelOpt string
const ( TrackSelDefault TrackSelOpt = "" TrackSelCtrlKey TrackSelOpt = "ctrl" )
func (TrackSelOpt) String ¶
func (tso TrackSelOpt) String() string
type Tracks ¶
type Tracks []Track
func GetTracksBatch ¶
func GetTracksPartial ¶
func GetTracksPartialSorted ¶
type User ¶
type User struct { ID int `dynamo:",hash"` Email string `index:"Email-index,hash"` Password []byte `json:"-"` Regdate time.Time Phase RegPhase // phase at time of reg Recovery string Usage int64 Quota int64 Tracks int CustomerID string `index:"CustomerID-index,hash"` // from stripe Plan PlanKind PlanStatus PlanStatus // from stripe PlanExpire time.Time `dynamo:",omitempty"` Canceled bool TrialOver bool Theme string Display DisplayOptions B2Token string B2Expire time.Time `dynamo:",omitempty"` LastMod time.Time LastDump time.Time `dynamo:",omitempty"` }
func (User) Grandfathered ¶
func (*User) SetB2Token ¶
func (*User) SetDisplayOpt ¶
func (u *User) SetDisplayOpt(ctx context.Context, disp DisplayOptions) error
func (User) StorageFull ¶
func (User) TimeRemaining ¶
func (*User) UpdateLastDump ¶
func (User) ValidPassword ¶
Click to show internal directories.
Click to hide internal directories.