Miscellaneous code cleanup
This commit is contained in:
parent
c81e12bb89
commit
06213df29f
@ -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
|
||||||
|
4
console
4
console
@ -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,
|
||||||
|
@ -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
|
||||||
{
|
{
|
||||||
|
@ -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'])
|
||||||
|
@ -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'],
|
||||||
|
@ -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);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user