Miscellaneous code cleanup

This commit is contained in:
Timothy Warren 2017-04-17 16:13:36 -04:00
parent 4d991629b1
commit d2fc955260
6 changed files with 13 additions and 17 deletions

View File

@ -45,6 +45,10 @@ Update your anime/manga list on Kitsu.io and MyAnimeList.net
3. Configure settings in `app/config/config.toml` to your liking
4. Create the following directories if they don't exist, and make sure they are world writable
* public/js/cache
* public/images/avatars
* public/images/anime
* public/images/characters
* public/images/manga
5. Make sure the `console` script is executable
### Using MAL API

View File

@ -18,9 +18,9 @@ unset($APP_DIR);
unset($SRC_DIR);
unset($CONF_DIR);
// ---------------------------------------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// Start console script
// ---------------------------------------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------
$console = new \ConsoleKit\Console([
'cache-prime' => Command\CachePrime::class,
'cache-clear' => Command\CacheClear::class,

View File

@ -47,7 +47,7 @@ class Model {
use ContainerAware;
use KitsuTrait;
const FULL_TRANSFORMED_LIST_CACHE_KEY = 'kitsu-full-organized-anime-list';
const LIST_PAGE_SIZE = 100;
/**
* Class to map anime list items
@ -382,7 +382,7 @@ class Model {
{
$status = $options['filter']['status'] ?? '';
$count = $this->getAnimeListCount($status);
$size = 100;
$size = static::LIST_PAGE_SIZE;
$pages = ceil($count / $size);
$requester = new ParallelAPIRequest();
@ -468,7 +468,7 @@ class Model {
* @param array $options
* @return Request
*/
public function getPagedAnimeList(int $limit = 100, int $offset = 0, array $options = [
public function getPagedAnimeList(int $limit, int $offset = 0, array $options = [
'include' => 'anime.mappings'
]): Request
{
@ -626,7 +626,7 @@ class Model {
{
$status = $options['filter']['status'] ?? '';
$count = $this->getMangaListCount($status);
$size = 100;
$size = static::LIST_PAGE_SIZE;
$pages = ceil($count / $size);
$requester = new ParallelAPIRequest();
@ -676,7 +676,7 @@ class Model {
* @param array $options
* @return Request
*/
public function getPagedMangaList(int $limit = 100, int $offset = 0, array $options = [
public function getPagedMangaList(int $limit, int $offset = 0, array $options = [
'include' => 'manga.mappings'
]): Request
{

View File

@ -149,10 +149,6 @@ class SyncKitsuWithMal extends BaseCommand {
'status' => AnimeWatchingStatus::MAL_TO_KITSU[$item['my_status']],
'progress' => $item['my_watched_episodes'],
'reconsuming' => (bool) $item['my_rewatching'],
'reconsumeCount' => array_key_exists('times_rewatched', $item)
? $item['times_rewatched']
: 0,
// 'notes' => ,
'rating' => $item['my_score'] / 2,
'updatedAt' => (new \DateTime())
->setTimestamp((int)$item['my_last_updated'])
@ -179,10 +175,6 @@ class SyncKitsuWithMal extends BaseCommand {
'progress' => $item['my_read_chapters'],
'volumes' => $item['my_read_volumes'],
'reconsuming' => (bool) $item['my_rereadingg'],
/* 'reconsumeCount' => array_key_exists('times_rewatched', $item)
? $item['times_rewatched']
: 0, */
// 'notes' => ,
'rating' => $item['my_score'] / 2,
'updatedAt' => (new \DateTime())
->setTimestamp((int)$item['my_last_updated'])

View File

@ -111,7 +111,7 @@ class Index extends BaseController {
$data = $model->getUserData($username);
$orgData = JsonAPI::organizeData($data);
$this->outputHTML('me', [
'title' => 'About' . $this->config->get('whose_list'),
'title' => 'About ' . $this->config->get('whose_list'),
'data' => $orgData[0],
'attributes' => $orgData[0]['attributes'],
'relationships' => $orgData[0]['relationships'],

View File

@ -98,7 +98,7 @@ class MenuGenerator extends UrlGenerator {
foreach ($menuConfig as $title => $path)
{
$has = $this->string($this->path())->contains($path);
$selected = ($has && strlen($this->path()) >= strlen($path));
$selected = ($has && mb_strlen($this->path()) >= mb_strlen($path));
$link = $this->helper->a($this->url($path), $title);