Fix Misc Naming in UI and API

This commit is contained in:
Qstick 2017-11-25 23:55:07 -05:00
parent a6882e7bdd
commit a613dad540
12 changed files with 22 additions and 32 deletions

View File

@ -1,6 +1,6 @@
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import React from 'react'; import React from 'react';
import getProgressBarKind from 'Utilities/Series/getProgressBarKind'; import getProgressBarKind from 'Utilities/Artist/getProgressBarKind';
import { sizes } from 'Helpers/Props'; import { sizes } from 'Helpers/Props';
import ProgressBar from 'Components/ProgressBar'; import ProgressBar from 'Components/ProgressBar';
import styles from './ArtistIndexProgressBar.css'; import styles from './ArtistIndexProgressBar.css';

View File

@ -1,6 +1,6 @@
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import React, { Component } from 'react'; import React, { Component } from 'react';
import getProgressBarKind from 'Utilities/Series/getProgressBarKind'; import getProgressBarKind from 'Utilities/Artist/getProgressBarKind';
import formatBytes from 'Utilities/Number/formatBytes'; import formatBytes from 'Utilities/Number/formatBytes';
import { icons } from 'Helpers/Props'; import { icons } from 'Helpers/Props';
import IconButton from 'Components/Link/IconButton'; import IconButton from 'Components/Link/IconButton';

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import getProgressBarKind from 'Utilities/Series/getProgressBarKind'; import getProgressBarKind from 'Utilities/Artist/getProgressBarKind';
import ProgressBar from 'Components/ProgressBar'; import ProgressBar from 'Components/ProgressBar';
import VirtualTableRowCell from 'Components/Table/Cells/VirtualTableRowCell'; import VirtualTableRowCell from 'Components/Table/Cells/VirtualTableRowCell';
import RelativeDateCellConnector from 'Components/Table/Cells/RelativeDateCellConnector'; import RelativeDateCellConnector from 'Components/Table/Cells/RelativeDateCellConnector';

View File

@ -2,7 +2,7 @@ import _ from 'lodash';
import $ from 'jquery'; import $ from 'jquery';
import { batchActions } from 'redux-batched-actions'; import { batchActions } from 'redux-batched-actions';
import createAjaxRequest from 'Utilities/createAjaxRequest'; import createAjaxRequest from 'Utilities/createAjaxRequest';
import getNewSeries from 'Utilities/Series/getNewSeries'; import getNewArtist from 'Utilities/Artist/getNewArtist';
import * as types from './actionTypes'; import * as types from './actionTypes';
import { set, update, updateItem } from './baseActions'; import { set, update, updateItem } from './baseActions';
@ -57,7 +57,7 @@ const addArtistActionHandlers = {
const foreignArtistId = payload.foreignArtistId; const foreignArtistId = payload.foreignArtistId;
const items = getState().addArtist.items; const items = getState().addArtist.items;
const newSeries = getNewSeries(_.cloneDeep(_.find(items, { foreignArtistId })), payload); const newSeries = getNewArtist(_.cloneDeep(_.find(items, { foreignArtistId })), payload);
const promise = $.ajax({ const promise = $.ajax({
url: '/artist', url: '/artist',

View File

@ -1,6 +1,6 @@
import _ from 'lodash'; import _ from 'lodash';
import $ from 'jquery'; import $ from 'jquery';
import getMonitoringOptions from 'Utilities/Series/getMonitoringOptions'; import getMonitoringOptions from 'Utilities/Artist/getMonitoringOptions';
import * as types from './actionTypes'; import * as types from './actionTypes';
import { set } from './baseActions'; import { set } from './baseActions';
import { fetchArtist } from './artistActions'; import { fetchArtist } from './artistActions';

View File

@ -1,7 +1,7 @@
import _ from 'lodash'; import _ from 'lodash';
import $ from 'jquery'; import $ from 'jquery';
import { batchActions } from 'redux-batched-actions'; import { batchActions } from 'redux-batched-actions';
import getNewSeries from 'Utilities/Series/getNewSeries'; import getNewArtist from 'Utilities/Artist/getNewArtist';
import * as types from './actionTypes'; import * as types from './actionTypes';
import { set, updateItem, removeItem } from './baseActions'; import { set, updateItem, removeItem } from './baseActions';
import { startLookupArtist } from './importArtistActions'; import { startLookupArtist } from './importArtistActions';
@ -117,7 +117,7 @@ const importArtistActionHandlers = {
// Make sure we have a selected artist and // Make sure we have a selected artist and
// the same artist hasn't been added yet. // the same artist hasn't been added yet.
if (selectedArtist && !_.some(acc, { foreignArtistId: selectedArtist.foreignArtistId })) { if (selectedArtist && !_.some(acc, { foreignArtistId: selectedArtist.foreignArtistId })) {
const newSeries = getNewSeries(_.cloneDeep(selectedArtist), item); const newSeries = getNewArtist(_.cloneDeep(selectedArtist), item);
newSeries.path = item.path; newSeries.path = item.path;
addedIds.push(id); addedIds.push(id);

View File

@ -1,6 +1,6 @@
import getMonitoringOptions from 'Utilities/Series/getMonitoringOptions'; import getMonitoringOptions from 'Utilities/Artist/getMonitoringOptions';
function getNewSeries(artist, payload) { function getNewArtist(artist, payload) {
const { const {
rootFolderPath, rootFolderPath,
monitor, monitor,
@ -14,13 +14,11 @@ function getNewSeries(artist, payload) {
} = payload; } = payload;
const { const {
// seasons,
options: addOptions options: addOptions
} = getMonitoringOptions(monitor); } = getMonitoringOptions(monitor);
addOptions.searchForMissingAlbums = searchForMissingAlbums; addOptions.searchForMissingAlbums = searchForMissingAlbums;
artist.addOptions = addOptions; artist.addOptions = addOptions;
// artist.seasons = seasons;
artist.monitored = true; artist.monitored = true;
artist.qualityProfileId = qualityProfileId; artist.qualityProfileId = qualityProfileId;
artist.languageProfileId = languageProfileId; artist.languageProfileId = languageProfileId;
@ -33,4 +31,4 @@ function getNewSeries(artist, payload) {
return artist; return artist;
} }
export default getNewSeries; export default getNewArtist;

View File

@ -22,8 +22,8 @@ namespace Lidarr.Api.V1.Artist
private Response Search() private Response Search()
{ {
var tvDbResults = _searchProxy.SearchForNewArtist((string)Request.Query.term); var searchResults = _searchProxy.SearchForNewArtist((string)Request.Query.term);
return MapToResource(tvDbResults).AsResponse(); return MapToResource(searchResults).AsResponse();
} }

View File

@ -58,7 +58,6 @@ namespace Lidarr.Api.V1.Artist
public bool Monitored { get; set; } public bool Monitored { get; set; }
public string RootFolderPath { get; set; } public string RootFolderPath { get; set; }
//public string Certification { get; set; }
public List<string> Genres { get; set; } public List<string> Genres { get; set; }
public string CleanName { get; set; } public string CleanName { get; set; }
public string SortName { get; set; } public string SortName { get; set; }
@ -71,7 +70,7 @@ namespace Lidarr.Api.V1.Artist
//TODO: Add series statistics as a property of the series (instead of individual properties) //TODO: Add series statistics as a property of the series (instead of individual properties)
} }
public static class SeriesResourceMapper public static class ArtistResourceMapper
{ {
public static ArtistResource ToResource(this NzbDrone.Core.Music.Artist model) public static ArtistResource ToResource(this NzbDrone.Core.Music.Artist model)
{ {
@ -93,7 +92,6 @@ namespace Lidarr.Api.V1.Artist
Images = model.Images, Images = model.Images,
Albums = model.Albums.ToResource(), Albums = model.Albums.ToResource(),
//Year = model.Year,
Path = model.Path, Path = model.Path,
QualityProfileId = model.ProfileId, QualityProfileId = model.ProfileId,
@ -105,12 +103,11 @@ namespace Lidarr.Api.V1.Artist
Monitored = model.Monitored, Monitored = model.Monitored,
LastInfoSync = model.LastInfoSync, LastInfoSync = model.LastInfoSync,
//SeriesType = model.SeriesType,
CleanName = model.CleanName, CleanName = model.CleanName,
ForeignArtistId = model.ForeignArtistId, ForeignArtistId = model.ForeignArtistId,
NameSlug = model.NameSlug, NameSlug = model.NameSlug,
RootFolderPath = model.RootFolderPath, RootFolderPath = model.RootFolderPath,
//Certification = model.Certification,
Genres = model.Genres, Genres = model.Genres,
Tags = model.Tags, Tags = model.Tags,
Added = model.Added, Added = model.Added,
@ -135,12 +132,8 @@ namespace Lidarr.Api.V1.Artist
Overview = resource.Overview, Overview = resource.Overview,
//NextAiring //NextAiring
//PreviousAiring //PreviousAiring
// Network = resource.Network,
//AirTime = resource.AirTime,
Images = resource.Images,
//Albums = resource.Albums.ToModel(), Images = resource.Images,
//Year = resource.Year,
Path = resource.Path, Path = resource.Path,
ProfileId = resource.QualityProfileId, ProfileId = resource.QualityProfileId,
@ -152,12 +145,11 @@ namespace Lidarr.Api.V1.Artist
Monitored = resource.Monitored, Monitored = resource.Monitored,
LastInfoSync = resource.LastInfoSync, LastInfoSync = resource.LastInfoSync,
//SeriesType = resource.SeriesType, ArtistType = resource.ArtistType,
CleanName = resource.CleanName, CleanName = resource.CleanName,
ForeignArtistId = resource.ForeignArtistId, ForeignArtistId = resource.ForeignArtistId,
NameSlug = resource.NameSlug, NameSlug = resource.NameSlug,
RootFolderPath = resource.RootFolderPath, RootFolderPath = resource.RootFolderPath,
//Certification = resource.Certification,
Genres = resource.Genres, Genres = resource.Genres,
Tags = resource.Tags, Tags = resource.Tags,
Added = resource.Added, Added = resource.Added,

View File

@ -1,4 +1,4 @@
using System.IO; using System.IO;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using Nancy; using Nancy;
using Nancy.Responses; using Nancy.Responses;
@ -12,7 +12,7 @@ namespace Lidarr.Api.V1.MediaCovers
{ {
private static readonly Regex RegexResizedImage = new Regex(@"-\d+\.jpg$", RegexOptions.Compiled | RegexOptions.IgnoreCase); private static readonly Regex RegexResizedImage = new Regex(@"-\d+\.jpg$", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private const string MEDIA_COVER_ROUTE = @"/(?<seriesId>\d+)/(?<filename>(.+)\.(jpg|png|gif))"; private const string MEDIA_COVER_ROUTE = @"/(?<artistId>\d+)/(?<filename>(.+)\.(jpg|png|gif))";
private readonly IAppFolderInfo _appFolderInfo; private readonly IAppFolderInfo _appFolderInfo;
private readonly IDiskProvider _diskProvider; private readonly IDiskProvider _diskProvider;
@ -22,12 +22,12 @@ namespace Lidarr.Api.V1.MediaCovers
_appFolderInfo = appFolderInfo; _appFolderInfo = appFolderInfo;
_diskProvider = diskProvider; _diskProvider = diskProvider;
Get[MEDIA_COVER_ROUTE] = options => GetMediaCover(options.seriesId, options.filename); Get[MEDIA_COVER_ROUTE] = options => GetMediaCover(options.artistId, options.filename);
} }
private Response GetMediaCover(int seriesId, string filename) private Response GetMediaCover(int artistId, string filename)
{ {
var filePath = Path.Combine(_appFolderInfo.GetAppDataPath(), "MediaCover", seriesId.ToString(), filename); var filePath = Path.Combine(_appFolderInfo.GetAppDataPath(), "MediaCover", artistId.ToString(), filename);
if (!_diskProvider.FileExists(filePath) || _diskProvider.GetFileSize(filePath) == 0) if (!_diskProvider.FileExists(filePath) || _diskProvider.GetFileSize(filePath) == 0)
{ {