Skip to Content
It is currently July 20th, 2019, 12:52 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: December 21st, 2018, 4:25 am 
Offline
Senior User
Senior User

Joined: September 12th, 2012, 9:42 pm
Posts: 89
Can you help me return the file name in the active player and write it to a txt file?

Thank you in advance!


Last edited by DJ Cassio on December 21st, 2018, 12:16 pm, edited 1 time in total.
Moved to PAL Forum


Top
 Profile  
Reply with quote  
PostPosted: December 21st, 2018, 12:33 pm 
Offline
SVS Member
SVS Member

Joined: December 6th, 2004, 9:00 am
Posts: 7863
Location: Aachen (Germany)
Code:
StrToFile('C:\currentsoong.txt', ActivePlayer.GetSongInfo['filename']);

_________________
Benedikt Bauer - SVS (Spacial Volunteer Support)

We're offering custom PAL / PHP code and general SAM assistance at palscripts.com

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


Top
 Profile  
Reply with quote  
PostPosted: December 21st, 2018, 3:30 pm 
Offline
Senior User
Senior User

Joined: September 12th, 2012, 9:42 pm
Posts: 89
Mastacheata wrote:
Code:
StrToFile('C:\currentsoong.txt', ActivePlayer.GetSongInfo['filename']);


Thanks! Is there a way to return which file was loaded from a command like this?

Dir['C:\music\'].QueueTop(smLRP, NoRules);
WriteLn "Song TITLE was loaded into Queue"

Thanks!


Top
 Profile  
Reply with quote  
PostPosted: December 21st, 2018, 6:34 pm 
Offline
SVS Member
SVS Member

Joined: December 6th, 2004, 9:00 am
Posts: 7863
Location: Aachen (Germany)
There is a skanky way to get the same effect, but the DIR and Queue{Bottom|Top} does not return anything.
Code:
VAR S : TSongInfo:
PAL.LockExecution;
Dir['C:\music\'].QueueTop(smLRP, NoRules);
S := Queue.NextInQueue;
Queue.Add(S, ipTop);
PAL.UnlockExecution;
WriteLn('Song ' + S['title'] + ' was loaded into queue');


What this does is add the file to the queue, remove the file from the queue while getting the TSongInfo object representing the file you just added and removed and then adding it back.

I also added a PAL.LockExecution block, so the time between removing and readding the track is minimized.

_________________
Benedikt Bauer - SVS (Spacial Volunteer Support)

We're offering custom PAL / PHP code and general SAM assistance at palscripts.com

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


Top
 Profile  
Reply with quote  
PostPosted: December 23rd, 2018, 12:17 pm 
Offline
Senior User
Senior User

Joined: September 12th, 2012, 9:42 pm
Posts: 89
Mastacheata wrote:
There is a skanky way to get the same effect, but the DIR and Queue{Bottom|Top} does not return anything.
Code:
VAR S : TSongInfo:
PAL.LockExecution;
Dir['C:\music\'].QueueTop(smLRP, NoRules);
S := Queue.NextInQueue;
Queue.Add(S, ipTop);
PAL.UnlockExecution;
WriteLn('Song ' + S['title'] + ' was loaded into queue');


What this does is add the file to the queue, remove the file from the queue while getting the TSongInfo object representing the file you just added and removed and then adding it back.

I also added a PAL.LockExecution block, so the time between removing and readding the track is minimized.




You are AWESOME!!!!! Thank you :)

Can I trouble you for one more piece of code??? I need to take the variable and put it in an HH:MM:SS format.


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

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 8 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