예제 #1
0
    def chapter_view(self):
        _ = self.R
        slug = _.matchdict.get('seriesSlug', "No Title")
        chap_slug = _.matchdict.get('chapterSlug', "No Title")

        # cari manga by slug
        manga = Manga.query.filter(Manga.slug == slug).first()
        if manga is not None:
            filename = '/'.join([manga.id, manga.thumb])
            thumb = _.storage.url(filename)
            aka = manga.aka
            artists = manga.get_artist()
            authors = manga.get_authors()
            description = manga.description
            name = manga.title
            last = Manga.last_chapter(manga.id)
            last_chapter = ' '.join([str(last.chapter), last.title])
            # cari chapter manga
            chapter = manga.get_chapter(manga, chap_slug)
            return dict(
                aka=aka,
                url='/chapter/{slug}/{chap}'.format(slug=slug, chap=chap_slug),
                thumb_url=thumb,
                artists=artists,
                authors=authors,
                description=description,
                name=' '.join([name, '|', 'Ch.', str(chapter.chapter).replace('.0', ''), chapter.title]),
                last_chapter=last_chapter
            )
        return {'project': 'moori'}
예제 #2
0
    def series_view(self):
        _ = self.R
        slug = _.matchdict.get('seriesSlug', "No Title")
        print(slug)
        qry = Manga.query
        manga = qry.filter(Manga.slug == slug.strip()).first()
        if manga is not None:
            filename = '/'.join([manga.id, manga.thumb])
            thumb = _.storage.url(filename)
            aka = manga.aka
            artists = manga.get_artist()
            authors = manga.get_authors()
            description = manga.description
            name = manga.title
            last = Manga.last_chapter(manga.id)
            last_chapter = ' '.join([str(last.chapter), last.title])

            return dict(
                aka=aka,
                url='/manga/{slug}'.format(slug=slug),
                thumb_url=thumb,
                artists=artists,
                authors=authors,
                description=description,
                name=name,
                last_chapter=last_chapter
            )
        return {'project': 'moori'}
예제 #3
0
    def series_page(self):
        _ = self.R
        slug = _.matchdict.get('series_slug', "No Title")
        present = arrow.utcnow()
        qry = Manga.query
        manga = qry.filter(Manga.slug == slug.strip()).first()
        if manga is not None:
            filename = '/'.join([manga.id, manga.thumb])
            thumb = _.storage.url(filename)
            aka = manga.aka
            artists = manga.get_artist()
            authors = manga.get_authors()
            description = manga.description
            name = manga.title
            status = manga.status
            stags = manga.get_genre_tostr()
            tags = [dict(label=tag, value=slugist(tag)) for tag in stags.split(',')]
            time = arrow.get(manga.chapter_updated.replace(tzinfo=tz.tzlocal())).humanize(present)
            origin = manga.origin
            last = Manga.last_chapter(manga.id)

            results = []
            last_chapter = ''
            last_url = ''
            if last is not None:
                last_chapter = ' '.join([str(last.chapter), last.title])
                last_url = '/'.join([manga.slug, last.slug])

                manga.updated_viewed()
                chapters = Chapter.query.filter_by(tb_manga_id=manga.id).order_by(desc(Chapter.sortorder)).all()
                for chapter in chapters:
                    results.append(dict(
                        name=' '.join(['Ch.', str(chapter.chapter).replace('.0', ''), chapter.title]),
                        url='/'.join([manga.slug, chapter.slug]),
                        time=arrow.get(chapter.updated.replace(tzinfo=tz.tzlocal())).humanize(present)
                    ))

            return dict(
                origin=origin,
                aka=aka,
                thumb_url='/{thumb}'.format(thumb=thumb),
                artists=artists,
                authors=authors,
                description=description,
                name=name,
                tags=tags,
                status=status,
                time=time,
                last_chapter=last_chapter,
                last_url=last_url,
                chapters=results
            )
        return None
예제 #4
0
    def series_view(self):
        _ = self.R
        slug = _.matchdict.get('seriesSlug', "No Title")
        present = arrow.utcnow()
        qry = Manga.query
        manga = qry.filter(Manga.slug == slug.strip()).first()
        if manga is not None:
            filename = '/'.join([manga.id, manga.thumb])
            thumb = _.storage.url(filename)
            aka = utils.HTMLUnscaped(manga.aka)
            artists = utils.HTMLUnscaped(manga.get_artist())
            authors = utils.HTMLUnscaped(manga.get_authors())
            description = utils.HTMLUnscaped(manga.description)
            name = utils.HTMLUnscaped(manga.title)
            last = Manga.last_chapter(manga.id)
            time = manga.chapter_updated.strftime('%b %d, %Y')
            stags = manga.get_genre_tostr()
            tags = [dict(label=tag, value=slugist(tag)) for tag in stags.split(',')]

            results = []
            last_chapter = ''
            last_url = ''
            if last is not None:
                last_chapter = ' '.join([str(last.chapter), last.title])
                last_url = '/'.join([manga.slug, last.slug])

                manga.updated_viewed()
                chapters = Chapter.query.filter_by(tb_manga_id=manga.id).order_by(desc(Chapter.sortorder)).all()
                for chapter in chapters:
                    results.append(dict(
                        name=' '.join(['Ch.', str(chapter.chapter).replace('.0', ''), chapter.title]),
                        url='/'.join([manga.slug, chapter.slug, "0"]),
                        time=chapter.updated.strftime('%b %d, %Y')
                    ))

            return dict(
                aka=aka,
                url='/manga/{slug}'.format(slug=slug),
                thumb_url=thumb,
                artists=artists,
                authors=authors,
                description=description,
                name=name,
                tags=tags,
                time=time,
                last_chapter=last_chapter,
                last_url=last_url,
                chapters=results
            )
        return None
예제 #5
0
    def chapter_view(self):
        _ = self.R
        slug = _.matchdict.get('seriesSlug', "No Title")
        chap_slug = _.matchdict.get('chapterSlug', "No Title")

        # cari manga by slug
        manga = Manga.query.filter(Manga.slug == slug).first()
        if manga is not None:
            filename = '/'.join([manga.id, manga.thumb])
            thumb = _.storage.url(filename)
            aka = utils.HTMLUnscaped(manga.aka)
            artists = utils.HTMLUnscaped(manga.get_artist())
            authors = utils.HTMLUnscaped(manga.get_authors())
            description = utils.HTMLUnscaped(manga.description)
            name = utils.HTMLUnscaped(manga.title)
            last = Manga.last_chapter(manga.id)
            last_chapter = ' '.join([str(last.chapter), last.title])
            # cari chapter manga
            chapter = manga.get_chapter(manga, chap_slug)
            ch = chapter.title if chapter.title == str(chapter.chapter) \
                .replace('.0', '') else '{ch} {chapter}' \
                .format(ch=str(chapter.chapter).replace('.0', ''), chapter=chapter.title)
            return dict(
                aka=aka,
                url='/chapter/{slug}/{chap}'.format(slug=slug, chap=chap_slug),
                thumb_url=thumb,
                artists=artists,
                authors=authors,
                description='Read newest {title} {ch} online'.format(
                    ch=ch,
                    title=manga.title
                ),
                name='{title} {ch}'.format(
                    ch=ch,
                    title=manga.title
                ),
                genres=manga.get_genre_tostr(),
                last_chapter=last_chapter,
                series_url=manga.slug
            )
        return {'project': 'moori'}
예제 #6
0
    def series_page(self):
        _ = self.R
        slug = _.matchdict.get('series_slug', "No Title")
        present = arrow.utcnow()
        qry = Manga.query
        manga = qry.filter(Manga.slug == slug.strip()).first()
        if manga is not None:
            filename = '/'.join([manga.id, manga.thumb])
            thumb = _.storage.url(filename)
            aka = manga.aka
            artists = manga.get_artist()
            authors = manga.get_authors()
            description = manga.description
            name = manga.title
            status = manga.status
            stags = manga.get_genre_tostr()
            tags = [
                dict(label=tag, value=slugist(tag)) for tag in stags.split(',')
            ]
            time = arrow.get(manga.chapter_updated.replace(
                tzinfo=tz.tzlocal())).humanize(present)
            origin = manga.origin
            last = Manga.last_chapter(manga.id)

            results = []
            last_chapter = ''
            last_url = ''
            if last is not None:
                last_chapter = ' '.join([str(last.chapter), last.title])
                last_url = '/'.join([manga.slug, last.slug])

                manga.updated_viewed()
                chapters = Chapter.query.filter_by(
                    tb_manga_id=manga.id).order_by(desc(
                        Chapter.sortorder)).all()
                for chapter in chapters:
                    results.append(
                        dict(name=' '.join([
                            'Ch.',
                            str(chapter.chapter).replace('.0', ''),
                            chapter.title
                        ]),
                             url='/'.join([manga.slug, chapter.slug]),
                             time=arrow.get(
                                 chapter.updated.replace(
                                     tzinfo=tz.tzlocal())).humanize(present)))

            return dict(origin=origin,
                        aka=aka,
                        url='/manga/{slug}'.format(slug=slug),
                        thumb_url='/{thumb}'.format(thumb=thumb),
                        artists=artists,
                        authors=authors,
                        description=description,
                        name=name,
                        tags=tags,
                        status=status,
                        time=time,
                        last_chapter=last_chapter,
                        last_url=last_url,
                        chapters=results)
        return None