Create List-AddOns

    DirectTune

    This page provides a step-by-step tutorial how to create List-AddOns.

    Since 1.2 there is a way to create the AddOn through the GUI, although the old way has some more options, like logos, so the old way is also described here. It doesn't matter what way you choose, but you have to perform Step 3 and 4 in both ways (so you can do new way and step 3 and 4 or old way step 1+2 and after that 3 and 4).

    New Step 1 and 2: Create it from the GUI

    Create your Streams in DirectTune using the new button, and close DirectTune (for example via switching into the Library or into a playlist).

    Go to Tools|Add-ons...

    Search DirectTune and select it, choose the 'Options...' button.

    Click the 'Create List-AddOn' button.

    The wizard will create the AddOn for you.

    [old Step 1]: Get the draft

    Download and unzip the archive directtune-defaultlist.zip.

    Hint: The draft is a bit outdated. You'll have to change the min- and max-version of Songbird in install.rdf if you choose the old way.

    [old Step 2]: Edit it

    Edit the following files:

    install.rdf

    Find the line

        <em:id>directtune-PACKNAME@YOURNAME.com</em:id>

    and insert an internal name (you can choose it yourself) as PACKNAME. Also, change the second part of the id (YOURNAME.com) as you like, it reflects you as developer.

    So the line could be

        <em:id>directtune-us-public-radio@great-developer.com</em:id>

    for a DirectTune-List providing public US radio livestreams developed by an developer called great-developer.

    Hint: The id has to be unique for your AddOn. Every Mozilla-AddOn has an own, unique id.

     

    The next thing to do is giving the List-AddOn a name. Search the line

        <em:name>DirectTune StreamList: (ENTER NAME HERE)</em:name>

    and enter the name of your List-AddOn instead of (ENTER NAME HERE). The name will be shown in the AddOn-Manager and, if you upload the AddOn, on the web.

    So, for the public US radio livestream list, this line could be

        <em:name>DirectTune StreamList: Public US Livestreams</em:name>

    Hint: The name doesn't need to be unique, but it would be good if it is. It is not that nice to have, for example, thousands of "DirectTune Streamlist: Best Livestreams". It would be great, if the Name is related to the content of the List. You don't have to use the "DirectTune StreamList:"-prefix, but I think it would be good if List-AddOns can be easily identifed as List-AddOns.

     

    Every Mozilla AddOn has a version number. It is defined in the line

        <em:version>1.0</em:version>

    For the first version there is no need to change the version number, if you release updates (for example when streams change their url or you add new stream to the same list), you should increase the version number.

     

    The next part to change is the creator's name. This can be a nick or your real name. Change the "(ENTER YOUR NAME HERE)" in the line

        <em:creator>(ENTER YOUR NAME HERE)</em:creator>

    as you want. So, for the us public radio example, this line could be

        <em:creator>Great Developer</em:creator>

     

    Something more technical: Your AddOn needs an unique internal name (not the same as id). I suggest taking the first part of the id: Replace "PACKNAME" in the line

        <em:iconURL>chrome://directtune-PACKNAME/skin/list-icon.png</em:iconURL>

    with the name you used in the id. Remember it, you need to replace some more PACKNAMEs soon. Again, the example for the us-radio:

        <em:iconURL>chrome://directtune-us-public-radio/skin/list-icon.png</em:iconURL>

     

    The last thing to change in the install.rdf is the Description, search the line
        <em:description>(ENTER DESCRIPTION)</em:description>

    and replace "(ENTER DESCRIPTION)" with a description describing your list. It will be shown, like the name, in the AddOn-Manager and, if you upload the AddOn, on the web. For the example this could be

        <em:description>Public Radio-Livestreams of US Radios</em:description>

    chrome.manifest

    In the chrome.manifest you have to replace 3 PACKNAMEs (replace it with the same as you replaced it in install.rdf). This affects the lines

    content directtune-PACKNAME  chrome/content/
    skin    directtune-PACKNAME  classic/1.0 chrome/skin/
    overlay chrome://directtune/content/accesspane.xul chrome://directtune-PACKNAME/content/overlay.xul

    For the us-radio example, these lines would be

    content directtune-us-public-radio  chrome/content/
    skin    directtune-us-public-radio  classic/1.0 chrome/skin/
    overlay chrome://directtune/content/accesspane.xul chrome://directtune-us-public-radio/content/overlay.xul

    chrome/content/add.js

    This is the file defining the list. The first paragraph has to stay as it is. Do not change anything.

    After that, there is a section

    //Put your Streams here:
    //This is one Example, replace the things written in <>. If you want to add more than one Stream, copy the line and paste it in anywhere under this comment.
    directtune.addList.push({pack:"<Name of your Package, unique>",name:"<Name of Stream, unique in your Package>",url:"<URL of the stream>"});

    //This is another Example, with an icon (height: 15px), replace the things written in <>. If you want to add more than one Stream, copy the line and paste it in anywhere under this comment.
    //Place the images in the chrome/skin folder, for example to the example.png linked in the example: chrome/skin/icons
    directtune.addList.push({pack:"<Name of your Package, unique>",name:"<Name of Stream, unique in your Package>",url:"<URL of the stream>",image:"chrome://directtune-PACKNAME/skin/icons/example.png"});

    This are two examples (one with and one without image) defining a list entry. You can mix list-entrys with and without image in one List-AddOn. A thing not mentioned in the example is defining streams where the url points to a playlist containing the url of the stream itself. If you have such streams, replace url with purl.

    If you want to define a default description, you can add a description field (not tested, only DirectTune 1.1 or later):

    directtune.addList.push({pack:"<Name of your Package, unique>",name:"<Name of Stream, unique in your Package>",url:"<URL of the stream>",image:"<Path to Image>",description:"<Stream-Description>"});

    If you understand the short comments above the examples you can start adding entrys to your list and go to Step 3. If not, read the long description:

    The central list the user sees when he clicks at the Add button in DirectTune, will be generated. With the command

    directtune.addList.push(something);

    you add one entry to the list. Do the following:

    1. delete the two example-paragraphs (quoted above)
    2. insert at the end of the file (under the first paragraph):

    directtune.addList.push({pack:"",name:"",url:""});

    What you have done, is adding an entry. It's that simple. The only thing you still need to do, is edit the entrys properties. Insert the name of the stream-content between the two " after name. So if the name is "Interesting Stream", you have;

    directtune.addList.push({pack:"",name:"Interesting Stream",url:""});

    The second thing a stream needs, is its url. So if the url would be "http://getsongbird.com" (THIS IS NOT A REAL STREAM ADRESS), the line describing the stream would be up to now: (Again the hint: If the url should point to a playlist, replace url with purl)

    The next and last thing a stream needs, is the pack name. You can freely choose one. The pack-name will be displayed in the List behind the name.

    Hint: You don't have to use a pack name similar to the List's title. You also don't have to use one pack-name for all entries. But it would be great if you take one name similar to the List-AddOn's title and use it for all entries, to support the User.

    Our line so far:

    directtune.addList.push({pack:"US Public Radio",name:"Interesting Stream",url:"http://getsongbird.com"});

    That's it. You can now add many of those lines, and proceed to Step 3. Or you want to add Images representing each stream. If so, read this step till the end.

    For adding images, you first have to create an image that will later represent one or more streams. The image should be 15 pixel in height, and 10-100 pixel in width.

    Place those images in the folder structure of the unzipped draft at chrome/skin/icons. The best results you can get with png.

    You can remove the example.png, it is placed there for demonstration issues.

    After creating your image(s), you have to connect the images with the list-entrys. For this, add an image parameter, for the example:

    directtune.addList.push({pack:"US Public Radio",name:"Interesting Stream",url:"http://getsongbird.com",image:"chrome://directtune-us-public-radio/skin/icons/example.png"});

    Be sure to have the correct PACKNAME!

    For advanced developers

    You can use any code to add items to the array directtune.addList, but please do not clear it, because other List-AddOns might have written something to it before. So you could, for example, recieve a stream list from a server and push (!) it to directtune.addList.

    Step 3: Pack the extension

    [only if you choose the old way] If you haven't done it before, delete the chrome/skin/icons/example.png.

    Pack all files together into an zip archive, make sure that the files are directly in the zip, not in any sub-folder. If you have no tool able to pack files into zip, you could use the free 7zip (Windows only), or the free gzip.

    Rename the file from *.zip to *.xpi, so the us-radio example could be named directtune_list_us-radio_1.0.xpi or usradio.xpi. On Windows you have to make file extensions visible (deselect "Hide Extensions for Known File Types")

    Congratulations! You have created a DirectTune-List-AddOn.

    Step 4: Upload and Tagging

    To share the AddOn, you can upload it at Songbird's AddOn Page through the Add-on Uploader. After going through the normal upload process, you should tag your AddOn as DirectTune List.

    Updating your Streams

    If you need to update your Streams, edit your AddOn (chrome/content/add.js), give it a higher version (install.rdf), pack it again and choose Upload New Version on the AddOns-Details-Page. DirectTune will update the urls automatically.

    Tag page
    • No tags
    You must login to post a comment.
    Powered by MindTouch Core
    Real Time Web Analytics