Author Topic: Getting Started with a Possible Conversion from SAM  (Read 5001 times)

djMot

  • Jr. Member

  • Offline
  • **
  • 51
    • Girls Rock Radio
Getting Started with a Possible Conversion from SAM
« on: June 29, 2014, 05:14:19 AM »
Hello everyone; this is my first post.

My station has been running on SAM Broadcaster for the past eight years.  A significant body of website development has centered around SAM's web integration capabilities, but I have simplified and recoded most of what Sam does to fit what I needed to do into my WordPress-based website.  A huge concern in contemplating a conversion to RadioDJ is finding ways to salvage and/or easily migrate my current website features over to however RadioDJ does the same things.

I have just installed version 1.7.0 and performed an initial directory import of my station's music files.  I had hoped that the importer would read the genre information already in the MP3 tag for each song and apply that instead of assigning the genre shown on the importer screen.  No such luck.  Everything came in as "Acapella" and a subsequent scan of the forum seems to be telling me there is no way for the importer to assign the song's genre.  Is this correct?  There is an "auto" checkbox at the end of the genre field on the directory importer screen.  It is not enabled.  What is it for?  Is that a hint at a future feature to auto assign genre based on MP3 tag information?

Re: website output...
SAM is currently outputting now playing track information to my website using the following template:

Code: [Select]
title||$song.title$
artist||$song.artist$
album||$song.album$
year||$song.albumyear$
genre||$song.genre$
picture||$song.picture$
buycd||$song.buycd$
website||$song.website$
start||$now$
duration||$song.ss$
trackid||$song.songID$
type||$song.songtype$

Which results in the following example track information which is automatically FTP'ed up to my website at the beginning of each new song:

Code: [Select]
title||Start My Heart Again
artist||Dani Poppitt
album||Dani Poppitt
year||2011
genre||Rock/Pop
picture||DaniPoppitt.jpg
buycd||https://www.facebook.com/DaniPoppitt
website||https://www.facebook.com/DaniPoppitt
start||6/28/2014 7:21:07 PM
duration||169
trackid||3486
type||S

This information is then formatted as you see in the Now Playing section on my website in the upper right.  Of particular importance is the start time and duration information that is used by the PHP script I have written to compute the proper time to go looking for the updated file as the songs change.

I also have a similar template with a little more complexity (but that SAM supports natively) which outputs and FTPs the last 90 songs played.

I have looked at the "Now Playing Info Exporter" and it looks like it might be able to do something similar, including using a template file, but I'm not sure I see any way to have it upload multiple files.  I'm also wondering about what kind of information is exposed by RadioDJ for uploading.

SAM also has a playlist export function which generates a separate file for each letter of the alphabet containing a listing of artist-song, and that is automatically FTP'ed up to the site.  Does this functionality exist in RadioDJ?

Finally, although I'm sure I will have a million other questions, for now I'll close by asking if someone can point me in a direction that would help me understand how  RadioDJ handles album art?  Presently, all album art is uploaded to the website as tracks are added by SAM, and each track in its database references the file name of that image file which is also included in the now playing song information FTP upload at each song change.  Does RadioDJ handle this in a similar fashion?

Thanks for your help, I sure would love to see things work out so I can break free of SAM.


Women Artists on Internet Radio:
Girls Rock Radio - http://www.girlsrockradio.com
and
Country Girl Radio - http://www.countrygirlradio.com

SnowHow

  • Hero Member

  • Offline
  • *****
  • 911
  • Personal Text
    A-1 Radio - The Variety Channel
    • A-1 Radio - The Variety Channel
Re: Getting Started with a Possible Conversion from SAM
« Reply #1 on: June 29, 2014, 05:27:05 AM »
Hello and Welcome to RadioDJ! :)


I can't speak to the website stuff, but as for the genre on import, is on the "to do" list. Under Utilities, there is a Tag Synchronization that will read your files and separate the genre's. That's the only way I know of until the Auto function has been implemented.


J-


djMot

  • Jr. Member

  • Offline
  • **
  • 51
    • Girls Rock Radio
Re: Getting Started with a Possible Conversion from SAM
« Reply #2 on: June 29, 2014, 10:49:23 PM »
Hello SnowHow,

I tried running Tags Synchronization, but there isn't a checkbox on its setup screen for Genre, and running it with defaults did not seem to affect the tracks already imported into the database - at least from a genre perspective anyway.  I ran the process as "From TAGS to Database" which seems the logical choice in this situation.

Am I missing something?
Women Artists on Internet Radio:
Girls Rock Radio - http://www.girlsrockradio.com
and
Country Girl Radio - http://www.countrygirlradio.com

SnowHow

  • Hero Member

  • Offline
  • *****
  • 911
  • Personal Text
    A-1 Radio - The Variety Channel
    • A-1 Radio - The Variety Channel
Re: Getting Started with a Possible Conversion from SAM
« Reply #3 on: June 30, 2014, 01:54:42 AM »
Hello SnowHow,

I tried running Tags Synchronization, but there isn't a checkbox on its setup screen for Genre, and running it with defaults did not seem to affect the tracks already imported into the database - at least from a genre perspective anyway.  I ran the process as "From TAGS to Database" which seems the logical choice in this situation.

Am I missing something?

My apologies, it seems you are right. I thought it synched genre also. Hopefully this will be moved up on the "to do" list...


J-


AndyDeGroo

  • Guest
Re: Getting Started with a Possible Conversion from SAM
« Reply #4 on: July 04, 2014, 07:55:47 AM »
Hi, djMot!

I'm a bit late on this, but I could help with web related questions and I also have experience with SAMBC.

I assume that you are familiar with PHP based on what you wrote.

1. Genre import
RadioDJ stores genres differently than SAMBC. in RDJ genres are stored in a separate MySQL table named genres and assigns genre IDs to entries in songs table.
If you are interested to correct the genres, I have a PHP CLI script which updates RadioDJ database from ID3 tags using ffmpeg. Had to create it after running my SAMBC to RDJ database migration script, because there were some disparities in track lengths. With some adjustments it could create new genres in genres table and assign new genre IDs to tracks.

2. Web export
RadioDJ uses different approach to export data to web. Instead of FTP upload, which IMO is awkward way to do this, RDJ is using Web Export in Now Playing Info by making a web request to specified URL. You can then use PHP to save data in a file as JSON or serialized string. I'd suggest the first option, as JSON file can be used directly on your web via AJAX request.

If you want to have list of recently played tracks, your PHP script will have to connect to RadioDJ database. This is easy if your web server is on same machine or same network as your playout PC. It they are not, you have to have either static IP address for your playout PC or dynamic DNS address if it has dynamic IP. Either way you have to be able to connect to MySQL where RadioDJ data is stored. When you have that, everything is possible with PHP.

3. Album art
RDJ stores album art files in a directory. Default path is "C:\Album-Art". If you need to access them from your web site, the files could be batch-uploaded on schedule using FTP sync application. You could use FullSync which is OSS and free.

djMot

  • Jr. Member

  • Offline
  • **
  • 51
    • Girls Rock Radio
Re: Getting Started with a Possible Conversion from SAM
« Reply #5 on: July 11, 2014, 05:55:17 PM »
Hello Andy!

Sorry for my late reply, but as you mentioned, time had gone by and it seemed this thread had run its course.  I'm glad to see you jumped into this thread because, in scanning many threads throughout this forum, I have found that you are quite clearly one of the more authoritative resources here.   :)

Yes, I am familiar with PHP and JavaScript, as well as MySQL, HTML, CSS, and WordPress.  Unfortunately, that doesn't necessarily make me an expert at any of them, but I am a MCSD, so I do not have much of a problem with any language.  Hopefully, that will serve me well as I dive deeper into the RDJ rabbit hole.

To your enumerated points,

1.  I would be very interested in any utilities you have created to allow a smoother transition from SAM to RDJ.  Even if you were to only provide some sort of example scripts, I think it may be possible for me to gain the knowledge necessary to code a more robust solution tailored to my specific needs.

2.  On the matter of the web export capabilities in RDJ, again it would be very helpful to have some sample scripts or applications I can use to understand how things work.  I agree that FTP upload is an awkward way to handle information transfer to a website.  I have always wanted to use PHP, JSON, AJAX, and JavaScript to form a more robust and efficient application, but every time I go looking for examples I fail to come up with anything matching what I need as a starting point to build an entire solution.  Presently, the information transferred via FTP from SAM contains start time and duration for the currently playing track.  Using PHP up on the website, I read the file SAM uploaded and then using the start and duration times as well as the current server time, I compute when it should be time to look for the next upload.  Because there could be a significant time difference between the clock on my SAM computer and the Web servers clock, I have to perform some rather awkward time difference correction.  It kind of works, and my Now Playing widget updates fairly accurately, but there really has got to be a better way to do it.  I'm sure that using PHP, JSON, JavaScript, and AJAX requests is the answer, but I've just not found good examples to work from.

My website's server is not the same machine as my SAM/RDJ computer, but I do have a static IP address at this location.  That actually reminds me of another question concerning automated requests.  Because I have a static IP, I am able to host my own request service for SAM.  This also requires that I be running an Apache Web server (not to be confused with my website host) at this IP to accept inbound requests and route them to SAM.  That Apache Web server is on the same machine as SAM/RDJ.  Can you give me a little overview on how RDJ handles inbound requests from radio station's a website?

3.  All of my album art is already up on my website, so all I need is a way for the website to know which album art image it should be displaying.  I see that there is a field for album art in the songs table.  But as with the web export discussion, I need to know a little more about how/what RDJ is capable of communicating to the website - hopefully album art is included in the information can expose.  And it is also clear that I will need to run some sort of script to populate the album_art field.  Sounds like that could be accomplished using the scripts you mentioned in the discussion on genre import modified to populate the RDJ album_art field from the corresponding field in SAM's database.

Thank you for whatever assistance you can lend me during this transition.  afterwards,I would be happy to do whatever I can to give back to the community, and in particular those trying to make the transition from SAM, once I have gained a deeper understanding of how this all works.  :)
Women Artists on Internet Radio:
Girls Rock Radio - http://www.girlsrockradio.com
and
Country Girl Radio - http://www.countrygirlradio.com

AndyDeGroo

  • Guest
Re: Getting Started with a Possible Conversion from SAM
« Reply #6 on: July 11, 2014, 07:51:39 PM »
I can't claim to be an expert on RadioDJ but I have a good understanding how it interacts with its database. I started to explore RDJ last December and right from beginning wanted see how the database is organized.

1. The scripts;
There is this SAM to RDJ migration script which I started but haven't had time to continue.
I didn't continue mainly because because RDJ still doesn't have nested categories like SAM does. In RDJ there are just two levels - main and subcategory - and one song can be only in one category at a time. I already discussed how to implement multiple-to-multiple category relationship in RDJ with Marius, but there were higher development priorities at the time. I hope to see this feature implemented soon.

I haven't published the ID3 tag updating script as it was created purely for personal use. If you really need it, I could clean it up and add proper comments for publishing.

2. Web export etc.;
The basic idea of web export in RDJ: plugin Now Playing Info sends a request to web server using POST or GET (can be chosen since v1.7.0.0). It can be configured in Now Playing Info > Web Export tab. By default it sends just title and password, but you can specify custom set of variables as query sting. More info here.
BTW, I use similar web request approach in SAM via PAL scripting on a station I manage. The PHP script then updates IceCast title (because SAM can't handle UTF-8) and sends websocket update to clients.

For web interaction you should take a look at "RadioDJ Demo Script V2.2" from downloads page. Those scripts show general idea how a web page can interact with RDJ. Some use them as a base for their own websites, but IMO they are not production ready.

Request are placed by directly inserting data into RDJ database. No need for separate server if your web server can access RDJ database.
For example implementation take a look at request.php file from demo scripts package.
On RDJ side there is a "Plugin Requests" in "Disabled Plugins" directory. To enable it, copy dll and xml file to Plugins directory. That will add "Online Request" tab to right hand side of main RDJ interface. Requested songs can be added to queue either manually, using rotation entries or events.

For album art in RDJ database there is album_art field in songs table. It corresponds to picture field in SAM songlist table. Both store just the filename of a picture. For more table field mappings see class.migration.php from my migration tool.

I might have skipped something, so feel free to ask more questions if anything is unclear.

Cheers,
Andy

djMot

  • Jr. Member

  • Offline
  • **
  • 51
    • Girls Rock Radio
Re: Getting Started with a Possible Conversion from SAM
« Reply #7 on: July 13, 2014, 10:35:50 PM »
Thank you, Andy!

I'm not really sure just yet if the no-more-than-one category to a song is a deal breaker or not.  That just seems in incomprehensible restriction.  I have many categories in SAM where many of the same songs live.  Not sure I can envision a way around that.  So, yes, I can only hope a change to allow songs to appear in more than one category is almost immediately ready for release.

I have downloaded your scripts and will take a look over the next few weeks...

On the ID3 Tags script - yes, I think everyone would have a desire for that.  Anyone coming over from SAM is actually going to expect such a built-in facility since SAM gets everything from the tags, and might naturally assume that RDJ would too.  One of my major tasks when adding new music to my station is to go in with Tag&Rename to ensure/clean-up all the tags so everything is good to go when I hand them off to SAM.  If I have to manually edit each track in RDJ as they are added, it would be a disappointing time suck for sure!

Looks like web export is more elegant than SAM's clunky FTP solution.  Without fully analyzing how it works in RDJ, I can at least say it looks very promising.  Thanks for the links to more goodies.

Looks like I have a bit of a learning curve to get through...


Women Artists on Internet Radio:
Girls Rock Radio - http://www.girlsrockradio.com
and
Country Girl Radio - http://www.countrygirlradio.com

AndyDeGroo

  • Guest
Re: Getting Started with a Possible Conversion from SAM
« Reply #8 on: July 14, 2014, 09:29:06 PM »
I'm not really sure just yet if the no-more-than-one category to a song is a deal breaker or not.  That just seems in incomprehensible restriction.  I have many categories in SAM where many of the same songs live.  Not sure I can envision a way around that.  So, yes, I can only hope a change to allow songs to appear in more than one category is almost immediately ready for release.
It really depends on how you have configured your rotations. If, like me, you use categories to separate songs for morning, day and evening rotations and many songs can be in either of categories, then you'll have to duplicate songs so that they can appear in more than one category. Not perfect, but it works. Other solution would be to maintain separate database table and modify each song's category before changing rotations. I can just hope that Marius reads this and is going to implement many-to-many category relations soon.

I have downloaded your scripts and will take a look over the next few weeks...
Good. But please publish the code if you make any changes or improvements. Easiest way to do that is by forking my repo on GitHub and adding pull requests.

On the ID3 Tags script - yes, I think everyone would have a desire for that.  Anyone coming over from SAM is actually going to expect such a built-in facility since SAM gets everything from the tags, and might naturally assume that RDJ would too.  One of my major tasks when adding new music to my station is to go in with Tag&Rename to ensure/clean-up all the tags so everything is good to go when I hand them off to SAM.  If I have to manually edit each track in RDJ as they are added, it would be a disappointing time suck for sure!
Marius has made a promise to add genre sync this week.
I took a look at my ID3 tag parser and updater script. Instead of ffmpeg I'm using getID3 library to parse tags and update duration and cue points for tracks with duration of one second or less. The script is one file and has two dependencies - getID3 and ezSQL. I could write a tutorial on how to put it together instead of publishing it as new GitHub repo. It would take some work to add genre updating.

If you are into coding and know .NET, you might want to check RDJ PluginInterface source code. I haven't tried it, but it can be used to create RDJ plugins.

Looks like web export is more elegant than SAM's clunky FTP solution.  Without fully analyzing how it works in RDJ, I can at least say it looks very promising.  Thanks for the links to more goodies.
It sure is better to interface with database directly than to generate pages from templates and upload them via FTP. Although not everyone is familiar with PHP or other web scripting to use this approach. I've seen many asking for help with web scripts on Website, Programming and related board.

Looks like I have a bit of a learning curve to get through...
There is always a learning curve with new software.

Brodephat

  • Sr. Member

  • Offline
  • ****
  • 458
  • Personal Text
    Pushing content to the world via an ethernet cable
    • Free RadioDJ Video Tutorials
Re: Getting Started with a Possible Conversion from SAM
« Reply #9 on: August 04, 2014, 05:59:51 AM »
I've been using SAM for about 9 years and the php web integration is better then using the html ftp upload. However, most web hosting companies are against using web scripts to connect to remote databases, so I'm almost sure that could be the same for connecting to your RDJ database. Because of that, I've created some pretty nice web scripts for displaying info from SAM using the ftp limitations. I'm hoping to be able to do the same for RDJ.

From what I see so far, there seems to be only one thing that pushes (Post/Get) info to the web and that's the Song Info.

As for the album art, you can upload your artwork to a folder and reference it using the img src="your-domain.com/pictures/$album_image$" and that will work.

I didn't know but did kinda realized that ID tags were not being pulled in when files were added into RDJ. That's a bummer (got over 20,000 titles)

But, I'm looking forward to learning more about RDJ and what I can do with it.


"Think Outside The Box And Make Something Truly Wonderful Happen"

Youtube Channel: https://bit.ly/3fGBsKJ

My RadioDJ Stations:
NiaRadioNetwork.com
RealPeopleTalkRadio.com
TheTriadComeUp.com

Radio Imaging & Tools:
CarterScripts.com

Free RDJ Videos:
HowToUseRadioDJ.com