Documentation ¶
Overview ¶
Package store is package for managing the database that stores the information about the songs, artists and albums.
Package store is package for managing the database that stores the information about the songs, artists and albums.
Index ¶
- func AddFileToPlaylist(file playlistmgr.PlaylistFile, playlistName string) error
- func CreateAlbum(artist string, nameRaw string) (string, error)
- func CreateArtist(nameRaw string) (string, error)
- func CreatePlaylist(name, mPoint string) (string, error)
- func CreateSong(artist string, album string, nameRaw string, path string) (string, error)
- func DeleteAlbum(artistName, albumName, mPoint string) error
- func DeleteArtist(artist, mPoint string) error
- func DeletePlaylist(name, mPoint string) error
- func DeletePlaylistSong(playlist, name string, force bool) error
- func DeleteSong(artist, album, song, mPoint string) error
- func GetAlbumPath(artist string, album string) (string, error)
- func GetArtistPath(artist string) (string, error)
- func GetCompatibleString(name string) string
- func GetDescription(artist string, album string, name string) (string, error)
- func GetDropFilePath(name, mPoint string) (string, error)
- func GetFilePath(artist, album, song string) (string, error)
- func GetPlaylistFilePath(playlist, song, mPoint string) (string, error)
- func GetPlaylistPath(playlist string) (string, error)
- func HandleDrop(path, rootPoint string) error
- func InitDB(path string) error
- func ListAlbums(artist string) ([]fuse.Dirent, error)
- func ListArtists() ([]fuse.Dirent, error)
- func ListPlaylistSongs(playlist, mPoint string) ([]fuse.Dirent, error)
- func ListPlaylists() ([]fuse.Dirent, error)
- func ListSongs(artist string, album string) ([]fuse.Dirent, error)
- func MoveAlbum(oldArtist, oldAlbum, newArtist, newAlbum, mPoint string) error
- func MoveArtist(oldArtist, newArtist, mPoint string) error
- func MoveSongs(...) (string, error)
- func RegeneratePlaylistFile(name, mPoint string) error
- func RenamePlaylist(oldName, newName, mPoint string) (string, error)
- func RenamePlaylistSong(playlist, oldName, newName, mPoint string) (string, error)
- func StoreNewSong(song *musicmgr.FileTags, path string) error
- type AlbumStore
- type ArtistStore
- type SongStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddFileToPlaylist ¶
func AddFileToPlaylist(file playlistmgr.PlaylistFile, playlistName string) error
AddFileToPlaylist function adds a file to a specific playlist. The function also checks that the file exists in the MuLi database.
func CreateAlbum ¶
CreateAlbum creates an album for a specific Artist from a Raw name. The name is returned as a compatible string to use as a Directory name and the description file is created. The description file for the Artist will be also updated in the process. If the Album is created correctly the string return value will contain the compatible string to use as Directory name and the second value will contain nil.
func CreateArtist ¶
CreateArtist creates a new artist from a Raw name. It generates the compatible string to use as Directory name and stores the information in the database. It also generates the description file. If there is an error it will be specified in the error return value, nil otherwise.
func CreatePlaylist ¶
CreatePlaylist function creates a playlist item in the database and also creates it in the filesystem. It receives the playlist name and returns the modified name and an error if something went wrong.
func CreateSong ¶
CreateSong creates a song for a specific Artist and Album from a Raw name and a path. The name is returned as a compatible string to use as a Directory name and the description file is created. The path parameter is used to identify the file being added to the filesystem. If the Song is created correctly the string return value will contain the compatible string to use as File name and the second value will contain nil.
func DeleteAlbum ¶
DeleteAlbum deletes the specified Album for the specified Artist only in the database and returns nil if there was no error.
func DeleteArtist ¶
DeleteArtist deletes the specified Artist only in the database and returns nil if there was no error.
func DeletePlaylist ¶
DeletePlaylist function deletes a playlist from the database and also deletes all the entries in the specific files and deletes it from the filesystem.
func DeletePlaylistSong ¶
DeletePlaylistSong function deletes a specific song from a playlist. The force parameter is used to just delete the song without modifying the original song file.
func DeleteSong ¶
DeleteSong deletes the specified Song in the specified Album and Artist only in the database and returns nil if there was no error.
func GetAlbumPath ¶
GetAlbumPath checks that a specified Artist and Album exists on the database and returns a fuse error if it does not. It also returns the Album name as string.
func GetArtistPath ¶
GetArtistPath checks that a specified Artist exists on the database and returns a fuse error if it does not. It also returns the Artist name as string.
func GetCompatibleString ¶
GetCompatibleString removes all the special characters from the string name to create a new string compatible with different file names.
func GetDescription ¶
GetDescription obtains a Song description from the database as a JSON object. If the description is obtained correctly a string with the JSON is returned and nil.
func GetDropFilePath ¶
* Returns the path of a file in the drop directory.
func GetFilePath ¶
GetFilePath checks that a specified Song Album exists on the database and returns the full path to the Song file. If there is an error obtaining the Song an error will be returned.
func GetPlaylistFilePath ¶
GetPlaylistFilePath function should return the path for a specific file in a specific playlist. The file could be on two places, first option is that the file is stored in the database. In that case, the file will be stored somewhere else in the MuLi filesystem but that will be specified on the item in the database. On the other hand, the file could be just dropped inside the playlist and it will be temporary stored in a directory inside the playlists directory. The playlist name is specified on the first argument and the song name on the second. The mount path is also needed and should be specified on the third argument. This function returns a string containing the file path and an error that will be nil if everything is ok.
func GetPlaylistPath ¶
GetPlaylistPath checks that a specified playlist exists on the database and returns an error if it does not. It also returns the playlist name as string.
func HandleDrop ¶
* This function manages the Drop directory.
- The user can copy/create files into this directory and
- the files will be organized to the correct directory
- based on the file tags.
func InitDB ¶
InitDB initializes the database with the specified configuration and returns nil if there was no problem.
func ListAlbums ¶
ListAlbums returns all the Dirent corresponding to Albums for a specified Artist in the database. This is used to generate the Album listing on the generated filesystem. It returns nil in the second return value if there was no error and nil if the Albums were obtained correctly.
func ListArtists ¶
ListArtists returns all the Dirent corresponding to Artists in the database. This is used to generate the Artist listing on the generated filesystem. It returns nil in the second return value if there was no error and nil if the Artists were obtained correctly.
func ListPlaylistSongs ¶
ListPlaylistSongs function returns all the songs inside a playlist. The available songs are loaded from the database and also from the temporary drop directory named after the playlist. It receives a playlist name and returns a slice with all the files.
func ListPlaylists ¶
ListPlaylists function returns all the names of the playlists available in the MuLi system. It receives no arguments and returns a slice of Dir objects to list all the available playlists and the error if there is any.
func ListSongs ¶
ListSongs returns all the Dirent corresponding to Songs for a specified Artist and Album in the database. This is used to generate the Song listing on the generated filesystem. It returns nil in the second return value if there was no error and nil if the Songs were obtained correctly.
func MoveAlbum ¶
MoveAlbum changes the album path. It modifies the information in the database and updates the tags to match the new location on every song inside the album. It also moves the actual files into the new location.
func MoveArtist ¶
MoveArtist changes the Artist path. It modifies the information in the database and updates the tags to match the new location on every song inside every album. It also moves the actual files into the new location.
func MoveSongs ¶
func MoveSongs(oldArtist, oldAlbum, oldName, newArtist, newAlbum, newName, path, mPoint string) (string, error)
MoveSongs changes the Songs path. It modifies the information in the database and updates the tags to match the new location. It also moves the actual file into the new location.
func RegeneratePlaylistFile ¶
RegeneratePlaylistFile creates the playlist file from the information in the database.
func RenamePlaylist ¶
RenamePlaylist moves the entire Playlist and changes all the links to the songs in every MuLi song.
func RenamePlaylistSong ¶
RenamePlaylistSong changes the name on a specific song, it also updates the song in the original place and checks that every playlist containing the song is updated.
Types ¶
type AlbumStore ¶
AlbumStore is the information for a specific album to be stored in the database.
type ArtistStore ¶
ArtistStore is the information for a specific artist to be stored in the database.