filesys

package
v0.0.0-...-1822270 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 24, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrintTree

func PrintTree(T *Tree, depth int)

`tree` command

Types

type Node

type Node struct {
	Name         string
	Format       string     // Tracks, Artists, Playlists, Folders
	Children     []*Node    // If artist or folders, Children != nil to store playlists and folders
	Id           spotify.ID // If album or playlist, Id != nil to retrieve tracks by ID
	Num_children int
	Is_leaf      bool // Makes it easier for us to print trees
}

Abstraction for tracks, artists, albums, playlists, and folders

func DFS

func DFS(dir []*Node, dirname string) *Node

Runs DFS on given directory and returns the destination NOTE: There's a problem where the node pointer returned is corrupted; that is, within the function scope of DFS, the data exists, but once returned the object is empty. This is most likely due to how we're dealing with pointers (i.e. lack of understanding of Golang), but also might be how we're recursing. Look into the recursive calls via *unit testing*, maybe we need to approach this from a different angle.

func ParseDir

func ParseDir(T *Tree) []*Node

When things get bigger, we should actually build a clean filesystem This system should act as the layout for our commands

func ScanDir

func ScanDir(dir []*Node, dname string) ([]*Node, int)

Finds the position of dirname relative to its directory level If it's the last element, return -1 Else, return the max depth remaining relative to current level Requirements: BFS

type Tree

type Tree struct {
	Client       *spotify.Client // Reference to Spotify client for mounting purposes
	Cwp          *Node           // Current working playlist (ls will display children of Cwp)
	Children     []*Node         // Subdirectories
	Num_children int
}

Essentially the data structure that represents the filesystem; Navigation and all other stuff will be done on a Tree (see `fs.go`) NOTE: Filesystem should only be done with user library (can maybe try to add saved albums)

func BuildTree

func BuildTree(f map[string]string, opt string) *Tree

Builds a directory tree

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL