Storing and fetching tags.

This commit is contained in:
ThePendulum 2019-05-06 23:41:38 +02:00
parent 8f85ef7a1a
commit 8eb2dcfd89
4 changed files with 10 additions and 4 deletions

View File

@ -14,6 +14,7 @@ class Home extends React.Component {
<th>Site</th>
<th>Title</th>
<th>Actors</th>
<th>Tags</th>
</tr>
{this.props.releases.map(release => (
@ -23,7 +24,8 @@ class Home extends React.Component {
<td>{ release.shootId || release.entryId }</td>
<td>{ release.site.name }</td>
<td>{ release.title }</td>
<td>{ release.actors && release.actors.map(actor => actor.name).join(', ') }</td>
<td>{ release.actors.map(actor => actor.name).join(', ') }</td>
<td>{ release.tags.map(tag => tag.tag).join(', ') }</td>
</tr>
))}
</table>

View File

@ -178,8 +178,6 @@ async function fetchReleases() {
})
: newReleases;
console.log(finalReleases);
await storeReleases(finalReleases);
}

View File

@ -115,7 +115,7 @@ async function fetchScene(url) {
const scene = await scraper.fetchScene(url, site);
const filename = deriveFilename(scene);
if (argv.save) {
if (argv.scene && argv.save) {
await storeRelease(scene);
}

View File

@ -8,6 +8,11 @@ async function curateRelease(release) {
.where({ release_id: release.id })
.leftJoin('actors', 'actors.id', 'actors_associated.actor_id');
const tags = await knex('tags_associated')
.select('tags.tag', 'tags.capitalization')
.where({ release_id: release.id })
.leftJoin('tags', 'tags.tag', 'tags_associated.tag_id');
return {
id: release.id,
title: release.title,
@ -18,6 +23,7 @@ async function curateRelease(release) {
entryId: release.entry_id,
actors,
director: release.director,
tags,
rating: {
likes: release.likes,
dislikes: release.dislikes,