[RDD] Cut dayparting bug when using MariaDB
Hey everyone, We are running an older version of Rivendell here (2.1.1), but we had to upgrade our MySQL install to version 5.5. As we are using Arch Linux, it has been replaced by MariaDB. Upgrade was seamless except for one (major) detail: dayparting would no longer work. The only cuts that would play were EVERGREEN ones. I have tracked down the bug to an incompatible SQL line, in lib/rdcart.cpp, function RDCart::selectCut(QString *cut,const QTime &time) const (line 72 in v2.1.1, 86 in 2.6.0): select CUT_NAME,WEIGHT,LOCAL_COUNTER from CUTS where ( ( (START_DATETIME<="$1") && (END_DATETIME>="$2") ) || (START_DATETIME is null) ) && ( ( (START_DAYPART<="$3") && (END_DAYPART>="$4") || START_DAYPART is null ) ) && ($5="Y") && (CART_NUMBER=$6) && (EVERGREEN="N") && (LENGTH>0) order by LOCAL_COUNTER $1-4 are the current time (in format "-MM-dd hh:mm:ss"), $5 is the day of the week in short format (e.g. "MON" for Monday) and $6 is the cart number. The issue with this line is that MySQL would implicitly convert e.g. "2013-12-31 19:00:00" to "19:00:00" for columns START_DAYPART and END_DAYPART, because of their type (TIME). MariaDB, unless I am mistaken, does not, and therefore the times in the database are interpreted as offsets from the Unix epoch, that is comparing "17:01:00" (value in database) to "2013-12-31 17:00:00" (current time) results in a conversion to ( "1970-01-01 17:01:00" <> "2013-12-31 17:00:00" ), which means END_DAYPART would always be smaller than the current time (thus, no scheduling of that cut). Using full timestamps as values for TIME types is undocumented, therefore I have fixed it by casting the timestamp to a second string, time_str, with format "hh:mm:ss", then using it for variables $3 and $4. I have included a patch in this email. Apply with `patch -p1 < `, when in rivendell source directory. This fix should not break compatibility with MySQL, but I did not test it. Is there a bug tracker for the Rivendell project? -- Sébastien Leblanc diff -aur rivendell-2.6.0/lib/rdcart.cpp rivendell-2.6.0-timestamp/lib/rdcart.cpp --- rivendell-2.6.0/lib/rdcart.cpp 2013-12-11 13:51:47.0 -0500 +++ rivendell-2.6.0-timestamp/lib/rdcart.cpp 2013-12-30 19:26:30.0 -0500 @@ -109,6 +109,8 @@ QDate current_date=QDate::currentDate(); QString datetime_str=QDateTime(current_date,time). toString("-MM-dd hh:mm:ss"); + QString time_str=QDateTime(current_date,time). +toString("hh:mm:ss"); // if(type()==RDCart::Audio) { switch(type()) { @@ -123,8 +125,8 @@ (LENGTH>0) order by LOCAL_COUNTER", (const char *)datetime_str, (const char *)datetime_str, - (const char *)datetime_str, - (const char *)datetime_str, + (const char *)time_str, + (const char *)time_str, (const char *)RDGetShortDayNameEN(current_date.dayOfWeek()).upper(), cart_number); q=new RDSqlQuery(sql); ___ Rivendell-dev mailing list Rivendell-dev@lists.rivendellaudio.org http://caspian.paravelsystems.com/mailman/listinfo/rivendell-dev
Re: [RDD] How does console importing handle dash and dot?
Assuming all your files are named Artist[Space]-[Space]Title you could amend the meta pattern: "%a[Space]-[Space]%t.wav" Should work. As for to bug or not to bug, that is the question. You've already found one exception, "so lets use the last occurrence of the pattern". What about a song like this: "A-Ha - Take on me with-food.wav" Now the artist becomes "A-Ha - Take on me with" Feel free to suggest code for recognising Artist names, I'm sure google require engineers with natural language processing if you can pull it off. Short answer is, its not as easy as it sounds. In our old system it exported out mpeg files contained within wavs along with an xml file containing all the database info. I wrote a small program that used the xml and rdimport to do bulk import of all of ours, the code wasn't pretty and you'd have to modify based on your xml layout. If required, I can shove it online somewhere. Finally, unique titles are not a problem we had. I know of at least one song title across about 5 or 6 artists that we have in Riv without any issues whatsoever. rdimport won't reimport the same file name (I think with some other checking for duplicity) so I've had to rename files temporarily if I had to import it again for some reason. Alternatively reloading rdimport seems to clear out its duplicate cache (just reapply the drop box settings in rdadmin). Regards, Wayne Merricks The Voice Asia On 27/12/13 22:43, Peter van Embden wrote: Hello! We're importing a lot of music into our new build database, all coming from .wav files from which the tags cannot be read by Rivendell (as far as we know). Luckily most files are properly named. But (and here comes the problem) while importing files from console using rdimport with metadata pattern "%a- %t.wav" pattern matching seems to stop at a dash (-) or dot (.). "A-Ha - Take on me.wav" becomes artist "A" with title "" "Bruce Springsteen - Born in the U.S.A..wav" becomes artist "Bruce Springsteen" with "Born in the U" Is this a bug in Rivendell or are we doing something wrong? Also, cart titles must be unique. Now we're playing the song "Crazy" by Gnarls Barkley, but also by Seal. Rivendell suggests we name one "Crazy [1]", but this seems a bit... strange? I would think that a combination of artist + title must be unique would make more sense. Do you have some advice for this case? Also, if we name one of them "Crazy [1]", will the [1] bit be reported for now/next statistics? As far as I know, at least one of you guys rocks and recognises the problem or can help us a step ahead. I must say that I'm quite new to this open source society and I really love the way everyone is helping one another. And since we are developing Rivendell in our own unique manner, I do hope to be helpful someday as well! Kind Regards, Peter van Embden. Verstuurd ___ Rivendell-dev mailing list Rivendell-dev@lists.rivendellaudio.org http://caspian.paravelsystems.com/mailman/listinfo/rivendell-dev ___ Rivendell-dev mailing list Rivendell-dev@lists.rivendellaudio.org http://caspian.paravelsystems.com/mailman/listinfo/rivendell-dev
Re: [RDD] How does console importing handle dash and dot?
Hi Jeff, I forwarded this one to the system manager. He replied this: [quote] > rdimport is going to see that first full stop [period] as the beginning > of the suffix I would consider that a bug. The last full stop should probably be considered the beginning of the suffix, rather than the first. Also, I'm not entirely convinced the pattern matching stopping at a "-" in the artist name is a console error. The filename and pattern are "quoted" properly, so the dash - and spaces shouldn't confuse the console. And the filename is obviously passed properly to rdimport, else rdimport shouldn't be able to find the file at all. Also, the same syntax/command works fine with regular artist names. I'll have to do some more experimenting with different syntaxes. Either way, sure, it's all things we can work around. :-) [/quote] Kind regards and have a blast! Peter. Verstuurd Van: Robert Jeffares Verzonden: zondag 29 december 2013 05:04 Aan: Peter van Embden On 28/12/13 11:43, Peter van Embden wrote: > (and here comes the problem) while importing files from console using > rdimport with metadata pattern "%a- %t.wav" pattern matching seems to > stop at a dash (-) or dot (.). > > "A-Ha - Take on me.wav" becomes artist "A" with title "" > "Bruce Springsteen - Born in the U.S.A..wav" becomes artist "Bruce > Springsteen" with "Born in the U" this one is a linux one .. %a - %t.wav will sort out A-Ha Although you may have to %a\ -\ %t.wav on some OS your match has no gap after the %a rdimport is going to see that first full stop [period] as the beginning of the suffix I would be cleaning out the extra '.' s and leaving .wav as the only place you see a '.' one more sed sweep for . regards robert___ Rivendell-dev mailing list Rivendell-dev@lists.rivendellaudio.org http://caspian.paravelsystems.com/mailman/listinfo/rivendell-dev