Skip to Content
It is currently July 6th, 2022, 8:09 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: April 27th, 2021, 3:12 pm 
Offline
Junior User
Junior User

Joined: April 27th, 2020, 6:15 pm
Posts: 27
for the built-in function of - tools > HTML Output > Generate provided on SAM, i am generating a JSON file that contains all necessary data.

Is there any way to automatically execute this when a successful request is added to the bottom of the Queue with PAL script?

I want the user to know right away that their song is in the Queue and reflect that on the frontend. Right now, i'm handling the push to the "upcoming" section of the website to force successful requests to bottom of list, then overwrite the state of the "upcoming" array when it recieves an updated JSON file on song change. Some songs are an hour long, and for error handling purposes, i would like SAM to generate the JSON file every time a successful request is added to the bottom of the Queue, instead of only updating the file on song change.

thanks.


Top
 Profile  
Reply with quote  
PostPosted: April 29th, 2021, 3:22 pm 
Offline
SVS Member
SVS Member

Joined: December 6th, 2004, 9:00 am
Posts: 8306
Location: Cologne (Germany)
Generating the file via PAL is possible, PAL has functions for outputting text into a file.
Uploading the file via FTP is not possible through PAL, PAL has no functionality regarding FTP or the HTML-Output functionality of SAM.
Uploading the file/JSON payload using a POST request to your website would be possible using the THttp module of SAM.

I'm stoked to see people use "modern" (compared to the other stuff in SAM) technology like JSON with SAM.

_________________
Benedikt Bauer - SVS (Spacial Volunteer Support)

Shop for readymade PAL scripts by countrywesterndj - Or get a custom script made by me (or others)

My Project:
Send "Now Playing" from SAM to Twitter and/or Facebook | Sourcecode


Top
 Profile  
Reply with quote  
PostPosted: May 1st, 2021, 7:58 am 
Offline
Junior User
Junior User

Joined: April 27th, 2020, 6:15 pm
Posts: 27
Thank you for your reply!

I am going to move -
Quote:
PAL has no functionality regarding FTP or the HTML-Output functionality of SAM.

- to a feature request. (if it's not already there).

I wish SAM would move on from Delphi, PHP, Zend DB and use modern technology. We live in the world of Python, Rust and Javascript now. It's 2021.... c'mon SAM....


Top
 Profile  
Reply with quote  
PostPosted: May 1st, 2021, 3:00 pm 
Offline
SVS Member
SVS Member

Joined: December 6th, 2004, 9:00 am
Posts: 8306
Location: Cologne (Germany)
Zend Framework should at least be replaced with Laminas, that one I'll give you, but when we just randomly ditch technologies because they're old, how about we drop C/C++/Java as well and see how many programs will survive?
If we're only dropping things that are objectively bad, let's start with FTP for websites.
That thing is insecure, slow and not suited for websites at all. (FTP was great if you wanted to transfer a single large file, but the more files you transfer the slower FTP gets, regardless of file size)

What's your problem with Delphi and PHP, though? They're both still in active development. PHP just did a major upgrade to version 8 and while delphi has longer release cycles than say PHP or Python, the last major update was in May 2020 and the last patch release came out yesterday.

_________________
Benedikt Bauer - SVS (Spacial Volunteer Support)

Shop for readymade PAL scripts by countrywesterndj - Or get a custom script made by me (or others)

My Project:
Send "Now Playing" from SAM to Twitter and/or Facebook | Sourcecode


Top
 Profile  
Reply with quote  
PostPosted: May 1st, 2021, 6:50 pm 
Offline
Junior User
Junior User

Joined: April 27th, 2020, 6:15 pm
Posts: 27
Didn't mean to offend you. I'm just another nobody developer.

I can only complain for what's best for me.
If PAL scripting was done in python, the learning curve would be tremendously reduced. (for me). I would love to see the community explode with new ideas because the learning curve was lowered.

Having an Node/express server boilerplate would help devs connect with their favorite frontend (javascript) framework. Personally, I loathe wordpress.

I 100% agree FTP needs to go or get updated/upgraded.

Over the course of the 10 years I've been using SAM, I've pulled my hair out learning languages that were from before my time, so for me, it's a fantasy that Spacial would use a different set of languages to lower my frustration level.

I use node/express, VueJS, DRF, mongoDB, amazon S3 and other technologies- all connected to SAM with no small effort. So forgive me :) , I wasn't trying to start a "what about this aspect" war.


Top
 Profile  
Reply with quote  
PostPosted: May 2nd, 2021, 5:46 am 
Offline
SVS Member
SVS Member

Joined: December 6th, 2004, 9:00 am
Posts: 8306
Location: Cologne (Germany)
Quote:
Didn't mean to offend you. I'm just another nobody developer.

I'm not offended. Just wanted to clarify this for others who might get the wrong idea.
I'm working with so many different technologies day-in day-out, that I just don't care anymore. (Lead Dev for 2 projects at a web agency, one is written in Django/Python+React/JS+MySQL and the other in Laminas(ZF2 successor)/PHP and Postgres)

You can't replace code from almost 20 years with the waive of a hand and I don't think selling radio automation software is profitable enough to warrant a complete rewrite of SAM, so at least Delphi is here to stay.

The templates that come with SAM are often misunderstood as a readymade website, when they're actually just a showcase of what is possible.
If you already have a backend to your webapp, you could easily take the PHP templates and look at how they interact with the database directly. All you need from there is a MySQL/MS SQL/Postgres (In theory you could use Firebird as well, but the default Firebird that comes with SAM has disabled network connectivity) adapter for your backend and port-forward the database port.

That would nullify your need for both JSON templates and the immediate feedback for requests as you can simply check the database for every web request instead of waiting for SAM to contact your webapp.

_________________
Benedikt Bauer - SVS (Spacial Volunteer Support)

Shop for readymade PAL scripts by countrywesterndj - Or get a custom script made by me (or others)

My Project:
Send "Now Playing" from SAM to Twitter and/or Facebook | Sourcecode


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group