diff --git a/Classes/SBMetadataSearchController.m b/Classes/SBMetadataSearchController.m index c27ff2b..93e38e0 100755 --- a/Classes/SBMetadataSearchController.m +++ b/Classes/SBMetadataSearchController.m @@ -35,6 +35,7 @@ #pragma mark Search input fields - (void) updateSearchButtonVisibility; - (void) searchTVSeriesNameDone:(NSArray *)seriesArray; +- (NSString *)selectedTvShowName; #pragma mark Search for metadata - (IBAction) searchForResults:(id)sender; @@ -179,7 +180,7 @@ return; } } else if ([[[searchMode selectedTabViewItem] label] isEqualToString:@"TV Episode"]) { - if ([[tvSeriesName stringValue] length] > 0) { + if ([[self selectedTvShowName] length] > 0) { if (([[tvSeasonNum stringValue] length] == 0) && ([[tvEpisodeNum stringValue] length] > 0)) { [searchButton setEnabled:NO]; return; @@ -209,6 +210,17 @@ [tvSeriesName reloadData]; } +- (NSString *)selectedTvShowName { + NSString *name = nil; + NSComboBox *comboBox = tvSeriesName; + NSInteger selectedIndex = comboBox.indexOfSelectedItem; + if (selectedIndex > -1) { + id dataSource = comboBox.dataSource; + name = [dataSource comboBox:comboBox objectValueForItemAtIndex:selectedIndex]; + } + return name; +} + #pragma mark Search for results - (IBAction) searchForResults: (id) sender { @@ -537,6 +549,12 @@ } } +- (void)comboBoxSelectionDidChange:(NSNotification *)notification { + if ([notification object] == tvSeriesName) { + [self updateSearchButtonVisibility]; + } +} + - (NSInteger)numberOfItemsInComboBox:(NSComboBox *)comboBox { if (comboBox == tvSeriesName) { return self.tvSeriesNameSearchArray.count;