Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Data Model Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Create Dataobjects from folder contents and pull ID3 tags in db


Go to End


2 Posts   2385 Views

Avatar
Howard

Community Member, 215 Posts

3 August 2009 at 4:56pm

Hi there,

This is a tricky problem that I am facing for my churches website. They currently have a site that is built pretty much in HTML with a little php thrown in so I'm moving it all to SS. We want to podcast each weeks message so I'll create a dataobject for each message and attach a file to it. That I will be able to handle but ideally I would write a function that looks at a folder and creates a dataobject for any files in the folder that arn't currently associated with a dataobject. I imagine this is similar to how the AssetAdmin does this but I'm not sure where to start.

As a second issue ideally I would be able to pull the ID3 tags from the audio files into the fields in the dataobject, ie pull in the Artist, Album etc...

Any ideas - even just a point in the right direction? :)

Thanks

Avatar
joshy

Community Member, 57 Posts

7 August 2009 at 7:18am

Hiya,

To push a new item into an existing DataObjectSet you'll need to $do->push() it in. What you will have to do in reality is create a completely new one and then merge the two.

In terms of ID3, http://getid3.sourceforge.net/ and http://us3.php.net/manual/en/book.id3.php will help you there.

Cheers,

Josh