by MPG » Mon Feb 28, 2022 11:24 am
Hi Ludek,
Thanks for the suggestions. The code doesn't work:
For example, I have the following function calls:
Code: Select all
UpdateAuthor('SELECT * FROM Songs WHERE SongPath = ":\\Music\\Music Collection\\Classical\\S\\String Quartet Tribute To Rush\\Exit...Stage Right\\01 - The Spirit Of Radio.mp3"',"John");
UpdateAuthor('SELECT * FROM Songs WHERE SongPath = ":\\Music\\Music Collection\\Classical\\S\\String Quartet Tribute To Rush\\Exit...Stage Right\\07 - Jacob\'s Ladder.mp3"',"Leo");
UpdateAuthor('SELECT * FROM Songs WHERE SongPath = ":\\Music\\Music Collection\\Classical\\S\\String Quartet Tribute To Rush\\Exit...Stage Right\\09 - The Trees.mp3"',"Empey");
to this function:
Code: Select all
function UpdateAuthor(psql, pauthor){
var trcklist;
trcklist = app.db.getTracklist(psql, -1);
trcklist.whenLoaded().then(function () {
listForEach(trcklist, (track) => {
track.author = pauthor;
});
trcklist.commitAsync().then(
function(){
messageDlg('Worked', 'Information', ['btnOK'], {
defaultButton: 'btnOK'
}, undefined);
},
function(err){
messageDlg('FAILED!' + err, 'Warning', ['btnOK'], {
defaultButton: 'btnOK'
}, undefined);
}
);
});
}
The first call updates the composer to "Empey" and it should be "John"
The second call updates the composer to "Leo". So that works
The third call updates the composer to "Empey". And this worked to.
I've also tried it with more calls and similar results happen...most of the songs are only updated with the value of the last function call, not the supplied value.
Please help...there has to be a way to get this to work.
Hi Ludek,
Thanks for the suggestions. The code doesn't work:
For example, I have the following function calls:
[code]
UpdateAuthor('SELECT * FROM Songs WHERE SongPath = ":\\Music\\Music Collection\\Classical\\S\\String Quartet Tribute To Rush\\Exit...Stage Right\\01 - The Spirit Of Radio.mp3"',"John");
UpdateAuthor('SELECT * FROM Songs WHERE SongPath = ":\\Music\\Music Collection\\Classical\\S\\String Quartet Tribute To Rush\\Exit...Stage Right\\07 - Jacob\'s Ladder.mp3"',"Leo");
UpdateAuthor('SELECT * FROM Songs WHERE SongPath = ":\\Music\\Music Collection\\Classical\\S\\String Quartet Tribute To Rush\\Exit...Stage Right\\09 - The Trees.mp3"',"Empey");
[/code]
to this function:
[code]
function UpdateAuthor(psql, pauthor){
var trcklist;
trcklist = app.db.getTracklist(psql, -1);
trcklist.whenLoaded().then(function () {
listForEach(trcklist, (track) => {
track.author = pauthor;
});
trcklist.commitAsync().then(
function(){
messageDlg('Worked', 'Information', ['btnOK'], {
defaultButton: 'btnOK'
}, undefined);
},
function(err){
messageDlg('FAILED!' + err, 'Warning', ['btnOK'], {
defaultButton: 'btnOK'
}, undefined);
}
);
});
}
[/code]
The first call updates the composer to "Empey" and it should be "John"
The second call updates the composer to "Leo". So that works
The third call updates the composer to "Empey". And this worked to.
I've also tried it with more calls and similar results happen...most of the songs are only updated with the value of the last function call, not the supplied value.
Please help...there has to be a way to get this to work.