[Folder Synchronization (push to VLC)] - Exposing VLC folder when "WLAN Sharing" is active on VLC (eg. via REST or SFTP)
Background:
As written in the related post (LINK), I have a Linux server with music files on it that I would like to sync to VLC on iOS.
Since the music files change (additions / deletions), I'd like to reflect these changes on my iPhone.
While I can drop files onto VLC on iOS via the "WLAN Sharing" feature, there is no way to keep my Linux and iPhone in sync.
In the optimal case, VLC on iOS had a "sync feature" as mentioned on the other link.
However, until such feature is available (which I appreciate is a difficult feature and thus might only happen far away in the future), there might be a easier solution to achieve the same: Pushing the sync via a script on Linux side.
Would any of the below proposed options be implementable with overseable effort @vlc team? I'd be happy to then contribute the script mentioned below (I would also write the vlc changes, but unfortunately for that I don't have the skills).
I hope with this feature, we can make VLC on iOS fully "synchronizable", which then alleviates the need of using Apple's "Music" / "iTunes" app
Proposal:
With a script on linux side (for instance, python; I'm happy to write that script), the following steps would be performed:
- Fetch all current songs from VLC on iOS
- Fetch all songs from Linux
- Compare the two lists
- New items on Linux are pushed to iOS (for instance using rsync)
- Deleted items on Linux are deleted from iOS (for instance using rsync)
In other words, the Linux is always in the lead; deletes from iOS would not be deleted on Linux (which of course could be built in, as a refinement).
Requirement:
For this script to work, three things are required:
i) Ability to retrieve the file list (with information such as filename, artist, title, genre, duration, size, unique identifier)
ii) Ability to send files to VLC on iOS
iii) Ability to delete files form iOS on iOS
Options:
I believe there are two options how this could be achieved.
Option 1: REST API
The current "WLAN Sharing" feature makes the phone available on http://my-iphone.local
If here a REST point could be added as follows, the script could hit it and and do everything that is required.
http://my-iphone.local/api/v1/files
REST Endpoint (Example):The current WLAN-Sharing feature does not expose the REST API (or I missed it), but my hunch is that if these APIs were available, the current UI could use the same.
GET:
Allows to retrieve the list of files on VLC, by pages.
Parameters:
- pageNr (Optional, defaults to 1)
- pageSize (Optional, defaults to 100)
Response:
{
totalRecords: XXX,
page: XXX
records:
[
{ id: XXX, fileName: XXX, artist: XXX, title: XXX, genre: XXX, size: XXX, length: XXX},
{ id: YYY, fileName: YYY, artist: YYY, title: YYY, genre: YYY, size: YYY, length: YYY}
]
}
DELETE:
Deletes the fileIDs
Parameters:
- [fileIDs]
POST:
Uploads the files
Parameters:
- [files]
Option 2: VLC folder exposed via SFTP, FTPS or similar
If a REST solution is not an option, an alternative could be that VLC turns on an SFTP / FTPS that allows connecting to the VLC music folder directly.
sftps://my-iphone.local:22
SFTP Endpoint (Example):What the script would then do is to first connect to this URL and mount the folder and perform the above synchronization steps.