magopie

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2016 License: MIT Imports: 10 Imported by: 0

README

Magopie GoDoc Build Status

Your Personal Torrent Search Engine. (It's a silent "O".)

What's with the name?

Magopie is pronounced just like "magpie" the bird. We chose the name because magpies are known for collecting things (especially if they're shiny). We added the "silent o" mostly for fun but also to differentiate from an existing Python project named magpie.

Use Cases

  1. I often want to search for some torrent but don't want to be subjected to NSFW ads that are prevalent on many torrent sites. Magopie proxies my query to multiple upstream torrent search engines and collates the results into a basic collection.
  2. I want to remotely start a torrent on a home server or seedbox. Magopie does not participate in any peer-to-peer file sharing itself; it merely downloads a .torrent file to a preconfigured directory on the server. Another program such as Transmission needs to be configured to watch that same directory for new .torrent files.
  3. I want to do all of that from my phone.

Demo

Note: we were tunneling through ngrok for the demo to work around a local networking problem.

Notable Features

  • Android client using Go bindings via gomobile.
  • Downloaded .torrent files are saved to disk through an afero filesystem interface providing for future extensibility to other remote afero implementations.
  • Torrents are gathered by parsing Kick Ass Torrents XML feeds and by scraping the search page of The Pirate Bay using goquery.
  • Searches against upstream sites are performed concurrently.

Future Plans

  • Serve magopie over TLS with automatic integration with Let's Encrypt.
  • Improve/replace the authentication mechanism.
  • Create an iOS app using the gomobile bindings.

Licenses

Magopie is licensed with the MIT license. Margo, the Magopie mascot, is a derivative work of the Go gopher, and thus, is licensed under the Creative Commons 3.0 Attributions license.

The Go gopher was designed by Renee French. http://reneefrench.blogspot.com/ The design is licensed under the Creative Commons 3.0 Attributions license. Read this article for more details: https://blog.golang.org/gopher

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckMAC

func CheckMAC(message, messageMAC, key string) bool

CheckMAC confirms that the mac provided with a message was signed with the appropriate key. The mac should be in a hex string.

func HMAC

func HMAC(message, key string) string

HMAC gives the sha256 HMAC of message using key. It is expressed as a hex string.

func ReadFromFile

func ReadFromFile(filePath string) []byte

ReadFromFile returns the bytes from 'filePath'

func SaveToFile

func SaveToFile(filePath string, data []byte) error

SaveToFile saves 'data' to the file 'filePath'

Types

type Client

type Client struct {
	ServerAddr string
	ServerKey  string
}

Client provides methods for talking to a magopie server.

func NewClient

func NewClient(server, key string) *Client

NewClient creates a Client

func (*Client) Download

func (c *Client) Download(t *Torrent) bool

Download triggers the Magopie server to download a particular torrent by ID.

func (*Client) ListSites

func (c *Client) ListSites() *SiteCollection

ListSites returns a collection of the sites that the server knows about

func (*Client) Search

func (c *Client) Search(s string) *TorrentCollection

Search asks the Magopie server for a list of results

type Site

type Site struct {
	ID      string
	Name    string
	URL     string
	Enabled bool
}

Site defines a site that serves torrent files.

type SiteCollection

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

SiteCollection is a collection of sites because gomobile can't handle slices

func (*SiteCollection) Clear

func (sc *SiteCollection) Clear()

Clear empties the list of sites

func (*SiteCollection) Get

func (sc *SiteCollection) Get(idx int) *Site

Get returns the site at idx or a nil site

func (*SiteCollection) Index

func (sc *SiteCollection) Index(s *Site) int

Index finds the index of a site or -1 if not found

func (*SiteCollection) Insert

func (sc *SiteCollection) Insert(i int, s *Site)

Insert inserts a site into the collection at i

func (*SiteCollection) Length

func (sc *SiteCollection) Length() int

Length returns how many sites are in the collection

func (*SiteCollection) MarshalJSON

func (sc *SiteCollection) MarshalJSON() ([]byte, error)

MarshalJSON returns JSON from the collection

func (*SiteCollection) Pop

func (sc *SiteCollection) Pop(s *Site)

Pop removes the last element from the collection

func (*SiteCollection) Push

func (sc *SiteCollection) Push(s *Site)

Push adds an element to the end of the collection

func (*SiteCollection) Remove

func (sc *SiteCollection) Remove(i int)

Remove a site from the collection at i

func (*SiteCollection) Shift

func (sc *SiteCollection) Shift(s *Site)

Shift removes an element from the front of the collection

func (*SiteCollection) UnmarshalJSON

func (sc *SiteCollection) UnmarshalJSON(data []byte) error

UnmarshalJSON replaces the collection with the results from a JSON []byte

func (*SiteCollection) Unshift

func (sc *SiteCollection) Unshift(s *Site)

Unshift adds an element to the front of the collection

type Torrent

type Torrent struct {
	ID        string
	Title     string
	MagnetURI string
	SiteID    string
	Seeders   int
	Leechers  int
	Size      int
}

A Torrent is an individual result from a search operation representing a single torrent file.

type TorrentCollection

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

TorrentCollection is a collection of torrents because gomobile can't handle slices

func (*TorrentCollection) Clear

func (tc *TorrentCollection) Clear()

Clear empties the list of torrents

func (*TorrentCollection) Get

func (tc *TorrentCollection) Get(idx int) *Torrent

Get returns the torrent at idx or a nil torrent

func (*TorrentCollection) Index

func (tc *TorrentCollection) Index(t *Torrent) int

Index finds the index of a torrent or -1 if not found

func (*TorrentCollection) Insert

func (tc *TorrentCollection) Insert(i int, t *Torrent)

Insert inserts a torrent into the collection at i

func (*TorrentCollection) Length

func (tc *TorrentCollection) Length() int

Length returns how many torrents are in the collection

func (*TorrentCollection) MarshalJSON

func (tc *TorrentCollection) MarshalJSON() ([]byte, error)

MarshalJSON returns JSON from the collection

func (*TorrentCollection) Pop

func (tc *TorrentCollection) Pop(t *Torrent)

Pop removes the last element from the collection

func (*TorrentCollection) Push

func (tc *TorrentCollection) Push(t *Torrent)

Push adds an element to the end of the collection

func (*TorrentCollection) Remove

func (tc *TorrentCollection) Remove(i int)

Remove a torrent from the collection at i

func (*TorrentCollection) Shift

func (tc *TorrentCollection) Shift(t *Torrent)

Shift removes an element from the front of the collection

func (*TorrentCollection) UnmarshalJSON

func (tc *TorrentCollection) UnmarshalJSON(data []byte) error

UnmarshalJSON replaces the collection with the results from a JSON []byte

func (*TorrentCollection) Unshift

func (tc *TorrentCollection) Unshift(t *Torrent)

Unshift adds an element to the front of the collection

Directories

Path Synopsis
cmd
android
Package android holds the native android client that talks to the server using go bindings.
Package android holds the native android client that talks to the server using go bindings.
magopie
GET /torrents?q=ubuntu POST /download/{id}
GET /torrents?q=ubuntu POST /download/{id}

Jump to

Keyboard shortcuts

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