irrenhaus_api

package module
v0.0.0-...-d9fdc38 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2018 License: GPL-3.0 Imports: 20 Imported by: 2

Documentation

Overview

* irrenhaus-api, API wrapper for irrenhaus.dyndns.dk * Copyright (C) 2018 Daniel Müller * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>

Index

Constants

View Source
const (
	ShoutboxEventNone = 0
	ShoutboxEvent1    = 1
	// if set, unread message count is in data[1]
	ShoutboxEventUserMessage = 2
	ShoutboxEvent4           = 4
	ShoutboxEvent8           = 8
	ShoutboxEvent16          = 16
	ShoutboxEvent32          = 32
	// if set, one of the following to operations are possible
	// simple message delete: data[3] contains 'del,ID1,ID2,...' indicating which message should be deleted
	// clear entire chat: data[3] is 'clear'
	ShoutboxEventDeleteEntry = 64
)

Unnamed events are still unknown

Variables

View Source
var DEBUG = false

Functions

func CommentWrite

func CommentWrite(c *Connection, id int64, message string) (bool, error)

func DownloadTorrent

func DownloadTorrent(c *Connection, id int64) ([]byte, string, error)

func ShoutboxStrip

func ShoutboxStrip(msg, url string) (stripped string)

Strip the HTML / format code from the message

func ShoutboxWrite

func ShoutboxWrite(c *Connection, shoutId int, message string) (bool, error)

func Thank

func Thank(c *Connection, id int64) (bool, error)

Types

type Connection

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

func NewConnection

func NewConnection(url string, username string, password string, pin string) Connection

func (Connection) GetCookies

func (c Connection) GetCookies() Cookies

func (*Connection) Login

func (c *Connection) Login() error

func (*Connection) SetCookies

func (c *Connection) SetCookies(cookies Cookies)

func (*Connection) SetUserAgent

func (c *Connection) SetUserAgent(userAgent string)

type Cookies

type Cookies struct {
	Uid      int64
	Pass     string
	Passhash string
}

type Peer

type Peer struct {
	Name        string
	Connectable bool
	Seeder      bool
	Uploaded    uint64
	Downloaded  uint64
	Ulrate      uint64
	Dlrate      uint64
	Ratio       float64
	Completed   float64
	Connected   uint64
	Idle        uint64
	Client      string
}

type ShoutboxEvent

type ShoutboxEvent struct {
	Type int
	ID   int
	Data []string
}

type ShoutboxMessage

type ShoutboxMessage struct {
	Id      int64
	User    string
	UserId  int
	Date    time.Time
	Message string

	Event *ShoutboxEvent
}

func ShoutboxRead

func ShoutboxRead(c *Connection, shoutId int, lastMessageId int64) ([]ShoutboxMessage, error)

type Snatch

type Snatch struct {
	Name       string
	Uploaded   uint64
	Downloaded uint64
	Ratio      float64
	Completed  time.Time
	Stopped    time.Time
	Seeding    bool
}

type TorrentEntry

type TorrentEntry struct {
	Id           int
	Name         string
	Category     int
	Added        time.Time
	Size         uint64
	Description  string
	InfoHash     string
	FileCount    int
	SeederCount  int
	LeecherCount int
	SnatchCount  int
	CommentCount int
	Uploader     string

	Files    []TorrentFile
	Peers    []Peer
	Snatches []Snatch
}

func Details

func Details(c *Connection, id int64, files bool, peers bool, snatches bool) (*TorrentEntry, error)
func Search(c *Connection, needle string, categories []int, dead bool) ([]TorrentEntry, error)

type TorrentFile

type TorrentFile struct {
	Name string
	Size uint64
}

type TorrentList

type TorrentList struct {
	Page    int64
	Entries []TorrentEntry
}

type TorrentUpload

type TorrentUpload struct {
	Meta        io.Reader
	Nfo         io.Reader
	Image1      io.Reader
	Image2      io.Reader
	Name        string
	Description string
	Category    int

	Id int64
	// contains filtered or unexported fields
}

func NewUpload

func NewUpload(c *Connection, meta io.Reader, nfo io.Reader, image io.Reader, name string, category int, description string) (TorrentUpload, error)

func (*TorrentUpload) Upload

func (t *TorrentUpload) Upload() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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