This repository has been archived on 2024-09-20. You can view files and clone it, but cannot push or open issues or pull requests.
musicapp/models/Tracks.moon

41 lines
891 B
Plaintext
Raw Normal View History

2019-04-18 04:05:33 +00:00
import Model, enum from require "lapis.db.model"
class Tracks extends Model
2019-04-18 06:43:26 +00:00
next: =>
2019-06-13 15:24:07 +00:00
return Tracks\select("WHERE id > ? ORDER BY id ASC LIMIT 1", @id)[1]
2019-06-13 15:35:26 +00:00
previous: =>
return Tracks\select("WHERE id < ? ORDER BY id DESC LIMIT 1", @id)[1]
2019-04-18 06:43:26 +00:00
2019-04-18 04:05:33 +00:00
@statuses: enum {
2019-06-13 15:24:07 +00:00
new: 1 -- needs to be checked out / downloaded / bought
downloaded: 2 -- illegal
owned: 3 -- legal!
2019-06-15 00:39:51 +00:00
invalid: 4 -- needs to be deleted
2019-06-13 15:24:07 +00:00
ignored: 5 -- don't want it
imported: 6 -- needs to be checked out
2019-04-18 04:05:33 +00:00
}
2019-04-18 05:08:09 +00:00
@qualities: enum {
unavailable: 1 -- not in library
2019-04-18 05:08:09 +00:00
lossless: 2
high: 3
acceptable: 4
low: 5
unacceptable: 6
}
@fields = {
id: true
artist: true
title: true
link: true
status: true
art_url: true
file_url: true
file_size: true
album: true
genre: true
tags: true
quality: true
2019-04-18 06:23:16 +00:00
mood: true
2019-04-18 05:08:09 +00:00
}