Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to ignore some composers
30-08-2018, 14:54
Post: #31
RE: How to ignore some composers
Can you describe in a bit more detail the mismatch between your tags and the browsing structure you would like to have?
Find all posts by this user
Quote this message in a reply
30-08-2018, 20:47
Post: #32
RE: How to ignore some composers
I have been experimenting with writing some code to build the tagupdate.txt file based on input parameters, so that I can have a collection of favourite genres bundled together - Classical on its own and then a set of others. Also, the code ought to be easier to maintain. I have written the following in R, the output file looks like a perfectly formatted tagupdate.txt file, but Minimserver is ignoring it. My manually created file adding a main library view of Classical music works fine. Even if you don't know R, you are probably way more advanced than me and can see what this is doing. Any ideas why the code-generated version of the tag file is being ignored?

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],sep=""),"\n")
    cat(paste("=GENRE=",graw[1],sep=""),"\n","\n")
  }
}

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

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

closeAllConnections()
Find all posts by this user
Quote this message in a reply
30-08-2018, 22:05
Post: #33
RE: How to ignore some composers
Are there any messages in the MinimServer log about this?

If there are no messages, please post the output from this program as a file attachment (preferably zipped). If the output is very large, please post a section of it. Many thanks.
Find all posts by this user
Quote this message in a reply
30-08-2018, 22:29
Post: #34
RE: How to ignore some composers

.zip  tagupdate.zip (Size: 434 bytes / Downloads: 0)
.zip  tagupdate_r.zip (Size: 504 bytes / Downloads: 0)

First of these tage files works fine, second one causes Minimserver to stall on starting. I don't see any issues in the log.
Find all posts by this user
Quote this message in a reply
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
01-09-2018, 10:48
Post: #36
RE: How to ignore some composers
Thanks for letting me know. Trailing blanks are automatically stripped from tag values, so I think MinimServer should ignore trailing blanks in the tag update file if present. I will make this change in the next update.
Find all posts by this user
Quote this message in a reply
01-09-2018, 11:03
Post: #37
RE: How to ignore some composers
Thanks for that Simon. And for anyone who is interested in building a tagupdate.txt file via R, here is an extension based on processing the all-tags txt file that Minimserver can create - this code reads the txt file from Minimserver, gets the lines in the file for genre tags, then creates a vector of (in this case) non-classical tags which can be processed using code in the previous post, so I can now select from classical/non-classical via the main page in my Kazoo control point.

Code:
intags <- "L:/tag.txt"
tagdat <- readLines(intags)
genres <- gsub("GENRE=","",tagdat[grep("GENRE=",tagdat)])
# non-classical genres
ncgenres <- genres[!grepl("Classical",genres)]
Find all posts by this user
Quote this message in a reply
02-09-2018, 14:43
Post: #38
RE: How to ignore some composers
Can I confirm my understanding of how the tag updating works: essentially, all actions associated with a tag @xxx= statement must be blocked together?

E.g. if at one point in the file we have

@GENRE=Pop Rock
=GENRE=Pop/Rock

but then later in the file we have

@GENRE=Pop Rock
+MAINGENRE=Main

then only the second update gets made. For both updates to apply, we need

@GENRE=Pop Rock
=GENRE=Pop/Rock
+MAINGENRE=Main

I ask this since the behaviour based on a tag update file that firstly processes all the synonyms and then processes the addition of main library tags did not quite work - I had to merge these steps together, which made the R code slightly more fiddly but the end result is now pretty solid.
Find all posts by this user
Quote this message in a reply
02-09-2018, 17:57
Post: #39
RE: How to ignore some composers
Yes, this is how it works at present. Supporting multiple actions for the same tag value is tricky because the first action might change or remove the tag value which would cause a problem for matching the @ instruction in the second action. There are ways round this but they would add significant complexity and overhead.
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


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