|
| 1 | +module example-jukebox { |
| 2 | + |
| 3 | + namespace "http://example.com/ns/example-jukebox"; |
| 4 | + prefix "jbox"; |
| 5 | + |
| 6 | + organization "Example, Inc."; |
| 7 | + contact "support at example.com"; |
| 8 | + description "Example Jukebox Data Model Module"; |
| 9 | + revision "2016-08-15" { |
| 10 | + description "Initial version."; |
| 11 | + reference "example.com document 1-4673"; |
| 12 | + } |
| 13 | + |
| 14 | + identity genre { |
| 15 | + description "Base for all genre types"; |
| 16 | + } |
| 17 | + |
| 18 | + // abbreviated list of genre classifications |
| 19 | + identity alternative { |
| 20 | + base genre; |
| 21 | + description "Alternative music"; |
| 22 | + } |
| 23 | + identity blues { |
| 24 | + base genre; |
| 25 | + description "Blues music"; |
| 26 | + } |
| 27 | + identity country { |
| 28 | + base genre; |
| 29 | + description "Country music"; |
| 30 | + } |
| 31 | + identity jazz { |
| 32 | + base genre; |
| 33 | + description "Jazz music"; |
| 34 | + } |
| 35 | + identity pop { |
| 36 | + base genre; |
| 37 | + description "Pop music"; |
| 38 | + } |
| 39 | + identity rock { |
| 40 | + base genre; |
| 41 | + description "Rock music"; |
| 42 | + } |
| 43 | + |
| 44 | + container jukebox { |
| 45 | + presence |
| 46 | + "An empty container indicates that the jukebox |
| 47 | + service is available"; |
| 48 | + |
| 49 | + description |
| 50 | + "Represents a jukebox resource, with a library, playlists, |
| 51 | + and a play operation."; |
| 52 | + |
| 53 | + container library { |
| 54 | + |
| 55 | + description "Represents the jukebox library resource."; |
| 56 | + |
| 57 | + list artist { |
| 58 | + key name; |
| 59 | + |
| 60 | + description |
| 61 | + "Represents one artist resource within the |
| 62 | + jukebox library resource."; |
| 63 | + |
| 64 | + leaf name { |
| 65 | + type string { |
| 66 | + length "1 .. max"; |
| 67 | + } |
| 68 | + description "The name of the artist."; |
| 69 | + } |
| 70 | + |
| 71 | + list album { |
| 72 | + key name; |
| 73 | + |
| 74 | + description |
| 75 | + "Represents one album resource within one |
| 76 | + artist resource, within the jukebox library."; |
| 77 | + |
| 78 | + leaf name { |
| 79 | + type string { |
| 80 | + length "1 .. max"; |
| 81 | + } |
| 82 | + description "The name of the album."; |
| 83 | + } |
| 84 | + |
| 85 | + leaf genre { |
| 86 | + type identityref { base genre; } |
| 87 | + description |
| 88 | + "The genre identifying the type of music on |
| 89 | + the album."; |
| 90 | + } |
| 91 | + |
| 92 | + leaf year { |
| 93 | + type uint16 { |
| 94 | + range "1900 .. max"; |
| 95 | + } |
| 96 | + description "The year the album was released"; |
| 97 | + } |
| 98 | + |
| 99 | + container admin { |
| 100 | + description |
| 101 | + "Administrative information for the album."; |
| 102 | + |
| 103 | + leaf label { |
| 104 | + type string; |
| 105 | + description "The label that released the album."; |
| 106 | + } |
| 107 | + leaf catalogue-number { |
| 108 | + type string; |
| 109 | + description "The album's catalogue number."; |
| 110 | + } |
| 111 | + } |
| 112 | + |
| 113 | + list song { |
| 114 | + key name; |
| 115 | + |
| 116 | + description |
| 117 | + "Represents one song resource within one |
| 118 | + album resource, within the jukebox library."; |
| 119 | + |
| 120 | + leaf name { |
| 121 | + type string { |
| 122 | + length "1 .. max"; |
| 123 | + } |
| 124 | + description "The name of the song"; |
| 125 | + } |
| 126 | + leaf location { |
| 127 | + type string; |
| 128 | + mandatory true; |
| 129 | + description |
| 130 | + "The file location string of the |
| 131 | + media file for the song"; |
| 132 | + } |
| 133 | + leaf format { |
| 134 | + type string; |
| 135 | + description |
| 136 | + "An identifier string for the media type |
| 137 | + for the file associated with the |
| 138 | + 'location' leaf for this entry."; |
| 139 | + } |
| 140 | + leaf length { |
| 141 | + type uint32; |
| 142 | + units "seconds"; |
| 143 | + description |
| 144 | + "The duration of this song in seconds."; |
| 145 | + } |
| 146 | + } // end list 'song' |
| 147 | + } // end list 'album' |
| 148 | + } // end list 'artist' |
| 149 | + |
| 150 | + leaf artist-count { |
| 151 | + type uint32; |
| 152 | + units "songs"; |
| 153 | + config false; |
| 154 | + description "Number of artists in the library"; |
| 155 | + } |
| 156 | + leaf album-count { |
| 157 | + type uint32; |
| 158 | + units "albums"; |
| 159 | + config false; |
| 160 | + description "Number of albums in the library"; |
| 161 | + } |
| 162 | + leaf song-count { |
| 163 | + type uint32; |
| 164 | + units "songs"; |
| 165 | + config false; |
| 166 | + description "Number of songs in the library"; |
| 167 | + } |
| 168 | + } // end library |
| 169 | + |
| 170 | + list playlist { |
| 171 | + key name; |
| 172 | + |
| 173 | + description |
| 174 | + "Example configuration data resource"; |
| 175 | + |
| 176 | + leaf name { |
| 177 | + type string; |
| 178 | + description |
| 179 | + "The name of the playlist."; |
| 180 | + } |
| 181 | + leaf description { |
| 182 | + type string; |
| 183 | + description |
| 184 | + "A comment describing the playlist."; |
| 185 | + } |
| 186 | + list song { |
| 187 | + key index; |
| 188 | + ordered-by user; |
| 189 | + |
| 190 | + description |
| 191 | + "Example nested configuration data resource"; |
| 192 | + |
| 193 | + leaf index { // not really needed |
| 194 | + type uint32; |
| 195 | + description |
| 196 | + "An arbitrary integer index for this playlist song."; |
| 197 | + } |
| 198 | + leaf id { |
| 199 | + type instance-identifier; |
| 200 | + mandatory true; |
| 201 | + description |
| 202 | + "Song identifier. Must identify an instance of |
| 203 | + /jukebox/library/artist/album/song/name."; |
| 204 | + } |
| 205 | + } |
| 206 | + } |
| 207 | + |
| 208 | + container player { |
| 209 | + description |
| 210 | + "Represents the jukebox player resource."; |
| 211 | + |
| 212 | + leaf gap { |
| 213 | + type decimal64 { |
| 214 | + fraction-digits 1; |
| 215 | + range "0.0 .. 2.0"; |
| 216 | + } |
| 217 | + units "tenths of seconds"; |
| 218 | + description "Time gap between each song"; |
| 219 | + } |
| 220 | + } |
| 221 | + } |
| 222 | + |
| 223 | + rpc play { |
| 224 | + description "Control function for the jukebox player"; |
| 225 | + input { |
| 226 | + leaf playlist { |
| 227 | + type string; |
| 228 | + mandatory true; |
| 229 | + description "playlist name"; |
| 230 | + } |
| 231 | + leaf song-number { |
| 232 | + type uint32; |
| 233 | + mandatory true; |
| 234 | + description "Song number in playlist to play"; |
| 235 | + } |
| 236 | + } |
| 237 | + } |
| 238 | +} |
| 239 | + |
0 commit comments