@@ -102,6 +102,8 @@ pub struct Song {
102
102
pub title : Option < String > ,
103
103
/// last modification time
104
104
pub last_mod : Option < Tm > ,
105
+ /// artist
106
+ pub artist : Option < String > ,
105
107
/// duration (in seconds resolution)
106
108
pub duration : Option < Duration > ,
107
109
/// place in the queue (if queued for playback)
@@ -124,15 +126,16 @@ impl Encodable for Song {
124
126
None => e. emit_option_none ( ) ,
125
127
} )
126
128
} ) ?;
127
- e. emit_struct_field ( "duration" , 4 , |e| {
129
+ e. emit_struct_field ( "artist" , 4 , |e| self . artist . encode ( e) ) ?;
130
+ e. emit_struct_field ( "duration" , 5 , |e| {
128
131
e. emit_option ( |e| match self . duration {
129
132
Some ( d) => e. emit_option_some ( |e| d. num_seconds ( ) . encode ( e) ) ,
130
133
None => e. emit_option_none ( ) ,
131
134
} )
132
135
} ) ?;
133
- e. emit_struct_field ( "place" , 5 , |e| self . place . encode ( e) ) ?;
134
- e. emit_struct_field ( "range" , 6 , |e| self . range . encode ( e) ) ?;
135
- e. emit_struct_field ( "tags" , 7 , |e| self . tags . encode ( e) ) ?;
136
+ e. emit_struct_field ( "place" , 6 , |e| self . place . encode ( e) ) ?;
137
+ e. emit_struct_field ( "range" , 7 , |e| self . range . encode ( e) ) ?;
138
+ e. emit_struct_field ( "tags" , 8 , |e| self . tags . encode ( e) ) ?;
136
139
Ok ( ( ) )
137
140
} )
138
141
}
@@ -149,6 +152,7 @@ impl FromIter for Song {
149
152
"file" => result. file = line. 1 . to_owned ( ) ,
150
153
"Title" => result. title = Some ( line. 1 . to_owned ( ) ) ,
151
154
"Last-Modified" => result. last_mod = try!( strptime ( & * line. 1 , "%Y-%m-%dT%H:%M:%S%Z" ) . map_err ( ParseError :: BadTime ) . map ( Some ) ) ,
155
+ "Artist" => result. artist = Some ( line. 1 . to_owned ( ) ) ,
152
156
"Name" => result. name = Some ( line. 1 . to_owned ( ) ) ,
153
157
"Time" => result. duration = Some ( Duration :: seconds ( try!( line. 1 . parse ( ) ) ) ) ,
154
158
"Range" => result. range = Some ( try!( line. 1 . parse ( ) ) ) ,
0 commit comments