Not logged in. · Lost password · Register
Forum: General Help and Support Features and Functionality RSS
Audio Library?
Avatar
blaksky #1
Member for 3 months · 2 posts
Group memberships: Members
Show profile · Link to this post
Subject: Audio Library?
Hello, just wanted to say a quick thank you in advance for reading.

The goal is to have a namespace where my users can upload their own songs/recordings (non-copyrighted) and lyrics in a structured way (in other words, where people don't have to use any syntax)

The desired result is to have an "index page" with a table showing the library with: artist - title - first line of lyrics.
This table needs to be sortable so the user can sort alphabetically by those headers. When they click on a song, it takes them to the page for that song.

So far I am attempting to find a solution with these plugins: struct, bureaucracy, pagemod, and sortablejs.

The main issue I am having difficulty overcoming is the "index" page.

I feel like the best solution would be to use the struct plugin to enter a row with all the data for one song e.g., "artist" - "title" - "first line of lyrics" - "full lyrics" - "audio file" - "page url"

I tried pagemod but it didn't work with uploading files.

The index page would only show "artist, title, first line" - which would link to the page for the respective song, where you could listen to the song, read the lyrics and see the artist name.

I can't figure out a way to make a struct entry, and also update the sortable "index" page that links to all the songs.

Example Upload
Artist: Hello
Title: World
First Line: The cake is a lie

I want the page to be = songs:hello-world

If the schema had a "page" field, is it possible to dynamically set that field to "songs:@@artist@@-@title@@"
when they submit the form?

Then the struct table on the index would have a working link ???

I have been scratching my head at the best way to do this! Any help would be appreciated!!!
Avatar
Digitalin #2
Member since Feb 2014 · 191 posts
Group memberships: Members
Show profile · Link to this post
Hello,

It is possible and quite easy to do it with Struct and Bureaucracy. I think you don't need sortablejs as tables in Struct are already sortable. If your have a wiki page for each song (page schema - assignment), you don't need either pagemod. 

You can display tables where you want by aggregation according permissions (ACL) given, with all fields or choosen fields from one or multiple schemas, even multiple tables in the same page you call index with filters or not as you want. A field with wiki page type is not necessary for aggregation. As described, I am not sure you need this type. The special colomn %pageid% is the link shown in the table to all pages created in your songs database.

With Bureaucracy plugin, you can create a form, easy for users (in collaboration with Struct, "the struct entry") even you can always create a page by the bar address in the format : yourwiki.org:songs:artist-title

With a complete exemple (Bureaucracy form, a template for template mode and Struct schema page fields definition) it would be easier to help.


EDIT : s/in the link shown/is the link shown/
This post was edited on 2018-12-01, 21:37 by Digitalin.
Avatar
blaksky #3
Member for 3 months · 2 posts
Group memberships: Members
Show profile · Link to this post
Hi Digitalin, thank you so much for the reply it was very helpful.

You are 100% correct, I was up last night until 3-4am trying to figure it out and the Struct plugin finally "clicked" in my brain!
My initial confusion was due to the fact I didn't completely understand how struct worked, but now it makes a lot more sense.

Like you said, I was able to accomplish what I needed with struct and bureaucracy alone!

The %pageid% column was a huge piece of the puzzle.
The other huge piece I found was filter: %%pageid%% = $ID$

The only issue I am having now, is an error I am getting once I submit the bureacuracy form to create the new page.
Warning: preg_split() expects parameter 2 to be string, array given in parserutils.php on line 289

Warning: Invalid argument supplied for foreach() in /home/xxxxx/public_html/inc/parserutils.php on line 289

In case this helps anyone else in the future, here is what I came up with (disclaimer: there might be mistakes, this isn't an exact copy paste of what I have, I quickly tried to simplify it just to show the concept):

Index Page:
---- struct table ----
schema: songs
cols: %title%, firstline
csv: 0
sort: %title%
----

Add Song Page:
Note: I use struct_field instead of struct_schema to have more control over required/optional fields.
<form>
action template templates:song "songs:@@songs.artist@@-@@songs.title@@"
struct_field "songs.artist"
struct_field "songs.title"
struct_field "songs.firstline"
struct_field "songs.audio1" !
struct_field "songs.lyrics" !
submit "Add Song"
</form>

Template:
Note: I don't have the audio1 in the cols, because in my schema, I have 3 audio fields in case they have multiple recordings. Then I just made the "audio1" "audio2" "audio3" the only visible in-page fields. So Depending on how my files they upload, they automatically show up at the top of the page. If no file is posted, there is no message or error shown which is nice.
===== @@songs.artist@@-@@songs.title@@ =====
---- struct table ----
schema: songs
cols: lyrics
filter: %%pageid%% = $ID$
csv: 0
----
Avatar
Digitalin #4
Member since Feb 2014 · 191 posts
Group memberships: Members
Show profile · Link to this post
Hi blaksky,

Good news, you are not far to find out the Grall :-) nice project anyway !

First, could you confirm you use PHP 5.6 at least as required for Struct plugin ?

Could you give Struct schema page fields definition you use ? Could you confirm the schema's assignment is well : songs:* ?

Sorry, I can't tell at a glance if and where there is an error in the syntax you provide.
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum
Imprint
This board is powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2015 by Yves Goergen
Current time: 2018-12-16, 07:06:55 (UTC +01:00)