• Welcome to RadioDJ - Free Radio Automation Software Forum. Please log in or sign up.

Artist separation (repeat rules) - Bug?

Started by HMC, June 30, 2014, 08:49:01 PM

HMC

Quote from: AndyDeGroo on July 03, 2014, 11:46:06 AM
@Marius: I didn't mean that you should implement it in RDJ. It was intended as a quick and dirty hack for particular case. I'm not sure if splitting will work, because you still have to store found artist names as variables and "feat" separator can differ.
Few examples from my DB: "Alex Barck Feat. Jonatan Bäckelie", "Boris Dlugosch ft. Róisín Murphy", "Riton feat Meleka". Besides, there are those cases where one artists name match part in other name (e.g. '%Queen%' will match 'Queens of Stone Age'). There are also some other variations with "vs" like "DJ Fresh VS Diplo Feat. Dominique Young Unique" for mashups. It woulb be easier if only MySQL supported splitting strings using regex.

I assume that HMC will understand how to use the code based on following:
That aside, this kind of separation could be implemented by storing main artists name as separate field in songs table and using that for timestamp updates. The main artists name could be parsed using regex from filename/ID3 tag when importing tracks. The name could be user-editable in track editor.

Yeah, I haven't messed with the now playing at all. Doing it with PHP will be quite hackish but might just work. I'll have to play with it and see what I can come up with. It would seem I'd have to check every song that is played with this method. Thanks for the suggestion for now.
Radio DJ 1.7.5 Update with MariaDB 10

Marius

#16
Quote from: AndyDeGroo on July 03, 2014, 11:46:06 AM
@Marius: I didn't mean that you should implement it in RDJ. It was intended as a quick and dirty hack for particular case. I'm not sure if splitting will work, because you still have to store found artist names as variables and "feat" separator can differ.
Few examples from my DB: "Alex Barck Feat. Jonatan Bäckelie", "Boris Dlugosch ft. Róisín Murphy", "Riton feat Meleka". Besides, there are those cases where one artists name match part in other name (e.g. '%Queen%' will match 'Queens of Stone Age'). There are also some other variations with "vs" like "DJ Fresh VS Diplo Feat. Dominique Young Unique" for mashups. It woulb be easier if only MySQL supported splitting strings using regex.

Very true, but looking to your php script, you do it in the same way:
[...] WHERE `artist` LIKE '%$main_artist%' OR `artist` LIKE '%$feat_artist%'"

So Queen will match any artist containing the Queen string.

Another dirty workaround would be to add more columns for artists, but again there are tracks with 2, 3 and even more artists and sooner or later there will be complains if this method will be implemented.

Ideally i guess that it would be not to have at all in songs table the artist and to have 2 tables something like:

artists:
ID|artist


artists_data
ID|artistID|songID


And then just simply auto assign and add if it's the case the artists from a list. And in the program i can write a function to correctly split the artist with more separators that are used today.
But it will complicate the queries very much and for me the joins are a pain.  :D
DOWNLOADS PAGE

HOW TO FIX RADIODJ DATABASE
----------------
Please don't PM me for support requests. Use the forums instead.

AndyDeGroo

Quote from: Marius on July 03, 2014, 01:32:14 PM
Very true, but looking to your php script, you do it in the same way:
[...] WHERE `artist` LIKE '%$main_artist%' OR `artist` LIKE '%$feat_artist%'"

So Queen will match any artist containing the Queen string.
I already mentioned that directly below the code. :)
It gets even crazier with artist names like "MO" which would match many artists. Oh, and "Air".

Quote from: Marius on July 03, 2014, 01:32:14 PM
Another dirty workaround would be to add more columns for artists, but again there are tracks with 2, 3 and even more artists and sooner or later there will be complains if this method will be implemented.
That would be the easiest workaround, but it does not scale.

Quote from: Marius on July 03, 2014, 01:32:14 PM
Ideally i guess that it would be not to have at all in songs table the artist and to have 2 tables something like:

artists:
ID|artist


artists_data
ID|artistID|songID


And then just simply auto assign and add if it's the case the artists from a list. And in the program i can write a function to correctly split the artist with more separators that are used today.
But it will complicate the queries very much and for me the joins are a pain.  :D
This would be the way to do it, but yes, it will complicate things. If you are going to test this idea, it would be better to store `artist_played` timestamp in artists table.
When I start to think about it, there could be even more problems to solve when it comes to "The Beatles", "Beatles, The" and just "Beatles". Although those should be solved before importing.

But you are already using joins for selecting songs for queue. :)

HMC

@Andy,

By the way, looking at your PHP script, I think you miss understood my problem with Artist separation. Take my initial example

Jennifer Lopez - I Luh Ya Papi
Jennifer Lopez f. Pitbull - Live it up

I don't care about the featured artist. The problem is RDJ see's this as two different artists when in fact, it's just one, Jennifer Lopez. The featured artist is irrelevant. So if I play the first track, it shouldn't play another Jennifer Lopez song( as the main artist) based on how long my repeat rules are. But since RDJ thinks "Jennifer Lopez f. Pitull" is a different artist, it will pick that and ignore my repeat rules.

That's all that matters. If I had to play based on Featured artist it'd be difficult because people like Pitbull is featured in every track these days. LOL

So I'm not trying to make it overly complicated. It just needs to account for artists that have features and group them as a single artist, the fact that they have a feature should be irrelevant.

Jennifer Lopez - Some song
Jennifer Lopez f. Some artist - another song
Jennifer Lopez f. another artist - yet another song

All 3 of those should be grouped together as Jennifer Lopez as the artist. Ignoring the feature. Then repeat rules will work correctly.


I hope that's a bit more clear now what the original issue is.

Radio DJ 1.7.5 Update with MariaDB 10

ncborges

Quote from: HMC on July 06, 2014, 09:55:19 PM

Jennifer Lopez - Some song
Jennifer Lopez f. Some artist - another song
Jennifer Lopez f. another artist - yet another song

All 3 of those should be grouped together as Jennifer Lopez as the artist. Ignoring the feature. Then repeat rules will work correctly.


I hope that's a bit more clear now what the original issue is.

It's VERY clear and I agree with you. It's a great request and you're right about repeat rules

+ :ok: :ok: :ok:1

Marius

#20
@HMC: If the things were be just so simple also in programming...

First, if you would ignore the featured artist, you would have a big problem. There are many artists who sing mostly with other artists, eg. "Pitbull" and i'm sure you would hate to hear 3-4 tracks one after another with that artist.

Second, the solution is not simple at all, in the latest version anyone is able to edit the update track and artist procedure and i already wrote on other topics that i don't have a solution for this issue and if someone more advanced in MySQL can give me a solution, i will implement it and until now no one did. With a few occasions i exchanged some PM's with AndyDeGroo and trust me that he's no beginner when it comes to sql.

Third: For your example:

Jennifer Lopez - Some song
Jennifer Lopez f. Some artist - another song
Jennifer Lopez f. another artist - yet another song

In programming you would have to split the artist correctly, because for a computer is not so obvious what that string is representing and this raises another problem because there is no standard when it comes for naming tracks.

"Jennifer Lopez f. Some artist" can be "Jennifer Lopez, Some artist ", "Jennifer Lopez feat. Some artist", "Jennifer Lopez featuring Some artist", "Jennifer Lopez & Some artist" etc.
So even to obtain the principal artist, you have to think to all scenarios first, because you will encounter many different situations.

I'm still open to solutions.
DOWNLOADS PAGE

HOW TO FIX RADIODJ DATABASE
----------------
Please don't PM me for support requests. Use the forums instead.

Marius

#21
PS: i'm testing something now that it may work. I will post the results.

PS: We will need to put together a list of used separators and to think them well.
For eg on some tracks i've seen the artists separated with the "and" or "&" symbol, but there are also many bands which are containing that symbol "Belle & Sebastian", "Iron & Wine" etc and using these keywords/symbols as separators could lead to unwanted results, so i think that we should limit to "feat." and "featuring" which are more clear that are separating the actual artists.
DOWNLOADS PAGE

HOW TO FIX RADIODJ DATABASE
----------------
Please don't PM me for support requests. Use the forums instead.

HMC

Quote from: Marius on July 06, 2014, 11:36:01 PM
@HMC: If the things were be just so simple also in programming...

First, if you would ignore the featured artist, you would have a big problem. There are many artists who sing mostly with other artists, eg. "Pitbull" and i'm sure you would hate to hear 3-4 tracks one after another with that artist.

Second, the solution is not simple at all, in the latest version anyone is able to edit the update track and artist procedure and i already wrote on other topics that i don't have a solution for this issue and if someone more advanced in MySQL can give me a solution, i will implement it and until now no one did. With a few occasions i exchanged some PM's with AndyDeGroo and trust me that he's no beginner when it comes to sql.

Third: For your example:

Jennifer Lopez - Some song
Jennifer Lopez f. Some artist - another song
Jennifer Lopez f. another artist - yet another song

In programming you would have to split the artist correctly, because for a computer is not so obvious what that string is representing and this raises another problem because there is no standard when it comes for naming tracks.

"Jennifer Lopez f. Some artist" can be "Jennifer Lopez, Some artist ", "Jennifer Lopez feat. Some artist", "Jennifer Lopez featuring Some artist", "Jennifer Lopez & Some artist" etc.
So even to obtain the principal artist, you have to think to all scenarios first, because you will encounter many different situations.

I'm still open to solutions.

I understand what you're saying and that's true you don't want featured artist in back to back songs either. I do programming so I understand the problems you face with not having a common delimiter which sucks. For me I know mine will almost always be "f." so if I created a php function it would be easy to explode the string.

Maybe you can give the user the option to group it and they can input their own delimiter. I know it's not easy coming up with a solution and thank you for trying. 

Maybe you can use nested MySQL, Insert, then select and compare using IF then. Something like Select the artist if it is Like then insert or do something else.
I've had to do some pretty complex queries before and can get my answer using on StackOverflow. There are some pretty good MySQL geniuses there.

Something like this http://stackoverflow.com/questions/5656030/mysql-if-select-then-insert
Radio DJ 1.7.5 Update with MariaDB 10

HMC

Quote from: Marius on July 07, 2014, 12:17:49 AM
PS: i'm testing something now that it may work. I will post the results.

PS: We will need to put together a list of used separators and to think them well.
For eg on some tracks i've seen the artists separated with the "and" or "&" symbol, but there are also many bands which are containing that symbol "Belle & Sebastian", "Iron & Wine" etc and using these keywords/symbols as separators could lead to unwanted results, so i think that we should limit to "feat." and "featuring" which are more clear that are separating the actual artists.

Yes, that could work. Mine happen to be "f." which are how I receive them. Maybe it could be read from XML and we can add the delimiter we need like a setting. Just a thought.

Edit:
I agree, a feature delimiter should be the limit. There are too many other variations. To me something Artist Vs Artist is a collaboration/mashup and to me is not a single artist.
Radio DJ 1.7.5 Update with MariaDB 10

FL Coast

Quote from: Marius on July 07, 2014, 12:17:49 AM
PS: i'm testing something now that it may work. I will post the results.

PS: We will need to put together a list of used separators and to think them well.
For eg on some tracks i've seen the artists separated with the "and" or "&" symbol, but there are also many bands which are containing that symbol "Belle & Sebastian", "Iron & Wine" etc and using these keywords/symbols as separators could lead to unwanted results, so i think that we should limit to "feat." and "featuring" which are more clear that are separating the actual artists.

From Wikipedia, the free encyclopedia

In pop music, guest appearances are often described with the words featuring, with, or and. It is abbreviated in credit lists as Feat., Ft., f/, f.

Those are the main ones I have seen, but I have also seen w/ (instead of with).
:)    Play the Music and Have Fun!    :ok:
==================================
Fun In The Sun,  From the Florida Coast
***************************************************
"It is what we learn after we think we know it all, that counts."
John Wooden 1910 - 2010

Marius

I made some tests and got some great results, but due the limitations of sql language, all the string handling will be made inside the program.

Until now, the function i tested allows you to have unlimited artists as long you don't mix the separators, so something like:
"Madonna & Justin Timberlake featuring Other Artist" will not work, but it can be modified if needed.

I also thought to a customizable list, but it will need to be edited with precautions otherwise the tracks will not be updated properly.

@FL Coast: single letter separators not followed by a distinct punctuation will cause detection problems and possible unwanted splits. I would avoid using "f" or "w".
DOWNLOADS PAGE

HOW TO FIX RADIODJ DATABASE
----------------
Please don't PM me for support requests. Use the forums instead.

FL Coast

Quote from: Marius on July 07, 2014, 01:03:35 AM
@FL Coast: single letter separators not followed by a distinct punctuation will cause detection problems and possible unwanted splits. I would avoid using "f" or "w".

Sorry if I missed a punctuation.

Feat.
Ft.
f/
f.
w/
:)    Play the Music and Have Fun!    :ok:
==================================
Fun In The Sun,  From the Florida Coast
***************************************************
"It is what we learn after we think we know it all, that counts."
John Wooden 1910 - 2010

kebmo18901

I don't have a great knowledge of MySQL, but could something like this work? Your artist being The Beatles for example. Let's just say the artist is placed in Column B of MySQL (Column A being the song title). Now you would add your "related artists". In Column C-Paul McCartney, In D-John Lennon, In E-George Harrison & In F-Ringo Starr. Then have RadioDJ, using the artist repeat rules, not play the same artists from Columns B through F.
You may have to enter the info for each particular song. If the artist is Tim McGraw, you should be able to play a Faith Hill song after. But if the artist is Tim McGraw & Faith Hill, you shouldn't be able to play a Tim McGraw OR a Faith Hill song using the artist repeat rules.
I don't know if I made this more complicated with my explanation. Only throwing out suggestions..

AndyDeGroo

Quote from: HMC on July 06, 2014, 09:55:19 PM
By the way, looking at your PHP script, I think you miss understood my problem with Artist separation. Take my initial example

Jennifer Lopez - I Luh Ya Papi
Jennifer Lopez f. Pitbull - Live it up

I don't care about the featured artist.
Just edit the PHP script to fit your needs. All you have to edit is $sql variable to exclude featured artist and match at the beginning of artist's name:

$sql = "UPDATE `songs` SET `artist_played` = NOW() WHERE `artist` LIKE '$main_artist%'";

That will update only main artist's name and RDJ will exclude those tracks. I just realized that the script could use preg_split instead of preg_match.

Quote from: Marius on July 06, 2014, 11:36:01 PM
First, if you would ignore the featured artist, you would have a big problem. There are many artists who sing mostly with other artists, eg. "Pitbull" and i'm sure you would hate to hear 3-4 tracks one after another with that artist.
That is exactly why I added the featured artist update to my PHP code.

Quote from: Marius on July 06, 2014, 11:36:01 PM
Second, the solution is not simple at all, in the latest version anyone is able to edit the update track and artist procedure and i already wrote on other topics that i don't have a solution for this issue and if someone more advanced in MySQL can give me a solution, i will implement it and until now no one did. With a few occasions i exchanged some PM's with AndyDeGroo and trust me that he's no beginner when it comes to sql.
I agree that there is no simple solution to this problem. Thank you, Marius, for your kind words. Truth is, I know a bit about SQL, but I'm no genius. :)

I wrote and tested a crude SQL procedure, but it still has same problem of matching irrelevant artists. It takes a fixed delimiter string as second argument, but the string is case-sensitive:

DELIMITER $$
CREATE PROCEDURE UpdateFeatured( trackID INT, delimStr VARCHAR(15) )
BEGIN

SET @Artist = ( SELECT `artist` FROM `songs` WHERE ID = trackID );
# Find main artist by splitting artist
SET @mainArtist = SUBSTRING_INDEX( @Artist, delimStr, 1 );
# Check if mainArtist was found
IF (@mainArtist != @Artist) THEN
# Find featured artist
SET @featArtist = SUBSTRING( @Artist, POSITION(delimStr IN @Artist )+CHAR_LENGTH(delimStr));
# Update matching entries
UPDATE `songs` SET `artist_played` = NOW()
WHERE `artist` LIKE CONCAT(@mainArtist, '%')
OR `artist` LIKE CONCAT(@featArtist, '%');
END IF;

END$$
DELIMITER ;


Note: It will also update featured artist, but can be adapted for updating only main artist. Also the delimiter has to contain spaces on both ends or it won't work.

The procedure could be called from UpdateTracks procedure like this:

CALL UpdateFeatured(4242, ' feat. ');


OR part of it could be merged into UpdateTracks procedure if someone really wants it.

Quote from: Marius on July 07, 2014, 12:17:49 AM
PS: We will need to put together a list of used separators and to think them well.
For eg on some tracks i've seen the artists separated with the "and" or "&" symbol, but there are also many bands which are containing that symbol "Belle & Sebastian", "Iron & Wine" etc and using these keywords/symbols as separators could lead to unwanted results, so i think that we should limit to "feat." and "featuring" which are more clear that are separating the actual artists.

Based on what I've seen, the splitting regex could be: / (f|ft|feat|featuring)[\.;\/]? /

If it is anything to go by, MusicBrainz database contains 1400+ artists with "and" and "&". So those two string are not an option for this purpose.

IMO, the assigned artists should be editable in track editor. Advanced users could then edit those entries to achieve the effect they need. There also should be an option to enable the splitting feature which would be disabled by default to use current artist separation logic.

HMC

Quote from: AndyDeGroo on July 07, 2014, 05:50:37 AM


DELIMITER $$
CREATE PROCEDURE UpdateFeatured( trackID INT, delimStr VARCHAR(15) )
BEGIN

SET @Artist = ( SELECT `artist` FROM `songs` WHERE ID = trackID );
# Find main artist by splitting artist
SET @mainArtist = SUBSTRING_INDEX( @Artist, delimStr, 1 );
# Check if mainArtist was found
IF (@mainArtist != @Artist) THEN
# Find featured artist
SET @featArtist = SUBSTRING( @Artist, POSITION(delimStr IN @Artist )+CHAR_LENGTH(delimStr));
# Update matching entries
UPDATE `songs` SET `artist_played` = NOW()
WHERE `artist` LIKE CONCAT(@mainArtist, '%')
OR `artist` LIKE CONCAT(@featArtist, '%');
END IF;

END$$
DELIMITER ;


Could you not use iLike to make it case insensitive?
Radio DJ 1.7.5 Update with MariaDB 10