Author Topic: Creating Track Type  (Read 2111 times)

marcbeinder

  • Sr. Member

  • Offline
  • ****
  • 331
    • Rise! FM - St. Louis
Creating Track Type
« on: July 26, 2016, 04:15:56 AM »
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

  • Hero Member

  • Offline
  • *****
  • 562
  • Personal Text
    Radio is a mental condition
    • home
Re: Creating Track Type
« Reply #1 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.
I am, therefore I think.
I design and develop web apps, and have created few RadioDJ plugins - https://axellence.lv/downloads/

marcbeinder

  • Sr. Member

  • Offline
  • ****
  • 331
    • Rise! FM - St. Louis
Re: Creating Track Type
« Reply #2 on: July 26, 2016, 04:47:55 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

  • Hero Member

  • Offline
  • *****
  • 562
  • Personal Text
    Radio is a mental condition
    • home
Re: Creating Track Type
« Reply #3 on: July 26, 2016, 04:52:42 AM »
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

  • Sr. Member

  • Offline
  • ****
  • 331
    • Rise! FM - St. Louis
Re: Creating Track Type
« Reply #4 on: July 26, 2016, 04:54:55 AM »
Okay. Want me to message you then?
RiseRadio.org // Podtrics.com

Valdis

  • Hero Member

  • Offline
  • *****
  • 562
  • Personal Text
    Radio is a mental condition
    • home
Re: Creating Track Type
« Reply #5 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.
I am, therefore I think.
I design and develop web apps, and have created few RadioDJ plugins - https://axellence.lv/downloads/

marcbeinder

  • Sr. Member

  • Offline
  • ****
  • 331
    • Rise! FM - St. Louis
Re: Creating Track Type
« Reply #6 on: July 26, 2016, 05:03:36 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

  • Sr. Member

  • Offline
  • ****
  • 331
    • Rise! FM - St. Louis
Re: Creating Track Type
« Reply #7 on: July 26, 2016, 11:35:18 PM »
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

  • Hero Member

  • Offline
  • *****
  • 562
  • Personal Text
    Radio is a mental condition
    • home
Re: Creating Track Type
« Reply #8 on: July 27, 2016, 10:44:57 AM »
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

  • Hero Member

  • Offline
  • *****
  • 562
  • Personal Text
    Radio is a mental condition
    • home
Re: Creating Track Type
« Reply #9 on: July 27, 2016, 11:12:32 AM »
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:
Code: [Select]
$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:
Code: [Select]
<?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

  • Sr. Member

  • Offline
  • ****
  • 331
    • Rise! FM - St. Louis
Re: Creating Track Type
« Reply #10 on: July 27, 2016, 04:33:14 PM »
Whoops! Sorry Valdis. Thanks again for all your help!  :ok:
RiseRadio.org // Podtrics.com