I can't figure out a good approach for this, but this seems like a not-awful one... sending as a pull request rather than committing straight to master, because I'm not sure and would value a second opinion.
This approach: have a TrackManager class with a .tracks property which always has up-to-date tracks in it. The current implementation does this by checking the file's last-modified timestamp and reloading it if it's changed.
Alternative idea 1: Have processmedia notify the API server whenever it has finished processing -- how does that work when encoding happens on a different machine, offline, and the results are sync'ed via syncthing a few hours later? What if we have many people sharing the same dataset but running their own servers? My gut tells me that processmedia should only care about the source folder and the processed folder, and have no other inputs or outputs
Alternative idea 2: Use inotify to monitor tracks.json for changes -- that appears to have issus when the server runs inside docker, and the file is modified outside of it.
Stack created with Sapling. Best reviewed with ReviewStack.
[api_queue] reload track.json when it changes
I can't figure out a good approach for this, but this seems like a not-awful one... sending as a pull request rather than committing straight to master, because I'm not sure and would value a second opinion.
This approach: have a
TrackManager
class with a.tracks
property which always has up-to-date tracks in it. The current implementation does this by checking the file's last-modified timestamp and reloading it if it's changed.Alternative idea 1: Have processmedia notify the API server whenever it has finished processing -- how does that work when encoding happens on a different machine, offline, and the results are sync'ed via syncthing a few hours later? What if we have many people sharing the same dataset but running their own servers? My gut tells me that processmedia should only care about the
source
folder and theprocessed
folder, and have no other inputs or outputsAlternative idea 2: Use inotify to monitor tracks.json for changes -- that appears to have issus when the server runs inside docker, and the file is modified outside of it.