Hello all i was wondering if anyone can share some light on this. I am trying to delete some tracks from my library.
Every-time get this error : “Could not delete file because it is scheduled in the future.”
I currently have no schedules running as , I have deleted all playlists and smartblocks and still getting this error…how can i delete file with out this?
This sounds like a bug, did you delete your playlists and smartblocks before you tried to delete the track ?
We need to figure out how to replicate this bug so that we can fix it.
If you can figure out what steps you went through in terms of uploading the track, scheduling it (via playlist or smartblock) and then deleting/cancelling the scheduled items so that there is no schedule and we can try to resolve it.
Did you have any repeating events in your calendar, is it possible that there are future events that you didn’t see on the calendar that are repeating ?
Anyways, there is probably no “easy” way to delete the track via the UI but it would be fairly simple to do so via the database (but if you are not familiar with SQL then it is tricky to get in there and write the query). If we can determine how this bug happens in the first place then we can recreate it and determine at what point in the code the bug is.
Here is the bug, I just re-opened it - https://github.com/LibreTime/libretime/issues/237
I had a 24 clock of rotating music that pretty mush never ended. When I tried to delete a file that I no longer wanted playing , I 0t gave me the “scheduled in the future message” So I canceled the current show and all shows in the future ( The UI of the calendar shows I have nothing scheduled) I then wend ahead and deleted all playlists and smart-blocks associated with that music and I am still getting the scheduled in the future error.
Is there a way I can completely wipe out my calendar? As it stand the only things a can see on my calender are the shows that ran in the past. Could that be affecting things?
Ok, this is helpful, I suspect the bug is with repeating shows and cancelling them. I will try to reproduce it. Basically what probably happened is you had these tracks scheduled and then when you cancelled the show the code didn’t go in and mark that they were no longer scheduled.
So the calendar isn’t likely the issue at this point so much as a flag in the database that marks tracks as “scheduled”. I could help write a SQL query to mark all tracks as non-scheduled so you can delete them but you’d need to get into the command line and connect to the database.
So whenever you cancel a show this function updatePastFilesIsScheduled() in airtime_mvc/application/models is supposed to go in and check all files that are scheduled in the future and then mark is_scheduled as false for those files which aren’t scheduled.
So it appears there might be a bug in that function that leaves some tracks lingering.
Can you try creating a new show and deleting it and see if that has any impact. That should run the function again. If it doesn’t work let me know and we can go down the SQL query route.
stand by will try now
just created a show…uploaded some music…i then deleted the instance and all to follow which deleted all future shows but left what was currently on. ) meaning today’s show. I had to cancel that show separately. I then preceded to delete files successfully. So doing that worked. It completly reved the show and relieved the files of being “locked in”. However why cant the shows on my calendar from previous days be deleted.
Cool. It seems like the function works then but perhaps there is a way that shows are removed or deleted that doesn’t trigger the function. Anyways it seems like creating a show and cancelling it is an easy workaround.
Deleting the past calendar isn’t a feature we have included because most stations want to preserve the history of tracks that they have played and exposing that in the UI could result in someone deleting it unintentionally. So I don’t think it is something we want to add to the UI. It can be done via SQL relatively easily if this is something that you really want to do.
Removing a show from the schedule will also run this function but like you pointed out we don’t currently have a way of removing past shows.
So if we keep having people run into this and we aren’t able to find the exact scenario that triggers this then it might make sense. To manually expose a button in the Settings that runs this function and clears up tracks for deletion.
Awesome. Thank you so much for your help…Last question…so I have Libretime running on a Raspberry Pi…and it works great but can you explain why this happens when I access libretime out side of the raspberry Pi. (see attched) when accessing on local machine the widgets work.
Yes this is because I’m assuming your raspberry pi doesn’t have an internet addressable domain name. And the widgets on the radio page rely upon the URL to load. So it might be pointing to say localhost - which works for the raspberry pi but any other computer will think it’s pointing to itself. It could also just be using whatever domain name raspberry pi used as the host.
There are a few ways of fixing it but I don’t think they have been super well documented. It is probably easy to do w/o SSL via setting up a CORLS forwarder, and you can use SSL and lets encrypt with a proxy - this issue shows that people have done it but are also still running into issues, so we need someone to take this issue on and write the documentation for how to resolve it and/or submit any code fixes.
actually I have assign the pi a static ip address. Also I point the ip address to a url that i set up and to top it off i did install let encrypt. so not sure why it still wouldn;t work
hmm, I’m thinking you might need to look and see what domain you are using and add that to whatever other /etc/host - I’m figuring that this is just a LAN IP, and so therefore you would need to have a host name match on whatever other computers. If you are hosting this with an external world addressable IP and the domain name resolves to it from any computer then it should work. Otherwise since you said it was a raspberry pi I’m assuming it is at home and therefore behind a router, but yeah you will need to do some kind of port forwarding etc to get it addressable anywhere over your router. Linuxserver.io has some good instructions for how to setup their dockerbase lets encrypt port forwarding - https://blog.linuxserver.io/2019/04/25/letsencrypt-nginx-starter-guide/
But this easy style documentation doesn’t yet exist for our project and we don’t have a easy docker based install for LibreTime officially part of our project, but there are a few implementations of libretime on docker that seem to work for people.
Basically the issue is probably that whatever domain name your libretime server thinks that it is running at isn’t addressable and pointing to your raspberry pi when you access it from another computer.
I cannot say thank you again for the direction. Will loop back once i got it done to keep you updated!!!
Hi, I stumble upon the same issue (Ubuntu 16.04.7 LTS)
But the add show and remove isn’t working.
I have access to the command line, how can I do this?
Well… I have news (I hope “good news everyone”)
Just in case, the scenario is:
Now, I have 0 show in the whole playlist, nothing at all in the station just the audio tracks.
Ubuntu 16.04.7 LTS (Updated silen 0.4)
(maybe I can think in some way to replicate the error, at the end of the post)
So!
I went directly to the database, and try to change some things
Connect to the PostgreSQL
psql airtime -h localhost -U airtime -W
Then, try to look at the tables with the music
SELECT id, filepath, is_scheduled, is_playlist FROM cc_files;
And here I found some tracks with is_scheduled = TRUE
So, I just change it to FALSE
UPDATE cc_files SET is_scheduled = FALSE WHERE is_scheduled = TRUE;
I look for certain id that I know have trouble with and everything seem normal
SELECT id, filepath, is_scheduled, is_playlist FROM cc_files WHERE id=1199;
Now with a nice “FALSE” in the is_scheduled part
I went to the admin panel and delete the track, Right?
Not so fast
“Could not delete file because it is scheduled in the future.”
Yeah, that’s right
I re-check the database, and everything seems normal (is_scheduled = FALSE)
Try to look and the cc_playlist and cc_playlistcontents, nothing
Totally empty
BUT! (EUREKA!)
Look for the cc_schedule table
SELECT * FROM cc_schedule;
…
better
SELECT count(*) FROM cc_schedule;
4681 song in the “ghost” cc_schedule
So, a little dynamite
DELETE * FROM cc_schedule;
Work done.
Now I can delete any track.
TD; DR;
Be sure you have nothing to lose first
psql airtime -h localhost -U airtime -W
UPDATE cc_files SET is_scheduled = FALSE WHERE is_scheduled = TRUE;
DELETE * FROM cc_schedule;
(Or maybe just the final line)
How to replicate?
At first, I created a long playlist with all the music (67 hours) manually.
When I created a show, I put that playlist to fill the space and repeat (like a primitive “AutoDJ” kind of thing)
When I used the dashboard, was usual to have a lot of music over the time, but when the timed show started, everything seems normal
(but not, I think maybe this was the main problem)
Then, when I noticed another problem (silen not working properly) I try to re-upload some tracks to check and at some point (unable to delete a track)
I remove the playlist
I hope it help someone, and help the development of this great tool!
Greetings.
PS:
Maybe the problem with the quick fix (create and cancel show) didn’t work because “LibreTime media analyzer service” and “LibreTime playout service” were not working. So this may help:
sudo systemctl restart libretime-analyzer
sudo systemctl restart libretime-playout
Possible feature request: Instead of a checkmark to indicate “Scheduled”, show the datetime of the next scheduled occurrence.
To delete a scheduled track you can then go to that show, and remove the track from the tracklist. The library will update, showing the next scheduled datetime, or blank if none.
–Bob.
Hi, thanks for the steps to delete the records from cc_schedule.
Could those steps be tuned to work without having to remove the whole future schedule??
The quick fix (create and cancel show) didn’t work for me even restarting the “analyzer service” and “playout service" (I’m in ubuntu18 and LT va5023d031)
Hey matias there is probably a way to craft the SQL to delete only the specific file from the schedule but it would require some knowledge of SQL.
If you know the file ID you could probably do something like DELETE * FROM cc_schedule WHERE file_id='#insertfilenumberhere'
- but I’m not 100% certain that won’t cause some issues with the schedule.
Messing around with the database like this could put your libretime instance into a broken state. So best to be done with the knowledge of how to dump and restore the database. What exactly is the issue you are experiencing ? A file that you can’t delete ? It may be best to ignore it if you aren’t comfortable dealing with the database.
A user wasn’t able to delete a sweeper track he was using for a specific month and had to stop using after the end of the month.
He was adding the sweepers using smartblocks. Since he couldn’t delete the track he tried removing the track type from the file but it was still getting scheduled.
When I tested the smarblock or when I filtered the tracks of “sweeper” type the track wasn’t showing up, so it seems the track type was removed correctly.
I couldn’t confirm the part when the track was still being added because he deleted the whole schedule trying to remove the track
So, I’m not sure if the original issue was really happening or was another problem.
The point is that if some tracks can’t be deleted they could be added in some random smartblock unless we put some extra criteria in the smartblock, am I right?
Also, I’ve been always curious about the “No End?” option in the repeating shows.
How does this work when you add a “dynamic smart block”?? does this insert thousands of tracks in the DB?
I remembered this because all the shows this user created were “no ending” shows, and when I tried the:
SELECT count(*) FROM cc_schedule;
mentioned above, it returned more than 30.000 (thirty thousand) hits!
And as I said, there weren’t shows scheduled.
Let me show you the SQL results because I also had a syntax error in case it helps someone:
airtime=> DELETE * FROM cc_schedule;
ERROR: syntax error at or near "*"
LINE 1: DELETE * FROM cc_schedule;
^
airtime=> SELECT count(*) FROM cc_schedule;
count
-------
33240
(1 row)
airtime=> DELETE FROM cc_schedule *;
DELETE 33240
airtime=> SELECT count(*) FROM cc_schedule;
count
-------
0
(1 row)
If I remember correctly and read the code right the never ending stuff doesn’t generate until the future calendar is browsed through the UI or otherwise.
But to your previous question if you have a smartblock that could randomly pull in a track and you have populated the calendar in the future it is very probable that this track was scheduled. If you were using the autoloading playlist then this wouldn’t likely happen because it doesn’t schedule tracks until an hour before they play but if you have repeating static playlists or smartblocks then yeah they could possibly stretch on for a long time depending upon how someone navigated the UI.