# coding=utf-8 # # Newsflash action script example. # # (c) Sami Väisänen 2009 # # Newsflash action script example. # # Action scripts are aimed to be run by Newsflash as # a reaction to some events in the application. Therefore # any output here should not be sent to stderr or stdout, # but passed to the host application through the application api. # """Example script which does nothing.""" import host # The scripts are executed in ascending priority order. I.e. first scripts with # Priority 0 are executed. Then scripts with priority 1 etc. # If priority is not set it is considered to be 0 PRIORITY=0 # This is the human readable name of the script. NAME="Example" # # These functions are newsflash hook stub functions with # brief documentation. A script does not have to implement # all of these functions. # # All strings are unicode strings # def newsflash_sys_error(msg, resource, code): """ This is the system error hook function. This is called whenever there has been an error with a system error code. Msg is the simple error message string. Resource is the resource in question to which the error applies. (A file, network server etc.) Code is the platform dependant error code. For linux this is errno and for Windows it can be either errno, WSAGetLastError or just GetLastError. (mostly errno) """ pass def newsflash_batch_complete(location, batchid): """ This is the batch_complete action hook function. This is called whenever a batch download completes. The argument given specifies the location of the batch files (i.e. the folder) on the filesystem. """ return host.ACTION_SUCCESS def newsflash_file_complete(file, batchsize): """ This is the download_complete action hook function. This is called whenever a single file download completes. The argument given specifies the location of the file. The file can be any kind of file, text or binary. batchsize gives the number of items remaining in the batch or -1 if the downloaded item was not in a batch """ return host.ACTION_SUCCESS def newsflash_update_complete(location, group): """ This is the update_complete action hook function. This is called whenever a group update completes. Location specifies the location of the datafiles on the filesystem (.cat, .idx, .nbr and .nfo files). Group is the name of the group, e.g. alt.binaries.mp3. """ pass