Write your own script

This functionality can be useful for python programmers, for whom predefined operations are not sufficient, and they need to specify their own.

When writting script you have to follow same syntactit rules applied to Python syntax in the version 2.7. It is neccessary to keep correct indent (4 spaces for nested block, first block without indent).

Script you write, is triggered for each file in the list separately, so it basically define the process of transformating known data into the new file name.

New file name store into the variable new_name. File ID which is currently being processed is stored in the variable file_id. File name and all other available data are accessible throught metods of local instances. Settings can be adjusted with local methods.

Local methods

Script you write is triggered inside the class RenameAction. You don't need to know full specification of this class, only few methods are usefull when writting script. Besides first two functions all others are setter-functions that enable you to adjust local settings. Values you set will override values set inside GUI.

Note.: You don't have to write keyword self in the front of each method, because these identificators are already localy defined as references to class methods.

Local instances

Within the interface of the class RenameAction (inside of which script is triggered), there is a couple of class instances, interface of which enable you to access data of particular category denoting particular file which is currently being processed.
Those instances are follows:

Note: You don't have to write keyword self in the front of each of these instances, because these identificators are already localy defined as references to these instances created inside initialization section of RenameAction.

File

Class instace which enables access to the basic properties of the particular file. All functions have one optional input argument _file (string type), representing whole file name (including path). If it is not set, than the name of the file which is currently being processed will be used.

Current_time

Class instance which enables access to entries of current time.

Current_date

Class instance which enables access to entries of current date.

Image

Class instance which enables access to basic image properties. All functions have one optional input argument _file (string type), representing whole file name (including path). If it is not set, than the name of the file which is currently being processed will be used.

Exif

Class instance which enables access to basic entries in EXIF structure of image file. All functions have one optional input argument _file (string type), representing whole file name (including path). If it is not set, than the name of the file which is currently being processed will be used.

ID3

Class instance which enables access to entries in ID3 structure of sound file. All functions have one optional input argument _file (string type), representing whole file name (including path). If it is not set, than the name of the file which is currently being processed will be used.

MusicBrainz

Class instance which enable gather data from internet music metadatabase MusicBrainz.org. Data are searched on the basis of explicitly entered information(Explicit_data), ID3 inf. and from results of automatic parsing (Auto_parser). All functions have one optional input argument _file (string type), representing whole file name (including path). If it is not set, than the name of the file which is currently being processed will be used.

For correct functionality it evidently requires access to the internet. It is also important to take into consideration, that method execution for gathering particular data will take significant amount of time. Therefore each of methods contain one optional argument timeout, which define maximum time(in seconds) that methods can consume by one execution. If not entered, methods will not be time-restricted. Next optional arguments are urls and only_urls. Urls is a list of predefined adress of albums from MusicBrain.com, from which data are supposed to be gathered primarily. Only_url specify whether only these adress will be used, or the program is allowed to search for some additional ones.

Explicit_data

Class instance for managing explicitly entered data. Under the term explicit data it is meant data entered by user(not programmer), which he knows, but these data are not embedded into the file name neither into file metadata structures. Therefore use setter-functions inside script is not recommended, neither meaningful.

All functions have one optional input argument _file (string type), representing whole file name (including path). If it is not set, than the name of the file which is currently being processed will be used.

Auto_parser

Class instance that enables access to the data gathered by automatic parsing of original file name. It is experimental feature, thus results are not completely accurate. This functionality is applied on sound, video and subtitle files. All functions have one optional input argument _file (string type), representing whole file name (including path). If it is not set, than the name of the file which is currently being processed will be used.