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 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 4. Create the following directories if they don't exist, and make sure they are world writable
* public/js/cache * public/js/cache
* public/images/avatars
* public/images/anime
* public/images/characters
* public/images/manga
5. Make sure the `console` script is executable 5. Make sure the `console` script is executable
### Using MAL API ### Using MAL API

View File

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

View File

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

View File

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

View File

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

View File

@ -98,7 +98,7 @@ class MenuGenerator extends UrlGenerator {
foreach ($menuConfig as $title => $path) foreach ($menuConfig as $title => $path)
{ {
$has = $this->string($this->path())->contains($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); $link = $this->helper->a($this->url($path), $title);