Configuration Files

| ## Configuration Files |

FatRat's configuration files typically reside in `/usr/share/fatrat/data` (this location is hardcoded at compile time), along with some other data files. Any user may force FatRat to use his own config files by placing them into `~/.local/share/fatrat/data`.

### btlinks.txt

When autodetecting link types, FatRat has to distinguish between ordinary HTTP links and links pointing to torrents. This is quite easy if the link ends with `.torrent`, however there are many websites that don't follow this scheme. Such websites have regular expressions in the `btlinks.txt` file - if an URL is fully matched by a regular expression from this file, it is regarded as a URL pointing to a torrent file.

### btsearch.xml

This XML document contains information about torrent search engines. The following sample file should make the document's structure clear:

    <search>
    	<engine name="The Pirate Bay"> <!-- Search engine's name -->

    		<!-- The URL to be used for search queries; %1 will be replaced with the search phrase -->
    		<param name="query">http://thepiratebay.org/search.php?q=%1</param>

    		<!-- A string that marks the beggining of search results -->
    		<param name="beginning">&lt;td class="vertTh"&gt;</param>

    		<!-- A string that is used as a splitter between individual search results -->
    		<param name="splitter">&lt;/tr&gt;</param>

    		<!-- A string that marks the end of search results -->
    		<param name="ending">&lt;/table&gt;</param>

    		<!--
    			If the query has to be sent using the POST method,
    			the following data will be used for the POST request.

    			%1 will be replaced with the search phrase.
    		-->
    		<param name="postdata">SearchString1=%1&amp;SearchString=&amp;search=Search</param>

    		<!--
    			When the results have been cut out and split by the splitter,
    			regular expression matching is used to extract torrent's details.
     		-->

    		<!-- A regular expression matching the name of a search result -->
    		<regexp name="name" field="1">class="detLink" title="([^"]+)"&gt;([^"]+)&lt;/a&gt;</regexp>

    		<!-- A regular expression matching the link pointing to the .torrent file -->
    		<regexp name="link" match="1">&lt;td&gt;&lt;a href="([^"]+)"</regexp>

    		<!-- A regular expression matching the link pointing to the details page -->
    		<regexp name="info" match="2">&lt;td&gt;&lt;a href="([^"]+)"</regexp>

    		<!--
    			A regular expression matching the torrent's size.
    			FatRat will automaically detect units (KB, MB etc.)
    		-->
    		<regexp name="size">&lt;td align="right"&gt;([^"]+)&lt;/td&gt;</regexp>

    		<!-- A regular expression matching the number of peers seeding the torrent -->
    		<regexp name="seeders" match="1">&lt;td align="right"&gt;([^"]+)&lt;/td&gt;</regexp>

    		<!-- A regular expression matching the number of peers downloading the torrent -->
    		<regexp name="leechers" match="2">&lt;td align="right"&gt;([^"]+)&lt;/td&gt;</regexp>

    		<!--
    			Notice the field and match attributes. The field number specifies
    			which of the regular expression's subexpressions is the desired resulting string.

    			The match number specifies which match of the expression is to be used.
    			1 is default, 2 means the second match will be used and so on.
     		-->
    	</engine>
    </search>

### defaults.conf

The default values of all sorts of configurable values are stored in this file. Generally, all of these values may be reconfigured via the GUI. Therefore it shouldn't be necessary to edit this file.

Copyright © 2006-2008 Luboš Doležel