Skip to content

Commit

Permalink
Remove ViewAs
Browse files Browse the repository at this point in the history
  • Loading branch information
probablykasper committed Sep 25, 2024
1 parent 0e6a0d7 commit cd745f5
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 40 deletions.
14 changes: 1 addition & 13 deletions ferrum-addon/addon.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,19 +122,6 @@ export interface TracksPage {
itemIds: Array<ItemId>
}
export declare function get_tracks_page(options: TracksPageOptions): TracksPage
export const enum ViewAs {
Songs = 0,
Artists = 1
}
export interface PageInfo {
id: string
viewAs: ViewAs
tracklist: TrackList
sortKey: string
sortDesc: boolean
length: number
}
export declare function move_tracks(playlistId: string, itemIds: Array<ItemId>, toIndex: number): void
export interface TrackListDetails {
id: string
name: string
Expand All @@ -153,6 +140,7 @@ export declare function delete_tracks_with_item_ids(itemIds: Array<ItemId>): voi
export declare function new_playlist(name: string, description: string, isFolder: boolean, parentId: string): void
export declare function update_playlist(id: string, name: string, description: string): void
export declare function move_playlist(id: string, fromId: string, toId: string, toIndex: number): void
export declare function move_tracks(playlistId: string, itemIds: Array<ItemId>, toIndex: number): void
/** Returns `None` if the file does not have an image */
export declare function read_small_cover_async(path: string, index: number, cacheDbPath: string): Promise<Buffer | null>
export interface TrackMd {
Expand Down
24 changes: 1 addition & 23 deletions src-native/page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::data_js::get_data;
use crate::filter::filter;
use crate::library_types::{ItemId, TrackList};
use crate::sort::sort;
use napi::{Env, JsUnknown, Result};
use napi::{Env, Result};

#[napi(object)]
#[derive(Clone)]
Expand Down Expand Up @@ -57,25 +57,3 @@ pub fn get_tracks_page(options: TracksPageOptions, env: Env) -> Result<TracksPag
};
Ok(track_page)
}

#[napi]
pub enum ViewAs {
Songs,
Artists,
}
impl Default for ViewAs {
fn default() -> Self {
Self::Songs
}
}

#[napi(object)]
pub struct PageInfo {
pub id: String,
pub view_as: ViewAs,
#[napi(ts_type = "TrackList")]
pub tracklist: JsUnknown,
pub sort_key: String,
pub sort_desc: bool,
pub length: i64,
}
4 changes: 0 additions & 4 deletions src/lib/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import type {
ItemId,
TrackMd,
TracksPageOptions,
ViewAs,
ViewOptions,
} from '../../ferrum-addon'
import { queue } from './queue'
Expand All @@ -26,9 +25,6 @@ export const ItunesImport = inner_addon.ItunesImport

call((addon) => addon.load_data(is_dev, local_data_path, library_path))

export const view_as_songs: ViewAs.Songs = 0
export const view_as_artists: ViewAs.Artists = 1

function get_error_message(err: unknown): string {
if (typeof err === 'object' && err !== null) {
const obj = err as { [key: string]: unknown }
Expand Down

0 comments on commit cd745f5

Please sign in to comment.