mirror of
https://github.com/captbaritone/webamp.git
synced 2026-01-23 02:15:01 +00:00
Search filter exploration
This commit is contained in:
parent
497dbb2ebd
commit
b224b627e3
5 changed files with 111 additions and 1 deletions
22
packages/skin-database/Search filter ideas
Normal file
22
packages/skin-database/Search filter ideas
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
// Built in windows
|
||||
filter:equalizer // includes eqmain.bmp
|
||||
filter:playlist // includes pledit.bmp
|
||||
filter:browser // includes mb.bmp
|
||||
filter:general // Includes gen.bmp and genex.bmp (you need both right?)
|
||||
filter:library // Alias of filter:general (Should there be other aliases of general?)
|
||||
filter:video // Includes video.bmp
|
||||
|
||||
|
||||
// Cursors
|
||||
filter:cur // Includes at least one .cur file
|
||||
filter:ani // Includes at least one .ani file (we could try to get fancy here and try to check for .ani files named .cur)
|
||||
|
||||
// Other attributes
|
||||
filter:transparency // Includes region.txt (we could get fancy and ensure it has actual points)
|
||||
|
||||
// Plugins
|
||||
filter:milkdrop // Alias of filter:general
|
||||
filter:mikro // Includes mikro.bmp (Should this also require winampmb.txt? Or maybe either?)
|
||||
filter:vidamp // Incldues vidamp.bmp
|
||||
filter:avs // Includes avs.bmp
|
||||
|
||||
|
|
@ -28,6 +28,9 @@ export default class ClassicSkinResolver
|
|||
average_color() {
|
||||
return this._model.getAverageColor();
|
||||
}
|
||||
has_media_library(): Promise<boolean> {
|
||||
return this._model.hasMediaLibrary();
|
||||
}
|
||||
async reviews() {
|
||||
const reviews = await this._model.getReviews();
|
||||
return reviews.map((row) => new ReviewResolver(row));
|
||||
|
|
|
|||
|
|
@ -206,6 +206,11 @@ type ClassicSkin implements Skin & Node {
|
|||
"""
|
||||
archive_files: [ArchiveFile]
|
||||
|
||||
"""
|
||||
Does the skin include sprite sheets for the media library?
|
||||
"""
|
||||
has_media_library: Boolean
|
||||
|
||||
"""
|
||||
The skin's "item" at archive.org
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -64,7 +64,6 @@ export default class ArchiveFileModel {
|
|||
if (info == null) {
|
||||
return null;
|
||||
}
|
||||
console.log("info", info);
|
||||
return info.getTextContent();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -267,6 +267,87 @@ export default class SkinModel {
|
|||
return withUrlAsTempFile(this.getSkinUrl(), filename, cb);
|
||||
}
|
||||
|
||||
async _hasSpriteSheet(base: string): Promise<boolean> {
|
||||
const ext = "(bmp)|(png)";
|
||||
return this._hasFile(base, ext);
|
||||
}
|
||||
|
||||
async _hasFile(base: string, ext: string): Promise<boolean> {
|
||||
// TODO: Pre-compile regexp
|
||||
const matcher = new RegExp(`^(.*[/\\\\])?${base}.(${ext})$`, "i");
|
||||
const archiveFiles = await this.getArchiveFiles();
|
||||
return archiveFiles.some((file) => {
|
||||
return matcher.test(file.getFileName());
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @returns
|
||||
*/
|
||||
async hasMediaLibrary(): Promise<boolean> {
|
||||
return this.hasGeneral();
|
||||
}
|
||||
|
||||
async hasMiniBrowser(): Promise<boolean> {
|
||||
return this._hasSpriteSheet("MB");
|
||||
}
|
||||
|
||||
async hasAVS(): Promise<boolean> {
|
||||
return this._hasSpriteSheet("AVS");
|
||||
}
|
||||
|
||||
async hasVideo(): Promise<boolean> {
|
||||
return this._hasSpriteSheet("VIDEO");
|
||||
}
|
||||
|
||||
// Has built-in support for the MikroAMP plugin.
|
||||
async hasMikro(): Promise<boolean> {
|
||||
// Could also check for `WINAMPMB.TXT`.
|
||||
return this._hasSpriteSheet("MIKRO");
|
||||
}
|
||||
|
||||
// Has built-in support of the Amarok plugin.
|
||||
async hasAmarok(): Promise<boolean> {
|
||||
return this._hasSpriteSheet("AMAROK");
|
||||
}
|
||||
|
||||
// Has built-in support of the vidamp
|
||||
async hasVidamp(): Promise<boolean> {
|
||||
return this._hasSpriteSheet("VIDAMP");
|
||||
}
|
||||
|
||||
// Includes custom cursors
|
||||
async hasCur(): Promise<boolean> {
|
||||
const matcher = new RegExp(`^.(cur)$`, "i");
|
||||
const archiveFiles = await this.getArchiveFiles();
|
||||
return archiveFiles.some((file) => {
|
||||
return matcher.test(file.getFileName());
|
||||
});
|
||||
}
|
||||
|
||||
// Has transparency
|
||||
async hasTransparency(): Promise<boolean> {
|
||||
return this._hasFile("region", "txt");
|
||||
}
|
||||
|
||||
async hasAni(): Promise<boolean> {
|
||||
// Note: This should be expanded to check for animated cursors that use the
|
||||
// .cur extension (but are actually .ani under the hood).
|
||||
const matcher = new RegExp(`^.(ani)$`, "i");
|
||||
const archiveFiles = await this.getArchiveFiles();
|
||||
return archiveFiles.some((file) => {
|
||||
return matcher.test(file.getFileName());
|
||||
});
|
||||
}
|
||||
|
||||
async hasGeneral(): Promise<boolean> {
|
||||
return (
|
||||
(await this._hasSpriteSheet("GEN")) &&
|
||||
(await this._hasSpriteSheet("GENEX"))
|
||||
);
|
||||
}
|
||||
|
||||
async withScreenshotTempFile(
|
||||
cb: (file: string) => Promise<void>
|
||||
): Promise<void> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue