Libretime Song Database - using existing song library?


#1

Hi,

I have an existing song library of around 1 terabyte of songs.

I’ve had a poke around the database directly and found I could manually add songs to it and as long as the required data fields were present these would appear and work within libretime.

So my next step was to mount my network storage and set this as my libretime audio folder but when I repeat the above steps the database entry appears correctly but the audio won’t play within Libretime.

Has anyone tried this and made it work? Does the Network storage need to be mounted as a specific user for Libretime to be able to access the files perhaps? Do I need to map the existing file structure?

The songs are all direct cd ripped wav files at 44.1kHz stereo and play fine except from the network storage.

What I’d like to achieve is to write a script to import my existing metadata database into Libretime (the easy bit) but use the songs in their current location on the network storage (the bit I’m struggling with).

Any advice gratefully received,

BB


#2

A little more experimentation today. Here’s what I have tried…

The nas is mounted as /media/nas/ and the songs live in the audio subdirectory. I can view the file list and play the songs from this directory.

In order to match the libretime directory structure I have added a new root directory to the local mount called “audio”. In there I have symlinked a folder called 1/ to my /media/nas/audio directory. Libretime is set up to use the audio directory as it’s default directory.

I’ve added the song to the database and in the database field “directory” I’ve added 1.

The NAS is mounted with www-data as it’s owner and this is verified when issuing ls -l command on

Prior to doing all of this the zendlog.php file was reporting that the song was not found. After doing this the zendlog.php file reports the following:

ERR (3): 10.0.0.56 [MediaController.php:89 - downloadAction()]


#3

Not sure but you should check out the work done thus far on https://github.com/LibreTime/libretime/pull/111
There was also an airtime-import function provided with previous versions of Airtime but it wasn’t rewritten to work with airtime_analyzer used by LibreTime.

What you are describing seems like it would be tricky to do.


#4

Thanks Robbt. I’ll share what I’ve learned today - even though my end goal is not to write an importer but to directly add the songs into the libretime database.

I’ve set my media folder to "/audio/ ". Songs that are imported using the web upload get put into a subfolder within that: “/audio/imported/1/filename.wav”.

Originally I was trying to symlink my directory of songs to that same location but it was breaking more things than I was fixing. I was also using just the filename (no folder info) in the database field which was incorrect. This resulted in Libretime being unable to find the files.

I’ve now symlinked my songs folder to “/audio/songs/” . I’ve added one file manually to the database (I’m using PSequel on a mac to connect to the database over IP) and it works!

The file list lives in the database table cc_files. Fields that I’ve added in order for the entry to be recognised are:

id: (I have a 5 digit song ID number in my existing database so I’ve used that)
mime: audio/x-wav
ftype: audioclip
filepath: songs/filename.wav
directory: 1
import_status: 0 (this appears to be important to make Libretime think it’s already processed the file itself)
track_title: song title
artist_name: song artist
sample_rate: 44100
cuein: 00:00:00
cueout: 00:03:30.255 (point at which the next song should start)
filesize: the file size in bytes.

I’ve added two songs by manually copying and pasting the fields and it works successfully. Tomorrow I’ll think about a way of automating my database transfer!