AnniWorkspace

Struct AnniWorkspace 

Source
pub struct AnniWorkspace { /* private fields */ }

Implementations§

Source§

impl AnniWorkspace

Source

pub unsafe fn new_unchecked(dot_anni: PathBuf) -> Self

§Safety

If you’re sure that the directory is .anni, you can use this method to avoid unnecessary checking steps.

Source

pub fn new() -> Result<Self, WorkspaceError>

Find AnniWorkspace from current working directory.

Source

pub fn open<P>(path: P) -> Result<Self, WorkspaceError>
where P: AsRef<Path>,

Open a AnniWorkspace from given path.

If the path is not a valid workspace, WorkspaceError::NotAWorkspace will be returned.

Source

pub fn find<P>(path: P) -> Result<Self, WorkspaceError>
where P: AsRef<Path>,

Find and open a AnniWorkspace from given path.

This method will try to open all parent directories until it finds a valid workspace. If workspace is not found, WorkspaceError::WorkspaceNotFound will be returned.

Source

pub fn workspace_root(&self) -> &Path

Get root path of the workspace

Source

pub fn repo_root(&self) -> PathBuf

Get root path of the metadata repository.

§Warn

This method may be removed in the future

Source

pub fn objects_root(&self) -> PathBuf

Get root path of internal audio files

Source

pub fn get_album_id<P>(&self, path: P) -> Result<Uuid, WorkspaceError>
where P: AsRef<Path>,

Get album id from symlink target.

Returns WorkspaceError::NotAnAlbum if the symlink is not valid.

Source

pub fn get_album_controlled_path( &self, album_id: &Uuid, ) -> Result<PathBuf, WorkspaceError>

Get controlled path of an album with album id.

Source

pub fn controlled_album_path(&self, album_id: &Uuid, layer: usize) -> PathBuf

Get album path with given album_id in workspace with no extra checks.

Source

pub fn strict_album_path( root: PathBuf, album_id: &Uuid, layer: usize, ) -> PathBuf

Source

pub fn get_workspace_album<P>( &self, path: P, ) -> Result<WorkspaceAlbum, WorkspaceError>
where P: AsRef<Path>,

Try to get WorkspaceAlbum from given path

Source

pub fn scan(&self) -> Result<Vec<WorkspaceAlbum>, WorkspaceError>

Scan the whole workspace and return all available albums

Source

pub fn create_album<P>( &self, album_id: &Uuid, userland_path: P, discs: NonZeroU8, ) -> Result<(), WorkspaceError>
where P: AsRef<Path>,

Create album with given album_id and discs at given path

Creation would fail if:

  • Album with given album_id already exists in workspace
  • Directory at path is an album directory
Source

pub fn to_repository_manager(&self) -> Result<RepositoryManager, WorkspaceError>

Source

pub fn get_config(&self) -> Result<WorkspaceConfig, WorkspaceError>

Source§

impl AnniWorkspace

Source

pub fn get_untracked_album_overview<P>( &self, album_path: P, ) -> Result<UntrackedWorkspaceAlbum, WorkspaceError>
where P: AsRef<Path>,

Take a overview of an untracked album directory.

If the path provided is not an UNTRACKED album directory, or the album is incomplete, an error will be returned.

Source

pub fn commit<P, V>( &self, path: P, validator: Option<V>, ) -> Result<Uuid, WorkspaceError>

Add album to workspace

Untracked -> Committed

Source

pub fn import_tags<P, E>( &self, album_path: P, extractor: E, allow_duplicate: bool, ) -> Result<Uuid, WorkspaceError>
where P: AsRef<Path>, E: FnOnce(&str) -> Option<ExtractedAlbumInfo<'_>>,

Import tag from committed album.

Source

pub fn revert<P>(&self, path: P) -> Result<(), WorkspaceError>
where P: AsRef<Path>,

Source

pub fn apply_tags<P>(&self, album_path: P) -> Result<(), WorkspaceError>
where P: AsRef<Path>,

Source

pub fn publish<P>( &self, album_path: P, soft: bool, ) -> Result<(), WorkspaceError>
where P: AsRef<Path>,

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.