Migration to new soundtrack title struct

This commit is contained in:
Eduard Urbach 2018-04-08 22:23:07 +02:00
parent dea33ab01d
commit 1ba0da36e2
9 changed files with 29 additions and 19 deletions

View File

@ -28,10 +28,10 @@ component SoundTrackMedia(track *arn.SoundTrack)
component SoundTrackFooter(track *arn.SoundTrack)
.soundtrack-footer
if track.Title == ""
if track.NewTitle.ByUser(nil) == ""
a(href=track.Link() + "/edit") untitled
else
a(href=track.Link())= track.Title
a(href=track.Link())= track.NewTitle.ByUser(nil)
span posted
span.utc-date(data-date=track.Created)
span by

View File

@ -1,17 +1,8 @@
component AnimeTracks(anime *arn.Anime, tracks []*arn.SoundTrack)
//- AnimeTabs(anime)
if len(tracks) > 0
.anime-section.mountable
h3.anime-section-name Tracks
.soundtracks.anime-soundtracks
each track in tracks
SoundTrack(track)
//- .anime-soundtracks
//- each track in tracks
//- .anime-soundtrack.mountable(data-mountable-type="track")
//- .video-container
//- iframe.video.lazy(data-src=track.Media[0].EmbedLink(), allowfullscreen="allowfullscreen")
//- a.soundtrack-footer(href=track.Link())= track.Title
SoundTrack(track)

View File

@ -13,7 +13,7 @@ component SoundTracksEditorList(tracks []*arn.SoundTrack, count int, url string,
tr.mountable
td= len(track.Likes)
td
a(href=track.Link(), target="_blank", rel="noopener")= track.Title
a(href=track.Link(), target="_blank", rel="noopener")= track.NewTitle.ByUser(user)
td
each media in track.Media
if media.Service == "Youtube"

View File

@ -104,7 +104,7 @@ component SoundTrackSearchResults(tracks []*arn.SoundTrack)
ul.soundtrack-search
each track in tracks
li.mountable(data-mountable-type="track")
a(href=track.Link())= track.Title
a(href=track.Link())= track.NewTitle.ByUser(nil)
span.soundtrack-search-anime= " - " + track.MainAnime().Title.Canonical
component CompanySearchResults(companies []*arn.Company)

View File

@ -23,7 +23,7 @@ func Edit(ctx *aero.Context) string {
ctx.Data = &arn.OpenGraph{
Tags: map[string]string{
"og:title": track.Title,
"og:title": track.NewTitle.ByUser(user),
"og:url": "https://" + ctx.App.Config.Domain + track.Link(),
"og:site_name": "notify.moe",
"og:type": "music.song",

View File

@ -32,7 +32,7 @@ func Get(ctx *aero.Context) string {
openGraph := &arn.OpenGraph{
Tags: map[string]string{
"og:title": track.Title,
"og:title": track.NewTitle.ByUser(user),
"og:description": track.MainAnime().Title.Canonical + " (" + strings.Join(descriptionTags, ", ") + ")",
"og:url": "https://" + ctx.App.Config.Domain + track.Link(),
"og:site_name": ctx.App.Config.Domain,

View File

@ -2,10 +2,10 @@ component SoundTrackPage(track *arn.SoundTrack, user *arn.User)
SoundTrackTabs(track, user)
.soundtrack-full-page
if track.Title == ""
if track.NewTitle.ByUser(user) == ""
h1.mountable untitled
else
h1.mountable= track.Title
h1.mountable= track.NewTitle.ByUser(user)
.widget-form.soundtrack-media-list
each media in track.Media

View File

@ -0,0 +1,19 @@
package main
import (
"github.com/animenotifier/arn"
)
func main() {
defer arn.Node.Close()
for track := range arn.StreamSoundTracks() {
if arn.ContainsUnicodeLetters(track.Title) {
track.NewTitle.Native = track.Title
} else {
track.NewTitle.Canonical = track.Title
}
track.Save()
}
}

View File

@ -260,7 +260,7 @@ export default class AudioPlayer {
let trackInfoResponse = await fetch("/api/soundtrack/" + trackId)
let track = await trackInfoResponse.json()
this.trackLink.href = "/soundtrack/" + track.id
this.trackLink.innerText = track.title
this.trackLink.innerText = track.title.canonical || track.title.native
let animeId = ""