Closed (outdated)
Project:
Filebrowser
Version:
6.x-2.x-dev
Component:
Directory Listing Pages
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
23 Feb 2010 at 22:04 UTC
Updated:
24 May 2018 at 12:00 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
Yoran commentedI think this is not difficult to implement using filebrowser_video plugin pattern.
Comment #2
renders commentedI will give this a try. In the case of playtagger, it is a javascript that looks thru the page for the mp3 extension on links. This does not work with the filebrowser listing though.
Comment #3
coopercrazy commentedI must say, I really do like the filebrowser module. I'm surprised drupal doesn't do this out of the box though.
With regard to the audio helper function-- I would find it very useful to include additional columns which can read id3 tags and the like for various audio files.
Maybe a good place to start would be apache's mod_musicindex module? I am not a coder, so I wouldn't begin to know how to add those features, but I am willing to beta test the modules you write if needed.
Thanks,
Kevin
Comment #4
Yoran commentedYou know have a full metadata API in order to provide all needed informations. Be carefull to cache those data in order not to reduce performances.
Comment #5
coopercrazy commentedThanks Yoran,
I've finally gotten back to this project after some other matters.
I had also finally installed 6.x-2.x-dev branch to do some testing. After untarring the module I had several errors with my database (which I think I have successfully now recovered from). I noticed the Video and Image helper modules and attempted to use one of those as a template for the audio helper module, but I am lost.
How does one call up the metadata api for an audio helper?
I'm by no means a php coder, but I am thinking I need to do something along the following.
In pseudo code . . .
generate list of files in directory and store in a VARIABLE
for SINGLEFILE in $VARIABLE
do
getID3($SINGLEFILE)
return FIELDS with non-null values
for FIELD in $FIELDS
do
getID3_FIELD($FIELD) and store in object array
done
return ARRAY for FILE and store in CACHE
done
handoff CACHE to filebrowser module for displaying.
Let me know what you think.
Also one an unrelated note, the "Whitelist" concept is working nicely. And, in my directory listing, the "Go Up" link tends to move around and be anywhere in the list. Shouldn't it be anchored to either the top or the bottom of the directory list?
Kevin
Comment #6
Yoran commentedI just commited a dev version (it'll take someting for drupal.org to update the tarball). In this you have a filebrowser_STARTER module in which you'll find everything you need. You can focus on :
function filebrowser_STARTER_filebrowser_metadata_info() {
function filebrowser_STARTER_filebrowser_metadata_get($file) {
function filebrowser_STARTER_filebrowser_metadata_set($file, $metadata) {
I made in the header of the module a copy of what you should find in $file object.
Let me know if this is enough for you
Comment #7
coopercrazy commentedThanks Yoran,
I will give drupal some time to post the new module for download.
I'll let you know how I'm doing.
Kevin
Comment #9
coopercrazy commentedYoran,
I've thought about what functions I would need for this.
I think there needs to be dependency on the getID3() drupal module. This is supposed to be accomplished by calling the getid3_load function.
I am thinking the functions you listed should contain something like the following (I am sure there are many errors and missing pieces):
function filebrowser_STARTER_filebrowser_metadata_info() {
$FileTag = $getID3-> analyze($file);
getid3_lib::CopyTagsToComments($FileTag);
};
function filebrowser_STARTER_filebrowser_metadata_get($file) {
return array(
'STARTER_foo' => 'artist' .$FileTag['comments_html']['artist'];
'STARTER_foo => 'genre' .$FileTag['comments_html']['genre'];
'STARTER_foo => 'title' .$FileTag['comments_html']['title'];
'STARTER_foo => 'length' .$FileTag['playtime_string'];
'STARTER_foo => 'copywright' .$FileTag['comments_html']['copywright'];
);
};
function filebrowser_STARTER_filebrowser_metadata_set($file, $metadata) {
I may be misunderstanding the purpose of this function, but I do not want to be able to modify the tags of audio files from within filebrowser.
};
Let me know what you think.
Kevin
Comment #10
coopercrazy commentedComment #11
coopercrazy commentedYoran,
I think I am going to need some more help with this.
Kevin
Comment #12
Yoran commentedThere is just one mistake as far as I can see. The filebrowser_STARTER_filebrowser_metadata_info is here to publish metadata names to the system. Perhaps something more like this :
Comment #13
coopercrazy commentedYoran,
That helps a lot. I had to close a couple of single quotes (') to make it parse correctly. Attached the filebrowser_STARTER.info files and filebrowswer_STARTER.module files I've modified. I've enabled the module and checked the "genre" checkbox to display and created the Directory Listing page. When I attempt to view the page I get an error message:
"Fatal error: Call to a member function analyze() on a non-object in /drupal-common/sites/all/modules/filebrowser/filebrowser_STARTER/filebrowser_STARTER.module on line 99"
I don't know if this means that it is unable to find the analyze function, or if the object being referenced (i.e. $file) does not exist. Any ideas?
I can create an ordinary page in drupal with the following code and the file tags get parsed and displayed properly. So I am thinking that when I call analyze($file); that $file is not being populated with the filename to analyze. Do you have any suggestions?
Comment #14
Yoran commented$file is a record, not only the file name. To get the filename you have to use $file['full-path']
You can have a look at filebrowser.module/filebrowser_filebrowser_metadata_get function for a concrete example (reading/writing to descript.ion files is done through metadata api).
Comment #15
coopercrazy commentedYoran,
That is working much better. I am finally getting some of the contents of the array.
I will try to get it to where one could select which fields they would like to see displayed in the description column.
Hopefully I will post the contents of my module shortly for your testing. How do I rename it from something like filebrowser_STARTER to something like filebrowser_AUDIO? Do a global find and replace?
Kevin
Comment #16
Yoran commentedIf you want me to open you a CVS access juste tell me. We can add a 'contrib' subfolder for that kind of modules
Comment #17
coopercrazy commentedI'll leave that up to you. It might make it easier to submit any changes I make using the CVS than uploading to drupal here.
I'm having some problems getting anything to show up in the description column of the directory listing. I can print the contents of the array using print_r('STARTER_title') and see it's contents so I know it is being populated with the title of the mp3 file in my directory. Do I have to do anything special to return the value of the array to the filebrowser handler? I also looked at the filebrowser.module file and didn't see anything relevant in there.
function filebrowser_STARTER_filebrowser_metadata_info() {
return array(
'STARTER_title' => array(
'title'=>'Title' ,
'writable'=>FALSE,
'sortable'=>TRUE,
'type'=>'string'));
}
function filebrowser_STARTER_filebrowser_metadata_get($file) {
getid3_load();
$getid3 = new getID3;
$getid3->encoding = 'UTF-8';
$full_path = $file['full-path'];
if (is_file($full_path'])) {
try {
$FileTags = $getid3->analyze($full_path);
getid3_lib::CopyTagsToComments($FileTags);
$artist = $FileTags['comments']['title']['0'];
//print_r($FileTags);
}
catch (Exception $e) {
echo 'An error occured: ' . $e->message;
}
return array(
'STARTER_title' => @$FileTags['comments']['title']['0']);
}
}
Kevin
Comment #18
coopercrazy commentedJust adding a post to keep the thread alive.
Comment #19
coopercrazy commentedComment #20
Yoran commentedSorry for my late answer.
Did you end up with a correct handling of ID3 ?
Comment #21
Yoran commentedComment #22
coopercrazy commentedNope. Never got it to work.
Comment #23
Nicolas Georget commented@coopercrazy
I am working on the MetaDatas for Filebrowser: ID3, IPTC, EXIF, etc... and what is the best way to fetch them properly.
What's up exactly with your code getID3 ?
Comment #24
coopercrazy commentedDon't really know. I've conceeded that i dont know what i am doing.
The idea was to be able to share a directory (with filebrowser ) of media files (mp3 to be exact). The module was supposed to parse the id3 tags on all the songs in the dielrectory and display them to the user in seperate columns like artist, title, and copyright. I got it to the point where i could read the tags in from 1 file and store in a variable. I could never actually pass that variable to the filebrowser view part to be displayed. The thing with the getid3 was just the only way i could figure out to read the tag.
I actually started using the "sermons " module to display my church's messages instead of using the filebrowser module. However, i still think there is value in adding these features to filebrowser, I just don't know how to implement - seeing as how my php skills aren't so good.
Comment #25
Nicolas Georget commented@coopercrazy
Here's the way to read and push the ID3 into a table(1) with filebrowser.
In this example, I push 5 Tags into a table:
There's many things to review. First, i create a new object getID3 if the mime-type == 'audio/mpeg' which is in your case might match with your files.
Because the method getID3::analyze() return a huge list of metatags, it was impossible to return a form with what fields to display in the table (like filebrowser does). Third thing (1), i could not made the table sortable because... it depends of the displayed fields and a lack of time today ;-)
So, now you can create a dir_list with mp3/4. In the default view, choose "getID3 view" and try it...
Comment #26
coopercrazy commentedThanks for the help Nicolas. I haven't had much time to work on this recently. I'll try to give it a shot this weekend.
Comment #27
coopercrazy commentedNicolas,
I finally had a few moments to test out the getid3 filebrowser example you made ( I know its been over 2 years since you posted it for me ).
A couple of things I am planning on adding:
You've given me a huge jump on this and I'll hopefully post something back here in the next couple of months.
Comment #28
clivesj commented