Needs work
Project:
Station
Version:
6.x-2.x-dev
Component:
Catalog
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
22 Sep 2010 at 02:41 UTC
Updated:
2 Apr 2012 at 18:31 UTC
Jump to comment: Most recent file
I haven't used the catalog module much, but I plan on using it more very soon. I was curious as to why Music Brainz data isn't retrieved and used on album creation.
| Comment | File | Size | Author |
|---|---|---|---|
| #18 | station_catalog.module.patch | 8.34 KB | thumb |
| #14 | station_catalog.module.patch | 7.9 KB | thumb |
| #11 | station_catalog.module.patch | 8.37 KB | thumb |
| #4 | station_catalog.module.patch | 4.98 KB | thumb |
Comments
Comment #1
tim.plunkettI guess it could be done with hook_nodeapi($op='presave'). Want to take a crack at it?
Comment #2
thumb commentedSure, but a few questions first. One possible answer to my original question may be that the user's may not want data they input overwritten with Music Brainz data by default and drewish was trying to respect this. If this is the case, perhaps adding a module setting switch to define the default might be wise.
Also, I'd love to be able to switch the requirement for entry of the album's year.
Comment #3
tim.plunkettTo address that you can use isset()/empty(), and only load MusicBrainz if the field is empty.
Comment #4
thumb commentedI just re-purposed the prior code in the _prepare function to avoid repeating things here. A couple of minor function name updates for musicbrainz-related functions, there's a set and get function now. Also tweaked the year fetching stuff, but it still doesn't handle all instances, as noted in the code.
Give it a try and let me know.
Comment #5
tim.plunkettMarking for me to go over later today.
Comment #6
drewish commentedHum, yeah I feel like it wasn't getting enough hits against albums we were using. I'd just manually called those functions from a batch import I was doing. I'm curious if it would make more sense to have an AJAX-ish way of calling this and letting the user pick which data to use.
Comment #7
thumb commentedAJAX would be nice, but not sure whether it's worth the effort right now. This patch should keep user input over MusicBrainz data as it had done previously. That seems like enough, at least for now.
AJAX might be nice to use to allow users to select an option when the service returns multiple values, like release dates when album's been released multiple times.
Comment #8
refreshingapathy commentedPatched this against CVS. Got the following error with an album that isn't in MusicBrainz yet:
Got the following error when adding an album that IS in MusicBrainz:
So, it is fetching okay, but something is getting hung up trying to insert the grabbed data.
Comment #9
thumb commentedThanks for report. I won't be able to look into it for at least a week. If the problem become evident before I get back to it, feel free to submit the patch :)
Comment #10
thumb commentedOkay, I've confirmed the error but it's not immediately clear to me why the error's happening. I've never worked with hook_nodeapi() before and suspect it. If anyone sees what's going on, feel free to enlighten me :)
Comment #11
thumb commentedI wasn't able to figure out what was firing the extra insert and throwing this error. By the looks of the previous version of station_log_album_update(), this problem isn't new. I ended up deleting the node after initial insert/update and then re-saving to avoid this error. It feels oh so wrong, but it keeps the logs clean for now.
Please give this updated patch a try.
Comment #12
refreshingapathy commentedLatest patch works without error, but I agree the delete and re-save feels a bit dirty.
Comment #13
thumb commentedI've read through hook docs and see that form_submit() calls insert() as does update(). I'll work with it more to clean things up.
Comment #14
thumb commentedOkay, a long day of flying gave me some time to get this worked out. The attached patch removes the hacky deletes, restores hook_nodeapi, and appears to work very nicely in my initial tests. Please give it a try.
Comment #15
drewish commentedI like where this is going but it still needs some work. The more I think about this I think it might be better to allow the user to trigger this functionality by adding a submit button that would fetch the data from MusicBrains. Take a look at the button on archived audio nodes to reload the scheduled info for an example of what I'm talking about.
We should drop the db_query(INSERT/UPDATE) in favor of drupal_write_record(). it'll let us drop several lines of code and look a lot cleaner.
It would be good to provide some comments explaining why we're looking where we're looking for the album's release year.
The PHP Docs for station_catalog_musicbrainz_set_album() need work, please review the Doxygen formatting conventions. I'm also not super into the name it's not really clear what it does. Maybe something like station_catalog_update_album_from_musicbrainz()? something like that?
Comment #16
thumb commentedThanks for the feedback drewish. I'll take care of items #2 and #3 and then double back on the MusicBrainz button.
Comment #17
thumb commentedComment #18
thumb commentedUpdated doc blocks to conform with doxygen standards, updated MusicBrainz function name.
Comment #19
drewish commentedSeems like there might be some unrelated changes in here. I'm not seeing the need for:
on this specific issue. If we want to change that I think it'd be best to do it in its own issue so we can look at the other sub-modules and make the change consistently.
Would love to get the docs explaining the ordering of these tests:
Comment #20
thumb commentedAs for as the $node->revision check, yeah, I don't see the need to support revisions per se. To be honest, I can't remember the specific reasoning I had for that change.
As for the MB year checks, that logic may have been too specific to a test album case I was using which had both a US release and a separate foreign release. Regardless of the reasoning, I think the station_catalog.year should be replaced by a date field named 'release_date'. I'm thinking ahead to displaying new releases which will be much easier to select with a full release date.
Comment #21
drewish commentedIn that case it might be easiest to use a Date module field. I've been trying to move station into CCK fields. Now that Features module is so far along it might make sense to "featurize" the station modules.
Comment #22
lunk rat commentedAny plans to "Feature" the station modules for D7?