RadioDJ - Free Radio Automation Software Forum

RadioDJ v1.7+ => v1.7+ - Support Forum => Topic started by: manishboyradio on October 07, 2015, 07:41:54 PM

Title: NOW PLAYING XML TEMPLATE
Post by: manishboyradio on October 07, 2015, 07:41:54 PM
Does anyone know how to create a now playing xml template, i am banging my head against the wall trying to do it, could someone show me a basic script for a now playing xml template to be generated

Thanks
Title: Re: NOW PLAYING XML TEMPLATE
Post by: Marius on October 08, 2015, 06:08:28 AM
Two questions:
1. Now playing supports several templates (file export, web export, serial export), which one are you using?
2. There is a special format do you need to export, if so, which one?
Title: Re: NOW PLAYING XML TEMPLATE
Post by: manishboyradio on October 09, 2015, 02:37:00 AM
the file export to either html or xml, so that it displays the artist, title and cover art

Thanks
Title: Re: NOW PLAYING XML TEMPLATE
Post by: Marius on October 09, 2015, 07:13:21 AM
In the Docs folder of RadioDJ there is a list of supported variables. When you make the template, insert them as placeholders for the actual values. It's that easy.
Title: Re: NOW PLAYING XML TEMPLATE
Post by: manishboyradio on October 12, 2015, 02:48:36 AM
I have no idea where to start , what are placeholders?, as i said i have no experience making xml files, show me an example

thanks
Title: Re: NOW PLAYING XML TEMPLATE
Post by: Valdis on October 26, 2015, 01:29:06 AM
It is really as simple as Marius says. For software developers, but not mere mortals. :)
Example:
Code (XML) Select

<?xml version="1.0" encoding="utf-8" ?>
<track id="$track_id$">
<artist>$artist$</artist>
<title>$title$</title>
<album>$album$</album>
<year>$year$</year>
<path>$path$</path>
<trackType>$track-type$</trackType>
<duration>$durationinSeconds$</duration>
<durationinSeconds>$durationinSeconds$</durationinSeconds>
</track>
Title: Re: NOW PLAYING XML TEMPLATE
Post by: manishboyradio on October 26, 2015, 06:26:29 PM
Thank You!!, this gives me a place to start:), So will this code change the album art and text when i song changes in radio dj?, again thank you posting the xml code:)
Title: Re: NOW PLAYING XML TEMPLATE
Post by: manishboyradio on October 26, 2015, 10:12:08 PM
another question, it is not displaying the actual album art, it is only displaying the filename of the album art, how do i fix that?
Title: Re: NOW PLAYING XML TEMPLATE
Post by: Valdis on October 26, 2015, 10:23:41 PM
XML is a data mark up language, not presentation mark up language. HTML is better suited for display images. You should have mentioned what you want to accomplish. You asked for XML but now you want it to function like HTML.
Banging head against wall is not healthy.
Title: Re: NOW PLAYING XML TEMPLATE
Post by: manishboyradio on October 26, 2015, 10:34:33 PM
okay i apologize, my mistake, so how do i go about doing that, sorry for the confusion, when you get a chance show me a code to do that, thanks for your help:)
Title: Re: NOW PLAYING XML TEMPLATE
Post by: Marius on October 26, 2015, 10:41:26 PM
Do you have the album art images on your web server? If so, what is the path to them?
Title: Re: NOW PLAYING XML TEMPLATE
Post by: manishboyradio on October 26, 2015, 10:51:13 PM
yes i do, they are locally stored in a folder in the same directory as radio dj, i know we have been going back and forth with this, i want to display album art using the html that was mentioned before , and plug into a title generator for xsplit broadcaster that reads HTML code. Thanks again for your help
Title: Re: NOW PLAYING XML TEMPLATE
Post by: manishboyradio on October 27, 2015, 12:25:42 AM
F:\RadioDJ\Album_Art, path to album art
Title: Re: NOW PLAYING XML TEMPLATE
Post by: Marius on October 27, 2015, 08:31:08 AM
Do you run your site from your computer? Do you have a web server installed locally?
I ask this because if you are running the site from a hosting company server, the image files must be uploaded there and then you must find a way to upload also the generated html on each track change. For such a scenario the php would be better, but that requires some programming knowledge.
Title: Re: NOW PLAYING XML TEMPLATE
Post by: manishboyradio on October 27, 2015, 02:22:04 PM
so i need a webserver installed like apache? to use the generated html?, i am using MariaDB rather MYSQL, and accessing the DB via hedi sql, i would be greatfull if you could step me through the whole process, i looked at the xml for the web export, it looks like a foreign language to me, thanks again
Title: Re: NOW PLAYING XML TEMPLATE
Post by: Valdis on October 27, 2015, 06:49:47 PM
Quote from: manishboyradio on October 27, 2015, 02:22:04 PM
so i need a webserver installed like apache? to use the generated html?, i am using MariaDB rather MYSQL, and accessing the DB via hedi sql, i would be greatfull if you could step me through the whole process, i looked at the xml for the web export, it looks like a foreign language to me, thanks again

Web server would be needed if you wanted to publish HTML for others to see. You should have started the thread by mentioning that you need HTML for xsplit broadcaster. If xsplit broadcaster reads the file from local disk, you could use relative image path. That would mean if the exported html file is at "F:\RadioDJ\now_playing_for_xsplit.html" and album art images are in "F:\RadioDJ\Album_Art", image src attribute should be "Album_Art/artist-album.jpg".

Example HTML for use as RadioDJ template:
Code (HTML) Select

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <title>Now playing: $artist$ - $title$</title>
    </head>
    <body>
        <div id="$track_id$">
            <h1>$artist$</h1>
            <h2>$title$</h2>
            <p>Album: $album$</p>
            <img src="Album_Art/$album_cover$" />
        </div>
    </body>
</html>


I'm not sure if XSplit needs header tags and wrapping elements in <body>, but you can remove those parts if XSplit doesn't like them. Try searching XSplit forums (https://support.xsplit.com/forum/) for HTML samples or start a new thread there if you can't find anything.

Btw, XML and HTML are much easier to read and understand if you have editor with syntax highlighting, like Notepad2 or Notepad++.

It's great when people ask short and to-the-point questions, but it's better if you explain what you want to accomplish, rather than what you think is what you need. If you had started this thread by explaining that you want to pass now playing info from RadioDJ to XSplit, your question may have been answered already.
Title: Re: NOW PLAYING XML TEMPLATE
Post by: manishboyradio on October 27, 2015, 06:59:20 PM
again i do apologize, so in order for this to work i need to have webserver software running?, where do i place this template file in radio dj, in the file export?, as well how do i properly setup the web export so i can see it locally?

Thanks so much for your help
Title: Re: NOW PLAYING XML TEMPLATE
Post by: Valdis on October 27, 2015, 07:26:51 PM
No, web server is not needed IF XSplit reads the .hml file from local disk. I don't know how XSplit works and don't have time to research it for you. You'll have to figure out that part yourself.

Save the template file somewhere on you computer and select that file in now playing info plugin options (file export tab) and set target file path to a folder one level above your album art location.

screenshot:
(http://i.imgur.com/SCvZwRY.png)

And this is how generated file looks in browser:
(http://i.imgur.com/p4B1wVb.png)

Web export sends requests to a web server. For that you do need a web server but the server can be located anywhere and doesn't have to be installed on your PC.
Sorry, but I have to ask this: What do you want to accomplish by setting up web export?
Title: Re: NOW PLAYING XML TEMPLATE
Post by: manishboyradio on October 27, 2015, 08:21:14 PM
Again thank you, it worked as i wanted, how do adjust the code so the picture is off to the side left or right of the text, as well the size of the text, thanks for your patience
Title: Re: NOW PLAYING XML TEMPLATE
Post by: Valdis on October 27, 2015, 09:30:04 PM
Quote from: manishboyradio on October 27, 2015, 08:21:14 PM
Again thank you, it worked as i wanted, how do adjust the code so the picture is off to the side left or right of the text, as well the size of the text, thanks for your patience

If XSplit supports CSS, you can change the look in any way you want, but if it doesn't, you'll have to rely on old-school HTML tables.

Here is a proper HTML5 with CSS:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <title>Now playing: $artist$ - $title$</title>
        <style>
body {
font-family: 'Open Sans', Helvetica, Arial, sans-serif;
font-size: 12px;
margin: 0; padding: 0;
}
h1, h2, h3 {
margin: 0;
padding: 0;
font-weight: lighter;
}
#main {
width: 410px;
margin: 1.44em auto;
}
header {
float: left;
width: 200px;
}
h1 {
font-size: 1.44em;
}
h2 {
font-size: 1.2em;
}
figure {
position: relative;
padding: 0;
margin: 0;
float: left;
width: 200px;
}
figure img {
width: 100%;
margin: 0;
padding: 0;
border: 0 none;
}
figcaption {
font-size: 1em;
position: absolute;
bottom: 0;
left: 0;
background: rgba(0,0,0,0.5);
color: #fff;
padding: 0.5em;
margin-bottom: 0.3em;
}
figcaption small {
display: block;
color: #fff;
text-align: right;
position: absolute;
top: -1em;
right: 0.5em;
}
</style>

    </head>
    <body>
        <section id="main">
            <header>
                        <h1>$artist$</h1>
                        <h2>$title$</h2>
            </header>
            <figure>
                <img src="Album-Art/$album_cover$" width="200" />
                <figcaption>$album$ <small>$year$</small></figcaption>
            </figure>
        </section>
    </body>
</html>


An this is how it looks:
(http://i.imgur.com/02L0lQs.png)

But there is no way to make sure the album art image exists or that the value is not empty. If image doesn't exist or album art field is empty, you may get broken image icon.
Title: Re: NOW PLAYING XML TEMPLATE
Post by: manishboyradio on October 27, 2015, 09:36:49 PM
Thanks again, i will let you know if this works:)
Title: Re: NOW PLAYING XML TEMPLATE
Post by: manishboyradio on October 28, 2015, 01:14:13 AM
The text comes up no problem in the web browser but the picture does not appear, when xsplit reads the css it just displays the entire code and not the result, lol, i will research how to make HTML table, lol, thanks so much for your help
Title: Re: NOW PLAYING XML TEMPLATE
Post by: Valdis on October 28, 2015, 02:39:46 AM
QuoteThe text comes up no problem in the web browser but the picture does not appear, when xsplit reads the css it just displays the entire code and not the result, lol, i will research how to make HTML table, lol, thanks so much for your help

Well, <table>s were used for HTML layouts in 1990s and some still use them today, but they (tables AND people who use them) should be avoided if possible.

If XSplit doesn't render CSS styling, you'll have to do it the 90s way with tables:

<table cellpadding="5" cellspacing="0" border="0" align="center" width="410" valign="top">
<tr>
<td valign="top">
<h1>$artist$</h1>
<h2>$title$</h2>
<!-- this is LOL -->
</td>
<td width="200" valign="top">
<img src="Album_Art/$album_cover$" width="200" border="0" /><br />
<span>$album$</span><br />
<small>released: $year$</small>

</td>
</tr>
</table>


Web developers using tables for layouts and <font> tags for text formatting should be called "develoretards". Jus' sayin'. LOL
Title: Re: NOW PLAYING XML TEMPLATE
Post by: manishboyradio on October 28, 2015, 03:09:26 AM
gotcha!, i will try this one, thanks again i owe ya:)
Title: Re: NOW PLAYING XML TEMPLATE
Post by: Capt_Fuzzy on October 28, 2015, 07:04:54 AM
Quote from: Valdis on October 28, 2015, 02:39:46 AM
Well, <table>s were used for HTML layouts in 1990s and some still use them today, but they (tables AND people who use them) should be avoided if possible.

Web developers using tables for layouts and <font> tags for text formatting should be called "develoretards". Jus' sayin'. LOL
Easy now!!  :D

I'm one of "those guys" though I will admit that I am in the process of familiarizing myself better with css, so hopefully not for long...  :hihi:

P.S.: I'm 49, so I've used the '1990s' method for a long time. Hell, my first "program" was written in BASIC back in the 1980s!!  :D
Title: Re: NOW PLAYING XML TEMPLATE
Post by: Valdis on October 30, 2015, 10:44:08 PM
Quote from: Capt_Fuzzy on October 28, 2015, 07:04:54 AM
Easy now!!  :D

I'm one of "those guys" though I will admit that I am in the process of familiarizing myself better with css, so hopefully not for long...  :hihi:

P.S.: I'm 49, so I've used the '1990s' method for a long time. Hell, my first "program" was written in BASIC back in the 1980s!!  :D

Sorry, I didn't mean to offend you, Cat'n. That's the thing with old habits. Hard to teach new tricks to old dog.
I'm a bit younger but also wrote my first lines of code in BACIS and it was in early 1990s. But I'm trying to keep myself up to date with latest and greatest web standards. That's why I'm dismissive of people using the HTML features.

Okay. Enough off topic.
Title: Re: NOW PLAYING XML TEMPLATE
Post by: Capt_Fuzzy on October 31, 2015, 12:21:08 AM
I wasn't offended, just 'jerking your chain' so to speak...  :D

I too am trying to keep up with the 'new' stuff, it's nearly a full-time job in and of itself.  ;D
Title: Re: NOW PLAYING XML TEMPLATE
Post by: wtmuradio on October 31, 2015, 03:17:06 PM
Quote from: Valdis on October 30, 2015, 10:44:08 PM
Sorry, I didn't mean to offend you, Cat'n. That's the thing with old habits. Hard to teach new tricks to old dog.
I'm a bit younger but also wrote my first lines of code in BACIS and it was in early 1990s. But I'm trying to keep myself up to date with latest and greatest web standards. That's why I'm dismissive of people using the HTML features.


i use a program for live video streaming also im just wondering if it will work with it since the program does use xaml