Topic: CybTekSol's Thunderbird Add-Ons Template (Inspired_by_Stalker)

My Thunderbird Add-Ons Template (Inspired_by_Stalker), REVISED AGAIN due to site changes:

UPDATED: April 10, 2009

NOTE: This template is a display of the power and flexibility of 'placeholders'...
            study it carefully to see what I mean! wink It will download ALL Thunderbird
            Add-Ons (Extensions and Themes) with or without the presence of policy
            agreements!

CAUTION: Enter data at the 'placeholder' prompts EXACTLY as shown in the
                   accompanying examples!

1) There is one user defined global variable used,
    root_folder=Insert YOUR download destination ROOT folder here
    [for example C:\Latest-Apps].

2) The latest version of Ketarin (1.04) released March 9, 2009 or later is required
    as this revision uses the new 'variables within regex' feature.

3) The template follows:

<?xml version="1.0" encoding="utf-16"?>
<Jobs>
  <ApplicationJob xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <DownloadBeta>AlwaysDownload</DownloadBeta>
    <DownloadDate xsi:nil="true" />
    <VariableChangeIndicator />
    <CanBeShared>true</CanBeShared>
    <ShareApplication>false</ShareApplication>
    <HttpReferer />
    <Variables>
      <item>
        <key>
          <string>Add-On_ID</string>
        </key>
        <value>
          <UrlVariable>
            <VariableType>Textual</VariableType>
            <Regex />
            <Url></Url>
            <TextualContent><placeholder name="Enter Thunderbird Add-On 'ID NUMBER' from URL [Example: 1279]" /></TextualContent>
            <Name>Add-On_ID</Name>
          </UrlVariable>
        </value>
      </item>
      <item>
        <key>
          <string>no_policy_url</string>
        </key>
        <value>
          <UrlVariable>
            <VariableType>Textual</VariableType>
            <Regex />
            <Url></Url>
            <TextualContent>https://addons.mozilla.org{no_policy_truncated_url}</TextualContent>
            <Name>no_policy_url</Name>
          </UrlVariable>
        </value>
      </item>
      <item>
        <key>
          <string>yes_policy_url</string>
        </key>
        <value>
          <UrlVariable>
            <VariableType>Textual</VariableType>
            <Regex />
            <Url></Url>
            <TextualContent>https://addons.mozilla.org{yes_policy_truncated_url}</TextualContent>
            <Name>yes_policy_url</Name>
          </UrlVariable>
        </value>
      </item>
      <item>
        <key>
          <string>version</string>
        </key>
        <value>
          <UrlVariable>
            <VariableType>StartEnd</VariableType>
            <Regex />
            <Url>https://addons.mozilla.org/en-US/thunderbird/addon/{Add-On_ID}</Url>
            <StartText>title="Permanent link to this version"&gt;Version </StartText>
            <EndText>&lt;/a&gt;</EndText>
            <Name>version</Name>
          </UrlVariable>
        </value>
      </item>
      <item>
        <key>
          <string>no_policy_truncated_url</string>
        </key>
        <value>
          <UrlVariable>
            <VariableType>RegularExpression</VariableType>
            <Regex>(?&lt;=(?:platform-ALL|platform-<placeholder name="Enter Operating System Preference EXACTLY as Shown [Windows OR Linux OR MacOSX]" />).*?)/en-US/thunderbird/downloads/latest/{Add-On_ID}/.*?{Add-On_ID}.*?\.[a-z]+(?=")</Regex>
            <Url>https://addons.mozilla.org/en-US/thunderbird/addon/{Add-On_ID}</Url>
            <Name>no_policy_truncated_url</Name>
          </UrlVariable>
        </value>
      </item>
      <item>
        <key>
          <string>redir1</string>
        </key>
        <value>
          <UrlVariable>
            <VariableType>RegularExpression</VariableType>
            <Regex>(?&lt;=(?:platform-ALL|platform-<placeholder name="Enter Operating System Preference EXACTLY as Shown [Windows OR Linux OR MacOSX]" />).*?/en-US/thunderbird/addons/policy/).*?(?=")</Regex>
            <Url>https://addons.mozilla.org/en-US/thunderbird/addon/{Add-On_ID}</Url>
            <Name>redir1</Name>
          </UrlVariable>
        </value>
      </item>
      <item>
        <key>
          <string>yes_policy_truncated_url</string>
        </key>
        <value>
          <UrlVariable>
            <VariableType>RegularExpression</VariableType>
            <Regex>(?&lt;=(?:platform-ALL|platform-<placeholder name="Enter Operating System Preference EXACTLY as Shown [Windows OR Linux OR MacOSX]" />).*?)/en-US/thunderbird/downloads/latest/{Add-On_ID}/.*?{Add-On_ID}.*?\.[a-z]+(?=")</Regex>
            <Url>https://addons.mozilla.org/en-US/thunderbird/addons/policy/{redir1}</Url>
            <Name>yes_policy_truncated_url</Name>
          </UrlVariable>
        </value>
      </item>
    </Variables>
    <ExecuteCommand />
    <Category>Thunderbird Add-Ons\<placeholder name="Enter Operating System Preference EXACTLY as Shown [Windows OR Linux OR MacOSX]" /></Category>
    <SourceType>FixedUrl</SourceType>
    <DeletePreviousFile>true</DeletePreviousFile>
    <Enabled>true</Enabled>
    <FileHippoId />
    <LastUpdated xsi:nil="true" />
    <TargetPath>{root_folder}\{category}\{appname:replace: :_}_v{version:replace: :_}_<placeholder name="Enter Operating System Preference EXACTLY as Shown [Windows OR Linux OR MacOSX]" />.{url:ext}</TargetPath>
    <FixedDownloadUrl>{<placeholder name="Policy Agreement Required? Enter EXACTLY as Shown: [yes or no]" />_policy_url}</FixedDownloadUrl>
    <Name><placeholder name="Thunderbird Add-On Name" /></Name>
  </ApplicationJob>
</Jobs>

To use it:

1) Define the user defined global variable under 'Settings' in Ketarin to YOUR preferences
2) Edit the template externally to reflect this modification (if you choose not to use
    mine)
    DO NOT Disturb the 'placeholders'!
3) Then:
    a) Import it (Obviously)
    b) Enter the information needed EXACTLY as requested as a result of the
        'placeholder' prompts...
    c) Change the 'Advanced Settings' to YOUR preferences


FOOTNOTE:  After locating the Thunderbird Add-On that you wish to add to Ketarin using this template, you will have to manually determine whether the add-on has a policy agreement present before download using your web browser. Just click on the 'Download Now' button, if the download window pops-up (Click CANCEL), there is no policy. Conversely, if you are re-directed to a policy window, obviously, there is a policy. The template will require a yes or no input reflecting this. Also, the template will ask for the 'Add-On ID Number' (from the URL), 'Add-On Name' and 'Operating System Preference' (as some downloads are OS specific) which MUST be entered EXACTLY as Windows, Linux or MacOSX. The {category} variable is determined by the  'Operating System Preference' (Thunderbird Add-Ons\Windows or Thunderbird Add-Ons\Linux or Thunderbird Add-Ons\MacOSX) and the filename is appended with the OS as well which will allow users to store copies of add-ons applicable to OSs they currently use! I chose to do this as I work with PCs, Linux Boxes and my son uses a Mac. TWEAK CAREFULLY and ONLY if you understand its function completely!


ENJOY & EXPAND your horizons Ketarin users... wink


CybTekSol

Last edited by CybTekSol (2009-04-10 07:15:58)