vfs

package
v0.0.0-...-f915236 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2011 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Track implements playable file (or piece of file) abstraction.

Filesystem package implements abstraction over OS filesystem API.

Index

Constants

View Source
const (

	// Entries with this type incapsulates playable track objects.
	TypeTrack = iota
	// Entries with this type incapsulates directory objects.
	TypeDirectory = iota
)
View Source
const (
	CueFilesExtension = ".cue"
)
View Source
const (
	PlaylistName = "*vfs*"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Directory

type Directory struct {
	// Full path to the directory.
	Filename *Path
	// Short name, -- last segment.
	Name string
}

Directory represents "real" directory in our virtual FS.

func NewDirectory

func NewDirectory(filename *Path) (dir *Directory, err os.Error)

NewDirectory returns newly initialized Directory object. filename parameter is full path to this directory.

type DirectoryArray

type DirectoryArray []*Directory

DirectoryArray is helper type for manipulating (e. g. sorting) Directory arrays.

func (DirectoryArray) Len

func (da DirectoryArray) Len() int

Len returns length of the array.

func (DirectoryArray) Less

func (da DirectoryArray) Less(i int, j int) bool

Less returns true if i-element less than j-element.

func (DirectoryArray) Sort

func (da DirectoryArray) Sort()

Sort sorts array in ascending order.

func (DirectoryArray) Swap

func (da DirectoryArray) Swap(i int, j int)

Swap swaps two elements.

type Entry

type Entry struct {
	// contains filtered or unexported fields
}

Entry represents any filesystem entry object. For example, it can be playable track, directory, etc.

func NewEntry

func NewEntry(t int, item interface{}) *Entry

NewEntry returns newly created and initialized Entry object. t is the type of the incapsulated object. item is incapsulated object itself.

func (*Entry) Directory

func (e *Entry) Directory() *Directory

Directory returns Directory object incapsulated by Entry. Before calling this method you should be sure that Entry incapsulates Directory object.

func (*Entry) Track

func (e *Entry) Track() *Track

Track returns Track object incapsulated by Entry. Before calling this method you should be sure that Type returns TypeTrack, otherwise panic will happend.

func (*Entry) Type

func (e *Entry) Type() int

Type returns type of the object incapsulated in the Entry.

func (*Entry) TypeString

func (e *Entry) TypeString() string

TypeString returns string representaion of the type.

type Filesystem

type Filesystem struct {
	// contains filtered or unexported fields
}

Filesystem structure.

func New

func New() *Filesystem

New returns newly initialized Filesystem object.

func (*Filesystem) List

func (fs *Filesystem) List() (entries []*Entry, err os.Error)

List returns content of the working directory.

func (*Filesystem) SetWorkingDir

func (fs *Filesystem) SetWorkingDir(dir string) os.Error

SetWorkingDir sets new working directory, -- directory where we are located in.

func (*Filesystem) WorkingDir

func (fs *Filesystem) WorkingDir() string

WorkingDir returns chrootedd current directory where we are located in.

func (*Filesystem) WorkingDirFull

func (fs *Filesystem) WorkingDirFull() string

WorkingDirFull returns not chrooted working directory. Returned value is a full path based on root of the physical FS.

type Path

type Path struct {
	// contains filtered or unexported fields
}

Path represents path to the resource of the VFS (file, track, ...) and helps to convert OS FS pathes into root-based VFS ones.

func NewPath

func NewPath(filename string) *Path

NewPath returns newly initialized Path object for given VFS (based on fs.root) path value.

func NewPathFull

func NewPathFull(filename string) *Path

NewPathFull returns newly initialized Path object for given OS-like path value.

func (*Path) Path

func (path *Path) Path() string

Path returns VFS (based on fs.root) path value.

func (*Path) PathFull

func (path *Path) PathFull() string

PathFull return full physical path (as used in OS).

func (*Path) String

func (path *Path) String() string

String returns string representation of the object.

type PathArray

type PathArray []*Path

PathArray is helper type for manipulating Path arrays.

func (PathArray) Len

func (pa PathArray) Len() int

Len returns length of the array.

func (PathArray) Less

func (pa PathArray) Less(i int, j int) bool

Less returns true if i-element of the array less than j-element.

func (PathArray) Sort

func (pa PathArray) Sort()

Sort sorts array in ascending order.

func (PathArray) Swap

func (pa PathArray) Swap(i int, j int)

Swap swaps two array elements.

type Track

type Track struct {
	// Full path to the file.
	FilePath *Path
	Number   int
	Tag      *audio.Tag
}

Track represents track (one song) which can be played.

func NewTrack

func NewTrack(filePath *Path, number int) *Track

NewTrack returns new initialized track indentify some audio file and track.

func (*Track) Len

func (track *Track) Len() int

Len returns length of the track in seconds.

func (*Track) LenString

func (track *Track) LenString() string

LenString returns length of the track in standard time format.

type TrackArray

type TrackArray []*Track

TrackArray is helper type for manipulating Track arrays.

func (TrackArray) Len

func (ta TrackArray) Len() int

Len returns length of the array.

func (TrackArray) Less

func (ta TrackArray) Less(i int, j int) bool

Less returns true if i-element of the array less than j-element.

func (TrackArray) Sort

func (ta TrackArray) Sort()

Sort sorts array in ascending order.

func (TrackArray) Swap

func (ta TrackArray) Swap(i int, j int)

Swap swaps two array elements.

Jump to

Keyboard shortcuts

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