mirror of
https://github.com/rclone/rclone.git
synced 2024-11-07 09:04:52 +01:00
premiumizeme: new backend for premiumize.me - Fixes #3063
This commit is contained in:
parent
f47e5220a2
commit
a1263e70cf
@ -52,6 +52,7 @@ Rclone *("rsync for cloud storage")* is a command line program to sync files and
|
||||
* Oracle Cloud Storage [:page_facing_up:](https://rclone.org/swift/)
|
||||
* ownCloud [:page_facing_up:](https://rclone.org/webdav/#owncloud)
|
||||
* pCloud [:page_facing_up:](https://rclone.org/pcloud/)
|
||||
* premiumize.me [:page_facing_up:](https://rclone.org/premiumizeme/)
|
||||
* put.io [:page_facing_up:](https://rclone.org/webdav/#put-io)
|
||||
* QingStor [:page_facing_up:](https://rclone.org/qingstor/)
|
||||
* Rackspace Cloud Files [:page_facing_up:](https://rclone.org/swift/)
|
||||
|
@ -24,6 +24,7 @@ import (
|
||||
_ "github.com/rclone/rclone/backend/onedrive"
|
||||
_ "github.com/rclone/rclone/backend/opendrive"
|
||||
_ "github.com/rclone/rclone/backend/pcloud"
|
||||
_ "github.com/rclone/rclone/backend/premiumizeme"
|
||||
_ "github.com/rclone/rclone/backend/qingstor"
|
||||
_ "github.com/rclone/rclone/backend/s3"
|
||||
_ "github.com/rclone/rclone/backend/sftp"
|
||||
|
83
backend/premiumizeme/api/types.go
Normal file
83
backend/premiumizeme/api/types.go
Normal file
@ -0,0 +1,83 @@
|
||||
// Package api contains definitions for using the premiumize.me API
|
||||
package api
|
||||
|
||||
import "fmt"
|
||||
|
||||
// Response is returned by all messages and embedded in the
|
||||
// structures below
|
||||
type Response struct {
|
||||
Message string `json:"message,omitempty"`
|
||||
Status string `json:"status"`
|
||||
}
|
||||
|
||||
// Error statisfies the error interface
|
||||
func (e *Response) Error() string {
|
||||
return fmt.Sprintf("%s: %s", e.Status, e.Message)
|
||||
}
|
||||
|
||||
// AsErr checks the status and returns an err if bad or nil if good
|
||||
func (e *Response) AsErr() error {
|
||||
if e.Status != "success" {
|
||||
return e
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Item Types
|
||||
const (
|
||||
ItemTypeFolder = "folder"
|
||||
ItemTypeFile = "file"
|
||||
)
|
||||
|
||||
// Item refers to a file or folder
|
||||
type Item struct {
|
||||
Breadcrumbs []Breadcrumb `json:"breadcrumbs"`
|
||||
CreatedAt int64 `json:"created_at,omitempty"`
|
||||
ID string `json:"id"`
|
||||
Link string `json:"link,omitempty"`
|
||||
Name string `json:"name"`
|
||||
Size int64 `json:"size,omitempty"`
|
||||
StreamLink string `json:"stream_link,omitempty"`
|
||||
Type string `json:"type"`
|
||||
TranscodeStatus string `json:"transcode_status"`
|
||||
IP string `json:"ip"`
|
||||
MimeType string `json:"mime_type"`
|
||||
}
|
||||
|
||||
// Breadcrumb is part the breadcrumb trail for a file or folder. It
|
||||
// is returned as part of folder/list if required
|
||||
type Breadcrumb struct {
|
||||
ID string `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
ParentID string `json:"parent_id,omitempty"`
|
||||
}
|
||||
|
||||
// FolderListResponse is the response to folder/list
|
||||
type FolderListResponse struct {
|
||||
Response
|
||||
Content []Item `json:"content"`
|
||||
Name string `json:"name,omitempty"`
|
||||
ParentID string `json:"parent_id,omitempty"`
|
||||
}
|
||||
|
||||
// FolderCreateResponse is the response to folder/create
|
||||
type FolderCreateResponse struct {
|
||||
Response
|
||||
ID string `json:"id,omitempty"`
|
||||
}
|
||||
|
||||
// FolderUploadinfoResponse is the response to folder/uploadinfo
|
||||
type FolderUploadinfoResponse struct {
|
||||
Response
|
||||
Token string `json:"token,omitempty"`
|
||||
URL string `json:"url,omitempty"`
|
||||
}
|
||||
|
||||
// AccountInfoResponse is the response to account/info
|
||||
type AccountInfoResponse struct {
|
||||
Response
|
||||
CustomerID string `json:"customer_id,omitempty"`
|
||||
LimitUsed float64 `json:"limit_used,omitempty"` // fraction 0..1 of download traffic limit
|
||||
PremiumUntil int64 `json:"premium_until,omitempty"`
|
||||
SpaceUsed float64 `json:"space_used,omitempty"`
|
||||
}
|
1217
backend/premiumizeme/premiumizeme.go
Normal file
1217
backend/premiumizeme/premiumizeme.go
Normal file
File diff suppressed because it is too large
Load Diff
17
backend/premiumizeme/premiumizeme_test.go
Normal file
17
backend/premiumizeme/premiumizeme_test.go
Normal file
@ -0,0 +1,17 @@
|
||||
// Test filesystem interface
|
||||
package premiumizeme_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/rclone/rclone/backend/premiumizeme"
|
||||
"github.com/rclone/rclone/fstest/fstests"
|
||||
)
|
||||
|
||||
// TestIntegration runs integration tests against the remote
|
||||
func TestIntegration(t *testing.T) {
|
||||
fstests.Run(t, &fstests.Opt{
|
||||
RemoteName: "TestPremiumizeMe:",
|
||||
NilObject: (*premiumizeme.Object)(nil),
|
||||
})
|
||||
}
|
@ -47,6 +47,7 @@ docs = [
|
||||
"qingstor.md",
|
||||
"swift.md",
|
||||
"pcloud.md",
|
||||
"premiumize.md",
|
||||
"sftp.md",
|
||||
"union.md",
|
||||
"webdav.md",
|
||||
|
@ -45,6 +45,7 @@ Rclone is a command line program to sync files and directories to and from:
|
||||
* {{< provider name="Oracle Cloud Storage" home="https://cloud.oracle.com/storage-opc" config="/swift/" >}}
|
||||
* {{< provider name="ownCloud" home="https://owncloud.org/" config="/webdav/#owncloud" >}}
|
||||
* {{< provider name="pCloud" home="https://www.pcloud.com/" config="/pcloud/" >}}
|
||||
* {{< provider name="premiumize.me" home="https://premiumize.me/" config="/premiumizeme/" >}}
|
||||
* {{< provider name="put.io" home="https://put.io/" config="/webdav/#put-io" >}}
|
||||
* {{< provider name="QingStor" home="https://www.qingcloud.com/products/storage" config="/qingstor/" >}}
|
||||
* {{< provider name="Rackspace Cloud Files" home="https://www.rackspace.com/cloud/files" config="/swift/" >}}
|
||||
|
@ -43,6 +43,7 @@ See the following for detailed instructions for
|
||||
* [Openstack Swift / Rackspace Cloudfiles / Memset Memstore](/swift/)
|
||||
* [OpenDrive](/opendrive/)
|
||||
* [Pcloud](/pcloud/)
|
||||
* [premiumize.me](/premiumizeme/)
|
||||
* [QingStor](/qingstor/)
|
||||
* [SFTP](/sftp/)
|
||||
* [Union](/union/)
|
||||
|
@ -37,6 +37,7 @@ Here is an overview of the major features of each cloud storage system.
|
||||
| OpenDrive | MD5 | Yes | Yes | No | - |
|
||||
| Openstack Swift | MD5 | Yes | No | No | R/W |
|
||||
| pCloud | MD5, SHA1 | Yes | No | No | W |
|
||||
| premiumize.me | - | No | Yes | No | R |
|
||||
| QingStor | MD5 | No | No | No | R/W |
|
||||
| SFTP | MD5, SHA1 ‡ | Yes | Depends | No | - |
|
||||
| WebDAV | MD5, SHA1 ††| Yes ††† | Depends | No | - |
|
||||
@ -152,6 +153,7 @@ operations more efficient.
|
||||
| OpenDrive | Yes | Yes | Yes | Yes | No | No | No | No | No |
|
||||
| Openstack Swift | Yes † | Yes | No | No | No | Yes | Yes | No [#2178](https://github.com/rclone/rclone/issues/2178) | Yes |
|
||||
| pCloud | Yes | Yes | Yes | Yes | Yes | No | No | No [#2178](https://github.com/rclone/rclone/issues/2178) | Yes |
|
||||
| premiumize.me | Yes | No | Yes | Yes | No | No | No | Yes | Yes |
|
||||
| QingStor | No | Yes | No | No | No | Yes | No | No [#2178](https://github.com/rclone/rclone/issues/2178) | No |
|
||||
| SFTP | No | No | Yes | Yes | No | No | Yes | No [#2178](https://github.com/rclone/rclone/issues/2178) | Yes |
|
||||
| WebDAV | Yes | Yes | Yes | Yes | No | No | Yes ‡ | No [#2178](https://github.com/rclone/rclone/issues/2178) | Yes |
|
||||
|
118
docs/content/premiumizeme.md
Normal file
118
docs/content/premiumizeme.md
Normal file
@ -0,0 +1,118 @@
|
||||
---
|
||||
title: "premiumize.me"
|
||||
description: "Rclone docs for premiumize.me"
|
||||
date: "2019-08-10"
|
||||
---
|
||||
|
||||
<i class="fa fa-user"></i> premiumize.me
|
||||
-----------------------------------------
|
||||
|
||||
Paths are specified as `remote:path`
|
||||
|
||||
Paths may be as deep as required, eg `remote:directory/subdirectory`.
|
||||
|
||||
The initial setup for [premiumize.me](https://premiumize.me/) involves getting a token from premiumize.me which you
|
||||
need to do in your browser. `rclone config` walks you through it.
|
||||
|
||||
Here is an example of how to make a remote called `remote`. First run:
|
||||
|
||||
rclone config
|
||||
|
||||
This will guide you through an interactive setup process:
|
||||
|
||||
```
|
||||
No remotes found - make a new one
|
||||
n) New remote
|
||||
s) Set configuration password
|
||||
q) Quit config
|
||||
n/s/q> n
|
||||
name> remote
|
||||
Type of storage to configure.
|
||||
Enter a string value. Press Enter for the default ("").
|
||||
Choose a number from below, or type in your own value
|
||||
[snip]
|
||||
30 / premiumize.me
|
||||
\ "premiumizeme"
|
||||
Storage> premiumizeme
|
||||
** See help for premiumizeme backend at: https://rclone.org/premiumizeme/ **
|
||||
|
||||
Remote config
|
||||
Use auto config?
|
||||
* Say Y if not sure
|
||||
* Say N if you are working on a remote or headless machine
|
||||
y) Yes
|
||||
n) No
|
||||
y/n> y
|
||||
If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth
|
||||
Log in and authorize rclone for access
|
||||
Waiting for code...
|
||||
Got code
|
||||
--------------------
|
||||
[remote]
|
||||
type = premiumizeme
|
||||
token = {"access_token":"XXX","token_type":"Bearer","refresh_token":"XXX","expiry":"2029-08-07T18:44:15.548915378+01:00"}
|
||||
--------------------
|
||||
y) Yes this is OK
|
||||
e) Edit this remote
|
||||
d) Delete this remote
|
||||
y/e/d>
|
||||
```
|
||||
|
||||
See the [remote setup docs](/remote_setup/) for how to set it up on a
|
||||
machine with no Internet browser available.
|
||||
|
||||
Note that rclone runs a webserver on your local machine to collect the
|
||||
token as returned from premiumize.me. This only runs from the moment it opens
|
||||
your browser to the moment you get back the verification code. This
|
||||
is on `http://127.0.0.1:53682/` and this it may require you to unblock
|
||||
it temporarily if you are running a host firewall.
|
||||
|
||||
Once configured you can then use `rclone` like this,
|
||||
|
||||
List directories in top level of your premiumize.me
|
||||
|
||||
rclone lsd remote:
|
||||
|
||||
List all the files in your premiumize.me
|
||||
|
||||
rclone ls remote:
|
||||
|
||||
To copy a local directory to an premiumize.me directory called backup
|
||||
|
||||
rclone copy /home/source remote:backup
|
||||
|
||||
### Modified time and hashes ###
|
||||
|
||||
premiumize.me does not support modification times or hashes, therefore
|
||||
syncing will default to `--size-only` checking. Note that using
|
||||
`--update` will work.
|
||||
|
||||
<!--- autogenerated options start - DO NOT EDIT, instead edit fs.RegInfo in backend/premiumizeme/premiumizeme.go then run make backenddocs -->
|
||||
### Standard Options
|
||||
|
||||
Here are the standard options specific to premiumizeme (premiumize.me).
|
||||
|
||||
#### --premiumizeme-api-key
|
||||
|
||||
API Key.
|
||||
|
||||
This is not normally used - use oauth instead.
|
||||
|
||||
|
||||
- Config: api_key
|
||||
- Env Var: RCLONE_PREMIUMIZEME_API_KEY
|
||||
- Type: string
|
||||
- Default: ""
|
||||
|
||||
<!--- autogenerated options stop -->
|
||||
|
||||
### Limitations ###
|
||||
|
||||
Note that premiumize.me is case insensitive so you can't have a file called
|
||||
"Hello.doc" and one called "hello.doc".
|
||||
|
||||
premiumize.me file names can't have the `\` or `"` characters in.
|
||||
rclone maps these to and from an identical looking unicode equivalents
|
||||
`\` and `"`
|
||||
|
||||
premiumize.me only supports filenames up to 255 characters in length.
|
@ -79,6 +79,7 @@
|
||||
<li><a href="/qingstor/"><i class="fa fa-hdd-o"></i> QingStor</a></li>
|
||||
<li><a href="/swift/"><i class="fa fa-space-shuttle"></i> Openstack Swift</a></li>
|
||||
<li><a href="/pcloud/"><i class="fa fa-cloud"></i> pCloud</a></li>
|
||||
<li><a href="/premiumizeme/"><i class="fa fa-user"></i> premiumize.me</a></li>
|
||||
<li><a href="/sftp/"><i class="fa fa-server"></i> SFTP</a></li>
|
||||
<li><a href="/union/"><i class="fa fa-link"></i> Union (merge backends)</a></li>
|
||||
<li><a href="/webdav/"><i class="fa fa-server"></i> WebDAV</a></li>
|
||||
|
@ -157,3 +157,7 @@ backends:
|
||||
remote: "TestKoofr:"
|
||||
subdir: false
|
||||
fastlist: false
|
||||
- backend: "premiumizeme"
|
||||
remote: "TestPremiumizeMe:"
|
||||
subdir: false
|
||||
fastlist: false
|
||||
|
Loading…
Reference in New Issue
Block a user