From 47e8f1dc22397aedbea7a45ff44c5b657911ff22 Mon Sep 17 00:00:00 2001 From: Vincent Riquer Date: Mon, 27 May 2013 12:44:39 +0200 Subject: [PATCH] force some fields as text --- .gitignore | 3 +++ lib/database/Insert | 4 ++++ lib/database/InsertIfUnset | 3 ++- lib/database/Update | 4 ++++ lib/tags/updateTags | 14 +++++++------- 5 files changed, 20 insertions(+), 8 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..21963fd --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*.ex +*.EX +trace.log diff --git a/lib/database/Insert b/lib/database/Insert index 77f7ec2..32d09be 100644 --- a/lib/database/Insert +++ b/lib/database/Insert @@ -15,6 +15,10 @@ Insert() { insert_keys+='`'"$key"'`' (( ${#insert_values} )) && insert_values+="," case $value in + '::AtOM:FT::'*) + value="${value//::AtOM:FT::/}" + insert_values+='"'"${value//\"/\"\"}"'"' + ;; 'NULL') insert_values+="NULL" ;; diff --git a/lib/database/InsertIfUnset b/lib/database/InsertIfUnset index 4277a62..5f53e7a 100644 --- a/lib/database/InsertIfUnset +++ b/lib/database/InsertIfUnset @@ -25,7 +25,8 @@ InsertIfUnset() { Select "$table" "$column" < <( for key in ${!keys[@]} do - echo "${keys[$key]}" = "${values[$key]}" + echo "${keys[$key]}" = \ + "${values[$key]//::AtOM:FT::}" done ) ) diff --git a/lib/database/Update b/lib/database/Update index 0fe5db5..015eac6 100644 --- a/lib/database/Update +++ b/lib/database/Update @@ -26,6 +26,10 @@ Update() { ;; value) case $argument in + '::AtOM:FT::'*) + argument="${argument//::AtOM:FT::/}" + set_statement+=" = "'"'"${argument//\"/\"\"}"'"' + ;; 'NULL') set_statement+=" = NULL" ;; diff --git a/lib/tags/updateTags b/lib/tags/updateTags index 9036869..9881843 100644 --- a/lib/tags/updateTags +++ b/lib/tags/updateTags @@ -108,15 +108,15 @@ updateTags() { [[ $oldchannels != "$channels" ]]&& uch=1 [[ $oldbitrate != "$bitrate" ]]&& ubi=1 Update tags \ - ${ual:+album "${album:-NULL}"} \ - ${uaa:+albumartist "${albumartist:-NULL}"} \ - ${uar:+artist "${artist:-NULL}"} \ - ${uco:+composer "${composer:-NULL}"} \ + ${ual:+album "::AtOM:FT::${album:-NULL}"}\ + ${uaa:+albumartist "::AtOM:FT::${albumartist:-NULL}"}\ + ${uar:+artist "::AtOM:FT::${artist:-NULL}"}\ + ${uco:+composer "::AtOM:FT::${composer:-NULL}"}\ ${udi:+disc "${disc:-NULL}"} \ ${uge:+genre "${genre:-NULL}"} \ - ${upe:+performer "${performer:-NULL}"} \ - ${uti:+title "${title:-NULL}"} \ - ${utr:+track "${tracknum:-NULL}"} \ + ${upe:+performer "::AtOM:FT::${performer:-NULL}"}\ + ${uti:+title "::AtOM:FT::${title:-NULL}"}\ + ${utr:+track "::AtOM:FT::${tracknum:-NULL}"}\ ${uye:+year "${year:-NULL}"} \ last_change "$lastchange" \ ${ura:+rate "${rate:-NULL}"} \