What information can be abstracted to the track.Track object? #456
Replies: 1 comment
-
Thank you for raising this. Yes, all of this is correct. Here are some details:
*
def validate(self):
missing_files = []
invalid_checksums = []
for track_tuple in self.track_index.values():
track_path, checksum = track_tuple
# validate that the file exists on disk
if not os.path.exists(track_path):
missing_files.append(track_path)
# validate that the checksum matches
elif utils.md5(track_path) != checksum:
invalid_checksums.append(track_path)
return missing_files, invalid_checksums Long-term, i would love to implement a "safe" mode of mirdata where we'd validate the track automatically before accessing the audio property, and raises an error if a checksum is invalid. This safe mode could be a flag in the Track constructor. In this way, users wouldn't need to run validate manually to be warned of a problem: they would just load stuff and access it with peace of mind.
Yes. In fact, i could see three stage of "loading" a Track: At the moment, mirdata does (3) splendidly, (2) inelegantly (copying over values from the |
Beta Was this translation helpful? Give feedback.
-
The generic
mirdata.track.Track
object provides a simple abstraction in order to automate the__repr__
method which we used to write manually for each dataset's module.In #219 @lostanlen experimented with what other information we could abstract in order to simplify each module's Track object. He proposed to have the following live as attributes/properties/methods of the new Track object:
audio
which loads an attribute in the track index called audioduration
(pulling from either the metadata or from audio)from_jams
method which instantiates mirdata objects from a jams objectload_metadata
method, which would live at the track-level rather than the module levelto_jams
method by programatically parsing the track attributesvalidate
method, which would live at the track-level rather than the module levelAny thoughts about each of these abstractions?
(@lostanlen correct any of this if I got the details wrong)
Beta Was this translation helpful? Give feedback.
All reactions