Jump to content
Ketarin forum
  • Announcements

InG

If there is no URL for downloading

Recommended Posts

If there is no URL for downloading, downloading is performed by an external program in the Commands tab. What should I write in the URL field in such cases?

Example:

<?xml version='1.0' encoding='utf-8'?>
<Jobs>
  <ApplicationJob xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Guid="97fdc979-7d1d-4254-bc9c-ef875bb2c232">
    <WebsiteUrl />
    <UserAgent />
    <UserNotes />
    <LastFileSize>19328752</LastFileSize>
    <LastFileDate>2017-07-08T19:44:37.0352028</LastFileDate>
    <IgnoreFileInformation>true</IgnoreFileInformation>
    <DownloadBeta>Default</DownloadBeta>
    <DownloadDate xsi:nil="true" />
    <CheckForUpdatesOnly>false</CheckForUpdatesOnly>
    <VariableChangeIndicator>version</VariableChangeIndicator>
    <HashVariable />
    <HashType>None</HashType>
    <CanBeShared>true</CanBeShared>
    <ShareApplication>false</ShareApplication>
    <ExclusiveDownload>false</ExclusiveDownload>
    <HttpReferer />
    <SetupInstructions />
    <Variables>
      <item>
        <key>
          <string>version</string>
        </key>
        <value>
          <UrlVariable>
            <RegexRightToLeft>false</RegexRightToLeft>
            <VariableType>RegularExpression</VariableType>
            <Regex>Daum PotPlayer (\d{1,2}\.\d{1,2}\.\d{1,4}) x86-x64</Regex>
            <Url>https://rutracker.org/forum/viewtopic.php?t=2143954</Url>
            <Name>version</Name>
          </UrlVariable>
        </value>
      </item>
      <item>
        <key>
          <string>url</string>
        </key>
        <value>
          <UrlVariable>
            <RegexRightToLeft>false</RegexRightToLeft>
            <VariableType>RegularExpression</VariableType>
            <Regex>(magnet:\?xt=urn:btih:.+?)&tr=</Regex>
            <Url>https://rutracker.org/forum/viewtopic.php?t=2143954</Url>
            <TextualContent />
            <Name>url</Name>
          </UrlVariable>
        </value>
      </item>
    </Variables>
    <ExecuteCommand>nircmd.exe exec show {TC}\Utilites\uTorrent\uTorrent.exe /directory "{dir}\{category}\Daum PotPlayer\" {url}</ExecuteCommand>
    <ExecutePreCommand />
    <ExecuteCommandType>Batch</ExecuteCommandType>
    <ExecutePreCommandType>Batch</ExecutePreCommandType>
    <Category>Media</Category>
    <SourceType>FixedUrl</SourceType>
    <PreviousLocation>d:\AData\Progs\Media\Daum PotPlayer\PotPlayerSetup.exe</PreviousLocation>
    <DeletePreviousFile>true</DeletePreviousFile>
    <Enabled>true</Enabled>
    <FileHippoId />
    <LastUpdated>2017-07-08T19:44:37.0352028</LastUpdated>
    <TargetPath>{dir}\{category}\Daum PotPlayer\</TargetPath>
    <FixedDownloadUrl>{url}</FixedDownloadUrl>
    <Name>Daum PotPlayer (Torrent)</Name>
  </ApplicationJob>
</Jobs>

 

Share this post


Link to post
Share on other sites
On 11.07.2017 at 6:58 AM, shawn said:

anything you want. i typically use "http://example.com/" just so there's a valid URL in it.

does not work:

"The downloaded file is not a binary file type (text/html). Possibly there is an error page. Status code: 200 (OK) (http://example.com)"

 

Share this post


Link to post
Share on other sites

I don't think this scenario is supported. You'll have to provide Ketarin with something "downloadable". So just a website won't do.

Share this post


Link to post
Share on other sites

It's actually a problem with the context. Whenever you're going to use an external download agent you need to save the download URL as a different variable, then process it manually in the pre-update command, returning 3 to indicate the update was successful ("exit 3"), not within the post-update command since that only fires after the download URL is successfully downloaded. 

When I need to parse a magnet URI I use Aria2. Here's an example:

aria2c --bt-require-crypto=true --seed-time=0 --dir="{myDownloadPath}" "{magneturi}"
exit 3

Again, this has to be done in the pre-update command or you'll get the "invalid download URL" error.  Still, I use "http://example.com/" in there to avoid an error that comes in certain contexts, primarily during testing.

As always, it's important to ensure that you're performing some form of version validation for your app or it'll run the pre-update command every time, resulting in a bunch of unnecessary bandwidth and false "update successful" indication. As long as you're using the "advanced\use the following variable as indicator for changes" value correctly you'll avoid this problem.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×