Struct trackermeta::ModInfo
source · pub struct ModInfo {Show 14 fields
pub id: u32,
pub filename: String,
pub title: String,
pub size: String,
pub md5: String,
pub format: String,
pub spotlit: bool,
pub download_count: u32,
pub fav_count: u32,
pub scrape_time: String,
pub channel_count: u32,
pub genre: String,
pub upload_date: String,
pub instrument_text: String,
}
Expand description
Struct containing all of the info about a module
Fields§
§id: u32
The module ID of the module on modarchive
filename: String
The filename of the module
title: String
The title of the module
size: String
The file size of the module, use the
crate byte-unit
to convert them to other units
md5: String
The MD5 hash of the module file as a string
format: String
The format of the module, for example XM
, IT
or MOD
and more, basically the extension of the
module file
spotlit: bool
Spotlit module or not
download_count: u32
Download count of the module at the time of scraping
fav_count: u32
Times the module has been favourited at the time of scraping
scrape_time: String
The time when it was scraped
channel_count: u32
The channel count of the module
genre: String
The genre of the module
upload_date: String
The upload date of the module
instrument_text: String
The instrument text of the module
Implementations§
source§impl ModInfo
impl ModInfo
sourcepub fn get(mod_id: u32) -> Result<ModInfo, Error>
pub fn get(mod_id: u32) -> Result<ModInfo, Error>
Probably the singular most important function in this crate, takes a mod id (can be
generated at random, deliberately entered or acquired by resolving a filename and
picking a search result), and then gives you a full ModInfo
struct.
Examples found in repository?
More examples
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
fn main() {
let args: Vec<String> = std::env::args().collect();
match args.get(1).unwrap_or(&"".into()).as_ref() {
"get" => {
let mod_id = ModInfo::resolve_filename(
args.get(2)
.expect("No filename provided as second argument."),
)
.unwrap()[0]
.id;
let mod_info = ModInfo::get(mod_id).unwrap();
println!("{}", &mod_info.instrument_text);
println!("\n----------------------------------------\n");
println!("{:#?}", mod_info);
println!("\n----------------------------------------\n");
println!("Download link: {}", mod_info.get_download_link());
}
_ => println!("Usage: trackermeta get <filename>"),
}
}
sourcepub fn get_download_link(&self) -> String
pub fn get_download_link(&self) -> String
Returns a modarchive download link for the given module, you can get this struct by using
ModInfo::get()
, or search using ModInfo::resolve_filename()
, if you’re using the
resolver function please consider using the ModSearch::get_download_link()
method
instead.
Examples found in repository?
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
fn main() {
let args: Vec<String> = std::env::args().collect();
match args.get(1).unwrap_or(&"".into()).as_ref() {
"get" => {
let mod_id = ModInfo::resolve_filename(
args.get(2)
.expect("No filename provided as second argument."),
)
.unwrap()[0]
.id;
let mod_info = ModInfo::get(mod_id).unwrap();
println!("{}", &mod_info.instrument_text);
println!("\n----------------------------------------\n");
println!("{:#?}", mod_info);
println!("\n----------------------------------------\n");
println!("Download link: {}", mod_info.get_download_link());
}
_ => println!("Usage: trackermeta get <filename>"),
}
}
sourcepub fn resolve_filename(filename: &str) -> Result<Vec<ModSearch>, Error>
pub fn resolve_filename(filename: &str) -> Result<Vec<ModSearch>, Error>
Searches for your string on Modarchive and returns the results on the first page (a.k.a
only up to the first 40) as a vector of ModSearch
Examples found in repository?
More examples
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
fn main() {
let args: Vec<String> = std::env::args().collect();
match args.get(1).unwrap_or(&"".into()).as_ref() {
"get" => {
let mod_id = ModInfo::resolve_filename(
args.get(2)
.expect("No filename provided as second argument."),
)
.unwrap()[0]
.id;
let mod_info = ModInfo::get(mod_id).unwrap();
println!("{}", &mod_info.instrument_text);
println!("\n----------------------------------------\n");
println!("{:#?}", mod_info);
println!("\n----------------------------------------\n");
println!("Download link: {}", mod_info.get_download_link());
}
_ => println!("Usage: trackermeta get <filename>"),
}
}