Adding Regex to remove (Author) from LP names

This commit is contained in:
Andreas Mieke 2016-02-28 16:30:55 +01:00
parent 83ccd79db3
commit 5deb41b6f1
4 changed files with 5 additions and 0 deletions

View file

@ -9,6 +9,7 @@ type Config struct {
DatabaseConnection string
EpisodeRegex string
RemoveRegex string
LPRenameRegex string
YoutubeKey string
GronkhUrl string
ImageDirectory string

View file

@ -1,6 +1,7 @@
{
"EpisodeRegex": "^(?:Folge |Folge |Special |Folge S01E|Folge ß|Folge ESIDENT EVIL REVELATIONS 2 \\[|Folge #|Folge 1 Galaktischer Krie\\: |Folge 15; Zurück in der neuen Wel\\: |Folge 6½ \\[German\\] Dr\\. Kleiners Vortra\\: |Folge ESIDENT EVIL REVELATIONS 2 \\[)([0-9]+)(?:½\\: |\\: | |; |\\.5\\: |½ \\[German\\] | Verwirrspiele & Hinterhalt\\: 18 |] |\\. KIPPLASTER RACING Schwadro\\: 95\\. |[,.][0-9a-zA-Z]+\\: | Titanenlord Ursego\\: 41 |[a-zA-Z]\\: )",
"RemoveRegex": "^(?:Folge Special\\: |Folge special\\: | Lets Play [1080][PS4\\: SIDENT EVIL REVELATIONS 2 [23] Getrennt..! Lets Play [1080][PS4]|Folge pecial\\: )",
"LPRenameRegex": "^(?:\\(Gronkh|Sarazar|Amras|Trashtazmani|Honeyball|TrueMG|Rahmschnitzel|LookslikeLink|Suishomaru|HerrDekay|Hijuga|Zombey\\))",
"YoutubeKey": "FOOOBAAAARRRRRRR",
"DatabaseConnection": "host=localhost user=gronkhde dbname=gronkhde sslmode=disable",
"GronkhUrl": "http://5.62.67.8",

View file

@ -57,6 +57,7 @@ func ParseLPPage(gslug string, LP *database.LetsPlay) {
}
LP.Name.String = doc.Find("h1 > a > strong").First().Text()
LP.Name.String = lpRenameRegex.ReplaceAllString(LP.Name.String, "")
pos, _ := doc.Find(".lightbox").Attr("href")
LP.PosterS.String, LP.PosterB.String, err = image.ResizeCover(pos)

View file

@ -13,6 +13,7 @@ import (
var conf config.Config
var episodeRegex *regexp.Regexp
var removeRegex *regexp.Regexp
var lpRenameRegex *regexp.Regexp
var wg sync.WaitGroup
func main() {
@ -30,6 +31,7 @@ func main() {
}
episodeRegex = regexp.MustCompile(config.C.EpisodeRegex)
removeRegex = regexp.MustCompile(config.C.RemoveRegex)
lpRenameRegex = regexp.MustCompile(config.C.LPRenameRegex)
if err = os.MkdirAll(config.C.ImageDirectory, 0775); err != nil {
log.Fatalf("FAT Could not create ImageDirectory, error: %+v", err)