• Welcome to RadioDJ - Free Radio Automation Software Forum. Please log in or sign up.

Creating Track Type

Started by marcbeinder, July 26, 2016, 04:15:56 AM

marcbeinder

Hi All, I'm wondering what file has the code for the different track types. I am looking to create another track type for a project I am working on and this would be extremely helpful. I have a separate category already set up, but I really need a new track type as well.
RiseRadio.org // Podtrics.com

Valdis

Track types are hard-coded in RadioDJ and users can't modify them, because some track types have special behaviour.
I am, therefore I think.
I design and develop web apps, and have created few RadioDJ plugins - https://axellence.lv/downloads/

marcbeinder

Quote from: Valdis on July 26, 2016, 04:42:31 AM
Track types are hard-coded in RadioDJ and users can't modify them, because some track types have special behaviour.

Well okay then. Thank kinda stinks.  :'( :'( :'(  Guess I'll need to find another way to do this. :bash: :bash: :bash:
RiseRadio.org // Podtrics.com

Valdis

This question has been asked before but I can't find the posts right away.

I may be able to help with advice if you explained what you want to accomplish. There may be other options.
I am, therefore I think.
I design and develop web apps, and have created few RadioDJ plugins - https://axellence.lv/downloads/

marcbeinder

Okay. Want me to message you then?
RiseRadio.org // Podtrics.com

Valdis

I'd prefer to continue here so others may benefit from our exchange. Unless your project is something secret and you'd like to keep it private.
I am, therefore I think.
I design and develop web apps, and have created few RadioDJ plugins - https://axellence.lv/downloads/

marcbeinder

Quote from: Valdis on July 26, 2016, 04:59:00 AM
I'd prefer to continue here so others may benefit from our exchange. Unless your project is something secret and you'd like to keep it private.

It's not something public yet. Still in the planning phases. I'll post our exchange after I air it.
RiseRadio.org // Podtrics.com

marcbeinder

#7
Here is the exchange between me and Vladis. Anything about my project has been removed. But the functionality for anyone to replicate is still there: RUOLradio.com/index.php/valdis-exchange
RiseRadio.org // Podtrics.com

Valdis

Thanks for sharing.
I don't want to make a fuss about it, but my name is Valdis, not Vladis.
I am, therefore I think.
I design and develop web apps, and have created few RadioDJ plugins - https://axellence.lv/downloads/

Valdis

The TL;DR version of our exchange:

Marc wanted to display a linked album art for special advertising tracks in now playing widget on his radio web page.
I offered to use one of otherwise unused track variables:

$disc_no$ (set to some known number for special track)
$genre-id$ (create special unique genre)
$subcat-id$ (if special tracks are in their own category)
$track_no$ (set to some known number for special track)


Decision fell on $disc_no$ and setting it to 42, because.

Next I modified radiodj.php (the web export script) to save new variable in radiodj.txt and Marc added "&disc_no=$disc_no$" to web export data in Now playing plugin.

Then I had to modify the PHP file which displays now playing info on the page to check for our special disc_no variable.

Shortened and cleaned-up version of the PHP script:

<?php
require_once 'config.php';
$toBeRestored file_get_contents($data_file);
$data unserialize($toBeRestored);

$nowPlayingTitle '';

if(isset(
$data['title']) && isset($data['artist'])) {
$nowPlayingTitle $data['title'] . ' - ' $data['artist'];
}

$disc_no = isset($data['disc_no']) ? $data['disc_no'] : false;
?>

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Now Playing: <?php echo $nowPlayingTitle?></title>
</head>

<body>
<div class="now-playing">
<figure class="album-art">

<?php if($disc_no == 42) { ?>
<a href="http://example.com/">
<?php ?>

<?php if( !empty($data['cover']) ) : ?>
<img src="<?php echo $data['cover']; ?>" width="100" />
<?php endif; ?>

<?php if($disc_no == 42) { ?>
</a>
<?php ?>

</figure>
<div class="title"><?php echo $data['title']; ?></div>
<div class="artist">by <?php echo $data['artist']; ?></div>
</div>
</body>
</html>


So that's about it. No need to add new track types.
I am, therefore I think.
I design and develop web apps, and have created few RadioDJ plugins - https://axellence.lv/downloads/

marcbeinder

Whoops! Sorry Valdis. Thanks again for all your help!  :ok:
RiseRadio.org // Podtrics.com