Author Topic: Problem when attempting to remove unused genres  (Read 3127 times)

royw

  • Guru
  • ****
  • Posts: 261
    • View Profile
Problem when attempting to remove unused genres
« on: May 22, 2008, 09:14:58 pm »
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:

Code: [Select]
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

Zaerc

  • Alumni
  • LinuxMCE God
  • *
  • Posts: 2256
  • Department of Redundancy Department.
    • View Profile
Re: Problem when attempting to remove unused genres
« Reply #1 on: May 22, 2008, 11:50:52 pm »
I think you can create them under "Files & Media | Edit Media file" in the web-admin.
"Change is inevitable. Progress is optional."
-- Anonymous


royw

  • Guru
  • ****
  • Posts: 261
    • View Profile
Re: Problem when attempting to remove unused genres
« Reply #2 on: May 23, 2008, 01:52:04 am »
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