mirror of
https://github.com/johrpan/musicus.git
synced 2025-10-26 19:57:25 +01:00
Store source track index in track
This commit is contained in:
parent
622f1312fb
commit
d410be75dc
6 changed files with 15 additions and 4 deletions
|
|
@ -66,6 +66,7 @@ CREATE TABLE "tracks" (
|
|||
"index" INTEGER NOT NULL,
|
||||
"recording" TEXT NOT NULL REFERENCES "recordings"("id"),
|
||||
"work_parts" TEXT NOT NULL,
|
||||
"source_index" INTEGER NOT NULL,
|
||||
"path" TEXT NOT NULL
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,10 @@ pub struct Track {
|
|||
/// work parts of the work that is associated with the recording.
|
||||
pub work_parts: Vec<usize>,
|
||||
|
||||
/// The index of the track within its source. This is used to associate
|
||||
/// the metadata with the audio data from the source when importing.
|
||||
pub source_index: usize,
|
||||
|
||||
/// The path to the audio file containing this track. This will not be
|
||||
/// included when communicating with the server.
|
||||
#[serde(skip)]
|
||||
|
|
@ -57,6 +61,7 @@ struct TrackRow {
|
|||
pub index: i32,
|
||||
pub recording: String,
|
||||
pub work_parts: String,
|
||||
pub source_index: i32,
|
||||
pub path: String,
|
||||
}
|
||||
|
||||
|
|
@ -105,6 +110,7 @@ impl Database {
|
|||
index: index as i32,
|
||||
recording: track.recording.id.clone(),
|
||||
work_parts,
|
||||
source_index: track.source_index as i32,
|
||||
path: track.path.clone(),
|
||||
};
|
||||
|
||||
|
|
@ -274,6 +280,7 @@ impl Database {
|
|||
let track = Track {
|
||||
recording,
|
||||
work_parts: part_indices,
|
||||
source_index: row.source_index as usize,
|
||||
path: row.path,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ table! {
|
|||
index -> Integer,
|
||||
recording -> Text,
|
||||
work_parts -> Text,
|
||||
source_index -> Integer,
|
||||
path -> Text,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue