summaryrefslogtreecommitdiff
path: root/lib/Ultramarine/Model/DB.pm6
blob: 47791b437288b6927d3293b69736ad1e2984965f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use v6.d.PREVIEW;
 
role Ultramarine::Model::DB {
    method seen-file(:$path) { ... }
    method remove-unseen-files() { ... }
 
    method is-up-to-date(:$path,:$mtime --> Bool{ ... }
    method ensure-song(:$path,:$mtime,:%metadata{ ... }
    method ensure-file-absent(:$path) { ... }
 
    method top-folders(--> Iterable{ ... }
    method dir-children-of(:$id{ ... }
    method songs-children-of(:$id{ ... }
}
 
class Ultramarine::Model::DB::File {
    has Int $.id is required;
    has IO::Path $.path is required;
    has Int $.mtime is required;
    has $.artist_id;
    has $.album_id;
    has %.metadata;
    submethod BUILD(Int() :$!id!IO() :$!path!,Int() :$!mtime!Int :$!album_id!:%!metadata!{}
}
 
class Ultramarine::Model::DB::Directory {
    has Int $.id is required;
    has Str $.name is required;
    submethod BUILD(Int() :$!id!Str() :$!name!{}
}