Added the ability to search movies via the movie db with a different language!

pull/2728/head
tidusjar 6 years ago
parent 53cdcdc23b
commit dc216ba9bf

@ -10,7 +10,7 @@ namespace Ombi.Core
Task<IEnumerable<SearchMovieViewModel>> PopularMovies();
Task<IEnumerable<SearchMovieViewModel>> Search(string search, int? year);
Task<IEnumerable<SearchMovieViewModel>> Search(string search, int? year, string languageCode);
Task<IEnumerable<SearchMovieViewModel>> TopRatedMovies();

@ -56,9 +56,9 @@ namespace Ombi.Core.Engine
/// </summary>
/// <param name="search">The search.</param>
/// <returns></returns>
public async Task<IEnumerable<SearchMovieViewModel>> Search(string search, int? year)
public async Task<IEnumerable<SearchMovieViewModel>> Search(string search, int? year, string langaugeCode)
{
var result = await MovieApi.SearchMovie(search, year);
var result = await MovieApi.SearchMovie(search, year, langaugeCode);
if (result != null)
{

@ -11,7 +11,7 @@ namespace Ombi.Api.TheMovieDb
Task<MovieResponseDto> GetMovieInformationWithExtraInfo(int movieId);
Task<List<MovieSearchResult>> NowPlaying();
Task<List<MovieSearchResult>> PopularMovies();
Task<List<MovieSearchResult>> SearchMovie(string searchTerm, int? year);
Task<List<MovieSearchResult>> SearchMovie(string searchTerm, int? year, string languageCode);
Task<List<TvSearchResult>> SearchTv(string searchTerm);
Task<List<MovieSearchResult>> TopRated();
Task<List<MovieSearchResult>> Upcoming();

@ -83,12 +83,13 @@ namespace Ombi.Api.TheMovieDb
return Mapper.Map<MovieResponseDto>(result);
}
public async Task<List<MovieSearchResult>> SearchMovie(string searchTerm, int? year)
public async Task<List<MovieSearchResult>> SearchMovie(string searchTerm, int? year, string langageCode)
{
var request = new Request($"search/movie", BaseUri, HttpMethod.Get);
request.FullUri = request.FullUri.AddQueryParameter("api_key", ApiToken);
request.FullUri = request.FullUri.AddQueryParameter("query", searchTerm);
if(year.HasValue && year.Value > 0)
request.FullUri = request.FullUri.AddQueryParameter("language", searchTerm);
if (year.HasValue && year.Value > 0)
{
request.FullUri = request.FullUri.AddQueryParameter("year", year.Value.ToString());
}

@ -34,6 +34,12 @@
background: any;
}
export interface ILanguageRefine {
code: string;
name: string;
nativeName: string;
}
export interface ISearchMovieResultContainer {
movies: ISearchMovieResult[];
}

@ -1,7 +1,7 @@
<!-- Movie tab -->
<div role="tabpanel" class="tab-pane active" id="MoviesTab">
<div class="input-group">
<div class="input-group search-bar-background">
<input id="search" type="text" class="form-control form-control-custom form-control-search form-control-withbuttons"
(keyup)="search($event)">
<div class="input-group-addon right-radius">
@ -26,11 +26,29 @@
</div>
</div>
<!-- Refine search options -->
<div class="row top-spacing" *ngIf="refineSearchEnabled">
<div class="col-md-2">
<input [(ngModel)]="searchYear" class="form-control form-control-custom" placeholder="Year">
</div>
<div class="col-md-10">
<div class="row top-spacing form-group vcenter" *ngIf="refineSearchEnabled">
<div class="col-md-1">
<div class="form-group">
<label class="control-label">Year</label>
<input [(ngModel)]="searchYear" class="form-control form-control-custom refine-option">
</div>
</div>
<!-- <label for="name" class="col-xs-2 col-md-1">Language:</label> -->
<div class="col-md-2">
<div class="form-group">
<label for="select" class="control-label">Language</label>
<div id="profiles">
<select [(ngModel)]="selectedLanguage" class="form-control form-control-custom refine-option"
id="select">
<option *ngFor="let lang of langauges" value="{{lang.code}}">{{lang.nativeName}}</option>
</select>
</div>
</div>
</div>
<div class="col-md-9">
<button class="btn pull-right btn-success-outline" (click)="applyRefinedSearch()">Apply</button>
</div>
</div>

@ -6,9 +6,11 @@ import { Subject } from "rxjs";
import { debounceTime, distinctUntilChanged } from "rxjs/operators";
import { AuthService } from "../auth/auth.service";
import { IIssueCategory, IRequestEngineResult, ISearchMovieResult } from "../interfaces";
import { IIssueCategory, IRequestEngineResult, ISearchMovieResult, ILanguageRefine } from "../interfaces";
import { NotificationService, RequestService, SearchService } from "../services";
import * as languageData from "../../other/iso-lang.json";
@Component({
selector: "movie-search",
templateUrl: "./moviesearch.component.html",
@ -23,8 +25,10 @@ export class MovieSearchComponent implements OnInit {
public result: IRequestEngineResult;
public searchApplied = false;
public refineSearchEnabled = false;
public refineSearchEnabled = true;
public searchYear?: number;
public selectedLanguage: string;
public langauges: ILanguageRefine[];
@Input() public issueCategories: IIssueCategory[];
@Input() public issuesEnabled: boolean;
@ -40,15 +44,12 @@ export class MovieSearchComponent implements OnInit {
private notificationService: NotificationService, private authService: AuthService,
private readonly translate: TranslateService, private sanitizer: DomSanitizer,
private readonly platformLocation: PlatformLocation) {
this.langauges = <ILanguageRefine[]><any>languageData;
this.searchChanged.pipe(
debounceTime(600), // Wait Xms after the last event before emitting last event
distinctUntilChanged(), // only emit if value is different from previous value
).subscribe(x => {
this.searchText = x as string;
if (this.searchText === "") {
this.clearResults();
return;
}
this.runSearch();
});
this.defaultPoster = "../../../images/default_movie_poster.png";
@ -182,12 +183,13 @@ export class MovieSearchComponent implements OnInit {
public refineOpen() {
this.refineSearchEnabled = !this.refineSearchEnabled;
if(!this.refineSearchEnabled) {
if (!this.refineSearchEnabled) {
this.searchYear = undefined;
}
}
public applyRefinedSearch() {
console.log(this.selectedLanguage);
this.runSearch();
}
@ -223,13 +225,28 @@ export class MovieSearchComponent implements OnInit {
}
private runSearch() {
this.searchService.searchMovie(this.searchText, this.searchYear)
.subscribe(x => {
this.movieResults = x;
this.searchApplied = true;
// Now let's load some extra info including IMDB Id
// This way the search is fast at displaying results.
this.getExtraInfo();
});
if (this.searchText === "") {
this.clearResults();
return;
}
if (this.refineOpen) {
this.searchService.searchMovieWithRefined(this.searchText, this.searchYear, this.selectedLanguage)
.subscribe(x => {
this.movieResults = x;
this.searchApplied = true;
// Now let's load some extra info including IMDB Id
// This way the search is fast at displaying results.
this.getExtraInfo();
});
} else {
this.searchService.searchMovie(this.searchText)
.subscribe(x => {
this.movieResults = x;
this.searchApplied = true;
// Now let's load some extra info including IMDB Id
// This way the search is fast at displaying results.
this.getExtraInfo();
});
}
}
}

@ -1,10 +1,30 @@
@media (max-width: 978px) {
.top-spacing {
padding-top: 5%
}
.form-control-search {
width: 77%;
}
}
@media (min-width: 979px) {
.top-spacing {
padding-top: 2%
}
.form-control-search {
width: 90%;
}
}
.search-bar-background {
background-color: #333333;
}
.vcenter {
display: flex;
align-items: center;
}
.refine-option {
box-shadow: inset 0 1px 5px rgba(0,0,0,1.0);
}

@ -17,13 +17,14 @@ export class SearchService extends ServiceHelpers {
}
// Movies
public searchMovie(searchTerm: string, year?: number): Observable<ISearchMovieResult[]> {
if(year && year > 0) {
return this.http.get<ISearchMovieResult[]>(`${this.url}/Movie/${searchTerm}/${year}`);
} else {
return this.http.get<ISearchMovieResult[]>(`${this.url}/Movie/${searchTerm}`);
}
public searchMovie(searchTerm: string): Observable<ISearchMovieResult[]> {
return this.http.get<ISearchMovieResult[]>(`${this.url}/Movie/${searchTerm}`);
}
public searchMovieWithRefined(searchTerm: string, year: number | undefined, langCode: string): Observable<ISearchMovieResult[]> {
return this.http.post<ISearchMovieResult[]>(`${this.url}/Movie/`, { searchTerm: searchTerm, year: year, languageCode: langCode });
}
public similarMovies(theMovieDbId: number): Observable<ISearchMovieResult[]> {
return this.http.get<ISearchMovieResult[]>(`${this.url}/Movie/${theMovieDbId}/similar`);
}
@ -46,32 +47,32 @@ export class SearchService extends ServiceHelpers {
// TV
public searchTv(searchTerm: string): Observable<ISearchTvResult[]> {
return this.http.get<ISearchTvResult[]>(`${this.url}/Tv/${searchTerm}`, {headers: this.headers});
return this.http.get<ISearchTvResult[]>(`${this.url}/Tv/${searchTerm}`, { headers: this.headers });
}
public searchTvTreeNode(searchTerm: string): Observable<TreeNode[]> {
return this.http.get<TreeNode[]>(`${this.url}/Tv/${searchTerm}/tree`, {headers: this.headers});
return this.http.get<TreeNode[]>(`${this.url}/Tv/${searchTerm}/tree`, { headers: this.headers });
}
public getShowInformationTreeNode(theTvDbId: number): Observable<TreeNode> {
return this.http.get<TreeNode>(`${this.url}/Tv/info/${theTvDbId}/Tree`, {headers: this.headers});
return this.http.get<TreeNode>(`${this.url}/Tv/info/${theTvDbId}/Tree`, { headers: this.headers });
}
public getShowInformation(theTvDbId: number): Observable<ISearchTvResult> {
return this.http.get<ISearchTvResult>(`${this.url}/Tv/info/${theTvDbId}`, {headers: this.headers});
return this.http.get<ISearchTvResult>(`${this.url}/Tv/info/${theTvDbId}`, { headers: this.headers });
}
public popularTv(): Observable<ISearchTvResult[]> {
return this.http.get<ISearchTvResult[]>(`${this.url}/Tv/popular`, {headers: this.headers});
return this.http.get<ISearchTvResult[]>(`${this.url}/Tv/popular`, { headers: this.headers });
}
public mostWatchedTv(): Observable<ISearchTvResult[]> {
return this.http.get<ISearchTvResult[]>(`${this.url}/Tv/mostwatched`, {headers: this.headers});
return this.http.get<ISearchTvResult[]>(`${this.url}/Tv/mostwatched`, { headers: this.headers });
}
public anticipatedTv(): Observable<ISearchTvResult[]> {
return this.http.get<ISearchTvResult[]>(`${this.url}/Tv/anticipated`, {headers: this.headers});
return this.http.get<ISearchTvResult[]>(`${this.url}/Tv/anticipated`, { headers: this.headers });
}
public trendingTv(): Observable<ISearchTvResult[]> {
return this.http.get<ISearchTvResult[]>(`${this.url}/Tv/trending`, {headers: this.headers});
return this.http.get<ISearchTvResult[]>(`${this.url}/Tv/trending`, { headers: this.headers });
}
// Music
public searchArtist(searchTerm: string): Observable<ISearchArtistResult[]> {

@ -0,0 +1,184 @@
[
{"code":"ab","name":"Abkhaz","nativeName":"аҧсуа"},
{"code":"aa","name":"Afar","nativeName":"Afaraf"},
{"code":"af","name":"Afrikaans","nativeName":"Afrikaans"},
{"code":"ak","name":"Akan","nativeName":"Akan"},
{"code":"sq","name":"Albanian","nativeName":"Shqip"},
{"code":"am","name":"Amharic","nativeName":"አማርኛ"},
{"code":"ar","name":"Arabic","nativeName":"العربية"},
{"code":"an","name":"Aragonese","nativeName":"Aragonés"},
{"code":"hy","name":"Armenian","nativeName":"Հայերեն"},
{"code":"as","name":"Assamese","nativeName":"অসমীয়া"},
{"code":"av","name":"Avaric","nativeName":"авар мацӀ, магӀарул мацӀ"},
{"code":"ae","name":"Avestan","nativeName":"avesta"},
{"code":"ay","name":"Aymara","nativeName":"aymar aru"},
{"code":"az","name":"Azerbaijani","nativeName":"azərbaycan dili"},
{"code":"bm","name":"Bambara","nativeName":"bamanankan"},
{"code":"ba","name":"Bashkir","nativeName":"башҡорт теле"},
{"code":"eu","name":"Basque","nativeName":"euskara, euskera"},
{"code":"be","name":"Belarusian","nativeName":"Беларуская"},
{"code":"bn","name":"Bengali","nativeName":"বাংলা"},
{"code":"bh","name":"Bihari","nativeName":"भोजपुरी"},
{"code":"bi","name":"Bislama","nativeName":"Bislama"},
{"code":"bs","name":"Bosnian","nativeName":"bosanski jezik"},
{"code":"br","name":"Breton","nativeName":"brezhoneg"},
{"code":"bg","name":"Bulgarian","nativeName":"български език"},
{"code":"my","name":"Burmese","nativeName":"ဗမာစာ"},
{"code":"ca","name":"Catalan; Valencian","nativeName":"Català"},
{"code":"ch","name":"Chamorro","nativeName":"Chamoru"},
{"code":"ce","name":"Chechen","nativeName":"нохчийн мотт"},
{"code":"ny","name":"Chichewa; Chewa; Nyanja","nativeName":"chiCheŵa, chinyanja"},
{"code":"zh","name":"Chinese","nativeName":"中文 (Zhōngwén), 汉语, 漢語"},
{"code":"cv","name":"Chuvash","nativeName":"чӑваш чӗлхи"},
{"code":"kw","name":"Cornish","nativeName":"Kernewek"},
{"code":"co","name":"Corsican","nativeName":"corsu, lingua corsa"},
{"code":"cr","name":"Cree","nativeName":"ᓀᐦᐃᔭᐍᐏᐣ"},
{"code":"hr","name":"Croatian","nativeName":"hrvatski"},
{"code":"cs","name":"Czech","nativeName":"česky, čeština"},
{"code":"da","name":"Danish","nativeName":"dansk"},
{"code":"dv","name":"Divehi; Dhivehi; Maldivian;","nativeName":"ދިވެހި"},
{"code":"nl","name":"Dutch","nativeName":"Nederlands, Vlaams"},
{"code":"en","name":"English","nativeName":"English"},
{"code":"eo","name":"Esperanto","nativeName":"Esperanto"},
{"code":"et","name":"Estonian","nativeName":"eesti, eesti keel"},
{"code":"ee","name":"Ewe","nativeName":"Eʋegbe"},
{"code":"fo","name":"Faroese","nativeName":"føroyskt"},
{"code":"fj","name":"Fijian","nativeName":"vosa Vakaviti"},
{"code":"fi","name":"Finnish","nativeName":"suomi, suomen kieli"},
{"code":"fr","name":"French","nativeName":"français, langue française"},
{"code":"ff","name":"Fula; Fulah; Pulaar; Pular","nativeName":"Fulfulde, Pulaar, Pular"},
{"code":"gl","name":"Galician","nativeName":"Galego"},
{"code":"ka","name":"Georgian","nativeName":"ქართული"},
{"code":"de","name":"German","nativeName":"Deutsch"},
{"code":"el","name":"Greek, Modern","nativeName":"Ελληνικά"},
{"code":"gn","name":"Guaraní","nativeName":"Avañeẽ"},
{"code":"gu","name":"Gujarati","nativeName":"ગુજરાતી"},
{"code":"ht","name":"Haitian; Haitian Creole","nativeName":"Kreyòl ayisyen"},
{"code":"ha","name":"Hausa","nativeName":"Hausa, هَوُسَ"},
{"code":"he","name":"Hebrew (modern)","nativeName":"עברית"},
{"code":"hz","name":"Herero","nativeName":"Otjiherero"},
{"code":"hi","name":"Hindi","nativeName":"हिन्दी, हिंदी"},
{"code":"ho","name":"Hiri Motu","nativeName":"Hiri Motu"},
{"code":"hu","name":"Hungarian","nativeName":"Magyar"},
{"code":"ia","name":"Interlingua","nativeName":"Interlingua"},
{"code":"id","name":"Indonesian","nativeName":"Bahasa Indonesia"},
{"code":"ie","name":"Interlingue","nativeName":"Originally called Occidental; then Interlingue after WWII"},
{"code":"ga","name":"Irish","nativeName":"Gaeilge"},
{"code":"ig","name":"Igbo","nativeName":"Asụsụ Igbo"},
{"code":"ik","name":"Inupiaq","nativeName":"Iñupiaq, Iñupiatun"},
{"code":"io","name":"Ido","nativeName":"Ido"},
{"code":"is","name":"Icelandic","nativeName":"Íslenska"},
{"code":"it","name":"Italian","nativeName":"Italiano"},
{"code":"iu","name":"Inuktitut","nativeName":"ᐃᓄᒃᑎᑐᑦ"},
{"code":"ja","name":"Japanese","nativeName":"日本語 (にほんご/にっぽんご)"},
{"code":"jv","name":"Javanese","nativeName":"basa Jawa"},
{"code":"kl","name":"Kalaallisut, Greenlandic","nativeName":"kalaallisut, kalaallit oqaasii"},
{"code":"kn","name":"Kannada","nativeName":"ಕನ್ನಡ"},
{"code":"kr","name":"Kanuri","nativeName":"Kanuri"},
{"code":"ks","name":"Kashmiri","nativeName":"कश्मीरी, كشميري‎"},
{"code":"kk","name":"Kazakh","nativeName":"Қазақ тілі"},
{"code":"km","name":"Khmer","nativeName":"ភាសាខ្មែរ"},
{"code":"ki","name":"Kikuyu, Gikuyu","nativeName":"Gĩkũyũ"},
{"code":"rw","name":"Kinyarwanda","nativeName":"Ikinyarwanda"},
{"code":"ky","name":"Kirghiz, Kyrgyz","nativeName":"кыргыз тили"},
{"code":"kv","name":"Komi","nativeName":"коми кыв"},
{"code":"kg","name":"Kongo","nativeName":"KiKongo"},
{"code":"ko","name":"Korean","nativeName":"한국어 (韓國語), 조선말 (朝鮮語)"},
{"code":"ku","name":"Kurdish","nativeName":"Kurdî, كوردی‎"},
{"code":"kj","name":"Kwanyama, Kuanyama","nativeName":"Kuanyama"},
{"code":"la","name":"Latin","nativeName":"latine, lingua latina"},
{"code":"lb","name":"Luxembourgish, Letzeburgesch","nativeName":"Lëtzebuergesch"},
{"code":"lg","name":"Luganda","nativeName":"Luganda"},
{"code":"li","name":"Limburgish, Limburgan, Limburger","nativeName":"Limburgs"},
{"code":"ln","name":"Lingala","nativeName":"Lingála"},
{"code":"lo","name":"Lao","nativeName":"ພາສາລາວ"},
{"code":"lt","name":"Lithuanian","nativeName":"lietuvių kalba"},
{"code":"lu","name":"Luba-Katanga","nativeName":"Luba-Katanga"},
{"code":"lv","name":"Latvian","nativeName":"latviešu valoda"},
{"code":"gv","name":"Manx","nativeName":"Gaelg, Gailck"},
{"code":"mk","name":"Macedonian","nativeName":"македонски јазик"},
{"code":"mg","name":"Malagasy","nativeName":"Malagasy fiteny"},
{"code":"ms","name":"Malay","nativeName":"bahasa Melayu, بهاس ملايو‎"},
{"code":"ml","name":"Malayalam","nativeName":"മലയാളം"},
{"code":"mt","name":"Maltese","nativeName":"Malti"},
{"code":"mi","name":"Māori","nativeName":"te reo Māori"},
{"code":"mr","name":"Marathi (Marāṭhī)","nativeName":"मराठी"},
{"code":"mh","name":"Marshallese","nativeName":"Kajin M̧ajeļ"},
{"code":"mn","name":"Mongolian","nativeName":"монгол"},
{"code":"na","name":"Nauru","nativeName":"Ekakairũ Naoero"},
{"code":"nv","name":"Navajo, Navaho","nativeName":"Diné bizaad, Dinékʼehǰí"},
{"code":"nb","name":"Norwegian Bokmål","nativeName":"Norsk bokmål"},
{"code":"nd","name":"North Ndebele","nativeName":"isiNdebele"},
{"code":"ne","name":"Nepali","nativeName":"नेपाली"},
{"code":"ng","name":"Ndonga","nativeName":"Owambo"},
{"code":"nn","name":"Norwegian Nynorsk","nativeName":"Norsk nynorsk"},
{"code":"no","name":"Norwegian","nativeName":"Norsk"},
{"code":"ii","name":"Nuosu","nativeName":"ꆈꌠ꒿ Nuosuhxop"},
{"code":"nr","name":"South Ndebele","nativeName":"isiNdebele"},
{"code":"oc","name":"Occitan","nativeName":"Occitan"},
{"code":"oj","name":"Ojibwe, Ojibwa","nativeName":"ᐊᓂᔑᓈᐯᒧᐎᓐ"},
{"code":"cu","name":"Old Church Slavonic, Church Slavic, Church Slavonic, Old Bulgarian, Old Slavonic","nativeName":"ѩзыкъ словѣньскъ"},
{"code":"om","name":"Oromo","nativeName":"Afaan Oromoo"},
{"code":"or","name":"Oriya","nativeName":"ଓଡ଼ିଆ"},
{"code":"os","name":"Ossetian, Ossetic","nativeName":"ирон æвзаг"},
{"code":"pa","name":"Panjabi, Punjabi","nativeName":"ਪੰਜਾਬੀ, پنجابی‎"},
{"code":"pi","name":"Pāli","nativeName":"पाऴि"},
{"code":"fa","name":"Persian","nativeName":"فارسی"},
{"code":"pl","name":"Polish","nativeName":"polski"},
{"code":"ps","name":"Pashto, Pushto","nativeName":"پښتو"},
{"code":"pt","name":"Portuguese","nativeName":"Português"},
{"code":"qu","name":"Quechua","nativeName":"Runa Simi, Kichwa"},
{"code":"rm","name":"Romansh","nativeName":"rumantsch grischun"},
{"code":"rn","name":"Kirundi","nativeName":"kiRundi"},
{"code":"ro","name":"Romanian, Moldavian, Moldovan","nativeName":"română"},
{"code":"ru","name":"Russian","nativeName":"русский язык"},
{"code":"sa","name":"Sanskrit (Saṁskṛta)","nativeName":"संस्कृतम्"},
{"code":"sc","name":"Sardinian","nativeName":"sardu"},
{"code":"sd","name":"Sindhi","nativeName":"सिन्धी, سنڌي، سندھی‎"},
{"code":"se","name":"Northern Sami","nativeName":"Davvisámegiella"},
{"code":"sm","name":"Samoan","nativeName":"gagana faa Samoa"},
{"code":"sg","name":"Sango","nativeName":"yângâ tî sängö"},
{"code":"sr","name":"Serbian","nativeName":"српски језик"},
{"code":"gd","name":"Scottish Gaelic; Gaelic","nativeName":"Gàidhlig"},
{"code":"sn","name":"Shona","nativeName":"chiShona"},
{"code":"si","name":"Sinhala, Sinhalese","nativeName":"සිංහල"},
{"code":"sk","name":"Slovak","nativeName":"slovenčina"},
{"code":"sl","name":"Slovene","nativeName":"slovenščina"},
{"code":"so","name":"Somali","nativeName":"Soomaaliga, af Soomaali"},
{"code":"st","name":"Southern Sotho","nativeName":"Sesotho"},
{"code":"es","name":"Spanish; Castilian","nativeName":"español, castellano"},
{"code":"su","name":"Sundanese","nativeName":"Basa Sunda"},
{"code":"sw","name":"Swahili","nativeName":"Kiswahili"},
{"code":"ss","name":"Swati","nativeName":"SiSwati"},
{"code":"sv","name":"Swedish","nativeName":"svenska"},
{"code":"ta","name":"Tamil","nativeName":"தமிழ்"},
{"code":"te","name":"Telugu","nativeName":"తెలుగు"},
{"code":"tg","name":"Tajik","nativeName":"тоҷикӣ, toğikī, تاجیکی‎"},
{"code":"th","name":"Thai","nativeName":"ไทย"},
{"code":"ti","name":"Tigrinya","nativeName":"ትግርኛ"},
{"code":"bo","name":"Tibetan Standard, Tibetan, Central","nativeName":"བོད་ཡིག"},
{"code":"tk","name":"Turkmen","nativeName":"Türkmen, Түркмен"},
{"code":"tl","name":"Tagalog","nativeName":"Wikang Tagalog"},
{"code":"tn","name":"Tswana","nativeName":"Setswana"},
{"code":"to","name":"Tonga (Tonga Islands)","nativeName":"faka Tonga"},
{"code":"tr","name":"Turkish","nativeName":"Türkçe"},
{"code":"ts","name":"Tsonga","nativeName":"Xitsonga"},
{"code":"tt","name":"Tatar","nativeName":"татарча, tatarça, تاتارچا‎"},
{"code":"tw","name":"Twi","nativeName":"Twi"},
{"code":"ty","name":"Tahitian","nativeName":"Reo Tahiti"},
{"code":"ug","name":"Uighur, Uyghur","nativeName":"Uyƣurqə, ئۇيغۇرچە‎"},
{"code":"uk","name":"Ukrainian","nativeName":"українська"},
{"code":"ur","name":"Urdu","nativeName":"اردو"},
{"code":"uz","name":"Uzbek","nativeName":"zbek, Ўзбек, أۇزبېك‎"},
{"code":"ve","name":"Venda","nativeName":"Tshivenḓa"},
{"code":"vi","name":"Vietnamese","nativeName":"Tiếng Việt"},
{"code":"vo","name":"Volapük","nativeName":"Volapük"},
{"code":"wa","name":"Walloon","nativeName":"Walon"},
{"code":"cy","name":"Welsh","nativeName":"Cymraeg"},
{"code":"wo","name":"Wolof","nativeName":"Wollof"},
{"code":"fy","name":"Western Frisian","nativeName":"Frysk"},
{"code":"xh","name":"Xhosa","nativeName":"isiXhosa"},
{"code":"yi","name":"Yiddish","nativeName":"ייִדיש"},
{"code":"yo","name":"Yoruba","nativeName":"Yorùbá"},
{"code":"za","name":"Zhuang, Chuang","nativeName":"Saɯ cueŋƅ, Saw cuengh"}
]

@ -28,3 +28,40 @@ $bg-colour-disabled: #252424;
.label {
margin: 3px;
}
@media (max-width: 924px) {
.navbar-header {
float: none;
}
.navbar-left,.navbar-right {
float: none !important;
}
.navbar-toggle {
display: block;
}
.navbar-collapse {
border-top: 1px solid transparent;
box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}
.navbar-fixed-top {
top: 0;
border-width: 0 0 1px;
}
.navbar-collapse.collapse {
display: none!important;
}
.navbar-nav {
float: none!important;
margin-top: 7.5px;
}
.navbar-nav>li {
float: none;
}
.navbar-nav>li>a {
padding-top: 10px;
padding-bottom: 10px;
}
.collapse.in{
display:block !important;
}
}

@ -10,7 +10,9 @@ using Ombi.Core.Engine;
using Ombi.Core.Engine.Interfaces;
using Ombi.Core.Models;
using Ombi.Core.Models.Search;
using Ombi.Models;
using StackExchange.Profiling;
using Microsoft.AspNetCore.Http;
namespace Ombi.Controllers
{
@ -18,7 +20,7 @@ namespace Ombi.Controllers
[ApiV1]
[Produces("application/json")]
[ApiController]
public class SearchController : ControllerBase
public class SearchController : Controller
{
public SearchController(IMovieEngine movie, ITvSearchEngine tvEngine, ILogger<SearchController> logger, IMusicSearchEngine music)
{
@ -46,7 +48,7 @@ namespace Ombi.Controllers
{
Logger.LogDebug("Searching : {searchTerm}", searchTerm);
return await MovieEngine.Search(searchTerm, null);
return await MovieEngine.Search(searchTerm, null, "en");
}
}
@ -54,17 +56,24 @@ namespace Ombi.Controllers
/// Searches for a movie.
/// </summary>
/// <remarks>We use TheMovieDb as the Movie Provider</remarks>
/// <param name="searchTerm">The search term.</param>
/// <param name="year">optional year parameter</param>
/// <param name="model">The refinement model, language code and year are both optional</param>
/// <returns></returns>
[HttpGet("movie/{searchTerm}/{year}")]
public async Task<IEnumerable<SearchMovieViewModel>> SearchMovie(string searchTerm, int? year)
[HttpPost("movie")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesDefaultResponseType]
public async Task<IActionResult> SearchMovie([FromBody] SearchMovieRefineModel model)
{
if (model == null)
{
return BadRequest();
}
using (MiniProfiler.Current.Step("SearchingMovie"))
{
Logger.LogDebug("Searching : {searchTerm}, Year: {year}", searchTerm, year);
Logger.LogDebug("Searching : {0}, Year: {1}, Lang: {2}", model.SearchTerm, model.Year, model.LanguageCode);
return await MovieEngine.Search(searchTerm, year);
return Json(await MovieEngine.Search(model.SearchTerm, model.Year, model.LanguageCode));
}
}

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Ombi.Models
{
public class SearchMovieRefineModel
{
public string SearchTerm { get; set; }
public int? Year { get; set; }
public string LanguageCode { get; set; } = "en";
}
}

@ -2,3 +2,8 @@
declare module "pace-progress";
declare var __webpack_public_path__: any;
declare module "*.json" {
const value: any;
export default value;
}
Loading…
Cancel
Save