it is LIT
This commit is contained in:
1 parent
36bfb1bdd3
commit
a0dce88d90
1 file changed
+48
-13
+48
-13
@@ -1,5 +1,11 @@
|
|||||||
mod db;
|
mod db;
|
||||||
|
|
||||||
|
extern crate walkdir;
|
||||||
|
|
||||||
|
use rekordcrate::pdb::Header;
|
||||||
|
use walkdir::WalkDir;
|
||||||
|
use std::env;
|
||||||
|
use std::{fs::exists, path::Path};
|
||||||
use db::Database;
|
use db::Database;
|
||||||
|
|
||||||
// Example
|
// Example
|
||||||
@@ -11,7 +17,42 @@ fn main() -> rekordcrate::Result<()> {
|
|||||||
println!("{:?}", n);
|
println!("{:?}", n);
|
||||||
}
|
}
|
||||||
|
|
||||||
println!("{:?}", db.tracks.first_key_value());
|
let (_first_id, first) = db.tracks.first_key_value().unwrap();
|
||||||
|
let (_last_id, last) = db.tracks.last_key_value().unwrap();
|
||||||
|
|
||||||
|
println!("{:?}", first);
|
||||||
|
println!("{:?}", last);
|
||||||
|
|
||||||
|
// let pic = db.tracks.iter().find(|(_id, t)| t.artwork_id == ArtworkId(680));
|
||||||
|
// match pic {
|
||||||
|
// Some(it) => println!("{:?}", it),
|
||||||
|
// None => println!("wasnt there"),
|
||||||
|
// }
|
||||||
|
|
||||||
|
assert!(env::set_current_dir(&Path::new("./data")).is_ok());
|
||||||
|
|
||||||
|
// strip the leading slash of the path to make it relative
|
||||||
|
let anlz = first.analyze_path.clone().into_string()?;
|
||||||
|
let anlz = anlz.strip_prefix("/").unwrap();
|
||||||
|
let mp3 = first.file_path.clone().into_string()?;
|
||||||
|
let mp3 = mp3.strip_prefix("/").unwrap();
|
||||||
|
|
||||||
|
println!("mp3={:?} exists={:?}", mp3, exists(mp3));
|
||||||
|
println!("anlz={:?} exists={:?}", anlz, exists(anlz));
|
||||||
|
|
||||||
|
let filename = "a680_m.jpg";
|
||||||
|
|
||||||
|
for entry in WalkDir::new(".") // start from current directory
|
||||||
|
.into_iter()
|
||||||
|
.filter_map(Result::ok)
|
||||||
|
.filter(|e| e.file_type().is_file())
|
||||||
|
{
|
||||||
|
if entry.file_name() == filename {
|
||||||
|
println!("Found: {}", entry.path().display());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let export = Header::default();
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@@ -19,21 +60,15 @@ fn main() -> rekordcrate::Result<()> {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use rekordcrate::pdb::string::DeviceSQLString;
|
|
||||||
use rekordcrate::pdb::ArtworkId;
|
|
||||||
use rekordcrate::pdb::KeyId;
|
|
||||||
use rekordcrate::pdb::LabelId;
|
|
||||||
use rekordcrate::pdb::GenreId;
|
|
||||||
use rekordcrate::pdb::AlbumId;
|
|
||||||
use rekordcrate::pdb::ArtistId;
|
|
||||||
use rekordcrate::util::ColorIndex;
|
use rekordcrate::util::ColorIndex;
|
||||||
use super::*;
|
use rekordcrate::pdb::{string::DeviceSQLString, ArtworkId};
|
||||||
use rekordcrate::pdb::{
|
use rekordcrate::pdb::{AlbumId, ArtistId, GenreId, KeyId, LabelId, Track, TrackId};
|
||||||
Header, PageType, PlaylistEntry, PlaylistTreeNode, PlaylistTreeNodeId, Row, Track, TrackId
|
|
||||||
};
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn acemo() {
|
fn acemo() {
|
||||||
let track = Track { unknown1: 36, index_shift: 32, bitmask: 788224, sample_rate: 44100, composer_id: ArtistId(0), file_size: 14547692, unknown2: 67991645, unknown3: 42343, unknown4: 54995, artwork_id: ArtworkId(1), key_id: KeyId(1), orig_artist_id: ArtistId(0), label_id: LabelId(0), remixer_id: ArtistId(0), bitrate: 0, track_number: 7, tempo: 13299, genre_id: GenreId(0), album_id: AlbumId(1), artist_id: ArtistId(1), id: TrackId(1), disc_number: 0, play_count: 0, year: 2019, sample_depth: 16, duration: 436, unknown5: 41, color: ColorIndex::None, rating: 0, unknown6: 1, unknown7: 3, isrc: DeviceSQLString::empty(), unknown_string1: DeviceSQLString::empty(), unknown_string2: DeviceSQLString::empty(), unknown_string3: DeviceSQLString::empty(), unknown_string4: DeviceSQLString::empty(), message: DeviceSQLString::empty(), kuvo_public: DeviceSQLString::empty(), autoload_hotcues: DeviceSQLString::empty(), unknown_string5: DeviceSQLString::empty(), unknown_string6: DeviceSQLString::empty(), date_added: DeviceSQLString::empty(), release_date: DeviceSQLString::empty(), mix_name: DeviceSQLString::empty(), unknown_string7: DeviceSQLString::empty(), analyze_path: DeviceSQLString::empty(), analyze_date: DeviceSQLString::empty(), comment: DeviceSQLString::empty(), title: DeviceSQLString::empty(), unknown_string8: DeviceSQLString::empty(), filename: DeviceSQLString::empty(), file_path: DeviceSQLString::empty() };
|
let _first = Track { unknown1: 36, index_shift: 32, bitmask: 788224, sample_rate: 44100, composer_id: ArtistId(0), file_size: 14547692, unknown2: 67991645, unknown3: 42343, unknown4: 54995, artwork_id: ArtworkId(1), key_id: KeyId(1), orig_artist_id: ArtistId(0), label_id: LabelId(0), remixer_id: ArtistId(0), bitrate: 0, track_number: 7, tempo: 13299, genre_id: GenreId(0), album_id: AlbumId(1), artist_id: ArtistId(1), id: TrackId(1), disc_number: 0, play_count: 0, year: 2019, sample_depth: 16, duration: 436, unknown5: 41, color: ColorIndex::None, rating: 0, unknown6: 1, unknown7: 3, isrc: DeviceSQLString::empty(), unknown_string1: DeviceSQLString::empty(), unknown_string2: "1".parse::<DeviceSQLString>().unwrap(), unknown_string3: "2".parse::<DeviceSQLString>().unwrap(), unknown_string4: DeviceSQLString::empty(), message: DeviceSQLString::empty(), kuvo_public: "ON".parse::<DeviceSQLString>().unwrap(), autoload_hotcues: "ON".parse::<DeviceSQLString>().unwrap(), unknown_string5: DeviceSQLString::empty(), unknown_string6: DeviceSQLString::empty(), date_added: "2025-01-04".parse::<DeviceSQLString>().unwrap(), release_date: DeviceSQLString::empty(), mix_name: DeviceSQLString::empty(), unknown_string7: DeviceSQLString::empty(), analyze_path: "/PIONEER/USBANLZ/P051/00018701/ANLZ0000.DAT".parse::<DeviceSQLString>().unwrap(), analyze_date: "2025-07-10".parse::<DeviceSQLString>().unwrap(), comment: "Visit https://acemo.bandcamp.com".parse::<DeviceSQLString>().unwrap(), title: "Where They At??? Ft. John FM".parse::<DeviceSQLString>().unwrap(), unknown_string8: DeviceSQLString::empty(), filename: "AceMo - All My Life - 07 Where They At- Ft. .mp3".parse::<DeviceSQLString>().unwrap(), file_path: "/Contents/AceMo/All My Life/AceMo - All My Life - 07 Where They At- Ft. .mp3".parse::<DeviceSQLString>().unwrap() };
|
||||||
|
|
||||||
|
let _last = Track { unknown1: 36, index_shift: 128, bitmask: 788224, sample_rate: 44100, composer_id: ArtistId(0), file_size: 12384711, unknown2: 197860019, unknown3: 42343, unknown4: 54995, artwork_id: ArtworkId(681), key_id: KeyId(20), orig_artist_id: ArtistId(0), label_id: LabelId(0), remixer_id: ArtistId(0), bitrate: 0, track_number: 6, tempo: 13600, genre_id: GenreId(0), album_id: AlbumId(333), artist_id: ArtistId(398), id: TrackId(847), disc_number: 0, play_count: 0, year: 2018, sample_depth: 16, duration: 367, unknown5: 41, color: ColorIndex::None, rating: 0, unknown6: 1, unknown7: 3, isrc: DeviceSQLString::empty(), unknown_string1: DeviceSQLString::empty(), unknown_string2: "1".parse::<DeviceSQLString>().unwrap(), unknown_string3: "2".parse::<DeviceSQLString>().unwrap(), unknown_string4: DeviceSQLString::empty(), message: DeviceSQLString::empty(), kuvo_public: "ON".parse::<DeviceSQLString>().unwrap(), autoload_hotcues: "ON".parse::<DeviceSQLString>().unwrap(), unknown_string5: DeviceSQLString::empty(), unknown_string6: DeviceSQLString::empty(), date_added: "2021-12-09".parse::<DeviceSQLString>().unwrap(), release_date: DeviceSQLString::empty(), mix_name: DeviceSQLString::empty(), unknown_string7: DeviceSQLString::empty(), analyze_path: "/PIONEER/USBANLZ/P00E/000209C4/ANLZ0000.DAT".parse::<DeviceSQLString>().unwrap(), analyze_date: "2023-06-02".parse::<DeviceSQLString>().unwrap(), comment: "Visit https://endofperception.bandcamp.com".parse::<DeviceSQLString>().unwrap(), title: "Ness - Orbital Debris".parse::<DeviceSQLString>().unwrap(), unknown_string8: DeviceSQLString::empty(), filename: "End Of Perception - ЛаBа VA 002 - 06 Ness - .mp3".parse::<DeviceSQLString>().unwrap(), file_path: "/Contents/End Of Perception/ЛаBа VA 002/End Of Perception - ЛаBа VA 002 - 06 Ness - .mp3".parse::<DeviceSQLString>().unwrap(), };
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user