Documentation ¶
Index ¶
- Constants
- func GetOpFromFetchOpsMsg(m *Msg) (string, error)
- func IsTrigger(msg *Msg) bool
- type AddEntry
- type AddFiles
- type Command
- type CommandAllocator
- type CommandParser
- type CreatePlaylist
- type DBsyncOffer
- type DeleteFiles
- type DeletePlaylist
- type FetchOpsMethod
- type File
- type LogPlayback
- type Msg
- func MakePingMsg() *Msg
- func NewDBSyncOfferMsg(key string) (m *Msg)
- func NewFetchOpsMsg(op string) *Msg
- func NewFileRequestOffer(fileId int64, controlid string) *Msg
- func NewMsg(payload []byte, flag byte) *Msg
- func NewSecondaryOffer(controlid, offerId string, port int) *Msg
- func ReadMSG(reader io.Reader) (msg *Msg, err error)
- func WrapCommand(c Command, islast bool) *Msg
- func (t *Msg) Compress()
- func (t *Msg) IsCompressed() bool
- func (t *Msg) IsDBOP() bool
- func (t *Msg) IsFragment() bool
- func (t *Msg) IsJSON() bool
- func (t *Msg) IsPing() bool
- func (t *Msg) IsRaw() bool
- func (t *Msg) IsReserved() bool
- func (t *Msg) IsSetup() bool
- func (t *Msg) Payload() []byte
- func (t *Msg) String() string
- func (t *Msg) Uncompress()
- func (m *Msg) WriteTo(w io.Writer) (n int64, err error)
- type NotRegisteredError
- type OfferMsg
- type Playlist
- type QueryType
- type RenamePlaylist
- type SetCollectionAttributes
- type SetPlaylistRevision
- type SocialAction
- type Song
Constants ¶
const ( RAW byte = 1 JSON = 2 FRAGMENT = 4 COMPRESSED = 8 DBOP = 16 PING = 32 RESERVED = 64 SETUP = 128 )
Variables ¶
This section is empty.
Functions ¶
func GetOpFromFetchOpsMsg ¶
Types ¶
type AddFiles ¶
type AddFiles struct { Files []File `json:"files"` // contains filtered or unexported fields }
The AddFiles command says that the files listed have been added in this command
func (*AddFiles) GetCommand ¶
func (c *AddFiles) GetCommand() string
type CommandAllocator ¶
type CommandAllocator func() Command
type CommandParser ¶
type CommandParser struct {
// contains filtered or unexported fields
}
func NewCommandParser ¶
func NewCommandParser() *CommandParser
func (*CommandParser) ParseCommand ¶
func (c *CommandParser) ParseCommand(m *Msg) (command Command, err error)
func (*CommandParser) Register ¶
func (c *CommandParser) Register(commandName string, allocator CommandAllocator)
type CreatePlaylist ¶
type CreatePlaylist struct { Playlist Playlist `json:"playlist"` // contains filtered or unexported fields }
thiscommand says that the given Playlist has been created by this command
func (*CreatePlaylist) GetCommand ¶
func (c *CreatePlaylist) GetCommand() string
type DBsyncOffer ¶
type DBsyncOffer struct { Method string `json:"method"` // "dbsync-offer" Key string `json:"key"` // uuid }
the message send forgetting dbsync
func ParseDBSyncOffer ¶
func ParseDBSyncOffer(msg *Msg) (*DBsyncOffer, error)
type DeleteFiles ¶
type DeleteFiles struct { Ids []int64 `json:"ids"` // contains filtered or unexported fields }
Command saying the the listed ids are of files that have been deleted
func (*DeleteFiles) GetCommand ¶
func (c *DeleteFiles) GetCommand() string
type DeletePlaylist ¶
type DeletePlaylist struct { PlaylistGuid string `json:"playlistguid"` // contains filtered or unexported fields }
Command saying that the playlist wit the given Guid is deleted
func (*DeletePlaylist) GetCommand ¶
func (c *DeletePlaylist) GetCommand() string
type FetchOpsMethod ¶
This is interface represents ONE fetchop workflow
Every call means a given command has been sent. The commands are in order and the interface CAN NOT be used in parallel.
Returning from a method means that the next command can be received. Multiple simultaneous calls to the inteface may cause panic.
None of the commands are guaranteed to be send before Close is called because of the way the protocol is designed. And every last call is never send before Close is called. After Close or after any error returned from any function it should be considered that ALL commands were not send.
When the interface is being implemented in order to receive commands returning error will stop the calling of methods but the network activity may still continue
type File ¶
type File struct { Id int64 `json:"id"` // the ID of the file Url string `json:"url"` // currently only a string representation of the ID Song Album string `json:"album"` // string representation of the Album name Mimetype string `json:"mimetype"` // the mime type of the file Hash string `json:"hash"` // future expanstion Year int `json:"year"` // year the song has been release Albumpos int `json:"albumpos"` // position in the album of the song Mtime int64 `json:"mtime"` // the last modification time of the file in seconds since 1970-01-01 Duration int `json:"duration"` // duration of the song in seconds Bitrate int `json:"bitrate"` // bitrate of the file (can be 0) Size int `json:"size"` // size of the file in bytes }
A File
type LogPlayback ¶
type LogPlayback struct { Song Action int `json:"action"` // 1 for start ,2 for stop PlayTime int64 `json:"playtime"` // time in seconds since 1970-01-01 SecsPlayed int `json:"secsPlayed"` // seconds of the song that have been played // contains filtered or unexported fields }
A command saying that a given song has been started or stopped playing action == 1 is start playing, action == 2 is stopped playing the GUID of an Logplayback with action == 1 can not be used in fetchops
func (*LogPlayback) GetCommand ¶
func (c *LogPlayback) GetCommand() string
type Msg ¶
type Msg struct {
// contains filtered or unexported fields
}
a generic Message between tomahawks
func NewDBSyncOfferMsg ¶
func NewFetchOpsMsg ¶
func NewFileRequestOffer ¶
Make new Msg that contains a Request for a File with the given id from the given control id
func NewSecondaryOffer ¶
func WrapCommand ¶
func (*Msg) IsCompressed ¶
func (*Msg) IsFragment ¶
func (*Msg) IsReserved ¶
type NotRegisteredError ¶
type NotRegisteredError struct {
// contains filtered or unexported fields
}
func (NotRegisteredError) Error ¶
func (n NotRegisteredError) Error() string
type OfferMsg ¶
type OfferMsg struct { Conntype string `json:"conntype"` // : "accept-offer" Key string `json:"key"` // "key" : "whitelist",/ "bb3c6870-ac0f-4822-abad-4439e7ffeb15" / "FILE_REQUEST_KEY:12" NodeId string `json:"nodeid,omitempty"` // "nodeid" : "bb3c6870-ac0f-4822-abad-4439e7ffeb15", ControlId string `json:"controlid,omitempty"` // "controlid" : "bb3c6870-ac0f-4822-abad-4439e7ffeb15", Port int `json:"port"` // "port" : 0 }
Generic offer Msg payload
func ParseOffer ¶
parse the payload of the given message as an Offer
type Playlist ¶
type Playlist struct { Info string `json:"info"` // generic info Creator string `json:"creator"` // string represeting the creator CreatedOn int64 `json:"createdon"` // the time it was created as seconds since 1970-01-01 Title string `json:"title"` // the title of the Playlist CurrentRevision string `json:"currentrevision"` // revision number Guid string `json:"guid"` // UUID of the Playlist }
A playlist
type RenamePlaylist ¶
type RenamePlaylist struct { PlaylistGuid string `json:"playlistguid"` PlaylistTitle string `json:"playlistTitle"` // contains filtered or unexported fields }
Rename a playlist
func (*RenamePlaylist) GetCommand ¶
func (c *RenamePlaylist) GetCommand() string
type SetCollectionAttributes ¶
type SetCollectionAttributes struct { Del bool `json:"del"` Id string `json:"id"` Type int `json:"type"` // contains filtered or unexported fields }
func (*SetCollectionAttributes) GetCommand ¶
func (c *SetCollectionAttributes) GetCommand() string
type SetPlaylistRevision ¶
type SetPlaylistRevision struct { OldRev string `json:"oldrev"` // the old revision of the playlist NewRev string `json:"newrev"` // the new revision of the playlist PlaylistGuid string `json:"playlistguid"` // the Guid of the Playlist AddEntries []AddEntry `json:"addedentries"` // the entries to be added OrderedGuids []string `json:"orderedguids"` // the ordered list Of All the songs in the playlist // contains filtered or unexported fields }
Change the playlist
Only new entries are being given in AddEntries the OrderedGuids is the order guids of all the song in the new revision of the playlist. To remove a song you simply skip it in the OrderedGuids
func (*SetPlaylistRevision) GetCommand ¶
func (c *SetPlaylistRevision) GetCommand() string
type SocialAction ¶
type SocialAction struct { Song Action string `json:"action"` // String representation of the action. "Love" is the only one // currently Comment string `json:"comment"` // comment to the action "true" means Love a song "false" Unlove when // Action == Love Timestamp int64 `json:"timestamp"` // timestamp of the action // contains filtered or unexported fields }
A social Action command
func (*SocialAction) GetCommand ¶
func (c *SocialAction) GetCommand() string
Source Files ¶
- add_files.go
- command.go
- command_parser.go
- create_playlist.go
- dbsync_msg.go
- delete_files.go
- delete_playlist.go
- fetchops_method.go
- file.go
- gzip.go
- logplayback.go
- msg.go
- offer_msg.go
- ping_msg.go
- playlist.go
- playlist_revision.go
- rename_playlist.go
- setcollectionattributes.go
- social_action.go
- song.go
- tomahawk.go