This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Creating an "external application" for online search

Tags: None
(comma "," separated)
thw
Registered Member
Posts
2
Karma
0
OS
Hello,

I currently started using Tellico for my Euro coin collection. I would like to import (mainly, but not necessarily only) the coin images from the ECB website and therefore tried to write a shell script that can be executed as "external data source" and returns the desired data. However, I am not able to get the main step working: To put result data into the Tellico search dialog.

I tried about several hours to write a very basic shell script that simply puts one static result data set into Tellico, i.e. like this:

Code: Select all
#!/bin/bash

echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
echo "<!DOCTYPE tellico PUBLIC \"-//Robby Stephenson/DTD Tellico V9.0//EN\" \"http://periapsis.org/tellico/dtd/v9/tellico.dtd\">"

echo "<tellico xmlns=\"http://periapsis.org/tellico/\" xmlns:atom=\"http://www.w3.org/2005/Atom\" xmlns:gbs=\"http://schemas.google.com/books/2008\" xmlns:dc=\"http://purl.org/dc/terms\" syntaxVersion=\"9\">"

echo "<collection title=\"ECB Euro Coin Search Results\" type=\"8\">"
echo "   <fields>"
echo "      <field title=\"Land\" flags=\"6\" category=\"Allgemein\" format=\"0\" type=\"1\" name=\"country\"/>"
echo "   </fields>"
echo "   <entry>"
echo "      <country>Frankreich</country>"
echo "   </entry>"
echo "</tellico>"


I am sure that my script is executed by Tellico, but no data comes back (Tellico always says "No results found"). I've read the chapter "Hacking Tellico" on docs.kde.org, but this doesn't really help me ;)
I also got the google book search script as example, but I couldn't even get it to work :/
That's why I have two questions:

1. Is there a detailed documentation for the external application interface (esp. data exchange)?
2. Is there a way to obtain more detailed error messages from the search dialog (a distinction between some general cases such as "No Data at all" or "Parse error in the XML" would be great already), maybe some kind of debug/verbose mode?

I am using Tellico 2.2. on KDE 4.6.2 (Kubuntu Natty).

Thanks in advance for all answers,
thw
robbystephenson
KDE Developer
Posts
384
Karma
1
OS
Hi,

You're right, the error output is pretty much useless in this case. Since the XML loading is pretty much the first thing that happens, it's typically an XML parse error, which it does seem to be in your case.
thw wrote:I currently started using Tellico for my Euro coin collection. I would like to import (mainly, but not necessarily only) the coin images from the ECB website and therefore tried to write a shell script that can be executed as "external data source" and returns the desired data.

Code: Select all
#!/bin/bash

echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
echo "<!DOCTYPE tellico PUBLIC \"-//Robby Stephenson/DTD Tellico V9.0//EN\" \"http://periapsis.org/tellico/dtd/v9/tellico.dtd\">"

echo "<tellico xmlns=\"http://periapsis.org/tellico/\" xmlns:atom=\"http://www.w3.org/2005/Atom\" xmlns:gbs=\"http://schemas.google.com/books/2008\" xmlns:dc=\"http://purl.org/dc/terms\" syntaxVersion=\"9\">"

echo "<collection title=\"ECB Euro Coin Search Results\" type=\"8\">"
echo "   <fields>"
echo "      <field title=\"Land\" flags=\"6\" category=\"Allgemein\" format=\"0\" type=\"1\" name=\"country\"/>"
echo "   </fields>"
echo "   <entry>"
echo "      <country>Frankreich</country>"
echo "   </entry>"
echo "</tellico>"

One quick way to test your output is to run it through the xmllint program.
Code: Select all
test_output.sh | xmllint -
That will tell you if all the tags are closed correctly, and in this case you forgot the closing </collection> tag.

The other thing is to be sure the script is executable (chmod +x test_output.sh). Also, you can just redirect the output to a file and then open it with tellico to check that the output is ok before you try to use it in the search dialog.

One other thing that is buried in that documentation is that you can add
Code: Select all
<field name="_default"/>
as the first child of the <fields> to get all the default collection fields.

thw wrote:1. Is there a detailed documentation for the external application interface (esp. data exchange)?
Not really, like you discovered, Tellico just passes command-line arguments to a command and then expects valid output.
thw wrote:2. Is there a way to obtain more detailed error messages from the search dialog (a distinction between some general cases such as "No Data at all" or "Parse error in the XML" would be great already), maybe some kind of debug/verbose mode?
Providing at least an error saying invalid XML is a good idea... :)


Bookmarks



Who is online

Registered users: Bing [Bot], claydoh, Evergrowing, Google [Bot], rblackwell