I am receiving metainformations in a radio player via ICY.
Here is a short example of how this can look:
die neue welle - Der beste Musikmix aus 4 Jahrzehnten! - WELSHLY ARMS - SANCTUARY - Der Mehr Musik-Arbeitstag mit Benni Rettich
Another example for the meta information stream would be:
SWR1 Baden Württemberg
or
Welshly Arms - Sanctuary
Now I need to extract the title from there, the problem is that this 'meta-information' string can have any format. What I know:
-I know the complete meta information string as showed in the first code section
-I know the station name, which is delivered by another ICY propertie
The first approach was to check if the string contains the station name (I thought if not, it has to be the title):
private boolean icyInfoContainsTitleInfo() {
String title = id3Values.get("StreamTitle"); //this is the title string
String icy = id3Values.get("icy-name"); //this is the station name
String[] titleSplit = title.split("\\s");
String[] icySplit = icy.split("\\s");
for (String a : titleSplit) {
StringBuilder abuilder = new StringBuilder();
abuilder.append(a);
for (String b : icySplit) {
StringBuilder builder = new StringBuilder();
builder.append(b);
if (builder.toString().toLowerCase().contains(abuilder.toString().toLowerCase())) {
return false;
}
}
}
return true;
}
But that does not help me if title and station are both present in the title string.
Is there a pattern that matches a string followed by a slash, backslash or a hyphen followed by another string?
Has anyone encountered a similiar problem?