Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to ignore some composers
30-08-2018, 23:05
Post: #35
RE: How to ignore some composers
Found the problem: my R code was inserting a trailing blank before the carriage return character, this caused the tag update to fail. I have tweaked the code to suppress these. The following now builds the tagupdate.txt file with the synonyms for genres in one place, and allows for favourite genres to be bundled.

Code:
# filename of tag update file
fn <- "M:/tagupdate.txt"

# genre tags, group using * character
# first entry is display genre in Minimserver, subsequent entries are synonyms
# R requires substitution of \ with \\ otherwise it is treated as an escape character

ingenre <- c("Electronica*Electronic*Electro",
             "Hip-Hop/Rap*Hip Hop/Rap*Hip-Hop*Rap*Alternative Rap",
             "Pop/Rock*Pop\\Rock*Pop Rock",
             "Pop*Dance*New Wave",
             "World*International",
             "Soundtrack*Original Score",
             "Alternative*Psychadelic*Alternative & Punk",
             "New Age*Newage",
             "Soul*R&B/Soul*Soul / Funk / R&B",
             "R&B*Blues",
             "Easy Listening*Swing*Adult Contemporary",
             "Rock*Metal",
             "Traditional*Traditional, Christmas")

# favourite non-classical genres
favgenre <- c("Alternative","Easy Listening","Electronica","Jazz","Latin","Pop","Pop/Rock","R&B","Reggae","Rock","Singer/Songwriter","Soul","Soundtrack","World")

con <- file(fn,open="w",encoding="UTF-8")
sink(con)
for (i in 1:length(ingenre)){
  graw <- unlist(strsplit(ingenre[i],split="*",fixed=TRUE))
  for (j in 2:length(graw)){
    cat(paste("@GENRE=",graw[j],"\n",sep=""))
    cat(paste("=GENRE=",graw[1],"\n",sep=""))
  }
}

# create additional main library genres
cat(paste("@GENRE=Classical","\n",sep=""))
cat(paste("+CLASSICALGENRE=Classical","\n",sep=""))

for (i in 1:length(favgenre)){
  cat(paste("@GENRE=",favgenre[i],"\n",sep=""))
  cat(paste("+FAVGENRE=Favourites","\n",sep=""))
}

closeAllConnections()
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
How to ignore some composers - ofrex - 06-11-2017, 14:10
RE: How to ignore some composers - ac16161 - 30-08-2018 23:05

Forum Jump:


User(s) browsing this thread: 1 Guest(s)