playlist

package
v0.0.29-0...-70a1537 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2022 License: Unlicense Imports: 6 Imported by: 0

Documentation

Overview

Package playlist list files from a folder resuming the last file listed.

Index

Constants

View Source
const (
	// FileSortModeFileNameAsc represents the file sort mode by file name ascendant.
	FileSortModeFileNameAsc = iota

	// FileSortModeTimestampCreationAsc represents the file sort mode by file timestamp creation ascendant.
	FileSortModeTimestampCreationAsc
)

Variables

View Source
var (
	// ErrUnsupportedFileSortMode represent the error when a file sort mode given is unknown.
	ErrUnsupportedFileSortMode = fmt.Errorf("unsupported file sort mode")
)

Functions

func GetNextFiles

func GetNextFiles(fileList []string, count int, fromFilePath string) []string

GetNextFiles return the count given file path names from the file list given after the from the file path given.

func ListFilesByDateCreation

func ListFilesByDateCreation(path string, filterExtensions []string) ([]string, error)

ListFilesByDateCreation lists file path sorted by timestamp creation ascendant on the given path and filter them with extension given.

func ListFilesByFileNamePath

func ListFilesByFileNamePath(path string, filterExtensions []string) ([]string, error)

ListFilesByFileNamePath lists file path sorted by file name ascendant on the given path and filter them with extension given.

Types

type FileSortMode

type FileSortMode uint

A FileSortMode represents a the mechanisms to sort files result.

type Playlist

type Playlist struct {
}

Playlist contains the mechanism to list file names.

func (*Playlist) GetNextFilesFromPath

func (*Playlist) GetNextFilesFromPath(
	path string, count int, fileExtension []string, sortMode FileSortMode) ([]string, error)

GetNextFilesFromPath returns existing files names on the path given following the next steps: 1. List file names by the sort mode given and filter them by the extension given. 2. Load from the ini configuration file which was the last file name processed. If there is no file, it will return empty string. 3. Get next N count value given file from the last file name processed. 4. Save the last file name returned on the filter list. 5. Return the full list to processed.

Jump to

Keyboard shortcuts

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