Tutorial on creation of services
1 – Introduction
In this document we will explain the general terms to implement a new service for Tucan (minimum files, location of these files, format, parameters, input/output… etc).
2 – Brief Summary
service/: | Directory that contains all the files of the service, it may not contain any dot “.” in the name (mandatory). |
---|---|
__init__.py: | Required for python to recognize the directory as module (mandatory). |
service.conf: | Description and information of the service so that the plugin system knows that it supports the plugin of this service (mandatory). |
<image or icon>: | |
Image or icon of size 48×48 pixels representative of the service (optional). | |
check_links.py: | Only required if the service has support for downloads. Can be a file or it can be a method of a plugin for download (optional). |
anonymous_download.py: | |
Only required if the service has support for anonymous downloads (optional). | |
premium.accounts: | |
Only required if the service has support for premium accounts (generated from the GUI) (optional). | |
premium_download.py: | |
Only required if the service has support for downloads, premium (optional). | |
premium_cookie.py: | |
Only required if the service has support for downloads, premium (optional). |
3.1 – Directory of Service (mandatory)
The directory will contain all the files of the different plugins service, must not contain any dot “.” in the name. Examples:
http://rapidshare.com -> rapidshare/
http://megaupload.com -> megaupload/
http://gigasize.com -> gigasize/
http://foobar.com -> foobar/
3.2 – File __init__.py (mandatory)
This file is required for python to recognize the directory as module. Is a file that is empty.
3.3 – File service.conf (mandatory)
This file describes and gives information of the different plugins to the system plugins Tucan for you to know the functionalities of the service.
It consists of several sections:
[main]
enabled = False
name = rapidshare.com
icon = rapidshare.png
premium_cookie = PremiumCookie
downloads = True
uploads = False
update = 0
[anonymous_download]
name = AnonymousDownload
author = Crak
captcha = True
version = 0.1
slots = 1
[premium_download]
name = Premium Download
author = Crak
version = 0.2
accounts = premium.accounts
[Main]section
“enabled” Option to notify that the service is enabled or disabled. Values True, False. Default is disabled (False).
“name” Option to notify the name of the service. Examples: rapidshare.com, megaupload.com, gigasize.com
“icon” Option to notify the name of the icon or representative image of the service that you are going to use in the GUI. Optional: if you are not going to use it you must put None.
“downloads” Option to notify that the service can perform downloads. Values: True, False.
“premium_cookie” Option to notify the name of the class that you will use to manage the cookie needed in the premium accounts.
“uploads” Option to notify that the service can perform uploads. Values: True, False.
“update” Option to update automatic service, it will be a number to increase when you want to update the service. Values: int.
Section [anonymous_download]
“name” Option to notify the name of the class that you are going to use to perform this type of access. Default value: Anonymous Download.
“author” Option to notify the name (or nick or email) of the creator.
“captcha” Option to notify if the service has captcha on the anonymous downloads. Values: True, False.
“version” Version of the plugin.
“slots” maximum Number of anonymous downloads simultaneous allowed for this service.
Section [premium_download]
“name” Option to notify the name of the class that you are going to use to perform this type of access. Default value: Premium Download.
“author” Option to notify the name (or nick or email) of the creator.
“version” Version of the plugin.
“accounts” Name of the file where to store the data of the premium account of this service.
3.4 – File image or icon (optional)
Imagen o icono de tamaño 48×48 pixels representative del servicio que se va a usar en el GUI. Si no se va a usar se debe notificar en el archivo service.conf, sección [main] opción “icon = None”.
3.5 – File check_links.py (optional)
This file is only required if the service has support for downloads. Can be a file if used by several plugins (anonymous downloads, downloads premium) or it can be a method of the various plug-ins download.
input parameters: url. output parameters: name of the file to be downloaded, size and units.
- checks/tasks minimum:
- url determine file name and total size.
3.6 – File anonymous_download.py (optional)
This file is only required if the service has support for anonymous downloads. Plugin typical.
classes: Anonymous Download (declared in the file service.conf, section [anonymous_download])
methods:
__init__: initialization of slots.py and download_plugin.py
add: input parameters: path, link, and name the file
delete: input parameters: name of the file.
check_links: input parameters: url. output parameters: name of the file to be downloaded, size and units.