Problem WriteTag

nelson c

Well-known member
Anteriormente, usé el comando &cmd=makelibrary para cambiar la biblioteca de una canción desde la API, y se conservaron las etiquetas.

Ahora uso &cmd=makelibrary <normalize:-9.0|silence|mixpoint:-14.0|bpm> (sin pasar la lista de etiquetas), pero este comando elimina todas las etiquetas. ¿Hay alguna forma de evitar esto?
 
Sorry for the Spanish, I said earlier:

Previously, I used the &cmd=makelibrary command to change a song's library from the API, and the tags were preserved.

Now I use &cmd=makelibrary <normalize:-9.0|silence|mixpoint:-14.0|bpm> (without passing the tag list), but this command removes all the tags. Is there a way around this?
I'm following my code, and apparently the problem is the writetag command. For some reason, it's not writing the tags.
The only thing I've changed on my end is the code from the previous post.
After adding to a library, I run the api writetag command to assign it, but for some reason, the tags aren't added.
 
I'm following my code, and apparently the problem is the writetag command. For some reason, it's not writing the tags.
The only thing I've changed on my end is the code from the previous post.
After adding to a library, I run the api writetag command to assign it, but for some reason, the tags aren't added.
To clarify, does makelibrary remove the tags, or writetag command is faulty? Also, do you use the beta version 7.1 or stable 7.0?
 
The problem does not confirm, all information seems to be written properly here. The test PHP code is as following:
PHP:
<?php

$fn = $_GET['fn'] ?? '';

try {

    $r = file_get_contents('http://127.0.0.1:9000?pass=1&action=readtag&fn=' . urlencode($fn));

    $x = simplexml_load_string($r);
    $x->File['Artist'] = 'test artist';
    $x->File['TagsList'] = "111\tNew";

    $r = file_get_contents('http://127.0.0.1:9000?pass=1&action=writetag&fn=' . urlencode($_GET['fn']) . '&data=' . urlencode($x->asXML()));

    echo $r;

} catch(Exception $e) {
    echo $e->getMessage();
}
 
The problem does not confirm, all information seems to be written properly here. The test PHP code is as following:
PHP:
<?php

$fn = $_GET['fn'] ?? '';

try {

    $r = file_get_contents('http://127.0.0.1:9000?pass=1&action=readtag&fn=' . urlencode($fn));

    $x = simplexml_load_string($r);
    $x->File['Artist'] = 'test artist';
    $x->File['TagsList'] = "111\tNew";

    $r = file_get_contents('http://127.0.0.1:9000?pass=1&action=writetag&fn=' . urlencode($_GET['fn']) . '&data=' . urlencode($x->asXML()));

    echo $r;

} catch(Exception $e) {
    echo $e->getMessage();
}
Thanks for responding, I'll try it again and continue the post.
 
The problem seems to be with makelibrary.
I first insert the track into the library and then assign the tags using the WriteTags API.

This previously worked.
RBAPI.Get(URLParaLlamarAAPI('&cmd=makelibrary ' + EncodeURIComponent(Libreria) + '|' + EncodeURIComponent(Ruta)));
WriteTag

Since I process the tracks it stops working:
RBAPI.Get(URLParaLlamarAAPI('&cmd=makelibrary <normalize:-9.0|silence|mixpoint:-14.0|bpm> ' + EncodeURIComponent(Libreria) + '|' + EncodeURIComponent(Ruta)));
WriteTag

If I go back to the original (unprocessed) code the tags are inserted correctly
 
I'm thinking it might be because Makelibrary takes a few milliseconds to process and is deleting tags.
I think the error is that the current tags aren't being preserved unless they're sent in the makelibrary command.
 
I'm thinking it might be because Makelibrary takes a few milliseconds to process and is deleting tags.
I think the error is that the current tags aren't being preserved unless they're sent in the makelibrary command.
Thank you for the information, this will be checked.
 
Update. There doesn't seem to be a bug. If you call those two commands sequentially, it seems that you experience "race condition".

The "makelibrary" API call returns immediately, and the command itself is then executed in the background.

Looks like it's how it happens:
1. You call makelibrary, the command is added for background processing
2. You immediately call "WriteTag" to set the tag, at the same time makelibrary also writes tag as a part of processing
3. Depending on the order of execution, you may or may not have this tag written.

You can try adding a reasonable delay between makelibrary and writetag calls. If the only purpose of writetag is to add tags, then this call is not needed at all as makelibrary command can add tags.
 
at the same time makelibrary also writes tag as a part of processing
I understand.
I also need to assign the enter point, so I need this command.
A reasonable wait time between commands might be a solution.
The question is why makelibrary writes tags if we don't pass that parameter. Wouldn't it be better to omit it if this parameter isn't present?
 
The question is why makelibrary writes tags if we don't pass that parameter. Wouldn't it be better to omit it if this parameter isn't present?
It shouldn't. It writes tags (tag information at a whole) in certain cases, e.g., if a track is added for the first time, it has to write Date Added field - and this requires writing the whole tag sometimes (depending on settings).
 
Back
Top