Skip to content

Commit

Permalink
New: Add Search Capabilities to Indexer API & InfoBox
Browse files Browse the repository at this point in the history
  • Loading branch information
bakerboy448 authored and Qstick committed Mar 30, 2022
1 parent 6ce9c77 commit 4f056bf
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 36 deletions.
108 changes: 74 additions & 34 deletions frontend/src/Indexer/Info/IndexerInfoModalContent.js
Expand Up @@ -4,6 +4,7 @@ import DescriptionList from 'Components/DescriptionList/DescriptionList';
import DescriptionListItem from 'Components/DescriptionList/DescriptionListItem';
import DescriptionListItemDescription from 'Components/DescriptionList/DescriptionListItemDescription';
import DescriptionListItemTitle from 'Components/DescriptionList/DescriptionListItemTitle';
import FieldSet from 'Components/FieldSet';
import Link from 'Components/Link/Link';
import ModalBody from 'Components/Modal/ModalBody';
import ModalContent from 'Components/Modal/ModalContent';
Expand All @@ -20,6 +21,7 @@ function IndexerInfoModalContent(props) {
language,
indexerUrls,
protocol,
capabilities,
onModalClose
} = props;

Expand All @@ -30,41 +32,78 @@ function IndexerInfoModalContent(props) {
</ModalHeader>

<ModalBody>
<DescriptionList>
<DescriptionListItem
descriptionClassName={styles.description}
title={translate('Id')}
data={id}
/>
<DescriptionListItem
descriptionClassName={styles.description}
title={translate('Description')}
data={description ? description : '-'}
/>
<DescriptionListItem
descriptionClassName={styles.description}
title={translate('Encoding')}
data={encoding ? encoding : '-'}
/>
<DescriptionListItem
descriptionClassName={styles.description}
title={translate('Language')}
data={language ?? '-'}
/>

<DescriptionListItemTitle>Indexer Site</DescriptionListItemTitle>
<DescriptionListItemDescription>
<Link to={indexerUrls[0]}>{indexerUrls[0]}</Link>
</DescriptionListItemDescription>

<DescriptionListItemTitle>{`${protocol === 'usenet' ? 'Newznab' : 'Torznab'} Url`}</DescriptionListItemTitle>
<DescriptionListItemDescription>
{`${window.location.origin}${window.Prowlarr.urlBase}/${id}/api`}
</DescriptionListItemDescription>

</DescriptionList>
<FieldSet legend={translate('IndexerDetails')}>
<div className={styles.groups}>
<DescriptionList>
<DescriptionListItem
descriptionClassName={styles.description}
title={translate('Id')}
data={id}
/>
<DescriptionListItem
descriptionClassName={styles.description}
title={translate('Description')}
data={description ? description : '-'}
/>
<DescriptionListItem
descriptionClassName={styles.description}
title={translate('Encoding')}
data={encoding ? encoding : '-'}
/>
<DescriptionListItem
descriptionClassName={styles.description}
title={translate('Language')}
data={language ?? '-'}
/>
<DescriptionListItemTitle>{translate('IndexerSite')}</DescriptionListItemTitle>
<DescriptionListItemDescription>
<Link to={indexerUrls[0]}>{indexerUrls[0]}</Link>
</DescriptionListItemDescription>
<DescriptionListItemTitle>{`${protocol === 'usenet' ? 'Newznab' : 'Torznab'} Url`}</DescriptionListItemTitle>
<DescriptionListItemDescription>
{`${window.location.origin}${window.Prowlarr.urlBase}/${id}/api`}
</DescriptionListItemDescription>
</DescriptionList>
</div>
</FieldSet>
<FieldSet legend={translate('SearchCapabilities')}>
<div className={styles.groups}>
<DescriptionList>
<DescriptionListItem
descriptionClassName={styles.description}
title={translate('RawSearchSupported')}
data={capabilities.supportsRawSearch ? translate('Yes') : translate('No')}
/>
<DescriptionListItem
descriptionClassName={styles.description}
title={translate('SearchTypes')}
data={capabilities.search.length === 0 ? translate('NotSupported') : capabilities.search[0]}
/>
<DescriptionListItem
descriptionClassName={styles.description}
title={translate('TVSearchTypes')}
data={capabilities.tv.length === 0 ? translate('NotSupported') : capabilities.tv.join(', ')}
/>
<DescriptionListItem
descriptionClassName={styles.description}
title={translate('MovieSearchTypes')}
data={capabilities.movie.length === 0 ? translate('NotSupported') : capabilities.movie.join(', ')}
/>
<DescriptionListItem
descriptionClassName={styles.description}
title={translate('BookSearchTypes')}
data={capabilities.book.length === 0 ? translate('NotSupported') : capabilities.book.join(', ')}
/>
<DescriptionListItem
descriptionClassName={styles.description}
title={translate('MusicSearchTypes')}
data={capabilities.music.length === 0 ? translate('NotSupported') : capabilities.music.join(', ')}
/>
</DescriptionList>
</div>
</FieldSet>
</ModalBody>
</ModalContent>
</ModalContent >
);
}

Expand All @@ -76,6 +115,7 @@ IndexerInfoModalContent.propTypes = {
language: PropTypes.string.isRequired,
indexerUrls: PropTypes.arrayOf(PropTypes.string).isRequired,
protocol: PropTypes.string.isRequired,
capabilities: PropTypes.object.isRequired,
onModalClose: PropTypes.func.isRequired
};

Expand Down
12 changes: 11 additions & 1 deletion src/NzbDrone.Core/Localization/Core/en.json
Expand Up @@ -55,6 +55,7 @@
"BindAddress": "Bind Address",
"BindAddressHelpText": "Valid IP4 address or '*' for all interfaces",
"BookSearch": "Book Search",
"BookSearchTypes": "Book Search Types",
"Branch": "Branch",
"BranchUpdate": "Branch to use to update Prowlarr",
"BranchUpdateMechanism": "Branch used by external update mechanism",
Expand Down Expand Up @@ -172,13 +173,14 @@
"Indexer": "Indexer",
"IndexerAlreadySetup": "At least one instace of indexer is already setup",
"IndexerAuth": "Indexer Auth",
"IndexerDetails": "Indexer Details",
"IndexerFlags": "Indexer Flags",
"IndexerHealthCheckNoIndexers": "No indexers enabled, Prowlarr will not return search results",
"IndexerInfo": "Indexer Info",
"IndexerLongTermStatusCheckAllClientMessage": "All indexers are unavailable due to failures for more than 6 hours",
"IndexerLongTermStatusCheckSingleClientMessage": "Indexers unavailable due to failures for more than 6 hours: {0}",
"IndexerObsoleteCheckMessage": "Indexers are obsolete or have been updated: {0}. Please remove and (or) re-add to Prowlarr",
"IndexerNoDefCheckMessage": "Indexers have no definition and will not work: {0}. Please remove and (or) re-add to Prowlarr",
"IndexerObsoleteCheckMessage": "Indexers are obsolete or have been updated: {0}. Please remove and (or) re-add to Prowlarr",
"IndexerPriority": "Indexer Priority",
"IndexerPriorityHelpText": "Indexer Priority from 1 (Highest) to 50 (Lowest). Default: 25.",
"IndexerProxies": "Indexer Proxies",
Expand All @@ -189,6 +191,7 @@
"IndexerRss": "Indexer Rss",
"Indexers": "Indexers",
"IndexerSettingsSummary": "Configure various global Indexer settings including Proxies.",
"IndexerSite": "Indexer Site",
"IndexersSelectedInterp": "{0} Indexer(s) Selected",
"IndexerStatusCheckAllClientMessage": "All indexers are unavailable due to failures",
"IndexerStatusCheckSingleClientMessage": "Indexers unavailable due to failures: {0}",
Expand Down Expand Up @@ -219,6 +222,8 @@
"MovieIndexScrollBottom": "Movie Index: Scroll Bottom",
"MovieIndexScrollTop": "Movie Index: Scroll Top",
"MovieSearch": "Movie Search",
"MovieSearchTypes": "Movie Search Types",
"MusicSearchTypes": "Music Search Types",
"Name": "Name",
"NetCore": ".NET",
"New": "New",
Expand All @@ -234,6 +239,7 @@
"Notifications": "Notifications",
"NotificationTriggers": "Notification Triggers",
"NotificationTriggersHelpText": "Select which events should trigger this notification",
"NotSupported": "Not Supported",
"NoUpdatesAreAvailable": "No updates are available",
"OAuthPopupMessage": "Pop-ups are being blocked by your browser",
"Ok": "Ok",
Expand Down Expand Up @@ -279,6 +285,7 @@
"QueryOptions": "Query Options",
"QueryResults": "Query Results",
"Queue": "Queue",
"RawSearchSupported": "Raw Search Supported",
"ReadTheWikiForMoreInformation": "Read the Wiki for more information",
"Reddit": "Reddit",
"Redirect": "Redirect",
Expand Down Expand Up @@ -309,8 +316,10 @@
"Scheduled": "Scheduled",
"ScriptPath": "Script Path",
"Search": "Search",
"SearchCapabilities": "Search Capabilities",
"SearchIndexers": "Search Indexers",
"SearchType": "Search Type",
"SearchTypes": "Search Types",
"Security": "Security",
"Seeders": "Seeders",
"SelectAll": "Select All",
Expand Down Expand Up @@ -379,6 +388,7 @@
"Torrent": "Torrent",
"Torrents": "Torrents",
"TvSearch": "TV Search",
"TVSearchTypes": "TV Search Types",
"Type": "Type",
"UI": "UI",
"UILanguage": "UI Language",
Expand Down
14 changes: 13 additions & 1 deletion src/Prowlarr.Api.V1/Indexers/IndexerCapabilityResource.cs
Expand Up @@ -10,6 +10,12 @@ public class IndexerCapabilityResource : RestResource
public int? LimitsMax { get; set; }
public int? LimitsDefault { get; set; }
public List<IndexerCategory> Categories { get; set; }
public bool SupportsRawSearch { get; set; }
public List<SearchParam> SearchParams { get; set; }
public List<TvSearchParam> TvSearchParams { get; set; }
public List<MovieSearchParam> MovieSearchParams { get; set; }
public List<MusicSearchParam> MusicSearchParams { get; set; }
public List<BookSearchParam> BookSearchParams { get; set; }
}

public static class IndexerCapabilitiesResourceMapper
Expand All @@ -25,7 +31,13 @@ public static IndexerCapabilityResource ToResource(this IndexerCapabilities mode
{
LimitsMax = model.LimitsMax,
LimitsDefault = model.LimitsDefault,
Categories = model.Categories.GetTorznabCategoryTree()
Categories = model.Categories.GetTorznabCategoryTree(),
SupportsRawSearch = model.SupportsRawSearch,
SearchParams = model.SearchParams,
TvSearchParams = model.TvSearchParams,
MovieSearchParams = model.MovieSearchParams,
MusicSearchParams = model.MusicSearchParams,
BookSearchParams = model.BookSearchParams
};
}

Expand Down

0 comments on commit 4f056bf

Please sign in to comment.