Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
developer:developing_scripts_basics [2010/09/10 11:07]
perezmu created
developer:developing_scripts_basics [2016/10/21 20:18] (current)
172.98.67.120 [Packaging and deploying]
Line 1: Line 1:
 ====== Developing Scripts basics ====== ====== Developing Scripts basics ======
  
-ComicRack has built in Python scripting support. This article gives a short introduction on how to write scripts.+ComicRack has built in Python scripting support. This article gives a short introduction on how to write scripts. Further information can be found in the [[developer:​API|API Reference]].
  
 ===== What can scripts do? ===== ===== What can scripts do? =====
Line 59: Line 59:
  
   def RenumberBooks(books):​   def RenumberBooks(books):​
-with books beeing ​a collection of book objects with the above specified properties. Whatever you do in this method will be reflected in ComicRack. Let's say you want a quick shortcut to clear the ratings on all books. The script would look something like this:+with books being a collection of book objects with the above specified properties. Whatever you do in this method will be reflected in ComicRack. Let's say you want a quick shortcut to clear the ratings on all books. The script would look something like this:
 <code python> <code python>
   def RenameBookFiles(books):​   def RenameBookFiles(books):​
Line 91: Line 91:
 Hook can be one of the following values Hook can be one of the following values
  
-  Library ...         ​Script is put on library level 
   Books ...           ​Places where books can be selected (popup menu)   Books ...           ​Places where books can be selected (popup menu)
-  ParseComicPath ...  Parses comic paths for proposed values 
   BookOpened... ​      ​Called when a book is opened   BookOpened... ​      ​Called when a book is opened
 +  ComicInfoHtml... ​   Used to create html info panels
 +  ComicInfoUI... ​     Used to create UI Control info panels
 +  ConfigScript... ​    For creating configuration scripts. Config button in preferences
   CreateBookList... ​  Used to write smart list scripts   CreateBookList... ​  Used to write smart list scripts
 +  Library ...         ​Script is put on library level
 +  NetSearch... ​       Used to add a new search to the internet search engine
 +  NewBooks... ​        Used to create additional commands in the file menu
 +  ParseComicPath ...  Parses comic paths for proposed values
 +  ReaderResized... ​   For changing viewer properties  ​
  
 Definitions are put as special comments above the script method declaration. Definitions are put as special comments above the script method declaration.
Line 123: Line 129:
 Description = Description of the contents of the package (default: nothing) Description = Description of the contents of the package (default: nothing)
 Image       = A image file used as the icon (default: a package icon) Image       = A image file used as the icon (default: a package icon)
 +HelpLink ​   = Some URL or file link (default: nothing)
 </​code>​ </​code>​
 If the file or entry is missing, the described default is used. If the file or entry is missing, the described default is used.
Line 133: Line 140:
 Description = A collection of useful scripts Description = A collection of useful scripts
 Image       = cyo_util.png Image       = cyo_util.png
 +HelpLink ​   = http://​comicrack.cyolito.com
 </​code>​ </​code>​
 +Put your python files, auxillary files (images, config files, etc), and the Package.ini into a .zip file, then rename the .zip file to a .crplugin file.  For example your MyAwesomeScript.zip file structure could look like the following:
 +<​code>​
 +myawesomescript.py
 +Package.ini
 +</​code>​
 +It could also look like the following:
 +<​code>​
 +myawesomescript.py
 +Package.ini
 +awesomelogo.png
 +config.txt
 +errors.log
 +</​code>​
 +
 +Then, rename MyAwesomeScript.zip to MyAwesomeScript.crplugin  ​
 +
 Such packages can be simply installed and removed from the Preferences/​Advanced dialog. Such packages can be simply installed and removed from the Preferences/​Advanced dialog.

Navigation