LibreTime plays older file but previewing file plays new file

Hey, I’m not sure where best to look to help debug this problem so I thought I share this as some you have you a better understanding of LibreTime than I do.

I have a watch folder that I use to download the latest news. The file in this watch folder physically changes, and I can verify that by previewing the song from the LibreTime dashboard. However when I listen to the actual stream, an older file is playing. This makes no sense what so ever. Is it possible that pypo caches files in a way that if it plays the same file within an hour rather than copying it over from source it just uses what’s already in the cache folder?

Okay so I found this in the code,
# TODO: Check if the locally cached variant of the file is sane.
# This used to be a filesize check that didn’t end up working.
# Once we have watched folders updated files from them might
# become an issue here… This needs proper cache management.
# https://github.com/LibreTime/libretime/issues/756#issuecomment-477853018
# https://github.com/LibreTime/libretime/pull/845

Problem resolved in that I found the cause and have reimplemented the file size check for the watch folder branch.

Can you also do a separate PR for your fix outside of the watched folder branch ? We try to keep PR’s focused on specific problems ? That way it’ll be easy to fix this while we are still working on watched folders.

Ah yup that makes sense. My problem is I’m on an older (late Feb) master branch and I’ve been hesitant to merge than into mines ever since the types update because migrations wasn’t working AND some UI issues. I can probably do it directly on github though it’s straight forward. Though I think the md5 is a better option we even have the md5 in the database.

Somewhat related and maybe you can help point me in the right direction - say I scheduled a file. The after that the file was updated - how can I push that new information to the schedular. If upon scheduling the file was 7 minutes long and then after scheduling the file changes to 4 minutes long my schedule still shows a 7 minute long item which means I’ll have 3 minutes of dead air. I can definitely make this a PR just looking for some tips on where to start.

I’m not really sure the best approach here either. The scheduling software (pypo-playout) mixed with liquidsoap has some weird bugs that I have yet to fully understand the root cause. For instance we sometimes have shows repeat or get off schedule by an hour or two. When I looked at the logs there wasn’t anything that stuck out as an obvious cause. Once we had a bug where flac files weren’t playing back in liquidsoap and I tried to schedule them and it really screwed up the schedule for my show and kept repeating the same track over and over again. So it maybe that we really need to dive in deep and rework the way we interact with liquidsoap. This is I think the biggest source of frustration that people will experience when they are using LibreTime. I haven’t dedicated the time to really figuring out how to properly test it or even how exactly we are using liquidsoap to do everything.

Adding in the watched folder where files can change is likely to cause a whole lot of new issues but it might also help us figure out a way to better test the sync and rewrite the way the two interfaces interact with each other.

In theory the dashboard is supposed to be the source of truth for what is playing and changes made to the schedule should be seen in what is played back over the output but this isn’t always the case and there are various ways we can inadvertently get them out of sync. One approach would be to develop a set of automated tests we can run or even manual tests so that we can explore where exactly we are either misusing liquidsoap instructions or have a bug in pypo. The cache issue you brought up is a good one but it’d be good if we had a number of failing tests that we can then develop solutions to vs. throwing darts blindly and hoping that things get fixed.

If you want to take the lead on any part of solving this feel free, I’ll help how I can and hope to be able to dedicate some more time to really fix this in the future. But I’d probably be more helpful if this was a group initiative or there was someone else like you taking the initiative so that I could help.