News:

Rule #1 - Be Patient - Rule #2 - Don't ask when, if you don't contribute - Rule #3 - You have coding skills - LinuxMCE's small brother is available: http://www.agocontrol.com

Main Menu

Problem when attempting to remove unused genres

Started by royw, May 22, 2008, 09:14:58 PM

Previous topic - Next topic

royw

Howdy,

I'm trying to clean up the list of genres that is displayed on UI2's Video, Genre menu.  My thoughts were to simply remove all of the unused  "Genre" Attributes, like:


desc "Remove unused Genre Attributes"
task(:remove_unused_genres => :environment) do
genre_attribute_type = fetch_attribute_type('Genre')
PlutoMedia::LmceAttribute.find_all_by_FK_AttributeType(genre_attribute_type.id).each do |genre_attribute|
if genre_attribute.lmce_files.empty?
puts "Deleting Genre Attribute: #{genre_attribute.Name}"
genre_attribute.destroy
end
end
end


Which does remove all of the Genre Attributes that don't have any File references.

The problem is that the Video, Genre menu now only contains the "All" entry.  I've tried regen'ing the oribiter, reloading the core/hybrid, rebooting, resynchronizing the media, adding a new attribute from the media file sync, restoring the database to it's pre-changed condition.  Nothing seems to work to get the list of Genre.

I've grep'ed in the source code and haven't found anything hinting that the menu requires anything else besides the Attribute and File tables.

I'm hoping some nice guru can point me to where I need to be looking.

Thank you,
Roy
My System: [url="http://wiki.linuxmce.org/index.php/User:Royw"]http://wiki.linuxmce.org/index.php/User:Royw[/url]

Zaerc

I think you can create them under "Files & Media | Edit Media file" in the web-admin.
"Change is inevitable. Progress is optional."
-- Anonymous

[url=http://petition.stopsoftwarepatents.eu/181001941347/][/url]

royw

A little more research and I discovered that the Genre Attributes are all referenced by search_tokens table and some are also referenced by discs table.  So removing unused genres is going to be a little more involved than I originally thought...

Thank you,
Roy
My System: [url="http://wiki.linuxmce.org/index.php/User:Royw"]http://wiki.linuxmce.org/index.php/User:Royw[/url]