Custom Plugins stopped working in DVDpedia 5.1.3

Any trouble you encounter with the Pedias, here's the place to ask for help.
Post Reply
DreamStatic
Addicted to Bruji
Addicted to Bruji
Posts: 71
Joined: Tue May 30, 2006 4:57 pm

Custom Plugins stopped working in DVDpedia 5.1.3

Post by DreamStatic »

Hello, I finally updated my DVDpedia to the latest version (5.1.3) and my custom plugins stopped working. I was using 4.6.8 and they have worked great forever. Is there something simple I need to tweak to get them working in the latest version? In 4.6.8, it created an extra menu - I don't see this extra menu in the latest DVDpedia. Thanks for info.
User avatar
Nora
Site Admin
Posts: 2155
Joined: Sun Jul 04, 2004 5:03 am
Contact:

Re: Custom Plugins stopped working in DVDpedia 5.1.3

Post by Nora »

The plug-ins still work but they need a slight tweak to be compatible with version 5. Simply needs to be rebuilt to add garbage collection support. The setting is in the build settings and needs to be switched to:

Code: Select all

GCC_ENABLE_OBJC_GC = supported
Open Xcode select the blue project icon at the top of the navigation column on the left, select the plugin name on the pane, select "build settings" tab and copy paste the above line into it. Build and install into DVDpedia and you're set to go.

There are other improvements. Plugins will appear under the "Movie" menu now and you can give them a menu name to appear under, old menu plugins appear in the generic "Plugins" sub menu.

The new format gives you more control as you declare as many menu items as you need in a single plugin as well as their attributes including keyboard shortcuts. Your init method would look like this:

Code: Select all

- (id)init {
    self = [super init];
    if (self) {
		NSMenuItem *aMenuItem = [[[NSMenuItem alloc] init] autorelease];
		[aMenuItem setTitle:@"A Test Menu"];
		[aMenuItem setTarget:self];
		[aMenuItem setAction:@selector(doTest:)];
		[aMenuItem setKeyEquivalent:@"k"];
                [aMenuItem setKeyEquivalentModifierMask:NSCommandKeyMask | NSShiftKeyMask];

		NSMenuItem *secondMenuItem = [[[NSMenuItem alloc] init] autorelease];
		[secondMenuItem setTitle:@"A Second Menu"];
		[secondMenuItem setTarget:self];
		[secondMenuItem setAction:@selector(doSecondTest:)];

		 MyPluginManager *pluginManager = [[NSApp delegate] pluginManager];
		[pluginManager addMenuItem:aMenuItem menuTitle:@"Awesome Commands"];  // Adds to a sub menu called Awesome Commands
		[pluginManager addMenuItem:secondMenuItem]; // Adds to the generic menu 
		[pluginManager addMenuItem:[NSMenuItem separatorItem] menuTitle:@"Awesome Commands"]; //Example of adding a separator				
	}
	return self;
}

 
- (IBAction)doTest:(id)sender {
	NSLog(@"Doing a test");
}
 
 
- (IBAction)doSecondTest:(id)sender {
	NSLog(@"Doing another test");
}
For others reading this and using a search plug-in instead, there are other improvements that can be included now such as search limiters (search by title, author, etc.).
DreamStatic
Addicted to Bruji
Addicted to Bruji
Posts: 71
Joined: Tue May 30, 2006 4:57 pm

Re: Custom Plugins stopped working in DVDpedia 5.1.3

Post by DreamStatic »

Thank you for the reply and the details. You guys never fail to impress with your great customer service. :) Thanks again.
DreamStatic
Addicted to Bruji
Addicted to Bruji
Posts: 71
Joined: Tue May 30, 2006 4:57 pm

Re: Custom Plugins stopped working in DVDpedia 5.1.3

Post by DreamStatic »

In the previous plugin, I used the "MOEntry" bit of code to indicate the selected item. What would I use with this new menu format? Thanks for helping the rookie out. :D

Code: Select all

OLD Plugin style:
- (NSArray *)menuCommandFor:(NSArray *)selectedObjects {
MOEntry *aDVD = [selectedObjects lastObject];



NEW Plugin style:
- (IBAction)doTest:(id)sender {
   NSLog(@"Doing a test");
}
User avatar
Conor
Top Dog
Posts: 5345
Joined: Sat Jul 03, 2004 12:58 pm
Contact:

Re: Custom Plugins stopped working in DVDpedia 5.1.3

Post by Conor »

There are a number of new methods to work with selections, but if you just want the main selected DVD use:

Code: Select all

NSManagedObject *aDVD = [[NSApp delegate] selectedEntry];
You will get an warning that no object responds to selectedEntry so paste the following declaration at the top of your file.

Code: Select all

@interface MyControllerForPlugins : NSObject
- (NSManagedObject *)selectedEntry;  // Main selected entry
- (NSArray *)arrangedEntries;  // All entries
- (NSArray *)selectedEntries;  // Entire selection
@end
The above is enough to get you working with the selection. If you want the full new header file that declares these selection methods and more you can find it in the Sample Plugin. It would be the MyControllerForPlugins.h that you would then include in your project and use #include MyControllerForPlugins.h in your plugin.m file to use other methods there.
DreamStatic
Addicted to Bruji
Addicted to Bruji
Posts: 71
Joined: Tue May 30, 2006 4:57 pm

Re: Custom Plugins stopped working in DVDpedia 5.1.3

Post by DreamStatic »

Conor, you guys saved the day again. This fixed me right up. THANK YOU SO MUCH!!!!
Post Reply